Class: PaypalController

Inherits:
ApplicationController show all
Defined in:
app/controllers/paypal_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#cancelObject



20
21
22
23
# File 'app/controllers/paypal_controller.rb', line 20

def cancel
  @redirect_url = payments_integrations_fail_path(provider: :paypal, tr: @payment.payment_token)
  render template: 'paypal/close_flow', layout: 'payments'
end

#createObject



6
7
8
9
10
# File 'app/controllers/paypal_controller.rb', line 6

def create
  response = @paypal.set_checkout! paypal_success_url(id: @payment.payment_token), paypal_cancel_url(id: @payment.payment_token)

  redirect_to response.popup_uri
end

#successObject



12
13
14
15
16
17
18
# File 'app/controllers/paypal_controller.rb', line 12

def success
  response = @paypal.get_checkout!(params[:token], params[:PayerID])
  @payment.paypal_capture!(response.payment_info.first.transaction_id)

  @redirect_url = payments_integrations_success_path(provider: :paypal)
  render template: 'paypal/close_flow', layout: 'payments'
end