Module ActiveMerchant::Billing::PaypalCommonAPI
In: lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb

This module is included in both PaypalGateway and PaypalExpressGateway

Methods

capture   credit   included   new   reauthorize   test?   transfer   void  

Constants

API_VERSION = '52.0'
URLS = { :test => { :certificate => 'https://api.sandbox.paypal.com/2.0/', :signature => 'https://api-3t.sandbox.paypal.com/2.0/' }, :live => { :certificate => 'https://api-aa.paypal.com/2.0/', :signature => 'https://api-3t.paypal.com/2.0/' }
PAYPAL_NAMESPACE = 'urn:ebay:api:PayPalAPI'
EBAY_NAMESPACE = 'urn:ebay:apis:eBLBaseComponents'
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' => PAYPAL_NAMESPACE, 'xmlns:n1' => EBAY_NAMESPACE, 'env:mustUnderstand' => '0'
AUSTRALIAN_STATES = { 'ACT' => 'Australian Capital Territory', 'NSW' => 'New South Wales', 'NT' => 'Northern Territory', 'QLD' => 'Queensland', 'SA' => 'South Australia', 'TAS' => 'Tasmania', 'VIC' => 'Victoria', 'WA' => 'Western Australia'
SUCCESS_CODES = [ 'Success', 'SuccessWithWarning' ]
FRAUD_REVIEW_CODE = "11610"

Public Class methods

[Source]

   # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 5
5:       def self.included(base)
6:         base.default_currency = 'USD'
7:         base.cattr_accessor :pem_file
8:         base.cattr_accessor :signature
9:       end

The gateway must be configured with either your PayPal PEM file or your PayPal API Signature. Only one is required.

: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

:signature The text of your PayPal signature.

                      If you are only using one API Signature
                      on your site you can declare it
                      globally and then you won't need to
                      include this option

[Source]

    # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 63
63:       def initialize(options = {})
64:         requires!(options, :login, :password)
65:         
66:         @options = {
67:           :pem => pem_file,
68:           :signature => signature
69:         }.update(options)
70:         
71:         if @options[:pem].blank? && @options[:signature].blank?
72:           raise ArgumentError, "An API Certificate or API Signature is required to make requests to PayPal" 
73:         end
74:         
75:         super
76:       end

Public Instance methods

[Source]

    # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 86
86:       def capture(money, authorization, options = {})
87:         commit 'DoCapture', build_capture_request(money, authorization, options)
88:       end

[Source]

     # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 108
108:       def credit(money, identification, options = {})
109:         commit 'RefundTransaction', build_credit_request(money, identification, options)
110:       end

[Source]

    # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 82
82:       def reauthorize(money, authorization, options = {})
83:         commit 'DoReauthorization', build_reauthorize_request(money, authorization, options)
84:       end

[Source]

    # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 78
78:       def test?
79:         @options[:test] || Base.gateway_mode == :test
80:       end

Transfer money to one or more recipients.

  gateway.transfer 1000, 'bob@example.com',
    :subject => "The money I owe you", :note => "Sorry it's so late"

  gateway.transfer [1000, 'fred@example.com'],
    [2450, 'wilma@example.com', :note => 'You will receive another payment on 3/24'],
    [2000, 'barney@example.com'],
    :subject => "Your Earnings", :note => "Thanks for your business."

[Source]

     # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 100
100:       def transfer(*args)
101:         commit 'MassPay', build_mass_pay_request(*args)
102:       end

[Source]

     # File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 104
104:       def void(authorization, options = {})
105:         commit 'DoVoid', build_void_request(authorization, options)
106:       end

[Validate]