Class: ActiveMerchant::Billing::PaypalGateway

Inherits:
Gateway
  • Object
show all
Includes:
PaypalCommonAPI
Defined in:
lib/active_merchant/billing/gateways/paypal.rb

Constant Summary

Constants included from PaypalCommonAPI

ActiveMerchant::Billing::PaypalCommonAPI::CREDENTIALS_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::ENVELOPE_NAMESPACES, ActiveMerchant::Billing::PaypalCommonAPI::LIVE_URL, ActiveMerchant::Billing::PaypalCommonAPI::TEST_URL

Instance Attribute Summary

Attributes inherited from Gateway

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PaypalCommonAPI

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

Methods inherited from Gateway

gateway, #initialize, supports?, #test?

Methods included from RequiresParameters

#requires!

Methods included from PostsData

#included?, #ssl_post

Class Method Details

.supported_cardtypesObject



8
9
10
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 8

def self.supported_cardtypes
  [:visa, :master, :american_express, :discover]
end

Instance Method Details

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



12
13
14
15
16
17
18
19
20
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 12

def authorize(money, credit_card, options = {})
  requires!(options, :ip)
  
  if result = test_result_from_cc_number(credit_card.number)
    return result
  end

  commit 'DoDirectPayment', build_sale_or_authorization_request('Authorization', money, credit_card, options)
end

#expressObject



32
33
34
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 32

def express
  @express ||= PaypalExpressGateway.new(@options)
end

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



22
23
24
25
26
27
28
29
30
# File 'lib/active_merchant/billing/gateways/paypal.rb', line 22

def purchase(money, credit_card, options = {})
  requires!(options, :ip)
  
  if result = test_result_from_cc_number(credit_card.number)
    return result
  end
  
  commit 'DoDirectPayment', build_sale_or_authorization_request('Sale', money, credit_card, options)
end