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::DEBIT_CARDS, 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.
-
#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
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of GlobalCollectGateway.
18
19
20
21
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 18
def initialize(options={})
requires!(options, :merchant_id, :api_key_id, :secret_api_key)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 30
def authorize(money, payment, options={})
post = nestable_hash
add_order(post, money, options)
add_payment(post, payment)
add_customer_data(post, options, payment)
add_address(post, payment, options)
commit(:authorize, post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 40
def capture(money, authorization, options={})
post = nestable_hash
add_order(post, money, options)
add_customer_data(post, options)
commit(:capture, post, authorization)
end
|
#purchase(money, payment, options = {}) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 23
def purchase(money, payment, options={})
MultiResponse.run do |r|
r.process { authorize(money, payment, options) }
r.process { capture(money, r.authorization, options) } unless capture_requested?(r)
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
47
48
49
50
51
52
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 47
def refund(money, authorization, options={})
post = nestable_hash
add_amount(post, money, options)
add_refund_customer_data(post, options)
commit(:refund, post, authorization)
end
|
#scrub(transcript) ⇒ Object
70
71
72
73
74
75
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 70
def scrub(transcript)
transcript.
gsub(%r((Authorization: )[^\\]*)i, '\1[FILTERED]').
gsub(%r(("cardNumber\\":\\")\d+), '\1[FILTERED]').
gsub(%r(("cvv\\":\\")\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
66
67
68
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 66
def supports_scrubbing?
true
end
|
#verify(payment, options = {}) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 59
def verify(payment, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, payment, options) }
r.process { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/global_collect.rb', line 54
def void(authorization, options={})
post = nestable_hash
commit(:void, post, authorization)
end
|