Class: ActiveMerchant::Billing::PayflowExpressGateway

Inherits:
Gateway
  • Object
show all
Includes:
PayflowCommonAPI
Defined in:
lib/active_merchant/billing/gateways/payflow_express.rb

Direct Known Subclasses

PayflowExpressUkGateway

Constant Summary collapse

LIVE_REDIRECT_URL =
'https://www.paypal.com/cgibin/webscr?cmd=_express-checkout&token='
TEST_REDIRECT_URL =
'https://test-expresscheckout.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='

Constants included from PayflowCommonAPI

ActiveMerchant::Billing::PayflowCommonAPI::CARD_MAPPING, ActiveMerchant::Billing::PayflowCommonAPI::LIVE_URL, ActiveMerchant::Billing::PayflowCommonAPI::TEST_URL, ActiveMerchant::Billing::PayflowCommonAPI::XMLNS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods included from PayflowCommonAPI

#capture, included, #initialize, #test?, #void

Methods inherited from Gateway

gateway, #initialize, supported_cardtypes, supports?, #test?

Methods included from RequiresParameters

#requires!

Methods included from PostsData

#included?, #ssl_post

Instance Method Details

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



20
21
22
23
24
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 20

def authorize(money, options = {})
  requires!(options, :token, :payer_id)
  request = build_sale_or_authorization_request('Authorization', money, options)
  commit(request)
end

#details_for(token) ⇒ Object



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

def details_for(token)
  request = build_get_express_details_request(token)
  commit(request)
end

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



26
27
28
29
30
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 26

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

#redirect_urlObject



12
13
14
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 12

def redirect_url
  test? ? TEST_REDIRECT_URL : LIVE_REDIRECT_URL
end

#redirect_url_for(token) ⇒ Object



16
17
18
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 16

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

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



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

def setup_authorization(money, options = {})
  requires!(options, :return_url, :cancel_return_url)
  
  request = build_setup_express_sale_or_authorization_request('Authorization', money, options)
  commit(request)
end

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



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

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