Class: ActiveMerchant::Billing::PayflowGateway

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

Direct Known Subclasses

PayflowUkGateway

Constant Summary collapse

RECURRING_ACTIONS =
Set.new([:add, :modify, :cancel, :inquiry, :reactivate, :payment])

Constants included from PayflowCommonAPI

ActiveMerchant::Billing::PayflowCommonAPI::CARD_MAPPING, ActiveMerchant::Billing::PayflowCommonAPI::CVV_CODE, ActiveMerchant::Billing::PayflowCommonAPI::LIVE_URL, ActiveMerchant::Billing::PayflowCommonAPI::TEST_URL, ActiveMerchant::Billing::PayflowCommonAPI::TRANSACTIONS, ActiveMerchant::Billing::PayflowCommonAPI::XMLNS

Constants inherited from Gateway

Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods included from PayflowCommonAPI

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

Methods inherited from Gateway

#card_brand, card_brand, inherited, #initialize, supports?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Instance Method Details

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



16
17
18
19
20
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 16

def authorize(money, credit_card_or_reference, options = {})
  request = build_sale_or_authorization_request(:authorization, money, credit_card_or_reference, options)

  commit(request)
end

#cancel_recurring(profile_id) ⇒ Object



60
61
62
63
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 60

def cancel_recurring(profile_id)
  request = build_recurring_request(:cancel, 0, :profile_id => profile_id)
  commit(request, :recurring)
end

#credit(money, identification_or_credit_card, options = {}) ⇒ Object



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

def credit(money, identification_or_credit_card, options = {})
  if identification_or_credit_card.is_a?(String)
    # Perform referenced credit
    request = build_reference_request(:credit, money, identification_or_credit_card, options)
  else
    # Perform non-referenced credit
    request = build_credit_card_request(:credit, money, identification_or_credit_card, options)
  end
  
  commit(request)
end

#expressObject



70
71
72
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 70

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

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



22
23
24
25
26
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 22

def purchase(money, credit_card_or_reference, options = {})
  request = build_sale_or_authorization_request(:purchase, money, credit_card_or_reference, options)

  commit(request)
end

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

Adds or modifies a recurring Payflow profile. See the Payflow Pro Recurring Billing Guide for more details: www.paypal.com/en_US/pdf/PayflowPro_RecurringBilling_Guide.pdf

Several options are available to customize the recurring profile:

  • profile_id - is only required for editing a recurring profile

  • starting_at - takes a Date, Time, or string in mmddyyyy format. The date must be in the future.

  • name - The name of the customer to be billed. If not specified, the name from the credit card is used.

  • periodicity - The frequency that the recurring payments will occur at. Can be one of

:bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily, :semimonthly, :quadweekly, :quarterly, :semiyearly

  • payments - The term, or number of payments that will be made

  • comment - A comment associated with the profile



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

def recurring(money, credit_card, options = {})
  options[:name] = credit_card.name if options[:name].blank? && credit_card
  request = build_recurring_request(options[:profile_id] ? :modify : :add, money, options) do |xml|
    add_credit_card(xml, credit_card) if credit_card
  end
  commit(request, :recurring)
end

#recurring_inquiry(profile_id, options = {}) ⇒ Object



65
66
67
68
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 65

def recurring_inquiry(profile_id, options = {})
  request = build_recurring_request(:inquiry, nil, options.update( :profile_id => profile_id ))
  commit(request, :recurring)
end