Class: ActiveMerchant::Billing::PaypalExpressGateway

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

Constant Summary collapse

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::STANDARD_ERROR_CODE_MAPPING, ActiveMerchant::Billing::PaypalCommonAPI::SUCCESS_CODES, ActiveMerchant::Billing::PaypalCommonAPI::URLS

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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, #scrub, #supports_scrubbing?, #transaction_details, #transaction_search, #transfer, #void

Methods inherited from Gateway

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

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Instance Method Details

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



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

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

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



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

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



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

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



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

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

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



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

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



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

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

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

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



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

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



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

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



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

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

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



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

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