Class: Bodega::PaymentMethod::Paypal

Inherits:
Base
  • Object
show all
Defined in:
lib/bodega/payment_method/paypal.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #order

Instance Method Summary collapse

Methods inherited from Base

#initialize, #shipping?

Methods included from Optional

#options

Constructor Details

This class inherits a constructor from Bodega::PaymentMethod::Base

Instance Method Details

#checkout_url(success_url, cancel_url, params = {}) ⇒ Object



8
9
10
11
# File 'lib/bodega/payment_method/paypal.rb', line 8

def checkout_url(success_url, cancel_url, params = {})
  response = client.setup(request, success_url, cancel_url)
  response.redirect_uri
end

#complete!(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/bodega/payment_method/paypal.rb', line 13

def complete!(options = {})
  response = client.checkout!(
    options[:token],
    options[:PayerID],
    request
  )
  response.payment_info.last.transaction_id
end