activemerchant 1.103.0 → 1.104.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +41 -0
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/avs_result.rb +8 -8
- data/lib/active_merchant/billing/compatibility.rb +2 -1
- data/lib/active_merchant/billing/credit_card.rb +3 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +3 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +32 -9
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +10 -9
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +1 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +18 -15
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +4 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +6 -5
- data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -3
- data/lib/active_merchant/billing/gateways/borgun.rb +1 -1
- data/lib/active_merchant/billing/gateways/bpoint.rb +0 -2
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +2 -1
- data/lib/active_merchant/billing/gateways/card_save.rb +2 -3
- data/lib/active_merchant/billing/gateways/card_stream.rb +6 -6
- data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +1 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +4 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +5 -3
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +17 -10
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +38 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +6 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
- data/lib/active_merchant/billing/gateways/decidir.rb +18 -2
- data/lib/active_merchant/billing/gateways/digitzs.rb +3 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +13 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -2
- data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +2 -1
- data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -0
- data/lib/active_merchant/billing/gateways/exact.rb +3 -3
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +2 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +2 -1
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +1 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +1 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +29 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
- data/lib/active_merchant/billing/gateways/hdfc.rb +1 -0
- data/lib/active_merchant/billing/gateways/hps.rb +9 -7
- data/lib/active_merchant/billing/gateways/iats_payments.rb +4 -4
- data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
- data/lib/active_merchant/billing/gateways/itransact.rb +3 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +1 -0
- 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/latitude19.rb +2 -1
- data/lib/active_merchant/billing/gateways/litle.rb +3 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +1 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +45 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +3 -3
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -1
- data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
- data/lib/active_merchant/billing/gateways/micropayment.rb +0 -1
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/moneris.rb +36 -8
- data/lib/active_merchant/billing/gateways/moneris_us.rb +2 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +6 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
- data/lib/active_merchant/billing/gateways/netbanx.rb +3 -1
- data/lib/active_merchant/billing/gateways/netbilling.rb +3 -3
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +5 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +4 -2
- data/lib/active_merchant/billing/gateways/omise.rb +1 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +3 -1
- data/lib/active_merchant/billing/gateways/opp.rb +1 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +17 -13
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
- data/lib/active_merchant/billing/gateways/pagarme.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +4 -2
- data/lib/active_merchant/billing/gateways/payeezy.rb +2 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/paymentez.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +1 -3
- data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
- data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -0
- data/lib/active_merchant/billing/gateways/payway.rb +3 -2
- data/lib/active_merchant/billing/gateways/pin.rb +1 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +2 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
- data/lib/active_merchant/billing/gateways/qbms.rb +2 -2
- data/lib/active_merchant/billing/gateways/quantum.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +5 -5
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +2 -0
- data/lib/active_merchant/billing/gateways/realex.rb +3 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -2
- data/lib/active_merchant/billing/gateways/s5.rb +1 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -0
- data/lib/active_merchant/billing/gateways/sage.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
- data/lib/active_merchant/billing/gateways/secure_net.rb +2 -4
- data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -5
- data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +7 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -4
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
- data/lib/active_merchant/billing/gateways/telr.rb +3 -0
- data/lib/active_merchant/billing/gateways/tns.rb +0 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +1 -0
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +4 -2
- data/lib/active_merchant/billing/gateways/transax.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +3 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +0 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +15 -16
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +5 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +7 -6
- data/lib/active_merchant/billing/gateways/wirecard.rb +6 -3
- data/lib/active_merchant/billing/gateways/world_net.rb +1 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +4 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +0 -1
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/response.rb +1 -1
- data/lib/active_merchant/connection.rb +2 -0
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/post_data.rb +1 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/ssl_verify.rb +0 -2
- data/lib/support/ssl_version.rb +0 -1
- metadata +2 -2
@@ -230,6 +230,7 @@ module ActiveMerchant #:nodoc:
|
|
230
230
|
def add_interval(xml, options)
|
231
231
|
interval = options[:interval]
|
232
232
|
return unless interval
|
233
|
+
|
233
234
|
xml.tag!('interval') do
|
234
235
|
# The measurement of time, in association with the Interval Unit,
|
235
236
|
# that is used to define the frequency of the billing occurrences
|
@@ -244,6 +245,7 @@ module ActiveMerchant #:nodoc:
|
|
244
245
|
def add_duration(xml, options)
|
245
246
|
duration = options[:duration]
|
246
247
|
return unless duration
|
248
|
+
|
247
249
|
# The date the subscription begins
|
248
250
|
# (also the date the initial billing occurs)
|
249
251
|
xml.tag!('startDate', duration[:start_date]) if duration[:start_date]
|
@@ -253,6 +255,7 @@ module ActiveMerchant #:nodoc:
|
|
253
255
|
|
254
256
|
def add_payment_schedule(xml, options)
|
255
257
|
return unless options[:interval] || options[:duration]
|
258
|
+
|
256
259
|
xml.tag!('paymentSchedule') do
|
257
260
|
# Contains information about the interval of time between payments
|
258
261
|
add_interval(xml, options)
|
@@ -267,6 +270,7 @@ module ActiveMerchant #:nodoc:
|
|
267
270
|
# Adds customer's credit card or bank account payment information
|
268
271
|
def add_payment(xml, options)
|
269
272
|
return unless options[:credit_card] || options[:bank_account]
|
273
|
+
|
270
274
|
xml.tag!('payment') do
|
271
275
|
# Contains the customer’s credit card information
|
272
276
|
add_credit_card(xml, options)
|
@@ -281,6 +285,7 @@ module ActiveMerchant #:nodoc:
|
|
281
285
|
def add_credit_card(xml, options)
|
282
286
|
credit_card = options[:credit_card]
|
283
287
|
return unless credit_card
|
288
|
+
|
284
289
|
xml.tag!('creditCard') do
|
285
290
|
# The credit card number used for payment of the subscription
|
286
291
|
xml.tag!('cardNumber', credit_card.number)
|
@@ -295,6 +300,7 @@ module ActiveMerchant #:nodoc:
|
|
295
300
|
def add_bank_account(xml, options)
|
296
301
|
bank_account = options[:bank_account]
|
297
302
|
return unless bank_account
|
303
|
+
|
298
304
|
xml.tag!('bankAccount') do
|
299
305
|
# The type of bank account used for payment of the subscription
|
300
306
|
xml.tag!('accountType', bank_account[:account_type])
|
@@ -317,6 +323,7 @@ module ActiveMerchant #:nodoc:
|
|
317
323
|
def add_order(xml, options)
|
318
324
|
order = options[:order]
|
319
325
|
return unless order
|
326
|
+
|
320
327
|
xml.tag!('order') do
|
321
328
|
# Merchant-assigned invoice number for the subscription (optional)
|
322
329
|
xml.tag!('invoiceNumber', order[:invoice_number])
|
@@ -329,6 +336,7 @@ module ActiveMerchant #:nodoc:
|
|
329
336
|
def add_customer(xml, options)
|
330
337
|
customer = options[:customer]
|
331
338
|
return unless customer
|
339
|
+
|
332
340
|
xml.tag!('customer') do
|
333
341
|
xml.tag!('type', customer[:type]) if customer[:type]
|
334
342
|
xml.tag!('id', customer[:id]) if customer[:id]
|
@@ -344,6 +352,7 @@ module ActiveMerchant #:nodoc:
|
|
344
352
|
def add_drivers_license(xml, options)
|
345
353
|
return unless customer = options[:customer]
|
346
354
|
return unless drivers_license = customer[:drivers_license]
|
355
|
+
|
347
356
|
xml.tag!('driversLicense') do
|
348
357
|
# The customer's driver's license number
|
349
358
|
xml.tag!('number', drivers_license[:number])
|
@@ -357,6 +366,7 @@ module ActiveMerchant #:nodoc:
|
|
357
366
|
# Adds address information
|
358
367
|
def add_address(xml, container_name, address)
|
359
368
|
return if address.blank?
|
369
|
+
|
360
370
|
xml.tag!(container_name) do
|
361
371
|
xml.tag!('firstName', address[:first_name])
|
362
372
|
xml.tag!('lastName', address[:last_name])
|
@@ -791,6 +791,7 @@ module ActiveMerchant #:nodoc:
|
|
791
791
|
# when the payment method is credit card.
|
792
792
|
def add_credit_card(xml, credit_card)
|
793
793
|
return unless credit_card
|
794
|
+
|
794
795
|
xml.tag!('creditCard') do
|
795
796
|
# The credit card number used for payment of the subscription
|
796
797
|
xml.tag!('cardNumber', full_or_masked_card_number(credit_card.number))
|
@@ -166,6 +166,7 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
|
167
167
|
def add_address(xml, address)
|
168
168
|
raise ArgumentError.new('Address is required') unless address
|
169
|
+
|
169
170
|
xml.tag! 'Address' do
|
170
171
|
xml.tag! 'Street', "#{address[:address1]} #{address[:address2]}".strip
|
171
172
|
xml.tag! 'City', address[:city]
|
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
|
|
45
45
|
|
46
46
|
MultiResponse.run do |r|
|
47
47
|
identifier =
|
48
|
-
if
|
48
|
+
if payment_method.respond_to?(:number)
|
49
49
|
r.process { store(payment_method, options) }
|
50
50
|
r.authorization
|
51
51
|
else
|
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
|
64
64
|
MultiResponse.run do |r|
|
65
65
|
identifier =
|
66
|
-
if
|
66
|
+
if payment_method.respond_to?(:number)
|
67
67
|
r.process { store(payment_method, options) }
|
68
68
|
r.authorization
|
69
69
|
else
|
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
|
|
139
139
|
|
140
140
|
def add_address(post, options)
|
141
141
|
address = (options[:billing_address] || options[:address])
|
142
|
-
if
|
142
|
+
if address && address[:zip].present?
|
143
143
|
post[:address] = {}
|
144
144
|
post[:address][:line1] = address[:address1] if address[:address1]
|
145
145
|
post[:address][:line2] = address[:address2] if address[:address2]
|
@@ -159,14 +159,16 @@ module ActiveMerchant #:nodoc:
|
|
159
159
|
def commit(entity_name, path, post, method=:post)
|
160
160
|
raw_response =
|
161
161
|
begin
|
162
|
-
parse(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
parse(
|
163
|
+
ssl_request(
|
164
|
+
method,
|
165
|
+
live_url + "/#{path}",
|
166
|
+
post_data(post),
|
167
|
+
headers
|
168
|
+
))
|
168
169
|
rescue ResponseError => e
|
169
|
-
raise unless
|
170
|
+
raise unless e.response.code.to_s =~ /4\d\d/
|
171
|
+
|
170
172
|
parse(e.response.body)
|
171
173
|
end
|
172
174
|
|
@@ -181,13 +183,13 @@ module ActiveMerchant #:nodoc:
|
|
181
183
|
|
182
184
|
def success_from(entity_name, raw_response)
|
183
185
|
entity = (raw_response[entity_name] || []).first
|
184
|
-
if
|
186
|
+
if !entity
|
185
187
|
false
|
186
|
-
elsif(
|
188
|
+
elsif (entity_name == 'refunds') && entity.include?('status')
|
187
189
|
%w(succeeded pending).include?(entity['status'])
|
188
|
-
elsif
|
190
|
+
elsif entity.include?('status')
|
189
191
|
(entity['status'] == 'succeeded')
|
190
|
-
elsif
|
192
|
+
elsif entity_name == 'cards'
|
191
193
|
!!entity['id']
|
192
194
|
else
|
193
195
|
false
|
@@ -195,7 +197,7 @@ module ActiveMerchant #:nodoc:
|
|
195
197
|
end
|
196
198
|
|
197
199
|
def message_from(raw_response)
|
198
|
-
if
|
200
|
+
if raw_response['errors']
|
199
201
|
error = raw_response['errors'].first
|
200
202
|
(error['additional'] || error['message'] || error['description'])
|
201
203
|
else
|
@@ -225,6 +227,7 @@ module ActiveMerchant #:nodoc:
|
|
225
227
|
|
226
228
|
params.map do |key, value|
|
227
229
|
next if value.blank?
|
230
|
+
|
228
231
|
if value.is_a?(Hash)
|
229
232
|
h = {}
|
230
233
|
value.each do |k, v|
|
@@ -184,6 +184,7 @@ module ActiveMerchant #:nodoc:
|
|
184
184
|
authorization = [parameters[:originalReference], response['pspReference']].compact
|
185
185
|
|
186
186
|
return nil if authorization.empty?
|
187
|
+
|
187
188
|
return authorization.join('#')
|
188
189
|
end
|
189
190
|
|
@@ -238,6 +239,7 @@ module ActiveMerchant #:nodoc:
|
|
238
239
|
return response['resultCode'] if response.has_key?('resultCode') # Payment request
|
239
240
|
return response['response'] if response['response'] # Modification request
|
240
241
|
return response['result'] if response.has_key?('result') # Store/Recurring request
|
242
|
+
|
241
243
|
'Failure' # Negative fallback in case of error
|
242
244
|
end
|
243
245
|
|
@@ -367,6 +369,7 @@ module ActiveMerchant #:nodoc:
|
|
367
369
|
end
|
368
370
|
else
|
369
371
|
return unless options[:execute_threed] || options[:threed_dynamic]
|
372
|
+
|
370
373
|
post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
|
371
374
|
post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed]
|
372
375
|
end
|
@@ -374,6 +377,7 @@ module ActiveMerchant #:nodoc:
|
|
374
377
|
|
375
378
|
def add_browser_info(browser_info, post)
|
376
379
|
return unless browser_info
|
380
|
+
|
377
381
|
post[:browserInfo] = {
|
378
382
|
acceptHeader: browser_info[:accept_header],
|
379
383
|
colorDepth: browser_info[:depth],
|
@@ -256,8 +256,9 @@ module ActiveMerchant #:nodoc:
|
|
256
256
|
end
|
257
257
|
|
258
258
|
def prepare_address_for_non_american_countries(options)
|
259
|
-
[
|
259
|
+
[options[:billing_address], options[:shipping_address]].compact.each do |address|
|
260
260
|
next if empty?(address[:country])
|
261
|
+
|
261
262
|
unless ['US', 'CA'].include?(address[:country])
|
262
263
|
address[:state] = '--'
|
263
264
|
address[:zip] = '000000' unless address[:zip]
|
@@ -366,6 +367,7 @@ module ActiveMerchant #:nodoc:
|
|
366
367
|
if interval.respond_to? :parts
|
367
368
|
parts = interval.parts
|
368
369
|
raise ArgumentError.new("Cannot recur with mixed interval (#{interval}). Use only one of: days, weeks, months or years") if parts.length > 1
|
370
|
+
|
369
371
|
parts.first
|
370
372
|
elsif interval.kind_of? Hash
|
371
373
|
requires!(interval, :unit)
|
@@ -10,8 +10,8 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
|
11
11
|
self.ignore_http_status = true
|
12
12
|
|
13
|
-
CARD_CODE_ERRORS = %w(
|
14
|
-
AVS_ERRORS = %w(
|
13
|
+
CARD_CODE_ERRORS = %w(N S)
|
14
|
+
AVS_ERRORS = %w(A E N R W Z)
|
15
15
|
AVS_REASON_CODES = %w(27 45)
|
16
16
|
|
17
17
|
FIELD_MAP = {
|
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
|
|
155
155
|
# If the payment_object is either a CreditCard or Check object, then the transaction type will be an unmatched credit placing funds in the specified account. This is referred to a CREDIT transaction in BluePay.
|
156
156
|
# * <tt>options</tt> -- A hash of parameters.
|
157
157
|
def refund(money, identification, options = {})
|
158
|
-
if
|
158
|
+
if identification && !identification.kind_of?(String)
|
159
159
|
ActiveMerchant.deprecated 'refund should only be used to refund a referenced transaction'
|
160
160
|
return credit(money, identification, options)
|
161
161
|
end
|
@@ -317,7 +317,7 @@ module ActiveMerchant #:nodoc:
|
|
317
317
|
private
|
318
318
|
|
319
319
|
def commit(action, money, fields, options = {})
|
320
|
-
fields[:AMOUNT] = amount(money) unless
|
320
|
+
fields[:AMOUNT] = amount(money) unless fields[:TRANS_TYPE] == 'VOID' || action == 'rebill'
|
321
321
|
fields[:MODE] = (test? ? 'TEST' : 'LIVE')
|
322
322
|
fields[:ACCOUNT_ID] = @options[:login]
|
323
323
|
fields[:CUSTOMER_IP] = options[:ip] if options[:ip]
|
@@ -372,7 +372,7 @@ module ActiveMerchant #:nodoc:
|
|
372
372
|
|
373
373
|
def message_from(parsed)
|
374
374
|
message = parsed[:message]
|
375
|
-
if
|
375
|
+
if parsed[:response_code].to_i == 2
|
376
376
|
if CARD_CODE_ERRORS.include?(parsed[:card_code])
|
377
377
|
message = CVVResult.messages[parsed[:card_code]]
|
378
378
|
elsif AVS_ERRORS.include?(parsed[:avs_result_code])
|
@@ -513,6 +513,7 @@ module ActiveMerchant #:nodoc:
|
|
513
513
|
|
514
514
|
def handle_response(response)
|
515
515
|
return response.body if ignore_http_status || (200...300).cover?(response.code.to_i)
|
516
|
+
|
516
517
|
raise ResponseError.new(response)
|
517
518
|
end
|
518
519
|
end
|
@@ -256,6 +256,7 @@ module ActiveMerchant
|
|
256
256
|
|
257
257
|
def add_level_3_data(doc, options)
|
258
258
|
return unless options[:customer_reference_number]
|
259
|
+
|
259
260
|
doc.send('level-3-data') do
|
260
261
|
send_when_present(doc, :customer_reference_number, options)
|
261
262
|
send_when_present(doc, :sales_tax_amount, options)
|
@@ -273,6 +274,7 @@ module ActiveMerchant
|
|
273
274
|
|
274
275
|
def send_when_present(doc, options_key, options, xml_element_name = nil)
|
275
276
|
return unless options[options_key]
|
277
|
+
|
276
278
|
xml_element_name ||= options_key.to_s
|
277
279
|
|
278
280
|
doc.send(xml_element_name.dasherize, options[options_key])
|
@@ -380,7 +382,7 @@ module ActiveMerchant
|
|
380
382
|
succeeded = success_from(action, response)
|
381
383
|
Response.new(
|
382
384
|
succeeded,
|
383
|
-
message_from(succeeded,
|
385
|
+
message_from(succeeded, response),
|
384
386
|
parsed,
|
385
387
|
authorization: authorization_from(action, parsed, payment_method_details),
|
386
388
|
avs_result: avs_result(parsed),
|
@@ -412,9 +414,34 @@ module ActiveMerchant
|
|
412
414
|
(200...300).cover?(response.code.to_i)
|
413
415
|
end
|
414
416
|
|
415
|
-
def message_from(succeeded,
|
417
|
+
def message_from(succeeded, response)
|
416
418
|
return 'Success' if succeeded
|
417
|
-
|
419
|
+
|
420
|
+
parsed = parse(response)
|
421
|
+
if parsed.dig('error-name') == 'FRAUD_DETECTED'
|
422
|
+
fraud_codes_from(response)
|
423
|
+
else
|
424
|
+
parsed['description']
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
def fraud_codes_from(response)
|
429
|
+
event_summary = {}
|
430
|
+
doc = Nokogiri::XML(response.body)
|
431
|
+
fraud_events = doc.xpath('//xmlns:fraud-events', 'xmlns' => 'http://ws.plimus.com')
|
432
|
+
fraud_events.children.each do |child|
|
433
|
+
if child.children.children.any?
|
434
|
+
event_summary[child.name] = event_summary[child.name] || []
|
435
|
+
event = {}
|
436
|
+
child.children.each do |chi|
|
437
|
+
event[chi.name] = chi.text
|
438
|
+
end
|
439
|
+
event_summary[child.name] << event
|
440
|
+
else
|
441
|
+
event_summary[child.name] = child.text
|
442
|
+
end
|
443
|
+
end
|
444
|
+
event_summary.to_json
|
418
445
|
end
|
419
446
|
|
420
447
|
def authorization_from(action, parsed_response, payment_method_details)
|
@@ -423,6 +450,7 @@ module ActiveMerchant
|
|
423
450
|
|
424
451
|
def vaulted_shopper_id(parsed_response, payment_method_details)
|
425
452
|
return nil unless parsed_response['content-location-header']
|
453
|
+
|
426
454
|
vaulted_shopper_id = parsed_response['content-location-header'].split('/').last
|
427
455
|
vaulted_shopper_id += "|#{payment_method_details.payment_method_type}" if payment_method_details.alt_transaction?
|
428
456
|
vaulted_shopper_id
|
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
|
|
9
9
|
self.test_url = 'https://gatewaytest.borgun.is/ws/Heimir.pub.ws:Authorization'
|
10
10
|
self.live_url = 'https://gateway01.borgun.is/ws/Heimir.pub.ws:Authorization'
|
11
11
|
|
12
|
-
self.supported_countries = ['IS', 'GB', 'HU', 'CZ', 'DE', 'DK', 'SE'
|
12
|
+
self.supported_countries = ['IS', 'GB', 'HU', 'CZ', 'DE', 'DK', 'SE']
|
13
13
|
self.default_currency = 'ISK'
|
14
14
|
self.money_format = :cents
|
15
15
|
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb]
|
@@ -240,7 +240,6 @@ module ActiveMerchant #:nodoc:
|
|
240
240
|
end
|
241
241
|
|
242
242
|
class ProcessPaymentResponse < BPointResponse
|
243
|
-
|
244
243
|
private
|
245
244
|
|
246
245
|
def authorization_key
|
@@ -257,7 +256,6 @@ module ActiveMerchant #:nodoc:
|
|
257
256
|
end
|
258
257
|
|
259
258
|
class AddTokenResponse < BPointResponse
|
260
|
-
|
261
259
|
private
|
262
260
|
|
263
261
|
def authorization_key
|
@@ -170,7 +170,7 @@ module ActiveMerchant #:nodoc:
|
|
170
170
|
|
171
171
|
def unstore(customer_vault_id, options = {})
|
172
172
|
commit do
|
173
|
-
if
|
173
|
+
if !customer_vault_id && options[:credit_card_token]
|
174
174
|
@braintree_gateway.credit_card.delete(options[:credit_card_token])
|
175
175
|
else
|
176
176
|
@braintree_gateway.customer.delete(customer_vault_id)
|
@@ -260,7 +260,7 @@ module ActiveMerchant #:nodoc:
|
|
260
260
|
}
|
261
261
|
if options[:billing_address]
|
262
262
|
address = map_address(options[:billing_address])
|
263
|
-
parameters[:
|
263
|
+
parameters[:billing_address] = address unless address.all? { |_k, v| empty?(v) }
|
264
264
|
end
|
265
265
|
|
266
266
|
result = @braintree_gateway.credit_card.create(parameters)
|
@@ -287,10 +287,10 @@ module ActiveMerchant #:nodoc:
|
|
287
287
|
|
288
288
|
def scrub_zip(zip)
|
289
289
|
return nil unless zip.present?
|
290
|
-
return nil if
|
290
|
+
return nil if
|
291
291
|
zip.gsub(/[^a-z0-9]/i, '').length > 9 ||
|
292
292
|
zip =~ /[^a-z0-9\- ]/i
|
293
|
-
|
293
|
+
|
294
294
|
zip
|
295
295
|
end
|
296
296
|
|
@@ -628,11 +628,17 @@ module ActiveMerchant #:nodoc:
|
|
628
628
|
|
629
629
|
parameters[:line_items] = options[:line_items] if options[:line_items]
|
630
630
|
|
631
|
+
if options[:payment_method_nonce].is_a?(String)
|
632
|
+
parameters.delete(:customer)
|
633
|
+
parameters[:payment_method_nonce] = options[:payment_method_nonce]
|
634
|
+
end
|
635
|
+
|
631
636
|
parameters
|
632
637
|
end
|
633
638
|
|
634
639
|
def add_3ds_info(parameters, three_d_secure_opts)
|
635
640
|
return if empty?(three_d_secure_opts)
|
641
|
+
|
636
642
|
pass_thru = {}
|
637
643
|
|
638
644
|
pass_thru[:three_d_secure_version] = three_d_secure_opts[:version] if three_d_secure_opts[:version]
|
@@ -655,6 +661,7 @@ module ActiveMerchant #:nodoc:
|
|
655
661
|
|
656
662
|
def add_stored_credential_data(parameters, credit_card_or_vault_id, options)
|
657
663
|
return unless (stored_credential = options[:stored_credential])
|
664
|
+
|
658
665
|
parameters[:external_vault] = {}
|
659
666
|
if stored_credential[:initial_transaction]
|
660
667
|
parameters[:external_vault][:status] = 'will_vault'
|
@@ -147,7 +147,7 @@ module ActiveMerchant #:nodoc:
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def add_customer_data(post, options)
|
150
|
-
if(billing_address = (options[:billing_address] || options[:address]))
|
150
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
151
151
|
post[:Street] = billing_address[:address1]
|
152
152
|
post[:Zip] = billing_address[:zip]
|
153
153
|
end
|
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
|
|
69
69
|
|
70
70
|
def require_valid_domain!(options, param)
|
71
71
|
if options[param]
|
72
|
-
raise ArgumentError.new('not a valid cardconnect domain') unless
|
72
|
+
raise ArgumentError.new('not a valid cardconnect domain') unless /https:\/\/\D*cardconnect.com/ =~ options[param]
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -288,6 +288,7 @@ module ActiveMerchant #:nodoc:
|
|
288
288
|
)
|
289
289
|
rescue ResponseError => e
|
290
290
|
return Response.new(false, 'Unable to authenticate. Please check your credentials.', {}, :test => test?) if e.response.code == '401'
|
291
|
+
|
291
292
|
raise
|
292
293
|
end
|
293
294
|
|