Class: ActiveMerchant::Billing::PayflowGateway
Constant Summary
collapse
- RECURRING_ACTIONS =
Set.new(%i[add modify cancel inquiry reactivate payment])
ActiveMerchant::Billing::PayflowCommonAPI::CARD_MAPPING, ActiveMerchant::Billing::PayflowCommonAPI::CVV_CODE, ActiveMerchant::Billing::PayflowCommonAPI::TRANSACTIONS, ActiveMerchant::Billing::PayflowCommonAPI::XMLNS
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, credit_card_or_reference, options = {}) ⇒ Object
-
#cancel_recurring(profile_id) ⇒ Object
-
#credit(money, funding_source, options = {}) ⇒ Object
-
#express ⇒ Object
-
#purchase(money, funding_source, options = {}) ⇒ Object
-
#recurring(money, credit_card, options = {}) ⇒ Object
Adds or modifies a recurring Payflow profile.
-
#recurring_inquiry(profile_id, options = {}) ⇒ Object
-
#refund(money, reference, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(payment, options = {}) ⇒ Object
-
#verify_credentials ⇒ Object
#capture, included, #initialize, #void
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, card_brand, #card_brand, #generate_unique_id, inherited, #initialize, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#format
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
17
18
19
20
21
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 17
def authorize(money, credit_card_or_reference, options = {})
request = build_sale_or_authorization_request(:authorization, money, credit_card_or_reference, options)
commit(request, options)
end
|
#cancel_recurring(profile_id) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 91
def cancel_recurring(profile_id)
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
request = build_recurring_request(:cancel, 0, profile_id: profile_id)
commit(request, options.merge(request_type: :recurring))
end
|
#credit(money, funding_source, options = {}) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 29
def credit(money, funding_source, options = {})
if funding_source.is_a?(String)
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
refund(money, funding_source, options)
elsif card_brand(funding_source) == 'check'
request = build_check_request(:credit, money, funding_source, options)
commit(request, options)
else
request = build_credit_card_request(:credit, money, funding_source, options)
commit(request, options)
end
end
|
#express ⇒ Object
105
106
107
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 105
def express
@express ||= PayflowExpressGateway.new(@options)
end
|
#purchase(money, funding_source, options = {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 23
def purchase(money, funding_source, options = {})
request = build_sale_or_authorization_request(:purchase, money, funding_source, options)
commit(request, options)
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
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 80
def recurring(money, credit_card, options = {})
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
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, options) if credit_card
add_stored_credential(xml, options[:stored_credential])
end
commit(request, options.merge(request_type: :recurring))
end
|
#recurring_inquiry(profile_id, options = {}) ⇒ Object
98
99
100
101
102
103
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 98
def recurring_inquiry(profile_id, options = {})
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
request = build_recurring_request(:inquiry, nil, options.update(profile_id: profile_id))
commit(request, options.merge(request_type: :recurring))
end
|
#refund(money, reference, options = {}) ⇒ Object
44
45
46
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 44
def refund(money, reference, options = {})
commit(build_reference_request(:credit, money, reference, options), options)
end
|
#scrub(transcript) ⇒ Object
113
114
115
116
117
118
119
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 113
def scrub(transcript)
transcript.
gsub(%r((<CardNum>)[^<]*(</CardNum>)), '\1[FILTERED]\2').
gsub(%r((<CVNum>)[^<]*(</CVNum>)), '\1[FILTERED]\2').
gsub(%r((<AcctNum>)[^<]*(</AcctNum>)), '\1[FILTERED]\2').
gsub(%r((<Password>)[^<]*(</Password>)), '\1[FILTERED]\2')
end
|
#store(payment, options = {}) ⇒ Object
59
60
61
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 59
def store(payment, options = {})
raise ArgumentError, 'Store is not supported on Payflow gateways'
end
|
#supports_scrubbing? ⇒ Boolean
109
110
111
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 109
def supports_scrubbing?
true
end
|
#verify(payment, options = {}) ⇒ Object
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 48
def verify(payment, options = {})
if credit_card_type(payment) == 'Amex'
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, payment, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
else
authorize(0, payment, options)
end
end
|
#verify_credentials ⇒ Object
63
64
65
66
|
# File 'lib/active_merchant/billing/gateways/payflow.rb', line 63
def verify_credentials
response = void('0')
response.params['result'] != '26'
end
|