Class/Module Index [+]

Quicksearch

ActiveMerchant::Billing::PaypalCommonAPI

This module is included in both PaypalGateway and PaypalExpressGateway

Public Class Methods

included(base) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 5
def self.included(base)
  base.default_currency = 'USD'
  base.cattr_accessor :pem_file
  base.cattr_accessor :signature
end
new(options = {}) click to toggle source

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
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 63
def initialize(options = {})
  requires!(options, :login, :password)
  
  headers = {'X-PP-AUTHORIZATION' => options.delete(:auth_signature), 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SOAP11'} if options[:auth_signature]
  @options = {
    :pem => pem_file,
    :signature => signature,
    :headers => headers || {}
  }.update(options)

  
  if @options[:pem].blank? && @options[:signature].blank?
    raise ArgumentError, "An API Certificate or API Signature is required to make requests to PayPal" 
  end
  
  super
end

Public Instance Methods

capture(money, authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 89
def capture(money, authorization, options = {})
  commit 'DoCapture', build_capture_request(money, authorization, options)
end
credit(money, identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 115
def credit(money, identification, options = {})
  deprecated Gateway::CREDIT_DEPRECATION_MESSAGE
  refund(money, identification, options)
end
reauthorize(money, authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 85
def reauthorize(money, authorization, options = {})
  commit 'DoReauthorization', build_reauthorize_request(money, authorization, options)
end
refund(money, identification, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 111
def refund(money, identification, options = {})
  commit 'RefundTransaction', build_refund_request(money, identification, options)
end
test?() click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 81
def test?
  @options[:test] || Base.gateway_mode == :test
end
transfer(*args) click to toggle source

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."
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 103
def transfer(*args)
  commit 'MassPay', build_mass_pay_request(*args)
end
void(authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb, line 107
def void(authorization, options = {})
  commit 'DoVoid', build_void_request(authorization, options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.