Class: MerbMerchant::Billing::PaypalExpressGateway

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

Constant Summary

Constants included from PaypalCommonAPI

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

Constants inherited from Gateway

Gateway::DEBIT_CARDS

Constants included from PostsData

PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT

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

#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

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



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

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

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

#details_for(token) ⇒ Object



28
29
30
# File 'lib/merb_merchant/billing/gateways/paypal_express.rb', line 28

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

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



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

def purchase(money, options = {})
  requires!(options, :token, :payer_id)
  
  commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money, options)
end

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



16
17
18
19
20
# File 'lib/merb_merchant/billing/gateways/paypal_express.rb', line 16

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



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

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