activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
1
3
|
module ActiveMerchant #:nodoc:
|
2
4
|
module Billing #:nodoc:
|
3
5
|
class WorldpayGateway < Gateway
|
@@ -6,10 +8,25 @@ module ActiveMerchant #:nodoc:
|
|
6
8
|
|
7
9
|
self.default_currency = 'GBP'
|
8
10
|
self.money_format = :cents
|
9
|
-
self.supported_countries = %w(
|
10
|
-
|
11
|
+
self.supported_countries = %w(AD AE AG AI AL AM AO AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BM BN BO BR BS BT BW
|
12
|
+
BY BZ CA CC CF CH CK CL CM CN CO CR CV CX CY CZ DE DJ DK DO DZ EC EE EG EH ES ET FI FJ FK
|
13
|
+
FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GT GU GW GY HK HM HN HR HT HU ID IE IL
|
14
|
+
IM IN IO IS IT JE JM JO JP KE KG KH KI KM KN KR KW KY KZ LA LC LI LK LS LT LU LV MA MC MD
|
15
|
+
ME MG MH MK ML MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ
|
16
|
+
OM PA PE PF PH PK PL PN PR PT PW PY QA RE RO RS RU RW SA SB SC SE SG SI SK SL SM SN ST SV
|
17
|
+
SZ TC TD TF TG TH TJ TK TM TO TR TT TV TW TZ UA UG US UY UZ VA VC VE VI VN VU WF WS YE YT
|
18
|
+
ZA ZM)
|
19
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb maestro elo naranja cabal unionpay]
|
20
|
+
self.currencies_without_fractions = %w(HUF IDR JPY KRW BEF XOF XAF XPF GRD GNF ITL LUF MGA MGF PYG PTE RWF ESP TRL VND KMF)
|
21
|
+
self.currencies_with_three_decimal_places = %w(BHD KWD OMR TND LYD JOD IQD)
|
11
22
|
self.homepage_url = 'http://www.worldpay.com/'
|
12
|
-
self.display_name = 'Worldpay'
|
23
|
+
self.display_name = 'Worldpay Global'
|
24
|
+
|
25
|
+
NETWORK_TOKEN_TYPE = {
|
26
|
+
apple_pay: 'APPLEPAY',
|
27
|
+
google_pay: 'GOOGLEPAY',
|
28
|
+
network_token: 'NETWORKTOKEN'
|
29
|
+
}
|
13
30
|
|
14
31
|
CARD_CODES = {
|
15
32
|
'visa' => 'VISA-SSL',
|
@@ -18,9 +35,32 @@ module ActiveMerchant #:nodoc:
|
|
18
35
|
'american_express' => 'AMEX-SSL',
|
19
36
|
'jcb' => 'JCB-SSL',
|
20
37
|
'maestro' => 'MAESTRO-SSL',
|
21
|
-
'laser' => 'LASER-SSL',
|
22
38
|
'diners_club' => 'DINERS-SSL',
|
23
|
-
'
|
39
|
+
'elo' => 'ELO-SSL',
|
40
|
+
'naranja' => 'NARANJA-SSL',
|
41
|
+
'cabal' => 'CABAL-SSL',
|
42
|
+
'unionpay' => 'CHINAUNIONPAY-SSL',
|
43
|
+
'unknown' => 'CARD-SSL'
|
44
|
+
}
|
45
|
+
|
46
|
+
AVS_CODE_MAP = {
|
47
|
+
'A' => 'M', # Match
|
48
|
+
'B' => 'P', # Postcode matches, address not verified
|
49
|
+
'C' => 'Z', # Postcode matches, address does not match
|
50
|
+
'D' => 'B', # Address matched; postcode not checked
|
51
|
+
'E' => 'I', # Address and postal code not checked
|
52
|
+
'F' => 'A', # Address matches, postcode does not match
|
53
|
+
'G' => 'C', # Address does not match, postcode not checked
|
54
|
+
'H' => 'I', # Address and postcode not provided
|
55
|
+
'I' => 'C', # Address not checked postcode does not match
|
56
|
+
'J' => 'C', # Address and postcode does not match
|
57
|
+
}
|
58
|
+
|
59
|
+
CVC_CODE_MAP = {
|
60
|
+
'A' => 'M', # CVV matches
|
61
|
+
'B' => 'P', # Not provided
|
62
|
+
'C' => 'P', # Not checked
|
63
|
+
'D' => 'N', # Does not match
|
24
64
|
}
|
25
65
|
|
26
66
|
def initialize(options = {})
|
@@ -30,68 +70,136 @@ module ActiveMerchant #:nodoc:
|
|
30
70
|
|
31
71
|
def purchase(money, payment_method, options = {})
|
32
72
|
MultiResponse.run do |r|
|
33
|
-
r.process{authorize(money, payment_method, options)}
|
34
|
-
r.process{capture(money, r.authorization, options.merge(:
|
73
|
+
r.process { authorize(money, payment_method, options) }
|
74
|
+
r.process { capture(money, r.authorization, options.merge(authorization_validated: true)) } unless options[:skip_capture]
|
35
75
|
end
|
36
76
|
end
|
37
77
|
|
38
78
|
def authorize(money, payment_method, options = {})
|
39
79
|
requires!(options, :order_id)
|
40
|
-
|
80
|
+
payment_details = payment_details(payment_method)
|
81
|
+
authorize_request(money, payment_method, payment_details.merge(options))
|
41
82
|
end
|
42
83
|
|
43
84
|
def capture(money, authorization, options = {})
|
85
|
+
authorization = order_id_from_authorization(authorization.to_s)
|
44
86
|
MultiResponse.run do |r|
|
45
|
-
r.process{inquire_request(authorization, options,
|
87
|
+
r.process { inquire_request(authorization, options, 'AUTHORISED', 'CAPTURED') } unless options[:authorization_validated]
|
46
88
|
if r.params
|
47
89
|
authorization_currency = r.params['amount_currency_code']
|
48
|
-
options = options.merge(:
|
90
|
+
options = options.merge(currency: authorization_currency) if authorization_currency.present?
|
49
91
|
end
|
50
|
-
r.process{capture_request(money, authorization, options)}
|
92
|
+
r.process { capture_request(money, authorization, options) }
|
51
93
|
end
|
52
94
|
end
|
53
95
|
|
54
96
|
def void(authorization, options = {})
|
97
|
+
authorization = order_id_from_authorization(authorization.to_s)
|
55
98
|
MultiResponse.run do |r|
|
56
|
-
r.process{inquire_request(authorization, options,
|
57
|
-
r.process{cancel_request(authorization, options)}
|
99
|
+
r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
|
100
|
+
r.process { cancel_request(authorization, options) }
|
58
101
|
end
|
59
102
|
end
|
60
103
|
|
61
104
|
def refund(money, authorization, options = {})
|
62
|
-
|
63
|
-
|
64
|
-
|
105
|
+
authorization = order_id_from_authorization(authorization.to_s)
|
106
|
+
success_criteria = %w(CAPTURED SETTLED SETTLED_BY_MERCHANT SENT_FOR_REFUND)
|
107
|
+
success_criteria.push('AUTHORIZED') if options[:cancel_or_refund]
|
108
|
+
response = MultiResponse.run do |r|
|
109
|
+
r.process { inquire_request(authorization, options, *success_criteria) } unless options[:authorization_validated]
|
110
|
+
r.process { refund_request(money, authorization, options) }
|
111
|
+
end
|
112
|
+
|
113
|
+
if !response.success? && options[:force_full_refund_if_unsettled] &&
|
114
|
+
response.params['last_event'] == 'AUTHORISED'
|
115
|
+
void(authorization, options)
|
116
|
+
else
|
117
|
+
response
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Credits only function on a Merchant ID/login/profile flagged for Payouts
|
122
|
+
# aka Credit Fund Transfers (CFT), whereas normal purchases, refunds,
|
123
|
+
# and other transactions should be performed on a normal eCom-flagged
|
124
|
+
# merchant ID.
|
125
|
+
def credit(money, payment_method, options = {})
|
126
|
+
payment_details = payment_details(payment_method)
|
127
|
+
if options[:fast_fund_credit]
|
128
|
+
fast_fund_credit_request(money, payment_method, payment_details.merge(credit: true, **options))
|
129
|
+
else
|
130
|
+
credit_request(money, payment_method, payment_details.merge(credit: true, **options))
|
65
131
|
end
|
66
132
|
end
|
67
133
|
|
134
|
+
def verify(payment_method, options = {})
|
135
|
+
amount = (eligible_for_0_auth?(payment_method, options) ? 0 : 100)
|
136
|
+
MultiResponse.run(:use_first_response) do |r|
|
137
|
+
r.process { authorize(amount, payment_method, options) }
|
138
|
+
r.process(:ignore_result) { void(r.authorization, options.merge(authorization_validated: true)) }
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def store(credit_card, options = {})
|
143
|
+
requires!(options, :customer)
|
144
|
+
store_request(credit_card, options)
|
145
|
+
end
|
146
|
+
|
147
|
+
def supports_scrubbing
|
148
|
+
true
|
149
|
+
end
|
150
|
+
|
151
|
+
def supports_network_tokenization?
|
152
|
+
true
|
153
|
+
end
|
154
|
+
|
155
|
+
def scrub(transcript)
|
156
|
+
transcript.
|
157
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
158
|
+
gsub(%r((<cardNumber>)\d+(</cardNumber>)), '\1[FILTERED]\2').
|
159
|
+
gsub(%r((<cvc>)[^<]+(</cvc>)), '\1[FILTERED]\2').
|
160
|
+
gsub(%r((<tokenNumber>)\d+(</tokenNumber>)), '\1[FILTERED]\2').
|
161
|
+
gsub(%r((<cryptogram>)[^<]+(</cryptogram>)), '\1[FILTERED]\2')
|
162
|
+
end
|
163
|
+
|
68
164
|
private
|
69
165
|
|
70
166
|
def authorize_request(money, payment_method, options)
|
71
|
-
commit('authorize', build_authorization_request(money, payment_method, options),
|
167
|
+
commit('authorize', build_authorization_request(money, payment_method, options), 'AUTHORISED', 'CAPTURED', options)
|
72
168
|
end
|
73
169
|
|
74
170
|
def capture_request(money, authorization, options)
|
75
|
-
commit('capture', build_capture_request(money, authorization, options), :ok)
|
171
|
+
commit('capture', build_capture_request(money, authorization, options), 'CAPTURED', :ok, options)
|
76
172
|
end
|
77
173
|
|
78
174
|
def cancel_request(authorization, options)
|
79
|
-
commit('cancel', build_void_request(authorization, options), :ok)
|
175
|
+
commit('cancel', build_void_request(authorization, options), :ok, options)
|
80
176
|
end
|
81
177
|
|
82
178
|
def inquire_request(authorization, options, *success_criteria)
|
83
|
-
commit('inquiry', build_order_inquiry_request(authorization, options), *success_criteria)
|
179
|
+
commit('inquiry', build_order_inquiry_request(authorization, options), *success_criteria, options)
|
84
180
|
end
|
85
181
|
|
86
182
|
def refund_request(money, authorization, options)
|
87
|
-
commit('refund', build_refund_request(money, authorization, options), :ok)
|
183
|
+
commit('refund', build_refund_request(money, authorization, options), :ok, 'SENT_FOR_REFUND', options)
|
184
|
+
end
|
185
|
+
|
186
|
+
def credit_request(money, payment_method, options)
|
187
|
+
commit('credit', build_authorization_request(money, payment_method, options), :ok, 'SENT_FOR_REFUND', options)
|
188
|
+
end
|
189
|
+
|
190
|
+
def fast_fund_credit_request(money, payment_method, options)
|
191
|
+
commit('fast_credit', build_fast_fund_credit_request(money, payment_method, options), :ok, 'PUSH_APPROVED', options)
|
192
|
+
end
|
193
|
+
|
194
|
+
def store_request(credit_card, options)
|
195
|
+
commit('store', build_store_request(credit_card, options), options)
|
88
196
|
end
|
89
197
|
|
90
198
|
def build_request
|
91
|
-
xml = Builder::XmlMarkup.new :
|
92
|
-
xml.instruct! :xml, :
|
93
|
-
xml.declare! :DOCTYPE, :paymentService, :PUBLIC,
|
94
|
-
xml.
|
199
|
+
xml = Builder::XmlMarkup.new indent: 2
|
200
|
+
xml.instruct! :xml, encoding: 'UTF-8'
|
201
|
+
xml.declare! :DOCTYPE, :paymentService, :PUBLIC, '-//WorldPay//DTD WorldPay PaymentService v1//EN', 'http://dtd.worldpay.com/paymentService_v1.dtd'
|
202
|
+
xml.paymentService 'version' => '1.4', 'merchantCode' => @options[:login] do
|
95
203
|
yield xml
|
96
204
|
end
|
97
205
|
xml.target!
|
@@ -99,8 +207,8 @@ module ActiveMerchant #:nodoc:
|
|
99
207
|
|
100
208
|
def build_order_modify_request(authorization)
|
101
209
|
build_request do |xml|
|
102
|
-
xml.
|
103
|
-
xml.
|
210
|
+
xml.modify do
|
211
|
+
xml.orderModification 'orderCode' => authorization do
|
104
212
|
yield xml
|
105
213
|
end
|
106
214
|
end
|
@@ -109,129 +217,485 @@ module ActiveMerchant #:nodoc:
|
|
109
217
|
|
110
218
|
def build_order_inquiry_request(authorization, options)
|
111
219
|
build_request do |xml|
|
112
|
-
xml.
|
113
|
-
xml.
|
220
|
+
xml.inquiry do
|
221
|
+
xml.orderInquiry 'orderCode' => authorization
|
114
222
|
end
|
115
223
|
end
|
116
224
|
end
|
117
225
|
|
118
226
|
def build_authorization_request(money, payment_method, options)
|
119
227
|
build_request do |xml|
|
120
|
-
xml.
|
121
|
-
xml.
|
122
|
-
xml.description(options[:description].blank? ?
|
228
|
+
xml.submit do
|
229
|
+
xml.order order_tag_attributes(options) do
|
230
|
+
xml.description(options[:description].blank? ? 'Purchase' : options[:description])
|
123
231
|
add_amount(xml, money, options)
|
124
|
-
|
125
|
-
xml.tag! 'orderContent' do
|
126
|
-
xml.cdata! options[:order_content]
|
127
|
-
end
|
128
|
-
end
|
232
|
+
add_order_content(xml, options)
|
129
233
|
add_payment_method(xml, money, payment_method, options)
|
130
|
-
|
234
|
+
add_shopper(xml, options)
|
235
|
+
add_statement_narrative(xml, options)
|
236
|
+
add_risk_data(xml, options[:risk_data]) if options[:risk_data]
|
237
|
+
add_sub_merchant_data(xml, options[:sub_merchant_data]) if options[:sub_merchant_data]
|
238
|
+
add_hcg_additional_data(xml, options) if options[:hcg_additional_data]
|
239
|
+
add_instalments_data(xml, options) if options[:instalments]
|
240
|
+
add_moto_flag(xml, options) if options.dig(:metadata, :manual_entry)
|
241
|
+
add_additional_3ds_data(xml, options) if options[:execute_threed] && options[:three_ds_version] && options[:three_ds_version] =~ /^2/
|
242
|
+
add_3ds_exemption(xml, options) if options[:exemption_type]
|
131
243
|
end
|
132
244
|
end
|
133
245
|
end
|
134
246
|
end
|
135
247
|
|
248
|
+
def order_tag_attributes(options)
|
249
|
+
{ 'orderCode' => clean_order_id(options[:order_id]), 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v.present? }
|
250
|
+
end
|
251
|
+
|
252
|
+
def clean_order_id(order_id)
|
253
|
+
order_id.to_s.gsub(/(\s|\||<|>|'|")/, '')[0..64]
|
254
|
+
end
|
255
|
+
|
256
|
+
def add_order_content(xml, options)
|
257
|
+
return unless options[:order_content]
|
258
|
+
|
259
|
+
xml.orderContent do
|
260
|
+
xml.cdata! options[:order_content]
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
136
264
|
def build_capture_request(money, authorization, options)
|
137
265
|
build_order_modify_request(authorization) do |xml|
|
138
|
-
xml.
|
266
|
+
xml.capture do
|
139
267
|
time = Time.now
|
140
|
-
xml.
|
268
|
+
xml.date 'dayOfMonth' => time.day, 'month' => time.month, 'year' => time.year
|
141
269
|
add_amount(xml, money, options)
|
142
270
|
end
|
143
271
|
end
|
144
272
|
end
|
145
273
|
|
146
274
|
def build_void_request(authorization, options)
|
147
|
-
|
148
|
-
|
275
|
+
if options[:cancel_or_refund]
|
276
|
+
build_order_modify_request(authorization, &:cancelOrRefund)
|
277
|
+
else
|
278
|
+
build_order_modify_request(authorization, &:cancel)
|
149
279
|
end
|
150
280
|
end
|
151
281
|
|
152
282
|
def build_refund_request(money, authorization, options)
|
153
283
|
build_order_modify_request(authorization) do |xml|
|
154
|
-
|
155
|
-
|
284
|
+
if options[:cancel_or_refund]
|
285
|
+
# Worldpay docs claim amount must be passed. This causes an error.
|
286
|
+
xml.cancelOrRefund # { add_amount(xml, money, options.merge(debit_credit_indicator: 'credit')) }
|
287
|
+
else
|
288
|
+
xml.refund do
|
289
|
+
add_amount(xml, money, options.merge(debit_credit_indicator: 'credit'))
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def build_store_request(credit_card, options)
|
296
|
+
build_request do |xml|
|
297
|
+
xml.submit do
|
298
|
+
xml.paymentTokenCreate do
|
299
|
+
add_authenticated_shopper_id(xml, options)
|
300
|
+
xml.createToken
|
301
|
+
xml.paymentInstrument do
|
302
|
+
xml.cardDetails do
|
303
|
+
add_card(xml, credit_card, options)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
add_transaction_identifier(xml, options) if network_transaction_id(options)
|
307
|
+
end
|
156
308
|
end
|
157
309
|
end
|
158
310
|
end
|
159
311
|
|
312
|
+
def network_transaction_id(options)
|
313
|
+
options[:stored_credential_transaction_id] || options.dig(:stored_credential, :network_transaction_id)
|
314
|
+
end
|
315
|
+
|
316
|
+
def add_transaction_identifier(xml, options)
|
317
|
+
xml.storedCredentials 'usage' => 'FIRST' do
|
318
|
+
xml.schemeTransactionIdentifier network_transaction_id(options)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
def build_fast_fund_credit_request(money, payment_method, options)
|
323
|
+
build_request do |xml|
|
324
|
+
xml.submit do
|
325
|
+
xml.order order_tag_attributes(options) do
|
326
|
+
xml.description(options[:description].blank? ? 'Fast Fund Credit' : options[:description])
|
327
|
+
add_amount(xml, money, options)
|
328
|
+
add_order_content(xml, options)
|
329
|
+
add_payment_details_for_ff_credit(xml, payment_method, options)
|
330
|
+
add_shopper_id(xml, options)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
def add_payment_details_for_ff_credit(xml, payment_method, options)
|
337
|
+
xml.paymentDetails do
|
338
|
+
xml.tag! 'FF_DISBURSE-SSL' do
|
339
|
+
if payment_method.is_a?(CreditCard)
|
340
|
+
add_card_for_ff_credit(xml, payment_method, options)
|
341
|
+
else
|
342
|
+
add_token_for_ff_credit(xml, payment_method, options)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def add_card_for_ff_credit(xml, payment_method, options)
|
349
|
+
xml.recipient do
|
350
|
+
xml.paymentInstrument do
|
351
|
+
xml.cardDetails do
|
352
|
+
add_card(xml, payment_method, options)
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def add_token_for_ff_credit(xml, payment_method, options)
|
359
|
+
return unless payment_method.is_a?(String)
|
360
|
+
|
361
|
+
token_details = token_details_from_authorization(payment_method)
|
362
|
+
|
363
|
+
xml.tag! 'recipient', 'tokenScope' => token_details[:token_scope] do
|
364
|
+
xml.paymentTokenID token_details[:token_id]
|
365
|
+
add_authenticated_shopper_id(xml, token_details)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def add_additional_3ds_data(xml, options)
|
370
|
+
additional_data = { 'dfReferenceId' => options[:session_id] }
|
371
|
+
additional_data['challengeWindowSize'] = options[:browser_size] if options[:browser_size]
|
372
|
+
|
373
|
+
xml.additional3DSData additional_data
|
374
|
+
end
|
375
|
+
|
376
|
+
def add_3ds_exemption(xml, options)
|
377
|
+
xml.exemption 'type' => options[:exemption_type], 'placement' => options[:exemption_placement] || 'AUTHORISATION'
|
378
|
+
end
|
379
|
+
|
380
|
+
def add_risk_data(xml, risk_data)
|
381
|
+
xml.riskData do
|
382
|
+
add_authentication_risk_data(xml, risk_data[:authentication_risk_data])
|
383
|
+
add_shopper_account_risk_data(xml, risk_data[:shopper_account_risk_data])
|
384
|
+
add_transaction_risk_data(xml, risk_data[:transaction_risk_data])
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def add_authentication_risk_data(xml, authentication_risk_data)
|
389
|
+
return unless authentication_risk_data
|
390
|
+
|
391
|
+
timestamp = authentication_risk_data.fetch(:authentication_date, {})
|
392
|
+
|
393
|
+
xml.authenticationRiskData('authenticationMethod' => authentication_risk_data[:authentication_method]) do
|
394
|
+
xml.authenticationTimestamp do
|
395
|
+
xml.date(
|
396
|
+
'dayOfMonth' => timestamp[:day_of_month],
|
397
|
+
'month' => timestamp[:month],
|
398
|
+
'year' => timestamp[:year],
|
399
|
+
'hour' => timestamp[:hour],
|
400
|
+
'minute' => timestamp[:minute],
|
401
|
+
'second' => timestamp[:second]
|
402
|
+
)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
def add_sub_merchant_data(xml, options)
|
408
|
+
xml.subMerchantData do
|
409
|
+
xml.pfId options[:pf_id] if options[:pf_id]
|
410
|
+
xml.subName options[:sub_name] if options[:sub_name]
|
411
|
+
xml.subId options[:sub_id] if options[:sub_id]
|
412
|
+
xml.subStreet options[:sub_street] if options[:sub_street]
|
413
|
+
xml.subCity options[:sub_city] if options[:sub_city]
|
414
|
+
xml.subState options[:sub_state] if options[:sub_state]
|
415
|
+
xml.subCountryCode options[:sub_country_code] if options[:sub_country_code]
|
416
|
+
xml.subPostalCode options[:sub_postal_code] if options[:sub_postal_code]
|
417
|
+
xml.subTaxId options[:sub_tax_id] if options[:sub_tax_id]
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
def add_shopper_account_risk_data(xml, shopper_account_risk_data)
|
422
|
+
return unless shopper_account_risk_data
|
423
|
+
|
424
|
+
data = {
|
425
|
+
'transactionsAttemptedLastDay' => shopper_account_risk_data[:transactions_attempted_last_day],
|
426
|
+
'transactionsAttemptedLastYear' => shopper_account_risk_data[:transactions_attempted_last_year],
|
427
|
+
'purchasesCompletedLastSixMonths' => shopper_account_risk_data[:purchases_completed_last_six_months],
|
428
|
+
'addCardAttemptsLastDay' => shopper_account_risk_data[:add_card_attempts_last_day],
|
429
|
+
'previousSuspiciousActivity' => shopper_account_risk_data[:previous_suspicious_activity],
|
430
|
+
'shippingNameMatchesAccountName' => shopper_account_risk_data[:shipping_name_matches_account_name],
|
431
|
+
'shopperAccountAgeIndicator' => shopper_account_risk_data[:shopper_account_age_indicator],
|
432
|
+
'shopperAccountChangeIndicator' => shopper_account_risk_data[:shopper_account_change_indicator],
|
433
|
+
'shopperAccountPasswordChangeIndicator' => shopper_account_risk_data[:shopper_account_password_change_indicator],
|
434
|
+
'shopperAccountShippingAddressUsageIndicator' => shopper_account_risk_data[:shopper_account_shipping_address_usage_indicator],
|
435
|
+
'shopperAccountPaymentAccountIndicator' => shopper_account_risk_data[:shopper_account_payment_account_indicator]
|
436
|
+
}.reject { |_k, v| v.nil? }
|
437
|
+
|
438
|
+
xml.shopperAccountRiskData(data) do
|
439
|
+
add_date_element(xml, 'shopperAccountCreationDate', shopper_account_risk_data[:shopper_account_creation_date])
|
440
|
+
add_date_element(xml, 'shopperAccountModificationDate', shopper_account_risk_data[:shopper_account_modification_date])
|
441
|
+
add_date_element(xml, 'shopperAccountPasswordChangeDate', shopper_account_risk_data[:shopper_account_password_change_date])
|
442
|
+
add_date_element(xml, 'shopperAccountShippingAddressFirstUseDate', shopper_account_risk_data[:shopper_account_shipping_address_first_use_date])
|
443
|
+
add_date_element(xml, 'shopperAccountPaymentAccountFirstUseDate', shopper_account_risk_data[:shopper_account_payment_account_first_use_date])
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
def add_transaction_risk_data(xml, transaction_risk_data)
|
448
|
+
return unless transaction_risk_data
|
449
|
+
|
450
|
+
data = {
|
451
|
+
'shippingMethod' => transaction_risk_data[:shipping_method],
|
452
|
+
'deliveryTimeframe' => transaction_risk_data[:delivery_timeframe],
|
453
|
+
'deliveryEmailAddress' => transaction_risk_data[:delivery_email_address],
|
454
|
+
'reorderingPreviousPurchases' => transaction_risk_data[:reordering_previous_purchases],
|
455
|
+
'preOrderPurchase' => transaction_risk_data[:pre_order_purchase],
|
456
|
+
'giftCardCount' => transaction_risk_data[:gift_card_count]
|
457
|
+
}.reject { |_k, v| v.nil? }
|
458
|
+
|
459
|
+
xml.transactionRiskData(data) do
|
460
|
+
xml.transactionRiskDataGiftCardAmount do
|
461
|
+
amount_hash = {
|
462
|
+
'value' => transaction_risk_data.dig(:transaction_risk_data_gift_card_amount, :value),
|
463
|
+
'currencyCode' => transaction_risk_data.dig(:transaction_risk_data_gift_card_amount, :currency),
|
464
|
+
'exponent' => transaction_risk_data.dig(:transaction_risk_data_gift_card_amount, :exponent)
|
465
|
+
}
|
466
|
+
debit_credit_indicator = transaction_risk_data.dig(:transaction_risk_data_gift_card_amount, :debit_credit_indicator)
|
467
|
+
amount_hash['debitCreditIndicator'] = debit_credit_indicator if debit_credit_indicator
|
468
|
+
xml.amount(amount_hash)
|
469
|
+
end
|
470
|
+
add_date_element(xml, 'transactionRiskDataPreOrderDate', transaction_risk_data[:transaction_risk_data_pre_order_date])
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
def add_date_element(xml, name, date)
|
475
|
+
xml.tag! name do
|
476
|
+
xml.date('dayOfMonth' => date[:day_of_month], 'month' => date[:month], 'year' => date[:year])
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
160
480
|
def add_amount(xml, money, options)
|
161
481
|
currency = options[:currency] || currency(money)
|
162
|
-
amount = localized_amount(money, currency)
|
163
482
|
|
164
483
|
amount_hash = {
|
165
|
-
:value =>
|
484
|
+
:value => localized_amount(money, currency),
|
166
485
|
'currencyCode' => currency,
|
167
|
-
'exponent' =>
|
486
|
+
'exponent' => currency_exponent(currency)
|
168
487
|
}
|
169
488
|
|
170
|
-
if options[:debit_credit_indicator]
|
171
|
-
amount_hash.merge!('debitCreditIndicator' => options[:debit_credit_indicator])
|
172
|
-
end
|
489
|
+
amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator] if options[:debit_credit_indicator]
|
173
490
|
|
174
|
-
xml.
|
491
|
+
xml.amount amount_hash
|
175
492
|
end
|
176
493
|
|
177
494
|
def add_payment_method(xml, amount, payment_method, options)
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
495
|
+
case options[:payment_type]
|
496
|
+
when :pay_as_order
|
497
|
+
add_amount_for_pay_as_order(xml, amount, payment_method, options)
|
498
|
+
when :network_token
|
499
|
+
add_network_tokenization_card(xml, payment_method)
|
500
|
+
else
|
501
|
+
add_card_or_token(xml, payment_method, options)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
def add_amount_for_pay_as_order(xml, amount, payment_method, options)
|
506
|
+
if options[:merchant_code]
|
507
|
+
xml.payAsOrder 'orderCode' => payment_method, 'merchantCode' => options[:merchant_code] do
|
508
|
+
add_amount(xml, amount, options)
|
509
|
+
end
|
510
|
+
else
|
511
|
+
xml.payAsOrder 'orderCode' => payment_method do
|
512
|
+
add_amount(xml, amount, options)
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
517
|
+
def add_network_tokenization_card(xml, payment_method)
|
518
|
+
token_type = NETWORK_TOKEN_TYPE.fetch(payment_method.source, 'NETWORKTOKEN')
|
519
|
+
|
520
|
+
xml.paymentDetails do
|
521
|
+
xml.tag! 'EMVCO_TOKEN-SSL', 'type' => token_type do
|
522
|
+
xml.tokenNumber payment_method.number
|
523
|
+
xml.expiryDate do
|
524
|
+
xml.date(
|
525
|
+
'month' => format(payment_method.month, :two_digits),
|
526
|
+
'year' => format(payment_method.year, :four_digits_year)
|
527
|
+
)
|
182
528
|
end
|
529
|
+
name = card_holder_name(payment_method, options)
|
530
|
+
eci = format(payment_method.eci, :two_digits)
|
531
|
+
xml.cardHolderName name if name.present?
|
532
|
+
xml.cryptogram payment_method.payment_cryptogram
|
533
|
+
xml.eciIndicator eci.empty? ? '07' : eci
|
534
|
+
end
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
538
|
+
def add_card_or_token(xml, payment_method, options)
|
539
|
+
xml.paymentDetails credit_fund_transfer_attribute(options) do
|
540
|
+
if options[:payment_type] == :token
|
541
|
+
add_token_details(xml, options)
|
183
542
|
else
|
184
|
-
xml
|
185
|
-
add_amount(xml, amount, options)
|
186
|
-
end
|
543
|
+
add_card_details(xml, payment_method, options)
|
187
544
|
end
|
545
|
+
add_stored_credential_options(xml, options)
|
546
|
+
add_shopper_id(xml, options)
|
547
|
+
add_three_d_secure(xml, options)
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
def add_token_details(xml, options)
|
552
|
+
xml.tag! 'TOKEN-SSL', 'tokenScope' => options[:token_scope] do
|
553
|
+
xml.paymentTokenID options[:token_id]
|
554
|
+
end
|
555
|
+
end
|
556
|
+
|
557
|
+
def add_card_details(xml, payment_method, options)
|
558
|
+
xml.tag! card_code_for(payment_method) do
|
559
|
+
add_card(xml, payment_method, options)
|
560
|
+
end
|
561
|
+
end
|
562
|
+
|
563
|
+
def add_shopper_id(xml, options)
|
564
|
+
if options[:ip] && options[:session_id]
|
565
|
+
xml.session 'shopperIPAddress' => options[:ip], 'id' => options[:session_id]
|
188
566
|
else
|
189
|
-
xml.
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
xml.tag! 'date', 'month' => format(payment_method.month, :two_digits), 'year' => format(payment_method.year, :four_digits)
|
194
|
-
end
|
567
|
+
xml.session 'shopperIPAddress' => options[:ip] if options[:ip]
|
568
|
+
xml.session 'id' => options[:session_id] if options[:session_id]
|
569
|
+
end
|
570
|
+
end
|
195
571
|
|
196
|
-
|
197
|
-
|
572
|
+
def add_three_d_secure(xml, options)
|
573
|
+
return unless three_d_secure = options[:three_d_secure]
|
198
574
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
575
|
+
xml.info3DSecure do
|
576
|
+
xml.threeDSVersion three_d_secure[:version]
|
577
|
+
if three_d_secure[:version] && three_d_secure[:ds_transaction_id]
|
578
|
+
xml.dsTransactionId three_d_secure[:ds_transaction_id]
|
579
|
+
else
|
580
|
+
xml.xid three_d_secure[:xid]
|
204
581
|
end
|
582
|
+
xml.cavv three_d_secure[:cavv]
|
583
|
+
xml.eci three_d_secure[:eci]
|
205
584
|
end
|
206
585
|
end
|
207
586
|
|
208
|
-
def
|
209
|
-
|
210
|
-
xml.
|
211
|
-
xml.
|
587
|
+
def add_card(xml, payment_method, options)
|
588
|
+
xml.cardNumber payment_method.number
|
589
|
+
xml.expiryDate do
|
590
|
+
xml.date(
|
591
|
+
'month' => format(payment_method.month, :two_digits),
|
592
|
+
'year' => format(payment_method.year, :four_digits_year)
|
593
|
+
)
|
212
594
|
end
|
595
|
+
xml.cardHolderName card_holder_name(payment_method, options)
|
596
|
+
xml.cvc payment_method.verification_value
|
597
|
+
|
598
|
+
add_address(xml, (options[:billing_address] || options[:address]), options)
|
213
599
|
end
|
214
600
|
|
215
|
-
def
|
601
|
+
def add_stored_credential_options(xml, options = {})
|
602
|
+
if options[:stored_credential]
|
603
|
+
add_stored_credential_using_normalized_fields(xml, options)
|
604
|
+
else
|
605
|
+
add_stored_credential_using_gateway_specific_fields(xml, options)
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
def add_stored_credential_using_normalized_fields(xml, options)
|
610
|
+
if options[:stored_credential][:initial_transaction]
|
611
|
+
xml.storedCredentials 'usage' => 'FIRST'
|
612
|
+
else
|
613
|
+
reason = case options[:stored_credential][:reason_type]
|
614
|
+
when 'installment' then 'INSTALMENT'
|
615
|
+
when 'recurring' then 'RECURRING'
|
616
|
+
when 'unscheduled' then 'UNSCHEDULED'
|
617
|
+
end
|
618
|
+
|
619
|
+
xml.storedCredentials 'usage' => 'USED', 'merchantInitiatedReason' => reason do
|
620
|
+
xml.schemeTransactionIdentifier options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
621
|
+
end
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
def add_stored_credential_using_gateway_specific_fields(xml, options)
|
626
|
+
return unless options[:stored_credential_usage]
|
627
|
+
|
628
|
+
if options[:stored_credential_initiated_reason]
|
629
|
+
xml.storedCredentials 'usage' => options[:stored_credential_usage], 'merchantInitiatedReason' => options[:stored_credential_initiated_reason] do
|
630
|
+
xml.schemeTransactionIdentifier options[:stored_credential_transaction_id] if options[:stored_credential_transaction_id]
|
631
|
+
end
|
632
|
+
else
|
633
|
+
xml.storedCredentials 'usage' => options[:stored_credential_usage]
|
634
|
+
end
|
635
|
+
end
|
636
|
+
|
637
|
+
def add_shopper(xml, options)
|
638
|
+
return unless options[:execute_threed] || options[:email] || options[:customer]
|
639
|
+
|
640
|
+
xml.shopper do
|
641
|
+
xml.shopperEmailAddress options[:email] if options[:email]
|
642
|
+
add_authenticated_shopper_id(xml, options)
|
643
|
+
xml.browser do
|
644
|
+
xml.acceptHeader options[:accept_header]
|
645
|
+
xml.userAgentHeader options[:user_agent]
|
646
|
+
end
|
647
|
+
end
|
648
|
+
end
|
649
|
+
|
650
|
+
def add_statement_narrative(xml, options)
|
651
|
+
xml.statementNarrative truncate(options[:statement_narrative], 50) if options[:statement_narrative]
|
652
|
+
end
|
653
|
+
|
654
|
+
def add_authenticated_shopper_id(xml, options)
|
655
|
+
xml.authenticatedShopperID options[:customer] if options[:customer]
|
656
|
+
end
|
657
|
+
|
658
|
+
def add_address(xml, address, options)
|
659
|
+
return unless address
|
660
|
+
|
216
661
|
address = address_with_defaults(address)
|
217
662
|
|
218
|
-
xml.
|
219
|
-
xml.
|
663
|
+
xml.cardAddress do
|
664
|
+
xml.address do
|
220
665
|
if m = /^\s*([^\s]+)\s+(.+)$/.match(address[:name])
|
221
|
-
xml.
|
222
|
-
xml.
|
666
|
+
xml.firstName m[1]
|
667
|
+
xml.lastName m[2]
|
223
668
|
end
|
224
|
-
xml.
|
225
|
-
xml.
|
226
|
-
xml.
|
227
|
-
xml.
|
228
|
-
xml.
|
229
|
-
xml.
|
230
|
-
xml.
|
669
|
+
xml.address1 address[:address1]
|
670
|
+
xml.address2 address[:address2] if address[:address2]
|
671
|
+
xml.postalCode address[:zip]
|
672
|
+
xml.city address[:city]
|
673
|
+
xml.state address[:state] unless address[:country] != 'US' && options[:execute_threed]
|
674
|
+
xml.countryCode address[:country]
|
675
|
+
xml.telephoneNumber address[:phone] if address[:phone]
|
231
676
|
end
|
232
677
|
end
|
233
678
|
end
|
234
679
|
|
680
|
+
def add_hcg_additional_data(xml, options)
|
681
|
+
xml.hcgAdditionalData do
|
682
|
+
options[:hcg_additional_data].each do |k, v|
|
683
|
+
xml.param({ name: k.to_s }, v)
|
684
|
+
end
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
def add_instalments_data(xml, options)
|
689
|
+
xml.thirdPartyData do
|
690
|
+
xml.instalments options[:instalments]
|
691
|
+
xml.cpf options[:cpf] if options[:cpf]
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
def add_moto_flag(xml, options)
|
696
|
+
xml.dynamicInteractionType 'type' => 'MOTO'
|
697
|
+
end
|
698
|
+
|
235
699
|
def address_with_defaults(address)
|
236
700
|
address ||= {}
|
237
701
|
address.delete_if { |_, v| v.blank? }
|
@@ -240,46 +704,80 @@ module ActiveMerchant #:nodoc:
|
|
240
704
|
|
241
705
|
def default_address
|
242
706
|
{
|
243
|
-
address1: 'N/A',
|
244
707
|
zip: '0000',
|
708
|
+
country: 'US',
|
245
709
|
city: 'N/A',
|
246
|
-
|
247
|
-
country: 'US'
|
710
|
+
address1: 'N/A'
|
248
711
|
}
|
249
712
|
end
|
250
713
|
|
251
714
|
def parse(action, xml)
|
252
|
-
|
715
|
+
xml = xml.strip.gsub(/\&/, '&')
|
716
|
+
doc = Nokogiri::XML(xml, &:strict)
|
717
|
+
doc.remove_namespaces!
|
718
|
+
resp_params = { action: action }
|
719
|
+
|
720
|
+
parse_elements(doc.root, resp_params)
|
721
|
+
resp_params
|
253
722
|
end
|
254
723
|
|
255
|
-
def
|
724
|
+
def parse_elements(node, response)
|
725
|
+
node_name = node.name.underscore
|
256
726
|
node.attributes.each do |k, v|
|
257
|
-
|
727
|
+
response["#{node_name}_#{k.underscore}".to_sym] = v.value
|
258
728
|
end
|
259
|
-
if node.
|
260
|
-
|
261
|
-
node.elements.each{|e| parse_element(raw, e) }
|
729
|
+
if node.elements.empty?
|
730
|
+
response[node_name.to_sym] = node.text unless node.text.blank?
|
262
731
|
else
|
263
|
-
|
732
|
+
response[node_name.to_sym] = true unless node.name.blank?
|
733
|
+
node.elements.each do |childnode|
|
734
|
+
parse_elements(childnode, response)
|
735
|
+
end
|
264
736
|
end
|
265
|
-
raw
|
266
737
|
end
|
267
738
|
|
268
|
-
def
|
269
|
-
|
270
|
-
|
271
|
-
|
739
|
+
def headers(options)
|
740
|
+
idempotency_key = options[:idempotency_key]
|
741
|
+
|
742
|
+
headers = {
|
743
|
+
'Content-Type' => 'text/xml',
|
744
|
+
'Authorization' => encoded_credentials
|
745
|
+
}
|
746
|
+
if options[:cookie]
|
747
|
+
headers['Cookie'] = options[:cookie] if options[:cookie]
|
748
|
+
end
|
749
|
+
|
750
|
+
headers['Idempotency-Key'] = idempotency_key if idempotency_key
|
751
|
+
headers
|
752
|
+
end
|
753
|
+
|
754
|
+
def commit(action, request, *success_criteria, options)
|
755
|
+
xml = ssl_post(url, request, headers(options))
|
756
|
+
raw = parse(action, xml)
|
757
|
+
|
758
|
+
if options[:execute_threed]
|
759
|
+
raw[:cookie] = @cookie if defined?(@cookie)
|
760
|
+
raw[:session_id] = options[:session_id]
|
761
|
+
raw[:is3DSOrder] = true
|
762
|
+
end
|
763
|
+
success = success_from(action, raw, success_criteria)
|
764
|
+
message = message_from(success, raw, success_criteria)
|
272
765
|
|
273
766
|
Response.new(
|
274
767
|
success,
|
275
768
|
message,
|
276
769
|
raw,
|
277
|
-
:
|
278
|
-
:
|
279
|
-
|
770
|
+
authorization: authorization_from(action, raw, options),
|
771
|
+
error_code: error_code_from(success, raw),
|
772
|
+
test: test?,
|
773
|
+
avs_result: AVSResult.new(code: AVS_CODE_MAP[raw[:avs_result_code_description]]),
|
774
|
+
cvv_result: CVVResult.new(CVC_CODE_MAP[raw[:cvc_result_code_description]])
|
775
|
+
)
|
776
|
+
rescue Nokogiri::SyntaxError
|
777
|
+
unparsable_response(xml)
|
280
778
|
rescue ActiveMerchant::ResponseError => e
|
281
|
-
if e.response.code.to_s ==
|
282
|
-
return Response.new(false,
|
779
|
+
if e.response.code.to_s == '401'
|
780
|
+
return Response.new(false, 'Invalid credentials', {}, test: test?)
|
283
781
|
else
|
284
782
|
raise e
|
285
783
|
end
|
@@ -289,42 +787,148 @@ module ActiveMerchant #:nodoc:
|
|
289
787
|
test? ? self.test_url : self.live_url
|
290
788
|
end
|
291
789
|
|
790
|
+
def unparsable_response(raw_response)
|
791
|
+
message = 'Unparsable response received from Worldpay. Please contact Worldpay if you continue to receive this message.'
|
792
|
+
message += " (The raw response returned by the API was: #{raw_response.inspect})"
|
793
|
+
return Response.new(false, message)
|
794
|
+
end
|
795
|
+
|
796
|
+
# Override the regular handle response so we can access the headers
|
797
|
+
# Set-Cookie value is needed for 3DS transactions
|
798
|
+
def handle_response(response)
|
799
|
+
case response.code.to_i
|
800
|
+
when 200...300
|
801
|
+
@cookie = response['Set-Cookie']
|
802
|
+
response.body
|
803
|
+
else
|
804
|
+
raise ResponseError.new(response)
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
808
|
+
def success_from(action, raw, success_criteria)
|
809
|
+
success_criteria_success?(raw, success_criteria) || action_success?(action, raw)
|
810
|
+
end
|
811
|
+
|
812
|
+
def message_from(success, raw, success_criteria)
|
813
|
+
return 'SUCCESS' if success
|
814
|
+
|
815
|
+
raw[:iso8583_return_code_description] || raw[:error] || required_status_message(raw, success_criteria)
|
816
|
+
end
|
817
|
+
|
292
818
|
# success_criteria can be:
|
293
819
|
# - a string or an array of strings (if one of many responses)
|
294
820
|
# - An array of strings if one of many responses could be considered a
|
295
821
|
# success.
|
296
|
-
def
|
297
|
-
|
298
|
-
|
299
|
-
|
822
|
+
def success_criteria_success?(raw, success_criteria)
|
823
|
+
return if raw[:error]
|
824
|
+
|
825
|
+
raw[:ok].present? || (success_criteria.include?(raw[:last_event]) if raw[:last_event])
|
826
|
+
end
|
827
|
+
|
828
|
+
def action_success?(action, raw)
|
829
|
+
case action
|
830
|
+
when 'store'
|
831
|
+
raw[:token].present?
|
300
832
|
else
|
301
|
-
|
833
|
+
false
|
302
834
|
end
|
835
|
+
end
|
303
836
|
|
304
|
-
|
837
|
+
def error_code_from(success, raw)
|
838
|
+
raw[:iso8583_return_code_code] || raw[:error_code] || nil unless success == 'SUCCESS'
|
305
839
|
end
|
306
840
|
|
307
841
|
def required_status_message(raw, success_criteria)
|
308
|
-
if
|
309
|
-
|
842
|
+
"A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(' or ')} is required." if !success_criteria.include?(raw[:last_event])
|
843
|
+
end
|
844
|
+
|
845
|
+
def authorization_from(action, raw, options)
|
846
|
+
order_id = order_id_from(raw)
|
847
|
+
|
848
|
+
case action
|
849
|
+
when 'store'
|
850
|
+
authorization_from_token_details(
|
851
|
+
order_id: order_id,
|
852
|
+
token_id: raw[:payment_token_id],
|
853
|
+
token_scope: 'shopper',
|
854
|
+
customer: options[:customer]
|
855
|
+
)
|
856
|
+
else
|
857
|
+
order_id
|
310
858
|
end
|
311
859
|
end
|
312
860
|
|
313
|
-
def
|
314
|
-
pair = raw.detect{|k,
|
861
|
+
def order_id_from(raw)
|
862
|
+
pair = raw.detect { |k, _v| k.to_s =~ /_order_code$/ }
|
315
863
|
(pair ? pair.last : nil)
|
316
864
|
end
|
317
865
|
|
866
|
+
def authorization_from_token_details(options = {})
|
867
|
+
[options[:order_id], options[:token_id], options[:token_scope], options[:customer]].join('|')
|
868
|
+
end
|
869
|
+
|
870
|
+
def order_id_from_authorization(authorization)
|
871
|
+
token_details_from_authorization(authorization)[:order_id]
|
872
|
+
end
|
873
|
+
|
874
|
+
def token_details_from_authorization(authorization)
|
875
|
+
order_id, token_id, token_scope, customer = authorization.split('|')
|
876
|
+
|
877
|
+
token_details = {}
|
878
|
+
token_details[:order_id] = order_id if order_id.present?
|
879
|
+
token_details[:token_id] = token_id if token_id.present?
|
880
|
+
token_details[:token_scope] = token_scope if token_scope.present?
|
881
|
+
token_details[:customer] = customer if customer.present?
|
882
|
+
|
883
|
+
token_details
|
884
|
+
end
|
885
|
+
|
886
|
+
def payment_details(payment_method)
|
887
|
+
case payment_method
|
888
|
+
when String
|
889
|
+
token_type_and_details(payment_method)
|
890
|
+
when NetworkTokenizationCreditCard
|
891
|
+
{ payment_type: :network_token }
|
892
|
+
else
|
893
|
+
{ payment_type: :credit }
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
def token_type_and_details(token)
|
898
|
+
token_details = token_details_from_authorization(token)
|
899
|
+
token_details[:payment_type] = token_details.has_key?(:token_id) ? :token : :pay_as_order
|
900
|
+
|
901
|
+
token_details
|
902
|
+
end
|
903
|
+
|
904
|
+
def credit_fund_transfer_attribute(options)
|
905
|
+
return unless options[:credit]
|
906
|
+
|
907
|
+
{ 'action' => 'REFUND' }
|
908
|
+
end
|
909
|
+
|
318
910
|
def encoded_credentials
|
319
911
|
credentials = "#{@options[:login]}:#{@options[:password]}"
|
320
912
|
"Basic #{[credentials].pack('m').strip}"
|
321
913
|
end
|
322
914
|
|
323
|
-
def
|
324
|
-
|
325
|
-
return
|
915
|
+
def currency_exponent(currency)
|
916
|
+
return 0 if non_fractional_currency?(currency)
|
917
|
+
return 3 if three_decimal_currency?(currency)
|
918
|
+
|
919
|
+
return 2
|
920
|
+
end
|
921
|
+
|
922
|
+
def card_code_for(payment_method)
|
923
|
+
CARD_CODES[card_brand(payment_method)] || CARD_CODES['unknown']
|
924
|
+
end
|
925
|
+
|
926
|
+
def eligible_for_0_auth?(payment_method, options = {})
|
927
|
+
payment_method.is_a?(CreditCard) && %w(visa master).include?(payment_method.brand) && options[:zero_dollar_auth]
|
928
|
+
end
|
326
929
|
|
327
|
-
|
930
|
+
def card_holder_name(payment_method, options)
|
931
|
+
test? && options[:execute_threed] && !options[:three_ds_version]&.start_with?('2') ? '3D' : payment_method.name
|
328
932
|
end
|
329
933
|
end
|
330
934
|
end
|