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',
'store' => 'CC.RG'
}
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, 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
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(credit_card, 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?
#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.
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 25
def initialize(options = {})
requires!(options, :sender, :channel, :login, :password)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 51
def authorize(money, payment, options = {})
request = build_xml_request do |xml|
add_identification(xml, options)
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
63
64
65
66
67
68
69
70
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 63
def capture(money, authorization, options = {})
request = build_xml_request do |xml|
add_identification(xml, options, authorization)
add_payment(xml, money, 'capture', options)
end
commit(request)
end
|
#purchase(money, payment, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 30
def purchase(money, payment, options = {})
request = build_xml_request do |xml|
add_identification(xml, options)
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
42
43
44
45
46
47
48
49
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 42
def refund(money, authorization, options = {})
request = build_xml_request do |xml|
add_identification(xml, options, authorization)
add_payment(xml, money, 'refund', options)
end
commit(request)
end
|
#scrub(transcript) ⇒ Object
103
104
105
106
107
108
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 103
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
|
#store(payment, options = {}) ⇒ Object
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 81
def store(payment, options = {})
request = build_xml_request do |xml|
xml.Payment(code: SUPPORTED_TRANSACTIONS['store'])
add_account(xml, payment)
add_customer(xml, payment, options)
add_recurrence_mode(xml, options)
end
commit(request)
end
|
#supports_scrubbing? ⇒ Boolean
99
100
101
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 99
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
92
93
94
95
96
97
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 92
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
72
73
74
75
76
77
78
79
|
# File 'lib/active_merchant/billing/gateways/s5.rb', line 72
def void(authorization, options = {})
request = build_xml_request do |xml|
add_identification(xml, options, authorization)
add_payment(xml, nil, 'void', options)
end
commit(request)
end
|