Class: ActiveMerchant::Billing::PaypalExpressRecurringGateway

Inherits:
Gateway
  • Object
show all
Includes:
PaypalCommonAPI, PaypalExpressCommon
Defined in:
lib/active_merchant/billing/gateways/paypal_express_recurring.rb

Constant Summary collapse

LIVE_REDIRECT_URL =
'https://www.paypal.com/cgi-bin/webscr?cmd=_customer-billing-agreement&token='
TEST_REDIRECT_URL =
'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_customer-billing-agreement&token='

Constants included from PaypalCommonAPI

ActiveMerchant::Billing::PaypalCommonAPI::API_VERSION, ActiveMerchant::Billing::PaypalCommonAPI::AUSTRALIAN_STATES, ActiveMerchant::Billing::PaypalCommonAPI::CREDENTIALS_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::EBAY_NAMESPACE, ActiveMerchant::Billing::PaypalCommonAPI::ENVELOPE_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::FRAUD_REVIEW_CODE, ActiveMerchant::Billing::PaypalCommonAPI::PAYPAL_NAMESPACE, ActiveMerchant::Billing::PaypalCommonAPI::SUCCESS_CODES, ActiveMerchant::Billing::PaypalCommonAPI::URLS

Constants inherited from Gateway

Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods included from PaypalExpressCommon

included

Methods included from PaypalCommonAPI

#capture, #credit, included, #initialize, #reauthorize, #test?, #transfer, #void

Methods inherited from Gateway

#card_brand, card_brand, inherited, #initialize, supports?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #ssl_get, #ssl_post

Instance Method Details

#bill_outstanding_amount(profile_id, options = {}) ⇒ Object



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

def bill_outstanding_amount(profile_id, options = {})
  commit 'BillOutstandingAmount', build_bill_outstanding_amount(profile_id, options)
end

#cancel_profile(profile_id, options = {}) ⇒ Object



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

def cancel_profile(profile_id, options = {})
  commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Cancel', options)
end

#create_profile(token, options = {}) ⇒ Object



48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 48

def create_profile(token, options = {})
  requires!(options, :description, :start_date, :frequency, :amount)

  commit 'CreateRecurringPaymentsProfile', build_create_profile_request(token, options)
end

#details_for(token) ⇒ Object

def setup_agreement(options = {})

requires!(options, :description, :return_url, :cancel_return_url)

commit 'SetExpressCheckout', build_setup_request('Authorization', options)

end



44
45
46
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 44

def details_for(token)
  commit 'GetExpressCheckoutDetails', build_get_details_request(token)
end

#get_agreement(token) ⇒ Object



28
29
30
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 28

def get_agreement(token)
  commit 'GetBillingAgreementCustomerDetails', build_get_agreement_request(token)
end

#get_profile_details(profile_id) ⇒ Object



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

def get_profile_details(profile_id)
  commit 'GetRecurringPaymentsProfileDetails', build_get_profile_details_request(profile_id)
end

#reactivate_profile(profile_id, options = {}) ⇒ Object



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

def reactivate_profile(profile_id, options = {})
  commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Reactivate', options)
end

#redirect_urlObject



14
15
16
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 14

def redirect_url
  test? ? TEST_REDIRECT_URL : LIVE_REDIRECT_URL
end

#redirect_url_for(token) ⇒ Object



18
19
20
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 18

def redirect_url_for(token)
  "#{redirect_url}#{token}"
end

#setup_agreement(options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/active_merchant/billing/gateways/paypal_express_recurring.rb', line 22

def setup_agreement(options = {})
  requires!(options, :description, :return_url, :cancel_return_url)

  commit 'SetCustomerBillingAgreement', build_setup_request(options)
end

#suspend_profile(profile_id, options = {}) ⇒ Object



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

def suspend_profile(profile_id, options = {})
  commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Suspend', options)
end

#update_profile(profile_id, options = {}) ⇒ Object



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

def update_profile(profile_id, options = {})
  commit 'UpdateRecurringPaymentsProfile', build_change_profile_request(profile_id, options)
end