Module: ActiveMerchant::Billing::PaypalCommonAPI

Included in:
PaypalExpressGateway, PaypalGateway
Defined in:
lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb

Overview

This class is an abstract base class for both PaypalGateway and PaypalExpressGateway

Constant Summary collapse

TEST_URL =
'https://api.sandbox.paypal.com/2.0/'
LIVE_URL =
'https://api-aa.paypal.com/2.0/'
ENVELOPE_NAMESPACES =
{ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
}
CREDENTIALS_NAMESPACES =
{ 'xmlns' => 'urn:ebay:api:PayPalAPI',
  'xmlns:n1' => 'urn:ebay:apis:eBLBaseComponents',
  'env:mustUnderstand' => '0'
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 6

def self.included(base)
  base.cattr_accessor :pem_file
end

Instance Method Details

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



42
43
44
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 42

def capture(money, authorization, options = {})
  commit 'DoCapture', build_capture_request(money, authorization, options)
end

#initialize(options = {}) ⇒ Object

:pem The text of your PayPal PEM file. Note

this is not the path to file, but its
contents. If you are only using one PEM
file on your site you can declare it
globally and then you won't need to
include this option


28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 28

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

#test?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 38

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

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



46
47
48
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 46

def void(authorization, options = {})
  commit 'DoVoid', build_void_request(authorization, options)
end