Class: Callbacks::CcbillsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/ccbill_ruby/cli/install/ccbill_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST: Webhooks



19
20
21
22
23
24
25
26
27
28
# File 'lib/ccbill_ruby/cli/install/ccbill_controller.rb', line 19

def create
  begin
    # Your code goes here.
  rescue StandardError => error
    # I assume we should put `rescue` statement because CCBill will call our server again and again untill he will receive 200
    # When there was failure of sending webhooks or the system was under maintenance at the moment.
  end

  head :ok
end

#showObject

GET: Redirect from payment system after approval/deny.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ccbill_ruby/cli/install/ccbill_controller.rb', line 5

def show
  case params[:mppResponse]
  when 'CheckoutSuccess'
    flash[:notice] = "Payment was successfully paid"
  when 'CheckoutFail'
    flash[:alert] = "Payment was declined. We're sorry"
  else
    fail 'Unknown mmpResponse'
  end

  redirect_to root_url
end