activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -8,10 +8,10 @@ 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
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro]
|
15
15
|
|
16
16
|
self.homepage_url = 'http://www.authorize.net/'
|
17
17
|
self.display_name = 'Authorize.Net'
|
@@ -54,25 +54,25 @@ module ActiveMerchant
|
|
54
54
|
'37' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
55
55
|
'378' => STANDARD_ERROR_CODE[:invalid_cvc],
|
56
56
|
'38' => STANDARD_ERROR_CODE[:expired_card],
|
57
|
-
'384' => STANDARD_ERROR_CODE[:config_error]
|
57
|
+
'384' => STANDARD_ERROR_CODE[:config_error]
|
58
58
|
}
|
59
59
|
|
60
60
|
MARKET_TYPE = {
|
61
|
-
:
|
62
|
-
:
|
61
|
+
moto: '1',
|
62
|
+
retail: '2'
|
63
63
|
}
|
64
64
|
|
65
65
|
DEVICE_TYPE = {
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
66
|
+
unknown: '1',
|
67
|
+
unattended_terminal: '2',
|
68
|
+
self_service_terminal: '3',
|
69
|
+
electronic_cash_register: '4',
|
70
|
+
personal_computer_terminal: '5',
|
71
|
+
airpay: '6',
|
72
|
+
wireless_pos: '7',
|
73
|
+
website: '8',
|
74
|
+
dial_terminal: '9',
|
75
|
+
virtual_terminal: '10'
|
76
76
|
}
|
77
77
|
|
78
78
|
class_attribute :duplicate_window
|
@@ -85,16 +85,15 @@ module ActiveMerchant
|
|
85
85
|
AVS_REASON_CODES = %w(27 45)
|
86
86
|
|
87
87
|
TRACKS = {
|
88
|
-
|
89
|
-
|
88
|
+
1 => /^%(?<format_code>.)(?<pan>[\d]{1,19}+)\^(?<name>.{2,26})\^(?<expiration>[\d]{0,4}|\^)(?<service_code>[\d]{0,3}|\^)(?<discretionary_data>.*)\?\Z/,
|
89
|
+
2 => /\A;(?<pan>[\d]{1,19}+)=(?<expiration>[\d]{0,4}|=)(?<service_code>[\d]{0,3}|=)(?<discretionary_data>.*)\?\Z/
|
90
90
|
}.freeze
|
91
91
|
|
92
92
|
APPLE_PAY_DATA_DESCRIPTOR = 'COMMON.APPLE.INAPP.PAYMENT'
|
93
|
-
|
94
93
|
PAYMENT_METHOD_NOT_SUPPORTED_ERROR = '155'
|
95
94
|
INELIGIBLE_FOR_ISSUING_CREDIT_ERROR = '54'
|
96
95
|
|
97
|
-
def initialize(options={})
|
96
|
+
def initialize(options = {})
|
98
97
|
requires!(options, :login, :password)
|
99
98
|
super
|
100
99
|
end
|
@@ -111,7 +110,7 @@ module ActiveMerchant
|
|
111
110
|
end
|
112
111
|
end
|
113
112
|
|
114
|
-
def authorize(amount, payment, options={})
|
113
|
+
def authorize(amount, payment, options = {})
|
115
114
|
if payment.is_a?(String)
|
116
115
|
commit(:cim_authorize, options) do |xml|
|
117
116
|
add_cim_auth_purchase(xml, 'profileTransAuthOnly', amount, payment, options)
|
@@ -123,7 +122,7 @@ module ActiveMerchant
|
|
123
122
|
end
|
124
123
|
end
|
125
124
|
|
126
|
-
def capture(amount, authorization, options={})
|
125
|
+
def capture(amount, authorization, options = {})
|
127
126
|
if auth_was_for_cim?(authorization)
|
128
127
|
cim_capture(amount, authorization, options)
|
129
128
|
else
|
@@ -131,12 +130,13 @@ module ActiveMerchant
|
|
131
130
|
end
|
132
131
|
end
|
133
132
|
|
134
|
-
def refund(amount, authorization, options={})
|
135
|
-
response =
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
133
|
+
def refund(amount, authorization, options = {})
|
134
|
+
response =
|
135
|
+
if auth_was_for_cim?(authorization)
|
136
|
+
cim_refund(amount, authorization, options)
|
137
|
+
else
|
138
|
+
normal_refund(amount, authorization, options)
|
139
|
+
end
|
140
140
|
|
141
141
|
return response if response.success?
|
142
142
|
return response unless options[:force_full_refund_if_unsettled]
|
@@ -148,7 +148,7 @@ module ActiveMerchant
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
def void(authorization, options={})
|
151
|
+
def void(authorization, options = {})
|
152
152
|
if auth_was_for_cim?(authorization)
|
153
153
|
cim_void(authorization, options)
|
154
154
|
else
|
@@ -156,10 +156,8 @@ module ActiveMerchant
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
def credit(amount, payment, options={})
|
160
|
-
if payment.is_a?(String)
|
161
|
-
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.'
|
162
|
-
end
|
159
|
+
def credit(amount, payment, options = {})
|
160
|
+
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if payment.is_a?(String)
|
163
161
|
|
164
162
|
commit(:credit) do |xml|
|
165
163
|
add_order_id(xml, options)
|
@@ -177,11 +175,29 @@ module ActiveMerchant
|
|
177
175
|
end
|
178
176
|
end
|
179
177
|
|
180
|
-
def verify(
|
178
|
+
def verify(payment_method, options = {})
|
179
|
+
amount = amount_for_verify(options)
|
180
|
+
|
181
181
|
MultiResponse.run(:use_first_response) do |r|
|
182
|
-
r.process { authorize(
|
183
|
-
r.process(:ignore_result) { void(r.authorization, options) }
|
182
|
+
r.process { authorize(amount, payment_method, options) }
|
183
|
+
r.process(:ignore_result) { void(r.authorization, options) } unless amount == 0
|
184
184
|
end
|
185
|
+
rescue ArgumentError => e
|
186
|
+
Response.new(false, e.message)
|
187
|
+
end
|
188
|
+
|
189
|
+
def amount_for_verify(options)
|
190
|
+
return 100 unless options[:verify_amount].present?
|
191
|
+
|
192
|
+
amount = options[:verify_amount]
|
193
|
+
raise ArgumentError.new 'verify_amount value must be an integer' unless amount.is_a?(Integer) && !amount.negative? || amount.is_a?(String) && amount.match?(/^\d+$/) && !amount.to_i.negative?
|
194
|
+
raise ArgumentError.new 'Billing address including zip code is required for a 0 amount verify' if amount.to_i.zero? && !validate_billing_address_values?(options)
|
195
|
+
|
196
|
+
amount.to_i
|
197
|
+
end
|
198
|
+
|
199
|
+
def validate_billing_address_values?(options)
|
200
|
+
options.dig(:billing_address, :zip).present? && options.dig(:billing_address, :address1).present?
|
185
201
|
end
|
186
202
|
|
187
203
|
def store(credit_card, options = {})
|
@@ -193,7 +209,7 @@ module ActiveMerchant
|
|
193
209
|
end
|
194
210
|
|
195
211
|
def unstore(authorization)
|
196
|
-
customer_profile_id,
|
212
|
+
customer_profile_id, = split_authorization(authorization)
|
197
213
|
|
198
214
|
delete_customer_profile(customer_profile_id)
|
199
215
|
end
|
@@ -222,13 +238,13 @@ module ActiveMerchant
|
|
222
238
|
|
223
239
|
def supports_network_tokenization?
|
224
240
|
card = Billing::NetworkTokenizationCreditCard.new({
|
225
|
-
:
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
241
|
+
number: '4111111111111111',
|
242
|
+
month: 12,
|
243
|
+
year: 20,
|
244
|
+
first_name: 'John',
|
245
|
+
last_name: 'Smith',
|
246
|
+
brand: 'visa',
|
247
|
+
payment_cryptogram: 'EHuWW9PiBkWvqE5juRwDzAUFBAk='
|
232
248
|
})
|
233
249
|
|
234
250
|
request = post_data(:authorize) do |xml|
|
@@ -258,6 +274,8 @@ module ActiveMerchant
|
|
258
274
|
add_settings(xml, payment, options)
|
259
275
|
add_user_fields(xml, amount, options)
|
260
276
|
add_ship_from_address(xml, options)
|
277
|
+
add_processing_options(xml, options)
|
278
|
+
add_subsequent_auth_information(xml, options)
|
261
279
|
end
|
262
280
|
end
|
263
281
|
|
@@ -312,7 +330,7 @@ module ActiveMerchant
|
|
312
330
|
end
|
313
331
|
|
314
332
|
def cim_refund(amount, authorization, options)
|
315
|
-
transaction_id, card_number,
|
333
|
+
transaction_id, card_number, = split_authorization(authorization)
|
316
334
|
|
317
335
|
commit(:cim_refund, options) do |xml|
|
318
336
|
add_order_id(xml, options)
|
@@ -332,7 +350,7 @@ module ActiveMerchant
|
|
332
350
|
end
|
333
351
|
|
334
352
|
def normal_refund(amount, authorization, options)
|
335
|
-
transaction_id, card_number,
|
353
|
+
transaction_id, card_number, = split_authorization(authorization)
|
336
354
|
|
337
355
|
commit(:refund) do |xml|
|
338
356
|
xml.transactionRequest do
|
@@ -344,7 +362,7 @@ module ActiveMerchant
|
|
344
362
|
xml.accountType(options[:account_type])
|
345
363
|
xml.routingNumber(options[:routing_number])
|
346
364
|
xml.accountNumber(options[:account_number])
|
347
|
-
xml.nameOnAccount("#{options[:first_name]} #{options[:last_name]}")
|
365
|
+
xml.nameOnAccount(truncate("#{options[:first_name]} #{options[:last_name]}", 22))
|
348
366
|
end
|
349
367
|
else
|
350
368
|
xml.creditCard do
|
@@ -391,6 +409,7 @@ module ActiveMerchant
|
|
391
409
|
|
392
410
|
def add_payment_source(xml, source, options, action = nil)
|
393
411
|
return unless source
|
412
|
+
|
394
413
|
if source.is_a?(String)
|
395
414
|
add_token_payment_method(xml, source, options)
|
396
415
|
elsif card_brand(source) == 'check'
|
@@ -408,7 +427,7 @@ module ActiveMerchant
|
|
408
427
|
|
409
428
|
def add_settings(xml, source, options)
|
410
429
|
xml.transactionSettings do
|
411
|
-
if options[:recurring]
|
430
|
+
if options[:recurring] || subsequent_recurring_transaction?(options)
|
412
431
|
xml.setting do
|
413
432
|
xml.settingName('recurringBilling')
|
414
433
|
xml.settingValue('true')
|
@@ -479,12 +498,8 @@ module ActiveMerchant
|
|
479
498
|
xml.creditCard do
|
480
499
|
xml.cardNumber(truncate(credit_card.number, 16))
|
481
500
|
xml.expirationDate(format(credit_card.month, :two_digits) + '/' + format(credit_card.year, :four_digits))
|
482
|
-
if credit_card.valid_card_verification_value?(credit_card.verification_value, credit_card.brand)
|
483
|
-
|
484
|
-
end
|
485
|
-
if credit_card.is_a?(NetworkTokenizationCreditCard) && action != :credit
|
486
|
-
xml.cryptogram(credit_card.payment_cryptogram)
|
487
|
-
end
|
501
|
+
xml.cardCode(credit_card.verification_value) if credit_card.valid_card_verification_value?(credit_card.verification_value, credit_card.brand)
|
502
|
+
xml.cryptogram(credit_card.payment_cryptogram) if credit_card.is_a?(NetworkTokenizationCreditCard) && action != :credit
|
488
503
|
end
|
489
504
|
end
|
490
505
|
end
|
@@ -492,7 +507,7 @@ module ActiveMerchant
|
|
492
507
|
|
493
508
|
def add_swipe_data(xml, credit_card)
|
494
509
|
TRACKS.each do |key, regex|
|
495
|
-
if regex.match(credit_card.track_data)
|
510
|
+
if regex.match?(credit_card.track_data)
|
496
511
|
@valid_track_data = true
|
497
512
|
xml.payment do
|
498
513
|
xml.trackData do
|
@@ -504,7 +519,7 @@ module ActiveMerchant
|
|
504
519
|
end
|
505
520
|
|
506
521
|
def add_token_payment_method(xml, token, options)
|
507
|
-
customer_profile_id, customer_payment_profile_id,
|
522
|
+
customer_profile_id, customer_payment_profile_id, = split_authorization(token)
|
508
523
|
customer_profile_id = options[:customer_profile_id] if options[:customer_profile_id]
|
509
524
|
customer_payment_profile_id = options[:customer_payment_profile_id] if options[:customer_payment_profile_id]
|
510
525
|
xml.customerProfileId(customer_profile_id)
|
@@ -522,6 +537,7 @@ module ActiveMerchant
|
|
522
537
|
|
523
538
|
def add_market_type_device_type(xml, payment, options)
|
524
539
|
return if payment.is_a?(String) || card_brand(payment) == 'check' || card_brand(payment) == 'apple_pay'
|
540
|
+
|
525
541
|
if valid_track_data
|
526
542
|
xml.retail do
|
527
543
|
xml.marketType(options[:market_type] || MARKET_TYPE[:retail])
|
@@ -547,6 +563,7 @@ module ActiveMerchant
|
|
547
563
|
def add_check(xml, check)
|
548
564
|
xml.payment do
|
549
565
|
xml.bankAccount do
|
566
|
+
xml.accountType(check.account_type)
|
550
567
|
xml.routingNumber(check.routing_number)
|
551
568
|
xml.accountNumber(check.account_number)
|
552
569
|
xml.nameOnAccount(truncate(check.name, 22))
|
@@ -567,12 +584,16 @@ module ActiveMerchant
|
|
567
584
|
|
568
585
|
xml.customerIP(options[:ip]) unless empty?(options[:ip])
|
569
586
|
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
587
|
+
if !empty?(options.fetch(:three_d_secure, {})) || options[:authentication_indicator] || options[:cardholder_authentication_value]
|
588
|
+
xml.cardholderAuthentication do
|
589
|
+
three_d_secure = options.fetch(:three_d_secure, {})
|
590
|
+
xml.authenticationIndicator(
|
591
|
+
options[:authentication_indicator] || three_d_secure[:eci]
|
592
|
+
)
|
593
|
+
xml.cardholderAuthenticationValue(
|
594
|
+
options[:cardholder_authentication_value] || three_d_secure[:cavv]
|
595
|
+
)
|
596
|
+
end
|
576
597
|
end
|
577
598
|
end
|
578
599
|
|
@@ -583,6 +604,7 @@ module ActiveMerchant
|
|
583
604
|
first_name, last_name = names_from(payment_source, address, options)
|
584
605
|
state = state_from(address, options)
|
585
606
|
full_address = "#{address[:address1]} #{address[:address2]}".strip
|
607
|
+
phone = address[:phone] || address[:phone_number] || ''
|
586
608
|
|
587
609
|
xml.firstName(truncate(first_name, 50)) unless empty?(first_name)
|
588
610
|
xml.lastName(truncate(last_name, 50)) unless empty?(last_name)
|
@@ -592,21 +614,22 @@ module ActiveMerchant
|
|
592
614
|
xml.state(truncate(state, 40))
|
593
615
|
xml.zip(truncate((address[:zip] || options[:zip]), 20))
|
594
616
|
xml.country(truncate(address[:country], 60))
|
595
|
-
xml.phoneNumber(truncate(
|
617
|
+
xml.phoneNumber(truncate(phone, 25)) unless empty?(phone)
|
596
618
|
xml.faxNumber(truncate(address[:fax], 25)) unless empty?(address[:fax])
|
597
619
|
end
|
598
620
|
end
|
599
621
|
|
600
|
-
def add_shipping_address(xml, options, root_node='shipTo')
|
622
|
+
def add_shipping_address(xml, options, root_node = 'shipTo')
|
601
623
|
address = options[:shipping_address] || options[:address]
|
602
624
|
return unless address
|
603
625
|
|
604
626
|
xml.send(root_node) do
|
605
|
-
first_name, last_name =
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
627
|
+
first_name, last_name =
|
628
|
+
if address[:name]
|
629
|
+
split_names(address[:name])
|
630
|
+
else
|
631
|
+
[address[:first_name], address[:last_name]]
|
632
|
+
end
|
610
633
|
full_address = "#{address[:address1]} #{address[:address2]}".strip
|
611
634
|
|
612
635
|
xml.firstName(truncate(first_name, 50)) unless empty?(first_name)
|
@@ -620,7 +643,7 @@ module ActiveMerchant
|
|
620
643
|
end
|
621
644
|
end
|
622
645
|
|
623
|
-
def add_ship_from_address(xml, options, root_node='shipFrom')
|
646
|
+
def add_ship_from_address(xml, options, root_node = 'shipFrom')
|
624
647
|
address = options[:ship_from_address]
|
625
648
|
return unless address
|
626
649
|
|
@@ -701,6 +724,31 @@ module ActiveMerchant
|
|
701
724
|
xml.extraOptions("x_delim_char=#{options[:delimiter]}") if options[:delimiter]
|
702
725
|
end
|
703
726
|
|
727
|
+
def add_processing_options(xml, options)
|
728
|
+
return unless options[:stored_credential]
|
729
|
+
|
730
|
+
xml.processingOptions do
|
731
|
+
if options[:stored_credential][:initial_transaction] && options[:stored_credential][:reason_type] == 'recurring'
|
732
|
+
xml.isFirstRecurringPayment 'true'
|
733
|
+
elsif options[:stored_credential][:initial_transaction]
|
734
|
+
xml.isFirstSubsequentAuth 'true'
|
735
|
+
elsif options[:stored_credential][:initiator] == 'cardholder'
|
736
|
+
xml.isStoredCredentials 'true'
|
737
|
+
else
|
738
|
+
xml.isSubsequentAuth 'true'
|
739
|
+
end
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
def add_subsequent_auth_information(xml, options)
|
744
|
+
return unless options.dig(:stored_credential, :initiator) == 'merchant'
|
745
|
+
|
746
|
+
xml.subsequentAuthInformation do
|
747
|
+
xml.reason options[:stored_credential_reason_type_override] if options[:stored_credential_reason_type_override]
|
748
|
+
xml.originalNetworkTransId options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
704
752
|
def create_customer_payment_profile(credit_card, options)
|
705
753
|
commit(:cim_store_update, options) do |xml|
|
706
754
|
xml.customerProfileId options[:customer_profile_id]
|
@@ -756,13 +804,17 @@ module ActiveMerchant
|
|
756
804
|
end
|
757
805
|
|
758
806
|
def state_from(address, options)
|
759
|
-
if [
|
807
|
+
if %w[US CA].include?(address[:country])
|
760
808
|
address[:state] || 'NC'
|
761
809
|
else
|
762
810
|
address[:state] || 'n/a'
|
763
811
|
end
|
764
812
|
end
|
765
813
|
|
814
|
+
def subsequent_recurring_transaction?(options)
|
815
|
+
options.dig(:stored_credential, :reason_type) == 'recurring' && !options.dig(:stored_credential, :initial_transaction)
|
816
|
+
end
|
817
|
+
|
766
818
|
def headers
|
767
819
|
{ 'Content-Type' => 'text/xml' }
|
768
820
|
end
|
@@ -772,7 +824,7 @@ module ActiveMerchant
|
|
772
824
|
end
|
773
825
|
|
774
826
|
def parse(action, raw_response, options = {})
|
775
|
-
if
|
827
|
+
if cim_action?(action) || action == :verify_credentials
|
776
828
|
parse_cim(raw_response, options)
|
777
829
|
else
|
778
830
|
parse_normal(action, raw_response)
|
@@ -803,7 +855,7 @@ module ActiveMerchant
|
|
803
855
|
end
|
804
856
|
end
|
805
857
|
|
806
|
-
def
|
858
|
+
def cim_action?(action)
|
807
859
|
action.to_s.start_with?('cim')
|
808
860
|
end
|
809
861
|
|
@@ -825,7 +877,7 @@ module ActiveMerchant
|
|
825
877
|
'deleteCustomerProfileRequest'
|
826
878
|
elsif action == :verify_credentials
|
827
879
|
'authenticateTestRequest'
|
828
|
-
elsif
|
880
|
+
elsif cim_action?(action)
|
829
881
|
'createCustomerProfileTransactionRequest'
|
830
882
|
else
|
831
883
|
'createTransactionRequest'
|
@@ -843,19 +895,19 @@ module ActiveMerchant
|
|
843
895
|
doc = Nokogiri::XML(body)
|
844
896
|
doc.remove_namespaces!
|
845
897
|
|
846
|
-
response = {action: action}
|
898
|
+
response = { action: action }
|
847
899
|
|
848
|
-
response[:response_code] = if(element = doc.at_xpath('//transactionResponse/responseCode'))
|
849
|
-
|
850
|
-
|
900
|
+
response[:response_code] = if (element = doc.at_xpath('//transactionResponse/responseCode'))
|
901
|
+
empty?(element.content) ? nil : element.content.to_i
|
902
|
+
end
|
851
903
|
|
852
|
-
if(element = doc.at_xpath('//errors/error'))
|
904
|
+
if (element = doc.at_xpath('//errors/error'))
|
853
905
|
response[:response_reason_code] = element.at_xpath('errorCode').content[/0*(\d+)$/, 1]
|
854
906
|
response[:response_reason_text] = element.at_xpath('errorText').content.chomp('.')
|
855
|
-
elsif(element = doc.at_xpath('//transactionResponse/messages/message'))
|
907
|
+
elsif (element = doc.at_xpath('//transactionResponse/messages/message'))
|
856
908
|
response[:response_reason_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
|
857
909
|
response[:response_reason_text] = element.at_xpath('description').content.chomp('.')
|
858
|
-
elsif(element = doc.at_xpath('//messages/message'))
|
910
|
+
elsif (element = doc.at_xpath('//messages/message'))
|
859
911
|
response[:response_reason_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
|
860
912
|
response[:response_reason_text] = element.at_xpath('text').content.chomp('.')
|
861
913
|
else
|
@@ -863,37 +915,50 @@ module ActiveMerchant
|
|
863
915
|
response[:response_reason_text] = ''
|
864
916
|
end
|
865
917
|
|
866
|
-
response[:avs_result_code] =
|
867
|
-
|
868
|
-
|
918
|
+
response[:avs_result_code] =
|
919
|
+
if (element = doc.at_xpath('//avsResultCode'))
|
920
|
+
empty?(element.content) ? nil : element.content
|
921
|
+
end
|
869
922
|
|
870
|
-
response[:transaction_id] =
|
871
|
-
|
872
|
-
|
923
|
+
response[:transaction_id] =
|
924
|
+
if element = doc.at_xpath('//transId')
|
925
|
+
empty?(element.content) ? nil : element.content
|
926
|
+
end
|
873
927
|
|
874
|
-
response[:card_code] =
|
875
|
-
|
876
|
-
|
928
|
+
response[:card_code] =
|
929
|
+
if element = doc.at_xpath('//cvvResultCode')
|
930
|
+
empty?(element.content) ? nil : element.content
|
931
|
+
end
|
877
932
|
|
878
|
-
response[:authorization_code] =
|
879
|
-
|
880
|
-
|
933
|
+
response[:authorization_code] =
|
934
|
+
if element = doc.at_xpath('//authCode')
|
935
|
+
empty?(element.content) ? nil : element.content
|
936
|
+
end
|
881
937
|
|
882
|
-
response[:cardholder_authentication_code] =
|
883
|
-
|
884
|
-
|
938
|
+
response[:cardholder_authentication_code] =
|
939
|
+
if element = doc.at_xpath('//cavvResultCode')
|
940
|
+
empty?(element.content) ? nil : element.content
|
941
|
+
end
|
885
942
|
|
886
|
-
response[:account_number] =
|
887
|
-
|
888
|
-
|
943
|
+
response[:account_number] =
|
944
|
+
if element = doc.at_xpath('//accountNumber')
|
945
|
+
empty?(element.content) ? nil : element.content[-4..-1]
|
946
|
+
end
|
889
947
|
|
890
|
-
response[:test_request] =
|
891
|
-
|
892
|
-
|
948
|
+
response[:test_request] =
|
949
|
+
if element = doc.at_xpath('//testRequest')
|
950
|
+
empty?(element.content) ? nil : element.content
|
951
|
+
end
|
893
952
|
|
894
|
-
response[:full_response_code] =
|
895
|
-
|
896
|
-
|
953
|
+
response[:full_response_code] =
|
954
|
+
if element = doc.at_xpath('//messages/message/code')
|
955
|
+
empty?(element.content) ? nil : element.content
|
956
|
+
end
|
957
|
+
|
958
|
+
response[:network_trans_id] =
|
959
|
+
if element = doc.at_xpath('//networkTransId')
|
960
|
+
empty?(element.content) ? nil : element.content
|
961
|
+
end
|
897
962
|
|
898
963
|
response
|
899
964
|
end
|
@@ -903,35 +968,41 @@ module ActiveMerchant
|
|
903
968
|
|
904
969
|
doc = Nokogiri::XML(body).remove_namespaces!
|
905
970
|
|
906
|
-
if
|
971
|
+
if element = doc.at_xpath('//messages/message')
|
907
972
|
response[:message_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
|
908
973
|
response[:message_text] = element.at_xpath('text').content.chomp('.')
|
909
974
|
end
|
910
975
|
|
911
|
-
response[:result_code] =
|
912
|
-
|
913
|
-
|
976
|
+
response[:result_code] =
|
977
|
+
if element = doc.at_xpath('//messages/resultCode')
|
978
|
+
empty?(element.content) ? nil : element.content
|
979
|
+
end
|
914
980
|
|
915
|
-
response[:test_request] =
|
916
|
-
|
917
|
-
|
981
|
+
response[:test_request] =
|
982
|
+
if element = doc.at_xpath('//testRequest')
|
983
|
+
empty?(element.content) ? nil : element.content
|
984
|
+
end
|
918
985
|
|
919
|
-
response[:customer_profile_id] =
|
920
|
-
|
921
|
-
|
986
|
+
response[:customer_profile_id] =
|
987
|
+
if element = doc.at_xpath('//customerProfileId')
|
988
|
+
empty?(element.content) ? nil : element.content
|
989
|
+
end
|
922
990
|
|
923
|
-
response[:customer_payment_profile_id] =
|
924
|
-
|
925
|
-
|
991
|
+
response[:customer_payment_profile_id] =
|
992
|
+
if element = doc.at_xpath('//customerPaymentProfileIdList/numericString')
|
993
|
+
empty?(element.content) ? nil : element.content
|
994
|
+
end
|
926
995
|
|
927
|
-
response[:customer_payment_profile_id] =
|
928
|
-
|
929
|
-
|
930
|
-
|
996
|
+
response[:customer_payment_profile_id] =
|
997
|
+
if element = doc.at_xpath('//customerPaymentProfileIdList/numericString') ||
|
998
|
+
doc.at_xpath('//customerPaymentProfileId')
|
999
|
+
empty?(element.content) ? nil : element.content
|
1000
|
+
end
|
931
1001
|
|
932
|
-
response[:direct_response] =
|
933
|
-
|
934
|
-
|
1002
|
+
response[:direct_response] =
|
1003
|
+
if element = doc.at_xpath('//directResponse')
|
1004
|
+
empty?(element.content) ? nil : element.content
|
1005
|
+
end
|
935
1006
|
|
936
1007
|
response.merge!(parse_direct_response_elements(response, options))
|
937
1008
|
|
@@ -950,7 +1021,7 @@ module ActiveMerchant
|
|
950
1021
|
if response[:response_code] == DECLINED
|
951
1022
|
if CARD_CODE_ERRORS.include?(cvv_result.code)
|
952
1023
|
return cvv_result.message
|
953
|
-
elsif
|
1024
|
+
elsif AVS_REASON_CODES.include?(response[:response_reason_code]) && AVS_ERRORS.include?(avs_result.code)
|
954
1025
|
return avs_result.message
|
955
1026
|
end
|
956
1027
|
end
|
@@ -975,7 +1046,7 @@ module ActiveMerchant
|
|
975
1046
|
end
|
976
1047
|
|
977
1048
|
def transaction_id_from(authorization)
|
978
|
-
transaction_id,
|
1049
|
+
transaction_id, = split_authorization(authorization)
|
979
1050
|
transaction_id
|
980
1051
|
end
|
981
1052
|
|
@@ -993,11 +1064,11 @@ module ActiveMerchant
|
|
993
1064
|
|
994
1065
|
def auth_was_for_cim?(authorization)
|
995
1066
|
_, _, action = split_authorization(authorization)
|
996
|
-
action &&
|
1067
|
+
action && cim_action?(action)
|
997
1068
|
end
|
998
1069
|
|
999
1070
|
def parse_direct_response_elements(response, options)
|
1000
|
-
params = response[:direct_response]
|
1071
|
+
params = response[:direct_response]&.tr('"', '')
|
1001
1072
|
return {} unless params
|
1002
1073
|
|
1003
1074
|
parts = params.split(options[:delimiter] || ',')
|
@@ -1046,10 +1117,9 @@ module ActiveMerchant
|
|
1046
1117
|
card_type: parts[51] || '',
|
1047
1118
|
split_tender_id: parts[52] || '',
|
1048
1119
|
requested_amount: parts[53] || '',
|
1049
|
-
balance_on_card: parts[54] || ''
|
1120
|
+
balance_on_card: parts[54] || ''
|
1050
1121
|
}
|
1051
1122
|
end
|
1052
|
-
|
1053
1123
|
end
|
1054
1124
|
end
|
1055
1125
|
end
|