Module: ActiveMerchant::Billing::PayflowCommonAPI

Included in:
PayflowExpressGateway, PayflowGateway
Defined in:
lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb

Constant Summary collapse

XMLNS =
'http://www.paypal.com/XMLPay'
TEST_URL =
'https://pilot-payflowpro.verisign.com/transaction'
LIVE_URL =
'https://payflowpro.verisign.com/transaction'
CARD_MAPPING =
{
  :visa => 'Visa',
  :master => 'MasterCard',
  :discover => 'Discover',
  :american_express => 'Amex',
  :jcb => 'JCB',
  :diners_club => 'DinersClub',
  :switch => 'Switch',
  :solo => 'Solo'
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb', line 6

def self.included(base)
  base.class_inheritable_accessor :default_currency
  base.default_currency = 'USD'
    
  # The certification_id is required by PayPal to make direct HTTPS posts to their servers.
  # You can obtain a certification id by emailing: [email protected]
  base.class_inheritable_accessor :certification_id
  base.class_inheritable_accessor :partner
  
  # Set the default partner to PayPal
  base.partner = 'PayPal'
end

Instance Method Details

#capture(money, authorization, options = {}) ⇒ Object



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

def capture(money, authorization, options = {})
  request = build_void_or_capture_request('Capture', authorization)
  commit(request)
end

#initialize(options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb', line 34

def initialize(options = {})
  requires!(options, :login, :password)
  @options = {
    :certification_id => self.class.certification_id,
    :partner => self.class.partner
  }.update(options)
  
  super
end

#test?Boolean

Returns:

  • (Boolean)


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

def test?
  @options[:test] || Base.gateway_mode == :test
end

#void(authorization, options = {}) ⇒ Object



53
54
55
56
# File 'lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb', line 53

def void(authorization, options = {})
  request = build_void_or_capture_request('Void', authorization)
  commit(request)
end