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: Post Back



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

def create
  postback = CCBill::Postback.new(response_params)

  if postback.approval?
    # Do something "Approval" postback.
  else
    # Do something "Deny" postback.
  end

  head :no_content
end

#showObject

GET: Redirect from payment system after approval/deny.



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

def show
  case response_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