Class: ActiveMerchant::Billing::ElavonGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::ElavonGateway
show all
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/elavon.rb
Constant Summary
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, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, creditcard, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ ElavonGateway
constructor
A new instance of ElavonGateway.
-
#purchase(money, payment_method, options = {}) ⇒ Object
-
#refund(money, identification, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(creditcard, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#update(token, creditcard, options = {}) ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(identification, 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 = {}) ⇒ ElavonGateway
Returns a new instance of ElavonGateway.
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 35
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 64
def authorize(money, creditcard, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:authorize]
xml.ssl_amount amount(money)
add_salestax(xml, options)
add_invoice(xml, options)
add_creditcard(xml, creditcard)
add_currency(xml, money, options)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
add_ip(xml, options)
add_auth_purchase_params(xml, options)
add_level_3_fields(xml, options) if options[:level_3_data]
end
commit(request)
end
|
#capture(money, authorization, options = {}) ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 83
def capture(money, authorization, options = {})
request = build_xml_request do |xml|
if options[:credit_card]
xml.ssl_transaction_type self.actions[:capture]
xml.ssl_amount amount(money)
add_salestax(xml, options)
add_approval_code(xml, authorization)
add_invoice(xml, options)
add_creditcard(xml, options[:credit_card])
add_currency(xml, money, options)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
else
xml.ssl_transaction_type self.actions[:capture_complete]
xml.ssl_amount amount(money)
add_currency(xml, money, options)
add_txn_id(xml, authorization)
add_partial_shipment_flag(xml, options)
add_test_mode(xml, options)
end
end
commit(request)
end
|
#credit(money, creditcard, options = {}) ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 128
def credit(money, creditcard, options = {})
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if creditcard.is_a?(String)
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:credit]
xml.ssl_amount amount(money)
add_invoice(xml, options)
add_creditcard(xml, creditcard)
add_currency(xml, money, options)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
end
commit(request)
end
|
#purchase(money, payment_method, options = {}) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 40
def purchase(money, payment_method, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:purchase]
xml.ssl_amount amount(money)
if payment_method.is_a?(String)
add_token(xml, payment_method)
else
add_creditcard(xml, payment_method)
end
add_invoice(xml, options)
add_salestax(xml, options)
add_currency(xml, money, options)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
add_ip(xml, options)
add_auth_purchase_params(xml, options)
add_level_3_fields(xml, options) if options[:level_3_data]
end
commit(request)
end
|
#refund(money, identification, options = {}) ⇒ Object
108
109
110
111
112
113
114
115
116
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 108
def refund(money, identification, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:refund]
xml.ssl_amount amount(money)
add_txn_id(xml, identification)
add_test_mode(xml, options)
end
commit(request)
end
|
#scrub(transcript) ⇒ Object
184
185
186
187
188
189
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 184
def scrub(transcript)
transcript.
gsub(%r((<ssl_pin>)(.*)(</ssl_pin>)), '\1[FILTERED]\3').
gsub(%r((<ssl_card_number>)(.*)(</ssl_card_number>)), '\1[FILTERED]\3').
gsub(%r((<ssl_cvv2cvc2>)(.*)(</ssl_cvv2cvc2>)), '\1[FILTERED]\3')
end
|
#store(creditcard, options = {}) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 155
def store(creditcard, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:store]
xml.ssl_add_token 'Y'
add_creditcard(xml, creditcard)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
add_verification(xml, options)
end
commit(request)
end
|
#supports_scrubbing? ⇒ Boolean
180
181
182
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 180
def supports_scrubbing?
true
end
|
#update(token, creditcard, options = {}) ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 168
def update(token, creditcard, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:update]
add_token(xml, token)
add_creditcard(xml, creditcard)
add_address(xml, options)
add_customer_email(xml, options)
add_test_mode(xml, options)
end
commit(request)
end
|
#verify(credit_card, options = {}) ⇒ Object
144
145
146
147
148
149
150
151
152
153
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 144
def verify(credit_card, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:verify]
add_creditcard(xml, credit_card)
add_address(xml, options)
add_test_mode(xml, options)
add_ip(xml, options)
end
commit(request)
end
|
#void(identification, options = {}) ⇒ Object
118
119
120
121
122
123
124
125
126
|
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 118
def void(identification, options = {})
request = build_xml_request do |xml|
xml.ssl_transaction_type self.actions[:void]
add_txn_id(xml, identification)
add_test_mode(xml, options)
end
commit(request)
end
|