Class: ActiveMerchant::Billing::S5Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::S5Gateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/s5.rb
Constant Summary
collapse
- SUPPORTED_TRANSACTIONS =
{
'sale' => 'CC.DB',
'authonly' => 'CC.PA',
'capture' => 'CC.CP',
'refund' => 'CC.RF',
'void' => 'CC.RV',
}
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, 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 = {}) ⇒ S5Gateway
constructor
A new instance of S5Gateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #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
#initialize(options = {}) ⇒ S5Gateway
Returns a new instance of S5Gateway.
24
25
26
27
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 24
def initialize(options={})
requires!(options, :sender, :channel, :login, :password)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 49
def authorize(money, payment, options={})
request = build_xml_request do |xml|
add_payment(xml, money, 'authonly', options)
add_account(xml, payment)
add_customer(xml, payment, options)
add_recurrence_mode(xml, options)
end
commit(request)
end
|
#capture(money, authorization, options = {}) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 60
def capture(money, authorization, options={})
request = build_xml_request do |xml|
add_identification(xml, authorization)
add_payment(xml, money, 'capture', options)
end
commit(request)
end
|
#purchase(money, payment, options = {}) ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 29
def purchase(money, payment, options={})
request = build_xml_request do |xml|
add_payment(xml, money, 'sale', options)
add_account(xml, payment)
add_customer(xml, payment, options)
add_recurrence_mode(xml, options)
end
commit(request)
end
|
#refund(money, authorization, options = {}) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 40
def refund(money, authorization, options={})
request = build_xml_request do |xml|
add_identification(xml, authorization)
add_payment(xml, money, 'refund', options)
end
commit(request)
end
|
#scrub(transcript) ⇒ Object
89
90
91
92
93
94
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 89
def scrub(transcript)
transcript.
gsub(%r((pwd=).+?(/>))i, '\1[FILTERED]\2').
gsub(%r((<Number>).+?(</Number>))i, '\1[FILTERED]\2').
gsub(%r((<Verification>).+?(</Verification>))i, '\1[FILTERED]\2')
end
|
#supports_scrubbing? ⇒ Boolean
85
86
87
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 85
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
78
79
80
81
82
83
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 78
def verify(credit_card, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 69
def void(authorization, options={})
request = build_xml_request do |xml|
add_identification(xml, authorization)
add_payment(xml, nil, 'void', options)
end
commit(request)
end
|