activemerchant 1.62.0 → 1.79.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +420 -2
- data/README.md +1 -2
- data/lib/active_merchant/billing/credit_card.rb +13 -14
- data/lib/active_merchant/billing/credit_card_methods.rb +3 -1
- data/lib/active_merchant/billing/gateway.rb +25 -9
- data/lib/active_merchant/billing/gateways/adyen.rb +299 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +168 -56
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +4 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +65 -22
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +87 -7
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +3 -8
- data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +49 -15
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +97 -2
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +14 -2
- data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +44 -14
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +0 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +4 -4
- data/lib/active_merchant/billing/gateways/creditcall.rb +71 -9
- data/lib/active_merchant/billing/gateways/credorax.rb +117 -5
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +54 -15
- data/lib/active_merchant/billing/gateways/data_cash.rb +12 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +0 -1
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +37 -95
- data/lib/active_merchant/billing/gateways/element.rb +11 -1
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -29
- data/lib/active_merchant/billing/gateways/first_pay.rb +12 -10
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +37 -20
- data/lib/active_merchant/billing/gateways/forte.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +55 -16
- data/lib/active_merchant/billing/gateways/global_transport.rb +16 -2
- data/lib/active_merchant/billing/gateways/hps.rb +12 -1
- data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +12 -9
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -2
- data/lib/active_merchant/billing/gateways/litle.rb +107 -30
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +11 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -4
- data/lib/active_merchant/billing/gateways/mercury.rb +14 -1
- data/lib/active_merchant/billing/gateways/migs.rb +28 -6
- data/lib/active_merchant/billing/gateways/moneris.rb +20 -12
- data/lib/active_merchant/billing/gateways/moneris_us.rb +11 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +60 -16
- data/lib/active_merchant/billing/gateways/netbilling.rb +0 -1
- data/lib/active_merchant/billing/gateways/nmi.rb +12 -1
- data/lib/active_merchant/billing/gateways/ogone.rb +1 -1
- data/lib/active_merchant/billing/gateways/omise.rb +9 -5
- data/lib/active_merchant/billing/gateways/openpay.rb +13 -0
- data/lib/active_merchant/billing/gateways/opp.rb +124 -114
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +14 -1
- data/lib/active_merchant/billing/gateways/orbital.rb +83 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +2 -2
- data/lib/active_merchant/billing/gateways/payeezy.rb +152 -46
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +24 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +3 -2
- data/lib/active_merchant/billing/gateways/paymentez.rb +276 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +18 -10
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +14 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +0 -12
- data/lib/active_merchant/billing/gateways/paystation.rb +14 -1
- data/lib/active_merchant/billing/gateways/payu_latam.rb +102 -62
- data/lib/active_merchant/billing/gateways/pin.rb +5 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +12 -1
- data/lib/active_merchant/billing/gateways/qbms.rb +11 -0
- data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +21 -17
- data/lib/active_merchant/billing/gateways/quickpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +60 -3
- data/lib/active_merchant/billing/gateways/realex.rb +16 -6
- data/lib/active_merchant/billing/gateways/redsys.rb +8 -2
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +8 -3
- data/lib/active_merchant/billing/gateways/sage_pay.rb +29 -13
- data/lib/active_merchant/billing/gateways/secure_net.rb +11 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +1 -1
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +53 -7
- data/lib/active_merchant/billing/gateways/stripe.rb +84 -26
- data/lib/active_merchant/billing/gateways/tns.rb +0 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +3 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +61 -26
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +114 -9
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +45 -22
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/wepay.rb +79 -46
- data/lib/active_merchant/billing/gateways/wirecard.rb +5 -4
- data/lib/active_merchant/billing/gateways/worldpay.rb +85 -20
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +27 -8
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/connection.rb +48 -12
- data/lib/active_merchant/net_http_ssl_connection.rb +9 -0
- data/lib/active_merchant/network_connection_retries.rb +6 -4
- data/lib/active_merchant/posts_data.rb +11 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -5
- data/lib/certs/cacert.pem +85 -0
- data/lib/support/ssl_version.rb +87 -0
- metadata +25 -9
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
@@ -2,43 +2,16 @@ require 'active_merchant/billing/gateways/viaklix'
|
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
|
-
# = Elavon Virtual Merchant Gateway
|
6
|
-
#
|
7
|
-
# == Example use:
|
8
|
-
#
|
9
|
-
# gateway = ActiveMerchant::Billing::ElavonGateway.new(
|
10
|
-
# :login => "my_virtual_merchant_id",
|
11
|
-
# :password => "my_virtual_merchant_pin",
|
12
|
-
# :user => "my_virtual_merchant_user_id" # optional
|
13
|
-
# )
|
14
|
-
#
|
15
|
-
# # set up credit card obj as in main ActiveMerchant example
|
16
|
-
# creditcard = ActiveMerchant::Billing::CreditCard.new(
|
17
|
-
# :type => 'visa',
|
18
|
-
# :number => '41111111111111111',
|
19
|
-
# :month => 10,
|
20
|
-
# :year => 2011,
|
21
|
-
# :first_name => 'Bob',
|
22
|
-
# :last_name => 'Bobsen'
|
23
|
-
# )
|
24
|
-
#
|
25
|
-
# # run request
|
26
|
-
# response = gateway.purchase(1000, creditcard) # authorize and capture 10 USD
|
27
|
-
#
|
28
|
-
# puts response.success? # Check whether the transaction was successful
|
29
|
-
# puts response.message # Retrieve the message returned by Elavon
|
30
|
-
# puts response.authorization # Retrieve the unique transaction ID returned by Elavon
|
31
|
-
#
|
32
5
|
class ElavonGateway < Gateway
|
33
6
|
include Empty
|
34
7
|
|
35
8
|
class_attribute :test_url, :live_url, :delimiter, :actions
|
36
9
|
|
37
|
-
self.test_url = 'https://demo.
|
38
|
-
self.live_url = 'https://
|
10
|
+
self.test_url = 'https://api.demo.convergepay.com/VirtualMerchantDemo/process.do'
|
11
|
+
self.live_url = 'https://api.convergepay.com/VirtualMerchant/process.do'
|
39
12
|
|
40
13
|
self.display_name = 'Elavon MyVirtualMerchant'
|
41
|
-
self.supported_countries = %w(US CA PR DE IE NO PL LU BE NL)
|
14
|
+
self.supported_countries = %w(US CA PR DE IE NO PL LU BE NL MX)
|
42
15
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
43
16
|
self.homepage_url = 'http://www.elavon.com/'
|
44
17
|
|
@@ -55,23 +28,11 @@ module ActiveMerchant #:nodoc:
|
|
55
28
|
:update => 'CCUPDATETOKEN',
|
56
29
|
}
|
57
30
|
|
58
|
-
# Initialize the Gateway
|
59
|
-
#
|
60
|
-
# The gateway requires that a valid login and password be passed
|
61
|
-
# in the +options+ hash.
|
62
|
-
#
|
63
|
-
# ==== Options
|
64
|
-
#
|
65
|
-
# * <tt>:login</tt> -- Merchant ID
|
66
|
-
# * <tt>:password</tt> -- PIN
|
67
|
-
# * <tt>:user</tt> -- Specify a subuser of the account (optional)
|
68
|
-
# * <tt>:test => +true+ or +false+</tt> -- Force test transactions
|
69
31
|
def initialize(options = {})
|
70
32
|
requires!(options, :login, :password)
|
71
33
|
super
|
72
34
|
end
|
73
35
|
|
74
|
-
# Make a purchase
|
75
36
|
def purchase(money, payment_method, options = {})
|
76
37
|
form = {}
|
77
38
|
add_salestax(form, options)
|
@@ -85,16 +46,9 @@ module ActiveMerchant #:nodoc:
|
|
85
46
|
add_customer_data(form, options)
|
86
47
|
add_test_mode(form, options)
|
87
48
|
add_ip(form, options)
|
88
|
-
commit(:purchase, money, form)
|
49
|
+
commit(:purchase, money, form, options)
|
89
50
|
end
|
90
51
|
|
91
|
-
# Authorize a credit card for a given amount.
|
92
|
-
#
|
93
|
-
# ==== Parameters
|
94
|
-
# * <tt>money</tt> - The amount to be authorized as an Integer value in cents.
|
95
|
-
# * <tt>credit_card</tt> - The CreditCard details for the transaction.
|
96
|
-
# * <tt>options</tt>
|
97
|
-
# * <tt>:billing_address</tt> - The billing address for the cardholder.
|
98
52
|
def authorize(money, creditcard, options = {})
|
99
53
|
form = {}
|
100
54
|
add_salestax(form, options)
|
@@ -104,16 +58,9 @@ module ActiveMerchant #:nodoc:
|
|
104
58
|
add_customer_data(form, options)
|
105
59
|
add_test_mode(form, options)
|
106
60
|
add_ip(form, options)
|
107
|
-
commit(:authorize, money, form)
|
61
|
+
commit(:authorize, money, form, options)
|
108
62
|
end
|
109
63
|
|
110
|
-
# Capture authorized funds from a credit card.
|
111
|
-
#
|
112
|
-
# ==== Parameters
|
113
|
-
# * <tt>money</tt> - The amount to be captured as an Integer value in cents.
|
114
|
-
# * <tt>authorization</tt> - The approval code returned from the initial authorization.
|
115
|
-
# * <tt>options</tt>
|
116
|
-
# * <tt>:credit_card</tt> - The CreditCard details from the initial transaction (required).
|
117
64
|
def capture(money, authorization, options = {})
|
118
65
|
form = {}
|
119
66
|
if options[:credit_card]
|
@@ -130,45 +77,23 @@ module ActiveMerchant #:nodoc:
|
|
130
77
|
add_partial_shipment_flag(form, options)
|
131
78
|
add_test_mode(form, options)
|
132
79
|
end
|
133
|
-
commit(action, money, form)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Refund a transaction.
|
137
|
-
#
|
138
|
-
# This transaction indicates to the gateway that
|
139
|
-
# money should flow from the merchant to the customer.
|
140
|
-
#
|
141
|
-
# ==== Parameters
|
142
|
-
#
|
143
|
-
# * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
|
144
|
-
# * <tt>identification</tt> -- The ID of the original transaction against which the refund is being issued.
|
145
|
-
# * <tt>options</tt> -- A hash of parameters.
|
80
|
+
commit(action, money, form, options)
|
81
|
+
end
|
82
|
+
|
146
83
|
def refund(money, identification, options = {})
|
147
84
|
form = {}
|
148
85
|
add_txn_id(form, identification)
|
149
86
|
add_test_mode(form, options)
|
150
|
-
commit(:refund, money, form)
|
87
|
+
commit(:refund, money, form, options)
|
151
88
|
end
|
152
89
|
|
153
|
-
# Void a previous transaction
|
154
|
-
#
|
155
|
-
# ==== Parameters
|
156
|
-
#
|
157
|
-
# * <tt>authorization</tt> - The authorization returned from the previous request.
|
158
90
|
def void(identification, options = {})
|
159
91
|
form = {}
|
160
92
|
add_txn_id(form, identification)
|
161
93
|
add_test_mode(form, options)
|
162
|
-
commit(:void, nil, form)
|
94
|
+
commit(:void, nil, form, options)
|
163
95
|
end
|
164
96
|
|
165
|
-
# Make a credit to a card. Use the refund method if you'd like to credit using
|
166
|
-
# previous transaction
|
167
|
-
#
|
168
|
-
# ==== Parameters
|
169
|
-
# * <tt>money</tt> - The amount to be credited as an Integer value in cents.
|
170
|
-
# * <tt>creditcard</tt> - The credit card to be credited.
|
171
|
-
# * <tt>options</tt>
|
172
97
|
def credit(money, creditcard, options = {})
|
173
98
|
if creditcard.is_a?(String)
|
174
99
|
raise ArgumentError, "Reference credits are not supported. Please supply the original credit card or use the #refund method."
|
@@ -180,7 +105,7 @@ module ActiveMerchant #:nodoc:
|
|
180
105
|
add_address(form, options)
|
181
106
|
add_customer_data(form, options)
|
182
107
|
add_test_mode(form, options)
|
183
|
-
commit(:credit, money, form)
|
108
|
+
commit(:credit, money, form, options)
|
184
109
|
end
|
185
110
|
|
186
111
|
def verify(credit_card, options = {})
|
@@ -198,7 +123,7 @@ module ActiveMerchant #:nodoc:
|
|
198
123
|
add_test_mode(form, options)
|
199
124
|
add_verification(form, options)
|
200
125
|
form[:add_token] = 'Y'
|
201
|
-
commit(:store, nil, form)
|
126
|
+
commit(:store, nil, form, options)
|
202
127
|
end
|
203
128
|
|
204
129
|
def update(token, creditcard, options = {})
|
@@ -208,7 +133,18 @@ module ActiveMerchant #:nodoc:
|
|
208
133
|
add_address(form, options)
|
209
134
|
add_customer_data(form, options)
|
210
135
|
add_test_mode(form, options)
|
211
|
-
commit(:update, nil, form)
|
136
|
+
commit(:update, nil, form, options)
|
137
|
+
end
|
138
|
+
|
139
|
+
def supports_scrubbing?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
def scrub(transcript)
|
144
|
+
transcript.
|
145
|
+
gsub(%r((&?ssl_pin=)[^&]*)i, '\1[FILTERED]').
|
146
|
+
gsub(%r((&?ssl_card_number=)[^&\\n\r\n]*)i, '\1[FILTERED]').
|
147
|
+
gsub(%r((&?ssl_cvv2cvc2=)[^&]*)i, '\1[FILTERED]')
|
212
148
|
end
|
213
149
|
|
214
150
|
private
|
@@ -255,6 +191,11 @@ module ActiveMerchant #:nodoc:
|
|
255
191
|
form[:email] = truncate(options[:email], 100) unless empty?(options[:email])
|
256
192
|
form[:customer_code] = truncate(options[:customer], 10) unless empty?(options[:customer])
|
257
193
|
form[:customer_number] = options[:customer_number] unless empty?(options[:customer_number])
|
194
|
+
if options[:custom_fields]
|
195
|
+
options[:custom_fields].each do |key, value|
|
196
|
+
form[key.to_s] = value
|
197
|
+
end
|
198
|
+
end
|
258
199
|
end
|
259
200
|
|
260
201
|
def add_salestax(form, options)
|
@@ -313,11 +254,11 @@ module ActiveMerchant #:nodoc:
|
|
313
254
|
!response.has_key?('errorMessage')
|
314
255
|
end
|
315
256
|
|
316
|
-
def commit(action, money, parameters)
|
257
|
+
def commit(action, money, parameters, options)
|
317
258
|
parameters[:amount] = amount(money)
|
318
259
|
parameters[:transaction_type] = self.actions[action]
|
319
260
|
|
320
|
-
response = parse( ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)) )
|
261
|
+
response = parse( ssl_post(test? ? self.test_url : self.live_url, post_data(parameters, options)) )
|
321
262
|
|
322
263
|
Response.new(response['result'] == '0', message_from(response), response,
|
323
264
|
:test => @options[:test] || test?,
|
@@ -327,21 +268,22 @@ module ActiveMerchant #:nodoc:
|
|
327
268
|
)
|
328
269
|
end
|
329
270
|
|
330
|
-
def post_data(parameters)
|
271
|
+
def post_data(parameters, options)
|
331
272
|
result = preamble
|
332
273
|
result.merge!(parameters)
|
333
|
-
result.collect { |key, value| post_data_string(key, value) }.join("&")
|
274
|
+
result.collect { |key, value| post_data_string(key, value, options) }.join("&")
|
334
275
|
end
|
335
276
|
|
336
|
-
def post_data_string(key, value)
|
337
|
-
if custom_field?(key)
|
277
|
+
def post_data_string(key, value, options)
|
278
|
+
if custom_field?(key, options)
|
338
279
|
"#{key}=#{CGI.escape(value.to_s)}"
|
339
280
|
else
|
340
281
|
"ssl_#{key}=#{CGI.escape(value.to_s)}"
|
341
282
|
end
|
342
283
|
end
|
343
284
|
|
344
|
-
def custom_field?(field_name)
|
285
|
+
def custom_field?(field_name, options)
|
286
|
+
return true if options[:custom_fields] && options[:custom_fields].include?(field_name.to_sym)
|
345
287
|
field_name == :customer_number
|
346
288
|
end
|
347
289
|
|
@@ -15,7 +15,7 @@ module ActiveMerchant #:nodoc:
|
|
15
15
|
self.display_name = 'Element'
|
16
16
|
|
17
17
|
SERVICE_TEST_URL = 'https://certservices.elementexpress.com/express.asmx'
|
18
|
-
SERVICE_LIVE_URL = 'https://
|
18
|
+
SERVICE_LIVE_URL = 'https://services.elementexpress.com/express.asmx'
|
19
19
|
|
20
20
|
def initialize(options={})
|
21
21
|
requires!(options, :account_id, :account_token, :application_id, :acceptor_id, :application_name, :application_version)
|
@@ -274,6 +274,8 @@ module ActiveMerchant #:nodoc:
|
|
274
274
|
message_from(response),
|
275
275
|
response,
|
276
276
|
authorization: authorization_from(action, response, amount),
|
277
|
+
avs_result: success_from(response) ? avs_from(response) : nil,
|
278
|
+
cvv_result: success_from(response) ? cvv_from(response) : nil,
|
277
279
|
test: test?
|
278
280
|
)
|
279
281
|
end
|
@@ -294,6 +296,14 @@ module ActiveMerchant #:nodoc:
|
|
294
296
|
response["expressresponsemessage"]
|
295
297
|
end
|
296
298
|
|
299
|
+
def avs_from(response)
|
300
|
+
AVSResult.new(code: response["card"]["avsresponsecode"]) if response["card"]
|
301
|
+
end
|
302
|
+
|
303
|
+
def cvv_from(response)
|
304
|
+
CVVResult.new(response["card"]["cvvresponsecode"]) if response["card"]
|
305
|
+
end
|
306
|
+
|
297
307
|
def split_authorization(authorization)
|
298
308
|
authorization.split("|")
|
299
309
|
end
|
@@ -14,23 +14,11 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
self.homepage_url = 'https://www.fatzebra.com.au/'
|
15
15
|
self.display_name = 'Fat Zebra'
|
16
16
|
|
17
|
-
# Setup a new instance of the gateway.
|
18
|
-
#
|
19
|
-
# The options hash should include :username and :token
|
20
|
-
# You can find your username and token at https://dashboard.fatzebra.com.au
|
21
|
-
# Under the Your Account section
|
22
17
|
def initialize(options = {})
|
23
18
|
requires!(options, :username, :token)
|
24
19
|
super
|
25
20
|
end
|
26
21
|
|
27
|
-
# To create a purchase on a credit card use:
|
28
|
-
#
|
29
|
-
# purchase(money, creditcard)
|
30
|
-
#
|
31
|
-
# To charge a tokenized card
|
32
|
-
#
|
33
|
-
# purchase(money, "abzy87u", :cvv => "123")
|
34
22
|
def purchase(money, creditcard, options = {})
|
35
23
|
post = {}
|
36
24
|
|
@@ -65,11 +53,6 @@ module ActiveMerchant #:nodoc:
|
|
65
53
|
commit(:post, "purchases/#{CGI.escape(authorization)}/capture", post)
|
66
54
|
end
|
67
55
|
|
68
|
-
# Refund a transaction
|
69
|
-
#
|
70
|
-
# amount - Integer - the amount to refund
|
71
|
-
# txn_id - String - the original transaction to be refunded
|
72
|
-
# reference - String - your transaction reference
|
73
56
|
def refund(money, txn_id, options={})
|
74
57
|
post = {}
|
75
58
|
|
@@ -81,9 +64,6 @@ module ActiveMerchant #:nodoc:
|
|
81
64
|
commit(:post, "refunds", post)
|
82
65
|
end
|
83
66
|
|
84
|
-
# Tokenize a credit card
|
85
|
-
#
|
86
|
-
# The token is returned in the Response#authorization
|
87
67
|
def store(creditcard, options={})
|
88
68
|
post = {}
|
89
69
|
add_creditcard(post, creditcard)
|
@@ -98,20 +78,18 @@ module ActiveMerchant #:nodoc:
|
|
98
78
|
def scrub(transcript)
|
99
79
|
transcript.
|
100
80
|
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
101
|
-
gsub(%r(("card_number
|
102
|
-
gsub(%r(("cvv
|
81
|
+
gsub(%r(("card_number\\?":\\?")[^"\\]*)i, '\1[FILTERED]').
|
82
|
+
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
|
103
83
|
end
|
104
84
|
|
105
85
|
private
|
106
86
|
|
107
|
-
# Add the money details to the request
|
108
87
|
def add_amount(post, money, options)
|
109
88
|
post[:currency] = (options[:currency] || currency(money))
|
110
89
|
post[:currency] = post[:currency].upcase if post[:currency]
|
111
90
|
post[:amount] = money
|
112
91
|
end
|
113
92
|
|
114
|
-
# Add the credit card details to the request
|
115
93
|
def add_creditcard(post, creditcard, options = {})
|
116
94
|
if creditcard.respond_to?(:number)
|
117
95
|
post[:card_number] = creditcard.number
|
@@ -134,7 +112,7 @@ module ActiveMerchant #:nodoc:
|
|
134
112
|
extra = {}
|
135
113
|
extra[:ecm] = "32" if options[:recurring]
|
136
114
|
extra[:cavv] = options[:cavv] if options[:cavv]
|
137
|
-
extra[:xid] = options[:
|
115
|
+
extra[:xid] = options[:xid] if options[:xid]
|
138
116
|
extra[:sli] = options[:sli] if options[:sli]
|
139
117
|
extra[:name] = options[:merchant] if options[:merchant]
|
140
118
|
extra[:location] = options[:merchant_location] if options[:merchant_location]
|
@@ -149,7 +127,6 @@ module ActiveMerchant #:nodoc:
|
|
149
127
|
post[:customer_ip] = options[:ip] || "127.0.0.1"
|
150
128
|
end
|
151
129
|
|
152
|
-
# Post the data to the gateway
|
153
130
|
def commit(method, uri, parameters=nil)
|
154
131
|
response = begin
|
155
132
|
parse(ssl_request(method, get_url(uri), parameters.to_json, headers))
|
@@ -194,7 +171,6 @@ module ActiveMerchant #:nodoc:
|
|
194
171
|
end
|
195
172
|
end
|
196
173
|
|
197
|
-
# Parse the returned JSON, if parse errors are raised then return a detailed error.
|
198
174
|
def parse(response)
|
199
175
|
begin
|
200
176
|
JSON.parse(response)
|
@@ -209,13 +185,11 @@ module ActiveMerchant #:nodoc:
|
|
209
185
|
end
|
210
186
|
end
|
211
187
|
|
212
|
-
# Build the URL based on the AM mode and the URI
|
213
188
|
def get_url(uri)
|
214
189
|
base = test? ? self.test_url : self.live_url
|
215
190
|
base + "/" + uri
|
216
191
|
end
|
217
192
|
|
218
|
-
# Builds the auth and U-A headers for the request
|
219
193
|
def headers
|
220
194
|
{
|
221
195
|
"Authorization" => "Basic " + Base64.strict_encode64(@options[:username].to_s + ":" + @options[:token].to_s).strip,
|
@@ -3,7 +3,7 @@ require 'nokogiri'
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class FirstPayGateway < Gateway
|
6
|
-
self.live_url = 'https://secure.
|
6
|
+
self.live_url = 'https://secure.goemerchant.com/secure/gateway/xmlgateway.aspx'
|
7
7
|
|
8
8
|
self.supported_countries = ['US']
|
9
9
|
self.default_currency = 'USD'
|
@@ -66,18 +66,20 @@ module ActiveMerchant #:nodoc:
|
|
66
66
|
def add_customer_data(post, options)
|
67
67
|
post[:owner_email] = options[:email] if options[:email]
|
68
68
|
post[:remote_ip_address] = options[:ip] if options[:ip]
|
69
|
+
post[:processor_id] = options[:processor_id] if options[:processor_id]
|
69
70
|
end
|
70
71
|
|
71
72
|
def add_address(post, creditcard, options)
|
72
|
-
address = options[:billing_address] || options[:address]
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
if address = options[:billing_address] || options[:address]
|
74
|
+
post[:owner_name] = address[:name]
|
75
|
+
post[:owner_street] = address[:address1]
|
76
|
+
post[:owner_street2] = address[:address2] if address[:address2]
|
77
|
+
post[:owner_city] = address[:city]
|
78
|
+
post[:owner_state] = address[:state]
|
79
|
+
post[:owner_zip] = address[:zip]
|
80
|
+
post[:owner_country] = address[:country]
|
81
|
+
post[:owner_phone] = address[:phone] if address[:phone]
|
82
|
+
end
|
81
83
|
end
|
82
84
|
|
83
85
|
def add_invoice(post, money, options)
|
@@ -34,6 +34,8 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
|
35
35
|
E4_BRANDS = BRANDS.merge({:mastercard => "Mastercard"})
|
36
36
|
|
37
|
+
DEFAULT_ECI = "07"
|
38
|
+
|
37
39
|
self.supported_cardtypes = BRANDS.keys
|
38
40
|
self.supported_countries = ["CA", "US"]
|
39
41
|
self.default_currency = "USD"
|
@@ -139,9 +141,12 @@ module ActiveMerchant #:nodoc:
|
|
139
141
|
end
|
140
142
|
|
141
143
|
def scrub(transcript)
|
142
|
-
transcript
|
143
|
-
gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2')
|
144
|
-
gsub(%r((<VerificationStr2>).+(</VerificationStr2>)), '\1[FILTERED]\2')
|
144
|
+
transcript
|
145
|
+
.gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2')
|
146
|
+
.gsub(%r((<VerificationStr2>).+(</VerificationStr2>)), '\1[FILTERED]\2')
|
147
|
+
.gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2')
|
148
|
+
.gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2')
|
149
|
+
.gsub(%r((Card Number : ).*\d)i, '\1[FILTERED]')
|
145
150
|
end
|
146
151
|
|
147
152
|
def supports_network_tokenization?
|
@@ -154,7 +159,7 @@ module ActiveMerchant #:nodoc:
|
|
154
159
|
xml = Builder::XmlMarkup.new
|
155
160
|
|
156
161
|
xml.instruct!
|
157
|
-
xml.tag! "Transaction" do
|
162
|
+
xml.tag! "Transaction", xmlns: "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" do
|
158
163
|
add_credentials(xml)
|
159
164
|
add_transaction_type(xml, action)
|
160
165
|
xml << body
|
@@ -169,14 +174,13 @@ module ActiveMerchant #:nodoc:
|
|
169
174
|
add_amount(xml, money, options)
|
170
175
|
|
171
176
|
if credit_card_or_store_authorization.is_a? String
|
172
|
-
add_credit_card_token(xml, credit_card_or_store_authorization)
|
177
|
+
add_credit_card_token(xml, credit_card_or_store_authorization, options)
|
173
178
|
else
|
174
179
|
add_credit_card(xml, credit_card_or_store_authorization, options)
|
175
180
|
end
|
176
181
|
|
177
182
|
add_customer_data(xml, options)
|
178
183
|
add_invoice(xml, options)
|
179
|
-
add_card_authentication_data(xml, options)
|
180
184
|
add_tax_fields(xml, options)
|
181
185
|
add_level_3(xml, options)
|
182
186
|
|
@@ -226,19 +230,33 @@ module ActiveMerchant #:nodoc:
|
|
226
230
|
end
|
227
231
|
|
228
232
|
def add_credit_card(xml, credit_card, options)
|
229
|
-
|
230
233
|
if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
|
231
234
|
xml.tag! "Track1", credit_card.track_data
|
235
|
+
xml.tag! "Ecommerce_Flag", "R"
|
232
236
|
else
|
233
237
|
xml.tag! "Card_Number", credit_card.number
|
234
238
|
xml.tag! "Expiry_Date", expdate(credit_card)
|
235
239
|
xml.tag! "CardHoldersName", credit_card.name
|
236
240
|
xml.tag! "CardType", card_type(credit_card.brand)
|
237
241
|
|
242
|
+
add_credit_card_eci(xml, credit_card, options)
|
238
243
|
add_credit_card_verification_strings(xml, credit_card, options)
|
239
244
|
end
|
240
245
|
end
|
241
246
|
|
247
|
+
def add_credit_card_eci(xml, credit_card, options)
|
248
|
+
eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == "discover"
|
249
|
+
# Discover requires any Apple Pay transaction, regardless of in-app
|
250
|
+
# or web, and regardless of the ECI contained in the PKPaymentToken,
|
251
|
+
# to have an ECI value explicitly of 04.
|
252
|
+
"04"
|
253
|
+
else
|
254
|
+
(credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
|
255
|
+
end
|
256
|
+
|
257
|
+
xml.tag! "Ecommerce_Flag", eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
|
258
|
+
end
|
259
|
+
|
242
260
|
def add_credit_card_verification_strings(xml, credit_card, options)
|
243
261
|
address = options[:billing_address] || options[:address]
|
244
262
|
if address
|
@@ -249,36 +267,34 @@ module ActiveMerchant #:nodoc:
|
|
249
267
|
|
250
268
|
if credit_card.is_a?(NetworkTokenizationCreditCard)
|
251
269
|
add_network_tokenization_credit_card(xml, credit_card)
|
252
|
-
|
253
|
-
|
254
|
-
|
270
|
+
else
|
271
|
+
if credit_card.verification_value?
|
272
|
+
xml.tag! "CVD_Presence_Ind", "1"
|
273
|
+
xml.tag! "VerificationStr2", credit_card.verification_value
|
274
|
+
end
|
275
|
+
|
276
|
+
add_card_authentication_data(xml, options)
|
255
277
|
end
|
256
278
|
end
|
257
279
|
|
258
280
|
def add_network_tokenization_credit_card(xml, credit_card)
|
259
|
-
xml.tag!("Ecommerce_Flag", credit_card.eci)
|
260
|
-
|
261
281
|
case card_brand(credit_card).to_sym
|
262
|
-
when :visa
|
263
|
-
xml.tag!("XID", credit_card.transaction_id) if credit_card.transaction_id
|
264
|
-
xml.tag!("CAVV", credit_card.payment_cryptogram)
|
265
|
-
when :mastercard
|
266
|
-
xml.tag!("XID", credit_card.transaction_id) if credit_card.transaction_id
|
267
|
-
xml.tag!("CAVV", credit_card.payment_cryptogram)
|
268
282
|
when :american_express
|
269
283
|
cryptogram = Base64.decode64(credit_card.payment_cryptogram)
|
270
284
|
xml.tag!("XID", Base64.encode64(cryptogram[20...40]))
|
271
285
|
xml.tag!("CAVV", Base64.encode64(cryptogram[0...20]))
|
286
|
+
else
|
287
|
+
xml.tag!("XID", credit_card.transaction_id) if credit_card.transaction_id
|
288
|
+
xml.tag!("CAVV", credit_card.payment_cryptogram)
|
272
289
|
end
|
273
290
|
end
|
274
291
|
|
275
292
|
def add_card_authentication_data(xml, options)
|
276
293
|
xml.tag! "CAVV", options[:cavv]
|
277
294
|
xml.tag! "XID", options[:xid]
|
278
|
-
xml.tag! "Ecommerce_Flag", options[:eci]
|
279
295
|
end
|
280
296
|
|
281
|
-
def add_credit_card_token(xml, store_authorization)
|
297
|
+
def add_credit_card_token(xml, store_authorization, options)
|
282
298
|
params = store_authorization.split(";")
|
283
299
|
credit_card = CreditCard.new(
|
284
300
|
:brand => params[1],
|
@@ -291,6 +307,7 @@ module ActiveMerchant #:nodoc:
|
|
291
307
|
xml.tag! "Expiry_Date", expdate(credit_card)
|
292
308
|
xml.tag! "CardHoldersName", credit_card.name
|
293
309
|
xml.tag! "CardType", card_type(credit_card.brand)
|
310
|
+
add_card_authentication_data(xml, options)
|
294
311
|
end
|
295
312
|
|
296
313
|
def add_customer_data(xml, options)
|
@@ -46,7 +46,6 @@ module ActiveMerchant #:nodoc:
|
|
46
46
|
|
47
47
|
def capture(money, authorization, options={})
|
48
48
|
post = {}
|
49
|
-
add_invoice(post, options)
|
50
49
|
post[:transaction_id] = transaction_id_from(authorization)
|
51
50
|
post[:authorization_code] = authorization_code_from(authorization) || ""
|
52
51
|
post[:action] = "capture"
|