activemerchant 1.103.0 → 1.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9ceb4b2da9006abdfcab980341c407f7b718ae35a424fc1e597c3cf2b189271
|
|
4
|
+
data.tar.gz: 19fe8973c00605d460cd56bcc8d0148cfa8ad7af9a33d07c9f2759da56dc5684
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94d123473e989145c5d9a34294718cc8913d231c72b415bd0398e88cfefdc81b1cd9070eaf14648be6c723de201785920de8479b8ef997454df194cfaa4f7734
|
|
7
|
+
data.tar.gz: 9567e118dd21f0779d5a8bd228ab385f2378c338f838fe027ed6ad6a245a86362fd786d91aa53cbaa65b31d3817efdc8ca299ff84f44f182140ff43018cd6f7c
|
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
== HEAD
|
|
4
4
|
|
|
5
|
+
== Version 1.104.0 (Jan 29, 2020)
|
|
6
|
+
* Adyen: add `recurring_contract_type` GSF [therufs] #3460
|
|
7
|
+
* Credorax: Only pass `3ds_version` parameter when required [britth] #3458
|
|
8
|
+
* EBANX: Include Peru in supported countries [Ruanito] #3443
|
|
9
|
+
* Bluesnap: include fraud data in response message [therufs] #3459
|
|
10
|
+
* Ingenico GlobalCollect: support `airline_data` and related GSFs [therufs] #3461
|
|
11
|
+
* Add UnionPay card type [leila-alderman] #3464
|
|
12
|
+
* Braintree: Fix add_credit_card_to_customer in Store [molbrown] #3466
|
|
13
|
+
* EBANX: Default to not send amount on capture [chinhle23] #3463
|
|
14
|
+
* Latitude19: Convert money format to dollars [molbrown] #3468
|
|
15
|
+
* Adyen: Fix response success for unstore [kheang] #3470
|
|
16
|
+
* CyberSource: add several GSFs [therufs] #3465
|
|
17
|
+
* Adyen: add `recurring_contract_type` GSF to auth [therufs] #3471
|
|
18
|
+
* Stripe Payment Intents: Use localized_amount on capture [molbrown] #3475
|
|
19
|
+
* dLocal: Add support for installments [kdelemme] #3456
|
|
20
|
+
* Merchant Warrior: Add void operation [leila-alderman] #3474
|
|
21
|
+
* Decidir: Update payment method IDs [leila-alderman] #3476
|
|
22
|
+
* Adyen: Add delivery address [leila-alderman] #3477
|
|
23
|
+
* Authorize.net: Correctly parse direct_response field with quotation marks [britth] #3479
|
|
24
|
+
* Decidir: Add debit card payment method IDs [leila-alderman] #3480
|
|
25
|
+
* CyberSource: Add issuer data+MDD to credit & void [leila-alderman] #3481
|
|
26
|
+
* Credorax: add `authorization_type` and `multiple_capture_count` GSFs [therufs] #3478
|
|
27
|
+
* CardStream: use localized_amount to correctly support zero-decimal currencies [britth] #3473
|
|
28
|
+
* EBANX: Add additional data in post [Ruanito] #3482
|
|
29
|
+
* Credorax: Omit phone when nil [leila-alderman] #3490
|
|
30
|
+
* TransFirst TrExp: Remove hyphens from zip [leila-alderman] #3483
|
|
31
|
+
* Mundipagg: Return acquirer code as the error code [leila-alderman] #3492
|
|
32
|
+
* Braintree Blue: Remove customer hash when using a payment_method_nonce #3495
|
|
33
|
+
* Credorax: Update non-standard currencies list [chinhle23] #3499
|
|
34
|
+
* Redsys: Update production URL [britth] #3505
|
|
35
|
+
* Moneris: include AVS and CoF fields when storing vault records [alexdunae] #3446
|
|
36
|
+
* Moneris: Add support for temporary vault storage [alexdunae] #3446
|
|
37
|
+
* Clearhaus: Update currencies without fractions list [chinhle23] #3506
|
|
38
|
+
* Merchant Warrior: Add recurringFlag to purchase & authorize [carrigan] #3504
|
|
39
|
+
* CardConnect: Remove domain port validation [leila-alderman] #3494
|
|
40
|
+
* Paymentez: Correct refund and void message parsing [carrigan] #3509
|
|
41
|
+
* Mercado Pago: Add taxes and net_amount gateway specific fields [carrigan] #3512
|
|
42
|
+
* Moneris: use dedicated card_verification methods [alexdunae] #3428
|
|
43
|
+
* Authorize.net: Trim down supported countries [fatcatt316] #3511
|
|
44
|
+
|
|
5
45
|
== Version 1.103.0 (Dec 2, 2019)
|
|
6
46
|
* Quickbooks: Mark transactions that returned `AuthorizationFailed` as failures [britth] #3447
|
|
7
47
|
* Credorax: Add referral CFT transactions [leila-alderman] #3432
|
|
@@ -56,6 +96,7 @@
|
|
|
56
96
|
* Rubocop: Layout/MultilineHashBraceLayout [nfarve] #3385
|
|
57
97
|
* CardConnect: Always include additional_data in purchase [therufs] #3387
|
|
58
98
|
* CardConnect: Add user_fields GSF [therufs] #3388
|
|
99
|
+
* Moneris: Add support for stored credentials [chinhle23] #3384
|
|
59
100
|
|
|
60
101
|
== Version 1.99.0 (Sep 26, 2019)
|
|
61
102
|
* Adyen: Add functionality to set 3DS exemptions via API [britth] #3331
|
data/lib/active_merchant.rb
CHANGED
|
@@ -52,7 +52,7 @@ require 'active_merchant/country'
|
|
|
52
52
|
module ActiveMerchant
|
|
53
53
|
def self.deprecated(message, caller=Kernel.caller[1])
|
|
54
54
|
warning = caller + ': ' + message
|
|
55
|
-
if
|
|
55
|
+
if respond_to?(:logger) && logger.present?
|
|
56
56
|
logger.warn(warning)
|
|
57
57
|
else
|
|
58
58
|
warn(warning)
|
|
@@ -39,10 +39,10 @@ module ActiveMerchant
|
|
|
39
39
|
|
|
40
40
|
# Map vendor's AVS result code to a postal match code
|
|
41
41
|
POSTAL_MATCH_CODE = {
|
|
42
|
-
'Y' => %w(
|
|
43
|
-
'N' => %w(
|
|
44
|
-
'X' => %w(
|
|
45
|
-
nil => %w(
|
|
42
|
+
'Y' => %w(D H F H J L M P Q V W X Y Z),
|
|
43
|
+
'N' => %w(A C K N O),
|
|
44
|
+
'X' => %w(G S),
|
|
45
|
+
nil => %w(B E I R T U)
|
|
46
46
|
}.inject({}) do |map, (type, codes)|
|
|
47
47
|
codes.each { |code| map[code] = type }
|
|
48
48
|
map
|
|
@@ -50,10 +50,10 @@ module ActiveMerchant
|
|
|
50
50
|
|
|
51
51
|
# Map vendor's AVS result code to a street match code
|
|
52
52
|
STREET_MATCH_CODE = {
|
|
53
|
-
'Y' => %w(
|
|
54
|
-
'N' => %w(
|
|
55
|
-
'X' => %w(
|
|
56
|
-
nil => %w(
|
|
53
|
+
'Y' => %w(A B D H J M O Q T V X Y),
|
|
54
|
+
'N' => %w(C K L N W Z),
|
|
55
|
+
'X' => %w(G S),
|
|
56
|
+
nil => %w(E F I P R U)
|
|
57
57
|
}.inject({}) do |map, (type, codes)|
|
|
58
58
|
codes.each { |code| map[code] = type }
|
|
59
59
|
map
|
|
@@ -22,6 +22,7 @@ module ActiveMerchant #:nodoc:
|
|
|
22
22
|
# * Alelo
|
|
23
23
|
# * Cabal
|
|
24
24
|
# * Naranja
|
|
25
|
+
# * UnionPay
|
|
25
26
|
#
|
|
26
27
|
# For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
|
|
27
28
|
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
|
|
@@ -96,6 +97,7 @@ module ActiveMerchant #:nodoc:
|
|
|
96
97
|
# * +'alelo'+
|
|
97
98
|
# * +'cabal'+
|
|
98
99
|
# * +'naranja'+
|
|
100
|
+
# * +'union_pay'+
|
|
99
101
|
#
|
|
100
102
|
# Or, if you wish to test your implementation, +'bogus'+.
|
|
101
103
|
#
|
|
@@ -327,7 +329,7 @@ module ActiveMerchant #:nodoc:
|
|
|
327
329
|
errors << [:last_name, 'cannot be empty'] if last_name.blank?
|
|
328
330
|
end
|
|
329
331
|
|
|
330
|
-
if
|
|
332
|
+
if empty?(month) || empty?(year)
|
|
331
333
|
errors << [:month, 'is required'] if empty?(month)
|
|
332
334
|
errors << [:year, 'is required'] if empty?(year)
|
|
333
335
|
else
|
|
@@ -18,6 +18,7 @@ module ActiveMerchant #:nodoc:
|
|
|
18
18
|
'sodexo' => ->(num) { num =~ /^(606071|603389|606070|606069|606068|600818)\d{10}$/ },
|
|
19
19
|
'vr' => ->(num) { num =~ /^(627416|637036)\d{10}$/ },
|
|
20
20
|
'cabal' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 8), CABAL_RANGES) },
|
|
21
|
+
'unionpay' => ->(num) { (16..19).cover?(num&.size) && in_bin_range?(num.slice(0, 8), UNIONPAY_RANGES) },
|
|
21
22
|
'carnet' => lambda { |num|
|
|
22
23
|
num&.size == 16 && (
|
|
23
24
|
in_bin_range?(num.slice(0, 6), CARNET_RANGES) ||
|
|
@@ -123,6 +124,14 @@ module ActiveMerchant #:nodoc:
|
|
|
123
124
|
589562..589562
|
|
124
125
|
]
|
|
125
126
|
|
|
127
|
+
# In addition to the BIN ranges listed here that all begin with 81, UnionPay cards
|
|
128
|
+
# include many ranges that start with 62.
|
|
129
|
+
# Prior to adding UnionPay, cards that start with 62 were all classified as Discover.
|
|
130
|
+
# Because UnionPay cards are able to run on Discover rails, this was kept the same.
|
|
131
|
+
UNIONPAY_RANGES = [
|
|
132
|
+
81000000..81099999, 81100000..81319999, 81320000..81519999, 81520000..81639999, 81640000..81719999
|
|
133
|
+
]
|
|
134
|
+
|
|
126
135
|
def self.included(base)
|
|
127
136
|
base.extend(ClassMethods)
|
|
128
137
|
end
|
|
@@ -238,6 +247,7 @@ module ActiveMerchant #:nodoc:
|
|
|
238
247
|
|
|
239
248
|
def last_digits(number)
|
|
240
249
|
return '' if number.nil?
|
|
250
|
+
|
|
241
251
|
number.length <= 4 ? number : number.slice(-4..-1)
|
|
242
252
|
end
|
|
243
253
|
|
|
@@ -259,11 +269,13 @@ module ActiveMerchant #:nodoc:
|
|
|
259
269
|
|
|
260
270
|
def valid_card_number_length?(number) #:nodoc:
|
|
261
271
|
return false if number.nil?
|
|
272
|
+
|
|
262
273
|
number.length >= 12
|
|
263
274
|
end
|
|
264
275
|
|
|
265
276
|
def valid_card_number_characters?(number) #:nodoc:
|
|
266
277
|
return false if number.nil?
|
|
278
|
+
|
|
267
279
|
!number.match(/\D/)
|
|
268
280
|
end
|
|
269
281
|
|
|
@@ -4,7 +4,6 @@ module ActiveMerchant
|
|
|
4
4
|
# http://www.bbbonline.org/eExport/doc/MerchantGuide_cvv2.pdf
|
|
5
5
|
# Check additional codes from cybersource website
|
|
6
6
|
class CVVResult
|
|
7
|
-
|
|
8
7
|
MESSAGES = {
|
|
9
8
|
'D' => 'CVV check flagged transaction as suspicious',
|
|
10
9
|
'I' => 'CVV failed data validation check',
|
|
@@ -249,6 +249,7 @@ module ActiveMerchant #:nodoc:
|
|
|
249
249
|
|
|
250
250
|
def amount(money)
|
|
251
251
|
return nil if money.nil?
|
|
252
|
+
|
|
252
253
|
cents =
|
|
253
254
|
if money.respond_to?(:cents)
|
|
254
255
|
ActiveMerchant.deprecated 'Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents'
|
|
@@ -278,6 +279,7 @@ module ActiveMerchant #:nodoc:
|
|
|
278
279
|
amount = amount(money)
|
|
279
280
|
|
|
280
281
|
return amount unless non_fractional_currency?(currency) || three_decimal_currency?(currency)
|
|
282
|
+
|
|
281
283
|
if non_fractional_currency?(currency)
|
|
282
284
|
if self.money_format == :cents
|
|
283
285
|
sprintf('%.0f', amount.to_f / 100)
|
|
@@ -299,6 +301,7 @@ module ActiveMerchant #:nodoc:
|
|
|
299
301
|
|
|
300
302
|
def truncate(value, max_size)
|
|
301
303
|
return nil unless value
|
|
304
|
+
|
|
302
305
|
value.to_s[0, max_size]
|
|
303
306
|
end
|
|
304
307
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
|
3
3
|
class AdyenGateway < Gateway
|
|
4
|
-
|
|
5
4
|
# we recommend setting up merchant-specific endpoints.
|
|
6
5
|
# https://docs.adyen.com/developers/api-manual#apiendpoints
|
|
7
6
|
self.test_url = 'https://pal-test.adyen.com/pal/servlet/'
|
|
@@ -10,7 +9,7 @@ module ActiveMerchant #:nodoc:
|
|
|
10
9
|
self.supported_countries = %w(AT AU BE BG BR CH CY CZ DE DK EE ES FI FR GB GI GR HK HU IE IS IT LI LT LU LV MC MT MX NL NO PL PT RO SE SG SK SI US)
|
|
11
10
|
self.default_currency = 'USD'
|
|
12
11
|
self.currencies_without_fractions = %w(CVE DJF GNF IDR JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
|
|
13
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo, :naranja, :cabal]
|
|
12
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo, :naranja, :cabal, :unionpay]
|
|
14
13
|
|
|
15
14
|
self.money_format = :cents
|
|
16
15
|
|
|
@@ -51,7 +50,7 @@ module ActiveMerchant #:nodoc:
|
|
|
51
50
|
requires!(options, :order_id)
|
|
52
51
|
post = init_post(options)
|
|
53
52
|
add_invoice(post, money, options)
|
|
54
|
-
add_payment(post, payment)
|
|
53
|
+
add_payment(post, payment, options)
|
|
55
54
|
add_extra_data(post, payment, options)
|
|
56
55
|
add_stored_credentials(post, payment, options)
|
|
57
56
|
add_address(post, options)
|
|
@@ -59,6 +58,7 @@ module ActiveMerchant #:nodoc:
|
|
|
59
58
|
add_3ds(post, options)
|
|
60
59
|
add_3ds_authenticated_data(post, options)
|
|
61
60
|
add_splits(post, options)
|
|
61
|
+
add_recurring_contract(post, options)
|
|
62
62
|
commit('authorise', post, options)
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -96,12 +96,14 @@ module ActiveMerchant #:nodoc:
|
|
|
96
96
|
requires!(options, :order_id)
|
|
97
97
|
post = init_post(options)
|
|
98
98
|
add_invoice(post, 0, options)
|
|
99
|
-
add_payment(post, credit_card)
|
|
99
|
+
add_payment(post, credit_card, options)
|
|
100
100
|
add_extra_data(post, credit_card, options)
|
|
101
101
|
add_stored_credentials(post, credit_card, options)
|
|
102
|
-
add_recurring_contract(post, options)
|
|
103
102
|
add_address(post, options)
|
|
104
103
|
|
|
104
|
+
options[:recurring_contract_type] ||= 'RECURRING'
|
|
105
|
+
add_recurring_contract(post, options)
|
|
106
|
+
|
|
105
107
|
action = options[:tokenize_only] ? 'storeToken' : 'authorise'
|
|
106
108
|
|
|
107
109
|
initial_response = commit(action, post, options)
|
|
@@ -226,6 +228,7 @@ module ActiveMerchant #:nodoc:
|
|
|
226
228
|
|
|
227
229
|
def add_splits(post, options)
|
|
228
230
|
return unless split_data = options[:splits]
|
|
231
|
+
|
|
229
232
|
splits = []
|
|
230
233
|
split_data.each do |split|
|
|
231
234
|
amount = {
|
|
@@ -269,6 +272,7 @@ module ActiveMerchant #:nodoc:
|
|
|
269
272
|
|
|
270
273
|
def add_recurring_processing_model(post, options)
|
|
271
274
|
return unless options.dig(:stored_credential, :reason_type) || options[:recurring_processing_model]
|
|
275
|
+
|
|
272
276
|
if options.dig(:stored_credential, :reason_type) && options[:stored_credential][:reason_type] == 'unscheduled'
|
|
273
277
|
recurring_processing_model = 'CardOnFile'
|
|
274
278
|
else
|
|
@@ -279,7 +283,17 @@ module ActiveMerchant #:nodoc:
|
|
|
279
283
|
end
|
|
280
284
|
|
|
281
285
|
def add_address(post, options)
|
|
286
|
+
if address = options[:shipping_address]
|
|
287
|
+
post[:deliveryAddress] = {}
|
|
288
|
+
post[:deliveryAddress][:street] = address[:address1] || 'NA'
|
|
289
|
+
post[:deliveryAddress][:houseNumberOrName] = address[:address2] || 'NA'
|
|
290
|
+
post[:deliveryAddress][:postalCode] = address[:zip] if address[:zip]
|
|
291
|
+
post[:deliveryAddress][:city] = address[:city] || 'NA'
|
|
292
|
+
post[:deliveryAddress][:stateOrProvince] = get_state(address)
|
|
293
|
+
post[:deliveryAddress][:country] = address[:country] if address[:country]
|
|
294
|
+
end
|
|
282
295
|
return unless post[:card]&.kind_of?(Hash)
|
|
296
|
+
|
|
283
297
|
if (address = options[:billing_address] || options[:address]) && address[:country]
|
|
284
298
|
post[:billingAddress] = {}
|
|
285
299
|
post[:billingAddress][:street] = address[:address1] || 'NA'
|
|
@@ -313,11 +327,11 @@ module ActiveMerchant #:nodoc:
|
|
|
313
327
|
post[:modificationAmount] = amount
|
|
314
328
|
end
|
|
315
329
|
|
|
316
|
-
def add_payment(post, payment)
|
|
330
|
+
def add_payment(post, payment, options)
|
|
317
331
|
if payment.is_a?(String)
|
|
318
332
|
_, _, recurring_detail_reference = payment.split('#')
|
|
319
333
|
post[:selectedRecurringDetailReference] = recurring_detail_reference
|
|
320
|
-
|
|
334
|
+
options[:recurring_contract_type] ||= 'RECURRING'
|
|
321
335
|
else
|
|
322
336
|
add_mpi_data_for_network_tokenization_card(post, payment) if payment.is_a?(NetworkTokenizationCreditCard)
|
|
323
337
|
add_card(post, payment)
|
|
@@ -341,6 +355,7 @@ module ActiveMerchant #:nodoc:
|
|
|
341
355
|
|
|
342
356
|
def capture_options(options)
|
|
343
357
|
return options.merge(idempotency_key: "#{options[:idempotency_key]}-cap") if options[:idempotency_key]
|
|
358
|
+
|
|
344
359
|
options
|
|
345
360
|
end
|
|
346
361
|
|
|
@@ -367,8 +382,10 @@ module ActiveMerchant #:nodoc:
|
|
|
367
382
|
end
|
|
368
383
|
|
|
369
384
|
def add_recurring_contract(post, options = {})
|
|
385
|
+
return unless options[:recurring_contract_type]
|
|
386
|
+
|
|
370
387
|
recurring = {
|
|
371
|
-
contract:
|
|
388
|
+
contract: options[:recurring_contract_type]
|
|
372
389
|
}
|
|
373
390
|
|
|
374
391
|
post[:recurring] = recurring
|
|
@@ -396,6 +413,7 @@ module ActiveMerchant #:nodoc:
|
|
|
396
413
|
end
|
|
397
414
|
else
|
|
398
415
|
return unless options[:execute_threed] || options[:threed_dynamic]
|
|
416
|
+
|
|
399
417
|
post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
|
|
400
418
|
post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed]
|
|
401
419
|
end
|
|
@@ -424,7 +442,7 @@ module ActiveMerchant #:nodoc:
|
|
|
424
442
|
def add_3ds2_authenticated_data(post, options)
|
|
425
443
|
three_d_secure_options = options[:three_d_secure]
|
|
426
444
|
# If the transaction was authenticated in a frictionless flow, send the transStatus from the ARes.
|
|
427
|
-
if
|
|
445
|
+
if three_d_secure_options[:authentication_response_status].nil?
|
|
428
446
|
authentication_response = three_d_secure_options[:directory_response_status]
|
|
429
447
|
else
|
|
430
448
|
authentication_response = three_d_secure_options[:authentication_response_status]
|
|
@@ -441,6 +459,7 @@ module ActiveMerchant #:nodoc:
|
|
|
441
459
|
|
|
442
460
|
def parse(body)
|
|
443
461
|
return {} if body.blank?
|
|
462
|
+
|
|
444
463
|
JSON.parse(body)
|
|
445
464
|
end
|
|
446
465
|
|
|
@@ -511,6 +530,8 @@ module ActiveMerchant #:nodoc:
|
|
|
511
530
|
response['response'] == 'Authorised' || response['response'] == '[adjustAuthorisation-received]'
|
|
512
531
|
when 'storeToken'
|
|
513
532
|
response['result'] == 'Success'
|
|
533
|
+
when 'disable'
|
|
534
|
+
response['response'] == '[detail-successfully-disabled]'
|
|
514
535
|
else
|
|
515
536
|
false
|
|
516
537
|
end
|
|
@@ -518,6 +539,7 @@ module ActiveMerchant #:nodoc:
|
|
|
518
539
|
|
|
519
540
|
def message_from(action, response)
|
|
520
541
|
return authorize_message_from(response) if action.to_s == 'authorise' || action.to_s == 'authorise3d'
|
|
542
|
+
|
|
521
543
|
response['response'] || response['message'] || response['result']
|
|
522
544
|
end
|
|
523
545
|
|
|
@@ -555,6 +577,7 @@ module ActiveMerchant #:nodoc:
|
|
|
555
577
|
|
|
556
578
|
def add_browser_info(browser_info, post)
|
|
557
579
|
return unless browser_info
|
|
580
|
+
|
|
558
581
|
post[:browserInfo] = {
|
|
559
582
|
acceptHeader: browser_info[:accept_header],
|
|
560
583
|
colorDepth: browser_info[:depth],
|
|
@@ -141,7 +141,8 @@ module ActiveMerchant #:nodoc:
|
|
|
141
141
|
raw_response = ssl_post(url(action), post.to_json, headers)
|
|
142
142
|
response = parse(raw_response)
|
|
143
143
|
rescue ResponseError => e
|
|
144
|
-
raise unless
|
|
144
|
+
raise unless e.response.code.to_s =~ /4\d\d/
|
|
145
|
+
|
|
145
146
|
response = parse(e.response.body)
|
|
146
147
|
end
|
|
147
148
|
|
|
@@ -199,7 +200,6 @@ module ActiveMerchant #:nodoc:
|
|
|
199
200
|
response['message'] || 'Unable to read error message'
|
|
200
201
|
end
|
|
201
202
|
end
|
|
202
|
-
|
|
203
203
|
end
|
|
204
204
|
end
|
|
205
205
|
end
|
|
@@ -8,7 +8,7 @@ module ActiveMerchant
|
|
|
8
8
|
self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
|
|
9
9
|
self.live_url = 'https://api2.authorize.net/xml/v1/request.api'
|
|
10
10
|
|
|
11
|
-
self.supported_countries = %w(
|
|
11
|
+
self.supported_countries = %w(AU CA US)
|
|
12
12
|
self.default_currency = 'USD'
|
|
13
13
|
self.money_format = :dollars
|
|
14
14
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
|
|
@@ -390,6 +390,7 @@ module ActiveMerchant
|
|
|
390
390
|
|
|
391
391
|
def add_payment_source(xml, source, options, action = nil)
|
|
392
392
|
return unless source
|
|
393
|
+
|
|
393
394
|
if source.is_a?(String)
|
|
394
395
|
add_token_payment_method(xml, source, options)
|
|
395
396
|
elsif card_brand(source) == 'check'
|
|
@@ -517,6 +518,7 @@ module ActiveMerchant
|
|
|
517
518
|
|
|
518
519
|
def add_market_type_device_type(xml, payment, options)
|
|
519
520
|
return if payment.is_a?(String) || card_brand(payment) == 'check' || card_brand(payment) == 'apple_pay'
|
|
521
|
+
|
|
520
522
|
if valid_track_data
|
|
521
523
|
xml.retail do
|
|
522
524
|
xml.marketType(options[:market_type] || MARKET_TYPE[:retail])
|
|
@@ -841,17 +843,17 @@ module ActiveMerchant
|
|
|
841
843
|
|
|
842
844
|
response = {action: action}
|
|
843
845
|
|
|
844
|
-
response[:response_code] = if(element = doc.at_xpath('//transactionResponse/responseCode'))
|
|
846
|
+
response[:response_code] = if (element = doc.at_xpath('//transactionResponse/responseCode'))
|
|
845
847
|
empty?(element.content) ? nil : element.content.to_i
|
|
846
848
|
end
|
|
847
849
|
|
|
848
|
-
if(element = doc.at_xpath('//errors/error'))
|
|
850
|
+
if (element = doc.at_xpath('//errors/error'))
|
|
849
851
|
response[:response_reason_code] = element.at_xpath('errorCode').content[/0*(\d+)$/, 1]
|
|
850
852
|
response[:response_reason_text] = element.at_xpath('errorText').content.chomp('.')
|
|
851
|
-
elsif(element = doc.at_xpath('//transactionResponse/messages/message'))
|
|
853
|
+
elsif (element = doc.at_xpath('//transactionResponse/messages/message'))
|
|
852
854
|
response[:response_reason_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
|
|
853
855
|
response[:response_reason_text] = element.at_xpath('description').content.chomp('.')
|
|
854
|
-
elsif(element = doc.at_xpath('//messages/message'))
|
|
856
|
+
elsif (element = doc.at_xpath('//messages/message'))
|
|
855
857
|
response[:response_reason_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
|
|
856
858
|
response[:response_reason_text] = element.at_xpath('text').content.chomp('.')
|
|
857
859
|
else
|
|
@@ -860,7 +862,7 @@ module ActiveMerchant
|
|
|
860
862
|
end
|
|
861
863
|
|
|
862
864
|
response[:avs_result_code] =
|
|
863
|
-
if(element = doc.at_xpath('//avsResultCode'))
|
|
865
|
+
if (element = doc.at_xpath('//avsResultCode'))
|
|
864
866
|
empty?(element.content) ? nil : element.content
|
|
865
867
|
end
|
|
866
868
|
|
|
@@ -960,7 +962,7 @@ module ActiveMerchant
|
|
|
960
962
|
if response[:response_code] == DECLINED
|
|
961
963
|
if CARD_CODE_ERRORS.include?(cvv_result.code)
|
|
962
964
|
return cvv_result.message
|
|
963
|
-
elsif
|
|
965
|
+
elsif AVS_REASON_CODES.include?(response[:response_reason_code]) && AVS_ERRORS.include?(avs_result.code)
|
|
964
966
|
return avs_result.message
|
|
965
967
|
end
|
|
966
968
|
end
|
|
@@ -1007,7 +1009,7 @@ module ActiveMerchant
|
|
|
1007
1009
|
end
|
|
1008
1010
|
|
|
1009
1011
|
def parse_direct_response_elements(response, options)
|
|
1010
|
-
params = response[:direct_response]
|
|
1012
|
+
params = response[:direct_response]&.tr('"', '')
|
|
1011
1013
|
return {} unless params
|
|
1012
1014
|
|
|
1013
1015
|
parts = params.split(options[:delimiter] || ',')
|
|
@@ -1059,7 +1061,6 @@ module ActiveMerchant
|
|
|
1059
1061
|
balance_on_card: parts[54] || '',
|
|
1060
1062
|
}
|
|
1061
1063
|
end
|
|
1062
|
-
|
|
1063
1064
|
end
|
|
1064
1065
|
end
|
|
1065
1066
|
end
|