Class: ActiveMerchant::Billing::PaypalExpressGateway

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

Direct Known Subclasses

PaypalDigitalGoodsGateway

Constant Summary

NON_STANDARD_LOCALE_CODES =
{
  'DK' => 'da_DK',
  'IL' => 'he_IL',
  'ID' => 'id_ID',
  'JP' => 'jp_JP',
  'NO' => 'no_NO',
  'BR' => 'pt_BR',
  'RU' => 'ru_RU',
  'SE' => 'sv_SE',
  'TH' => 'th_TH',
  'TR' => 'tr_TR',
  'CN' => 'zh_CN',
  'HK' => 'zh_HK',
  'TW' => 'zh_TW'
}

Constants included from PaypalRecurringApi

ActiveMerchant::Billing::PaypalRecurringApi::API_VERSION, ActiveMerchant::Billing::PaypalRecurringApi::EBAY_NAMESPACE, ActiveMerchant::Billing::PaypalRecurringApi::PAYPAL_NAMESPACE

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::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods included from PaypalRecurringApi

#bill_outstanding_amount, #cancel_recurring, #reactivate_recurring, #recurring, #status_recurring, #suspend_recurring, #update_recurring

Methods included from PaypalExpressCommon

included, #redirect_url, #redirect_url_for

Methods included from PaypalCommonAPI

#authorize_transaction, #balance, #capture, #credit, included, #initialize, #manage_pending_transaction, #reauthorize, #refund, #transaction_details, #transaction_search, #transfer, #void

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, #initialize, non_fractional_currency?, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Instance Method Details

#agreement_details(reference_id, options = {}) ⇒ Object



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

def agreement_details(reference_id, options = {})
  commit 'BAUpdate', build_details_billing_agreement_request(reference_id)
end

#authorize(money, options = {}) ⇒ Object



50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 50

def authorize(money, options = {})
  requires!(options, :token, :payer_id)

  commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Authorization', money, options)
end

#authorize_reference_transaction(money, options = {}) ⇒ Object



74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 74

def authorize_reference_transaction(money, options = {})
  requires!(options, :reference_id, :payment_type, :invoice_id, :description, :ip)

  commit 'DoReferenceTransaction', build_reference_transaction_request('Authorization', money, options)
end

#details_for(token) ⇒ Object



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

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

#purchase(money, options = {}) ⇒ Object



56
57
58
59
60
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 56

def purchase(money, options = {})
  requires!(options, :token, :payer_id)

  commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money, options)
end

#reference_transaction(money, options = {}) ⇒ Object



80
81
82
83
84
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 80

def reference_transaction(money, options = {})
  requires!(options, :reference_id)

  commit 'DoReferenceTransaction', build_reference_transaction_request('Sale', money, options)
end

#setup_authorization(money, options = {}) ⇒ Object



34
35
36
37
38
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 34

def setup_authorization(money, options = {})
  requires!(options, :return_url, :cancel_return_url)

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

#setup_purchase(money, options = {}) ⇒ Object



40
41
42
43
44
# File 'lib/active_merchant/billing/gateways/paypal_express.rb', line 40

def setup_purchase(money, options = {})
  requires!(options, :return_url, :cancel_return_url)

  commit 'SetExpressCheckout', build_setup_request('Sale', money, options)
end

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



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

def store(token, options = {})
  commit 'CreateBillingAgreement', build_create_billing_agreement_request(token, options)
end

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



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

def unstore(token, options = {})
  commit 'BAUpdate', build_cancel_billing_agreement_request(token)
end