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::CVV_CODE, ActiveMerchant::Billing::PayflowCommonAPI::LIVE_URL, ActiveMerchant::Billing::PayflowCommonAPI::TEST_URL, ActiveMerchant::Billing::PayflowCommonAPI::TRANSACTIONS, ActiveMerchant::Billing::PayflowCommonAPI::XMLNS

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 PayflowCommonAPI

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

Methods inherited from Gateway

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, #retry_exceptions, #ssl_post

Instance Method Details

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



23
24
25
26
27
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 23

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

#credit(money, identification, options = {}) ⇒ Object



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

def credit(money, identification, options = {})
  request = build_reference_request(:credit, money, identification, options)
  commit(request)
end

#details_for(token) ⇒ Object



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

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

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



29
30
31
32
33
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 29

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

#redirect_urlObject



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

def redirect_url
  test? ? TEST_REDIRECT_URL : LIVE_REDIRECT_URL
end

#redirect_url_for(token) ⇒ Object



19
20
21
# File 'lib/active_merchant/billing/gateways/payflow_express.rb', line 19

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

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



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

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



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

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