Class: ActiveMerchant::Billing::GlobalCollectGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::GlobalCollectGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/global_collect.rb
Constant Summary
Constants inherited
from Gateway
ActiveMerchant::Billing::Gateway::CREDIT_DEPRECATION_MESSAGE, ActiveMerchant::Billing::Gateway::RECURRING_DEPRECATION_MESSAGE, ActiveMerchant::Billing::Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ GlobalCollectGateway
constructor
A new instance of GlobalCollectGateway.
-
#inquire(authorization, options = {}) ⇒ Object
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(payment, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#fetch_version, included
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of GlobalCollectGateway.
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 25
def initialize(options = {})
requires!(options, :merchant_id, :api_key_id, :secret_api_key)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 37
def authorize(money, payment, options = {})
post = nestable_hash
add_order(post, money, options)
add_payment(post, payment, options)
add_customer_data(post, options, payment)
add_address(post, payment, options)
add_creator_info(post, options)
add_fraud_fields(post, options)
add_external_cardholder_authentication_data(post, options)
add_threeds_exemption_data(post, options)
action = options[:action] || :authorize
commit(:post, action, post, options:)
end
|
#capture(money, authorization, options = {}) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 52
def capture(money, authorization, options = {})
post = nestable_hash
add_order(post, money, options, capture: true)
add_customer_data(post, options)
add_creator_info(post, options)
commit(:post, :capture, post, authorization:)
end
|
#inquire(authorization, options = {}) ⇒ Object
85
86
87
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 85
def inquire(authorization, options = {})
commit(:get, :inquire, nil, authorization:)
end
|
#purchase(money, payment, options = {}) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 30
def purchase(money, payment, options = {})
MultiResponse.run do |r|
r.process { authorize(money, payment, options) }
r.process { capture(money, r.authorization, options) } if should_request_capture?(r, options[:requires_approval])
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 60
def refund(money, authorization, options = {})
post = nestable_hash
add_amount(post, money, options)
add_refund_customer_data(post, options)
add_creator_info(post, options)
commit(:post, :refund, post, authorization:)
end
|
#scrub(transcript) ⇒ Object
93
94
95
96
97
98
99
100
101
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 93
def scrub(transcript)
transcript.
gsub(%r((Authorization: )[^\\]*)i, '\1[FILTERED]').
gsub(%r(("cardNumber\\+":\\+")\d+), '\1[FILTERED]').
gsub(%r(("cvv\\+":\\+")\d+), '\1[FILTERED]').
gsub(%r(("dpan\\+":\\+")\d+), '\1[FILTERED]').
gsub(%r(("pan\\+":\\+")\d+), '\1[FILTERED]').
gsub(%r(("cryptogram\\+":\\+"|("cavv\\+" : \\+"))[^\\]*), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
89
90
91
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 89
def supports_scrubbing?
true
end
|
#verify(payment, options = {}) ⇒ Object
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 74
def verify(payment, options = {})
if ogone_direct?
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, payment, options) }
r.process { void(r.authorization, options) }
end
else
authorize(0, payment, options.merge(action: :verify))
end
end
|
#void(authorization, options = {}) ⇒ Object
68
69
70
71
72
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 68
def void(authorization, options = {})
post = nestable_hash
add_creator_info(post, options)
commit(:post, :void, post, authorization:)
end
|