Class: ActiveMerchant::Billing::PaypalAdaptivePayment

Inherits:
Gateway
  • Object
show all
Includes:
PaypalAdaptivePaymentCommon
Defined in:
lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb

Defined Under Namespace

Modules: FeesPayer, PaymentType

Constant Summary collapse

TEST_URL =
'https://svcs.sandbox.paypal.com/AdaptivePayments/'
LIVE_URL =
'https://svcs.paypal.com/AdaptivePayments/'
EMBEDDED_FLOW_TEST_URL =
'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay'
EMBEDDED_FLOW_LIVE_URL =
'https://www.paypal.com/webapps/adaptivepayment/flow/pay'

Instance Method Summary collapse

Methods included from PaypalAdaptivePaymentCommon

included, #redirect_pre_approval_url, #redirect_pre_approval_url_for, #redirect_url, #redirect_url_for

Constructor Details

#initialize(options = {}) ⇒ PaypalAdaptivePayment

Returns a new instance of PaypalAdaptivePayment.



36
37
38
39
40
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 36

def initialize(options = {})
  requires!(options, :login, :password, :signature, :appid)
  @options = options.dup
  super
end

Instance Method Details

#cancel_preapproval(options) ⇒ Object



74
75
76
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 74

def cancel_preapproval(options)
  commit('CancelPreapproval', build_cancel_preapproval(options))
end

#convert_currency(options) ⇒ Object



82
83
84
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 82

def convert_currency(options)
  commit('ConvertCurrency', build_currency_conversion(options))
end

#debugObject



94
95
96
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 94

def debug
  {:url => @url, :request => @xml, :response => @response.json}
end

#details_for_payment(options) ⇒ Object



46
47
48
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 46

def details_for_payment(options)
  commit('PaymentDetails', build_adaptive_payment_details_request(options))
end

#embedded_flow_urlObject



86
87
88
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 86

def embedded_flow_url
  test? ? EMBEDDED_FLOW_TEST_URL : EMBEDDED_FLOW_LIVE_URL
end

#embedded_flow_url_for(token) ⇒ Object



90
91
92
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 90

def embedded_flow_url_for(token)
  "#{embedded_flow_url}?paykey=#{token}"
end

#execute_payment(options) ⇒ Object



66
67
68
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 66

def execute_payment(options)
  commit('ExecutePayment', build_adaptive_execute_payment_request(options))
end

#get_payment_options(options) ⇒ Object



54
55
56
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 54

def get_payment_options(options)
  commit('GetPaymentOptions', build_adaptive_get_payment_options_request(options))
end

#get_shipping_addresses(options) ⇒ Object



50
51
52
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 50

def get_shipping_addresses(options)
  commit('GetShippingAddresses', build_adaptive_get_shipping_addresses_request(options))
end

#preapproval_details_for(options) ⇒ Object



78
79
80
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 78

def preapproval_details_for(options)
  commit('PreapprovalDetails', build_preapproval_details(options))
end

#preapprove_payment(options) ⇒ Object



70
71
72
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 70

def preapprove_payment(options)
  commit('Preapproval', build_preapproval_payment(options))
end

#refund(options) ⇒ Object



62
63
64
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 62

def refund(options)
  commit('Refund', build_adaptive_refund_details(options))
end

#set_payment_options(options) ⇒ Object



58
59
60
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 58

def set_payment_options(options)
  commit('SetPaymentOptions', build_adaptive_set_payment_options_request(options))
end

#setup_purchase(options) ⇒ Object



42
43
44
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb', line 42

def setup_purchase(options)
  commit('Pay', build_adaptive_payment_pay_request(options))
end