Class: ActiveMerchant::Billing::PaypalExpressGateway

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

Direct Known Subclasses

PaypalDigitalGoodsGateway

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 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

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

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, inherited, #initialize, supports?, #test?

Methods included from CreditCardFormatting

#format

Instance Method Details

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



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

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

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

#details_for(token) ⇒ Object



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

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

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



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

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



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

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

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

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



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

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



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

def setup_purchase(money, options = {})
  requires!(options, :return_url, :cancel_return_url)
  
  commit 'SetExpressCheckout', build_setup_request('Sale', money, options)
end