activemerchant 1.85.0 → 1.86.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +15 -3
- data/lib/active_merchant/billing/avs_result.rb +12 -12
- data/lib/active_merchant/billing/compatibility.rb +1 -2
- data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +45 -22
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -6
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +0 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +6 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/card_connect.rb +6 -6
- data/lib/active_merchant/billing/gateways/card_save.rb +5 -6
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -4
- data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
- data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout.rb +8 -8
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +3 -3
- data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +5 -5
- data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
- data/lib/active_merchant/billing/gateways/elavon.rb +3 -5
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/exact.rb +0 -1
- data/lib/active_merchant/billing/gateways/federated_canada.rb +0 -1
- data/lib/active_merchant/billing/gateways/finansbank.rb +0 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +0 -1
- data/lib/active_merchant/billing/gateways/first_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +6 -6
- data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +21 -6
- data/lib/active_merchant/billing/gateways/hdfc.rb +0 -1
- data/lib/active_merchant/billing/gateways/hps.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +0 -1
- data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
- data/lib/active_merchant/billing/gateways/itransact.rb +0 -1
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
- data/lib/active_merchant/billing/gateways/litle.rb +1 -1
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -1
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +5 -5
- data/lib/active_merchant/billing/gateways/modern_payments.rb +0 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +0 -1
- data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
- data/lib/active_merchant/billing/gateways/mundipagg.rb +4 -4
- data/lib/active_merchant/billing/gateways/nab_transact.rb +8 -8
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
- data/lib/active_merchant/billing/gateways/netaxept.rb +0 -1
- data/lib/active_merchant/billing/gateways/netbanx.rb +4 -3
- data/lib/active_merchant/billing/gateways/netpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +0 -1
- data/lib/active_merchant/billing/gateways/omise.rb +1 -1
- data/lib/active_merchant/billing/gateways/opp.rb +0 -1
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +20 -20
- data/lib/active_merchant/billing/gateways/orbital.rb +1 -1
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +0 -1
- data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
- data/lib/active_merchant/billing/gateways/payex.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +5 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paymentez.rb +4 -4
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
- data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -6
- data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
- data/lib/active_merchant/billing/gateways/s5.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -8
- data/lib/active_merchant/billing/gateways/telr.rb +2 -2
- data/lib/active_merchant/billing/gateways/transax.rb +4 -5
- data/lib/active_merchant/billing/gateways/transnational.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +6 -6
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -2
- data/lib/active_merchant/billing/gateways/world_net.rb +3 -3
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +15 -15
- data/lib/active_merchant/connection.rb +2 -2
- data/lib/active_merchant/network_connection_retries.rb +1 -1
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/activemerchant.rb +1 -1
- data/lib/support/gateway_support.rb +0 -1
- metadata +2 -2
@@ -340,7 +340,7 @@ module ActiveMerchant #:nodoc:
|
|
340
340
|
:terminaltype => options[:terminaltype],
|
341
341
|
:ip => options[:ip],
|
342
342
|
:reference_number => options[:reference_number],
|
343
|
-
:recurring => options[:recurring] || 'NO', #DO NOT USE if you are using the periodic billing option.
|
343
|
+
:recurring => options[:recurring] || 'NO', # DO NOT USE if you are using the periodic billing option.
|
344
344
|
:tdate => options[:tdate]
|
345
345
|
},
|
346
346
|
:orderoptions => {
|
@@ -434,9 +434,9 @@ module ActiveMerchant #:nodoc:
|
|
434
434
|
response = {:message => 'Global Error Receipt', :complete => false}
|
435
435
|
|
436
436
|
xml = REXML::Document.new("<response>#{xml}</response>")
|
437
|
-
xml.root
|
437
|
+
xml.root&.elements&.each do |node|
|
438
438
|
response[node.name.downcase.sub(/^r_/, '').to_sym] = normalize(node.text)
|
439
|
-
end
|
439
|
+
end
|
440
440
|
|
441
441
|
response
|
442
442
|
end
|
@@ -284,7 +284,7 @@ module ActiveMerchant #:nodoc:
|
|
284
284
|
doc.cardholderAuthentication do
|
285
285
|
doc.authenticationValue(payment_method.payment_cryptogram)
|
286
286
|
end
|
287
|
-
elsif options[:order_source]
|
287
|
+
elsif options[:order_source]&.start_with?('3ds')
|
288
288
|
doc.cardholderAuthentication do
|
289
289
|
doc.authenticationValue(options[:cavv]) if options[:cavv]
|
290
290
|
doc.authenticationTransactionId(options[:xid]) if options[:xid]
|
@@ -186,6 +186,12 @@ module ActiveMerchant #:nodoc:
|
|
186
186
|
|
187
187
|
def parse(body)
|
188
188
|
JSON.parse(body)
|
189
|
+
rescue JSON::ParserError
|
190
|
+
{
|
191
|
+
'status' => 'error',
|
192
|
+
'status_detail' => 'json_parse_error',
|
193
|
+
'message' => "A non-JSON response was received from Mercado Pago where one was expected. The raw response was:\n\n#{body}"
|
194
|
+
}
|
189
195
|
end
|
190
196
|
|
191
197
|
def commit(action, path, parameters)
|
@@ -207,7 +213,7 @@ module ActiveMerchant #:nodoc:
|
|
207
213
|
|
208
214
|
def success_from(action, response)
|
209
215
|
if action == 'refund'
|
210
|
-
response['error'].nil?
|
216
|
+
response['status'] != 404 && response['error'].nil?
|
211
217
|
else
|
212
218
|
['active', 'approved', 'authorized', 'cancelled', 'in_process'].include?(response['status'])
|
213
219
|
end
|
@@ -212,7 +212,7 @@ module ActiveMerchant #:nodoc:
|
|
212
212
|
# Track 1 and 2 have identical end sentinels (ETX) of '?'
|
213
213
|
# Tracks may or may not have checksum (LRC) after the ETX
|
214
214
|
# If the track has no STX or is corrupt, we send it as track 1, to let Mercury
|
215
|
-
#handle with the validation error as it sees fit.
|
215
|
+
# handle with the validation error as it sees fit.
|
216
216
|
# Track 2 requires having the STX and ETX stripped. Track 1 does not.
|
217
217
|
# Max-length track 1s require having the STX and ETX stripped. Max is 79 bytes including LRC.
|
218
218
|
is_track_2 = credit_card.track_data[0] == ';'
|
@@ -314,11 +314,11 @@ module ActiveMerchant #:nodoc:
|
|
314
314
|
end
|
315
315
|
|
316
316
|
def calculate_secure_hash(post, secure_hash)
|
317
|
-
input = post
|
318
|
-
|
319
|
-
.
|
320
|
-
|
321
|
-
|
317
|
+
input = post.
|
318
|
+
reject { |k| %i[SecureHash SecureHashType].include?(k) }.
|
319
|
+
sort.
|
320
|
+
map { |(k, v)| "vpc_#{k}=#{v}" }.
|
321
|
+
join('&')
|
322
322
|
OpenSSL::HMAC.hexdigest('SHA256', [secure_hash].pack('H*'), input).upcase
|
323
323
|
end
|
324
324
|
end
|
@@ -89,10 +89,10 @@ module ActiveMerchant #:nodoc:
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def scrub(transcript)
|
92
|
-
transcript
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
transcript.
|
93
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
94
|
+
gsub(%r(("cvv\\":\\")\d*), '\1[FILTERED]').
|
95
|
+
gsub(%r((card\\":{\\"number\\":\\")\d*), '\1[FILTERED]')
|
96
96
|
end
|
97
97
|
|
98
98
|
private
|
@@ -23,14 +23,14 @@ module ActiveMerchant #:nodoc:
|
|
23
23
|
self.money_format = :cents
|
24
24
|
self.default_currency = 'AUD'
|
25
25
|
|
26
|
-
#Transactions currently accepted by NAB Transact XML API
|
26
|
+
# Transactions currently accepted by NAB Transact XML API
|
27
27
|
TRANSACTIONS = {
|
28
|
-
:purchase => 0, #Standard Payment
|
29
|
-
:refund => 4, #Refund
|
30
|
-
:void => 6, #Client Reversal (Void)
|
31
|
-
:unmatched_refund => 666, #Unmatched Refund
|
32
|
-
:authorization => 10, #Preauthorise
|
33
|
-
:capture => 11 #Preauthorise Complete (Advice)
|
28
|
+
:purchase => 0, # Standard Payment
|
29
|
+
:refund => 4, # Refund
|
30
|
+
:void => 6, # Client Reversal (Void)
|
31
|
+
:unmatched_refund => 666, # Unmatched Refund
|
32
|
+
:authorization => 10, # Preauthorise
|
33
|
+
:capture => 11 # Preauthorise Complete (Advice)
|
34
34
|
}
|
35
35
|
|
36
36
|
PERIODIC_TYPES = {
|
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
|
|
134
134
|
xml.target!
|
135
135
|
end
|
136
136
|
|
137
|
-
#Generate payment request XML
|
137
|
+
# Generate payment request XML
|
138
138
|
# - API is set to allow multiple Txn's but currently only allows one
|
139
139
|
# - txnSource = 23 - (XML)
|
140
140
|
def build_request(action, body)
|
@@ -131,7 +131,7 @@ module ActiveMerchant
|
|
131
131
|
# format for a command.
|
132
132
|
def expiry(credit_card)
|
133
133
|
month = format(credit_card.month, :two_digits)
|
134
|
-
year = format(credit_card.year
|
134
|
+
year = format(credit_card.year, :two_digits)
|
135
135
|
"#{month}/#{year}"
|
136
136
|
end
|
137
137
|
|
@@ -165,9 +165,10 @@ module ActiveMerchant #:nodoc:
|
|
165
165
|
return {} if address.nil?
|
166
166
|
country = Country.find(address[:country]) if address[:country]
|
167
167
|
mapped = {
|
168
|
-
:street
|
169
|
-
:city
|
170
|
-
:zip
|
168
|
+
:street => address[:address1],
|
169
|
+
:city => address[:city],
|
170
|
+
:zip => address[:zip],
|
171
|
+
:state => address[:state],
|
171
172
|
}
|
172
173
|
mapped.merge!({:country => country.code(:alpha2).value}) unless country.blank?
|
173
174
|
|
@@ -99,11 +99,11 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
cc_stored_data_request(money, post)
|
100
100
|
when 'ccAuthorizeReversal'
|
101
101
|
cc_auth_reversal_request(post)
|
102
|
-
#when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
|
102
|
+
# when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
|
103
103
|
# cc_cancel_request(money, post)
|
104
|
-
#when 'ccPayment'
|
104
|
+
# when 'ccPayment'
|
105
105
|
# cc_payment_request(money, post)
|
106
|
-
#when 'ccAuthenticate'
|
106
|
+
# when 'ccAuthenticate'
|
107
107
|
# cc_authenticate_request(money, post)
|
108
108
|
else
|
109
109
|
raise 'Unknown Action'
|
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
|
|
178
178
|
|
179
179
|
def get_text_from_document(document, node)
|
180
180
|
node = REXML::XPath.first(document, node)
|
181
|
-
node
|
181
|
+
node&.text
|
182
182
|
end
|
183
183
|
|
184
184
|
def cc_auth_request(money, opts)
|
@@ -255,27 +255,27 @@ module ActiveMerchant #:nodoc:
|
|
255
255
|
|
256
256
|
def build_merchant_account(xml)
|
257
257
|
xml.tag! 'merchantAccount' do
|
258
|
-
xml.tag! 'accountNum'
|
259
|
-
xml.tag! 'storeID'
|
260
|
-
xml.tag! 'storePwd'
|
258
|
+
xml.tag! 'accountNum', @options[:account_number]
|
259
|
+
xml.tag! 'storeID', @options[:store_id]
|
260
|
+
xml.tag! 'storePwd', @options[:password]
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
264
|
def build_card(xml, opts)
|
265
265
|
xml.tag! 'card' do
|
266
|
-
xml.tag! 'cardNum'
|
266
|
+
xml.tag! 'cardNum', @credit_card.number
|
267
267
|
xml.tag! 'cardExpiry' do
|
268
|
-
xml.tag! 'month'
|
269
|
-
xml.tag! 'year'
|
268
|
+
xml.tag! 'month', @credit_card.month
|
269
|
+
xml.tag! 'year', @credit_card.year
|
270
270
|
end
|
271
271
|
if brand = card_type(@credit_card.brand)
|
272
|
-
xml.tag! 'cardType'
|
272
|
+
xml.tag! 'cardType', brand
|
273
273
|
end
|
274
274
|
if @credit_card.verification_value?
|
275
|
-
xml.tag! 'cvdIndicator'
|
276
|
-
xml.tag! 'cvd'
|
275
|
+
xml.tag! 'cvdIndicator', '1' # Value Provided
|
276
|
+
xml.tag! 'cvd', @credit_card.verification_value
|
277
277
|
else
|
278
|
-
xml.tag! 'cvdIndicator'
|
278
|
+
xml.tag! 'cvdIndicator', '0'
|
279
279
|
end
|
280
280
|
end
|
281
281
|
end
|
@@ -299,18 +299,18 @@ module ActiveMerchant #:nodoc:
|
|
299
299
|
if addr[:name]
|
300
300
|
first_name, last_name = split_names(addr[:name])
|
301
301
|
xml.tag! 'firstName', first_name
|
302
|
-
xml.tag! 'lastName'
|
302
|
+
xml.tag! 'lastName', last_name
|
303
303
|
end
|
304
|
-
xml.tag! 'street'
|
304
|
+
xml.tag! 'street', addr[:address1] if addr[:address1].present?
|
305
305
|
xml.tag! 'street2', addr[:address2] if addr[:address2].present?
|
306
|
-
xml.tag! 'city'
|
306
|
+
xml.tag! 'city', addr[:city] if addr[:city].present?
|
307
307
|
if addr[:state].present?
|
308
308
|
state_tag = %w(US CA).include?(addr[:country]) ? 'state' : 'region'
|
309
309
|
xml.tag! state_tag, addr[:state]
|
310
310
|
end
|
311
|
-
xml.tag! 'country', addr[:country]
|
312
|
-
xml.tag! 'zip'
|
313
|
-
xml.tag! 'phone'
|
311
|
+
xml.tag! 'country', addr[:country] if addr[:country].present?
|
312
|
+
xml.tag! 'zip', addr[:zip] if addr[:zip].present?
|
313
|
+
xml.tag! 'phone', addr[:phone] if addr[:phone].present?
|
314
314
|
end
|
315
315
|
|
316
316
|
def card_type(key)
|
@@ -396,7 +396,7 @@ module ActiveMerchant #:nodoc:
|
|
396
396
|
xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
|
397
397
|
end
|
398
398
|
|
399
|
-
xml.tag! :AVSname, (
|
399
|
+
xml.tag! :AVSname, (creditcard&.name ? creditcard.name[0..29] : nil)
|
400
400
|
xml.tag! :AVScountryCode, (avs_supported ? byte_limit(format_address_field(address[:country]), 2) : '')
|
401
401
|
|
402
402
|
# Needs to come after AVScountryCode
|
@@ -181,7 +181,7 @@ module ActiveMerchant #:nodoc:
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def json_error(raw_response)
|
184
|
-
|
184
|
+
msg = 'Resposta inválida retornada pela API do Pagar.me. Por favor entre em contato com suporte@pagar.me se você continuar recebendo essa mensagem.'
|
185
185
|
msg += " (A resposta retornada pela API foi #{raw_response.inspect})"
|
186
186
|
{
|
187
187
|
'errors' => [{
|
@@ -173,7 +173,7 @@ module ActiveMerchant #:nodoc:
|
|
173
173
|
def message_from(response)
|
174
174
|
return response['response']['message'] if response['response']
|
175
175
|
|
176
|
-
response['errors']
|
176
|
+
response['errors']&.inject(''){ |message,error| error['message'] + '|' + message }
|
177
177
|
end
|
178
178
|
|
179
179
|
def authorization_from(response)
|
@@ -363,7 +363,7 @@ module ActiveMerchant #:nodoc:
|
|
363
363
|
|
364
364
|
doc = Nokogiri::XML(body)
|
365
365
|
|
366
|
-
doc.root
|
366
|
+
doc.root&.xpath('*')&.each do |node|
|
367
367
|
if (node.elements.size == 0)
|
368
368
|
response[node.name.downcase.to_sym] = node.text
|
369
369
|
else
|
@@ -372,7 +372,7 @@ module ActiveMerchant #:nodoc:
|
|
372
372
|
response[name.to_sym] = childnode.text
|
373
373
|
end
|
374
374
|
end
|
375
|
-
end
|
375
|
+
end
|
376
376
|
|
377
377
|
response
|
378
378
|
end
|
@@ -408,4 +408,3 @@ module ActiveMerchant #:nodoc:
|
|
408
408
|
end
|
409
409
|
end
|
410
410
|
end
|
411
|
-
|
@@ -22,6 +22,10 @@ module ActiveMerchant #:nodoc:
|
|
22
22
|
address['country']
|
23
23
|
end
|
24
24
|
|
25
|
+
def phone
|
26
|
+
@params['phone']
|
27
|
+
end
|
28
|
+
|
25
29
|
def address
|
26
30
|
{ 'name' => @params['shiptoname'] || full_name,
|
27
31
|
'company' => nil,
|
@@ -31,7 +35,7 @@ module ActiveMerchant #:nodoc:
|
|
31
35
|
'state' => @params['state'],
|
32
36
|
'country' => @params['country'],
|
33
37
|
'zip' => @params['zip'],
|
34
|
-
'phone' =>
|
38
|
+
'phone' => phone,
|
35
39
|
}
|
36
40
|
end
|
37
41
|
end
|