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
@@ -0,0 +1,208 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class WorldpayOnlinePaymentsGateway < Gateway
|
4
|
+
self.live_url = 'https://api.worldpay.com/v1/'
|
5
|
+
|
6
|
+
self.default_currency = 'GBP'
|
7
|
+
|
8
|
+
self.money_format = :cents
|
9
|
+
|
10
|
+
self.supported_countries = %w(HK US GB BE CH CZ DE DK ES FI FR GR HU IE IT LU MT NL NO PL PT SE SG TR)
|
11
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb maestro]
|
12
|
+
|
13
|
+
self.homepage_url = 'http://online.worldpay.com'
|
14
|
+
self.display_name = 'Worldpay Online Payments'
|
15
|
+
|
16
|
+
def initialize(options = {})
|
17
|
+
requires!(options, :client_key, :service_key)
|
18
|
+
@client_key = options[:client_key]
|
19
|
+
@service_key = options[:service_key]
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def authorize(money, credit_card, options = {})
|
24
|
+
response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
25
|
+
if response.success?
|
26
|
+
options[:authorizeOnly] = true
|
27
|
+
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
28
|
+
response = commit(:post, 'orders', post, {}, 'authorize')
|
29
|
+
end
|
30
|
+
response
|
31
|
+
end
|
32
|
+
|
33
|
+
def capture(money, authorization, options = {})
|
34
|
+
if authorization
|
35
|
+
commit(:post, "orders/#{CGI.escape(authorization)}/capture", { 'captureAmount' => money }, options, 'capture')
|
36
|
+
else
|
37
|
+
Response.new(false,
|
38
|
+
'FAILED',
|
39
|
+
'FAILED',
|
40
|
+
test: test?,
|
41
|
+
authorization: false,
|
42
|
+
avs_result: {},
|
43
|
+
cvv_result: {},
|
44
|
+
error_code: false)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def purchase(money, credit_card, options = {})
|
49
|
+
response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
50
|
+
if response.success?
|
51
|
+
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
52
|
+
response = commit(:post, 'orders', post, options, 'purchase')
|
53
|
+
end
|
54
|
+
response
|
55
|
+
end
|
56
|
+
|
57
|
+
def refund(money, orderCode, options = {})
|
58
|
+
obj = money ? { 'refundAmount' => money } : {}
|
59
|
+
commit(:post, "orders/#{CGI.escape(orderCode)}/refund", obj, options, 'refund')
|
60
|
+
end
|
61
|
+
|
62
|
+
def void(orderCode, options = {})
|
63
|
+
response = commit(:delete, "orders/#{CGI.escape(orderCode)}", nil, options, 'void')
|
64
|
+
response = refund(nil, orderCode) if !response.success? && (response.params && response.params['customCode'] != 'ORDER_NOT_FOUND')
|
65
|
+
response
|
66
|
+
end
|
67
|
+
|
68
|
+
def verify(credit_card, options = {})
|
69
|
+
authorize(0, credit_card, options)
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def create_token(reusable, name, exp_month, exp_year, number, cvc)
|
75
|
+
obj = {
|
76
|
+
'reusable' => reusable,
|
77
|
+
'paymentMethod' => {
|
78
|
+
'type' => 'Card',
|
79
|
+
'name' => name,
|
80
|
+
'expiryMonth' => exp_month,
|
81
|
+
'expiryYear' => exp_year,
|
82
|
+
'cardNumber' => number,
|
83
|
+
'cvc' => cvc
|
84
|
+
},
|
85
|
+
'clientKey' => @client_key
|
86
|
+
}
|
87
|
+
token_response = commit(:post, 'tokens', obj, { 'Authorization' => @service_key }, 'token')
|
88
|
+
token_response
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_post_for_auth_or_purchase(token, money, options)
|
92
|
+
{
|
93
|
+
'token' => token,
|
94
|
+
'orderDescription' => options[:description] || 'Worldpay Order',
|
95
|
+
'amount' => money,
|
96
|
+
'currencyCode' => options[:currency] || default_currency,
|
97
|
+
'name' => options[:billing_address] && options[:billing_address][:name] ? options[:billing_address][:name] : '',
|
98
|
+
'billingAddress' => {
|
99
|
+
'address1' => options[:billing_address] && options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
|
100
|
+
'address2' => options[:billing_address] && options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
|
101
|
+
'address3' => '',
|
102
|
+
'postalCode' => options[:billing_address] && options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
|
103
|
+
'city' => options[:billing_address] && options[:billing_address][:city] ? options[:billing_address][:city] : '',
|
104
|
+
'state' => options[:billing_address] && options[:billing_address][:state] ? options[:billing_address][:state] : '',
|
105
|
+
'countryCode' => options[:billing_address] && options[:billing_address][:country] ? options[:billing_address][:country] : ''
|
106
|
+
},
|
107
|
+
'customerOrderCode' => options[:order_id],
|
108
|
+
'orderType' => 'ECOM',
|
109
|
+
'authorizeOnly' => options[:authorizeOnly] ? true : false
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
def parse(body)
|
114
|
+
body ? JSON.parse(body) : {}
|
115
|
+
end
|
116
|
+
|
117
|
+
def headers(options = {})
|
118
|
+
headers = {
|
119
|
+
'Authorization' => @service_key,
|
120
|
+
'Content-Type' => 'application/json',
|
121
|
+
'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
122
|
+
'X-Worldpay-Client-User-Agent' => user_agent,
|
123
|
+
'X-Worldpay-Client-User-Metadata' => { ip: options[:ip] }.to_json
|
124
|
+
}
|
125
|
+
headers['Authorization'] = options['Authorization'] if options['Authorization']
|
126
|
+
headers
|
127
|
+
end
|
128
|
+
|
129
|
+
def commit(method, url, parameters = nil, options = {}, type = false)
|
130
|
+
raw_response = response = nil
|
131
|
+
success = false
|
132
|
+
begin
|
133
|
+
json = parameters ? parameters.to_json : nil
|
134
|
+
|
135
|
+
raw_response = ssl_request(method, self.live_url + url, json, headers(options))
|
136
|
+
|
137
|
+
if raw_response != ''
|
138
|
+
response = parse(raw_response)
|
139
|
+
if type == 'token'
|
140
|
+
success = response.key?('token')
|
141
|
+
else
|
142
|
+
if response.key?('httpStatusCode')
|
143
|
+
success = false
|
144
|
+
else
|
145
|
+
if type == 'authorize' && response['paymentStatus'] == 'AUTHORIZED'
|
146
|
+
success = true
|
147
|
+
elsif type == 'purchase' && response['paymentStatus'] == 'SUCCESS'
|
148
|
+
success = true
|
149
|
+
elsif type == 'capture' || type == 'refund' || type == 'void'
|
150
|
+
success = true
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
else
|
155
|
+
success = true
|
156
|
+
response = {}
|
157
|
+
end
|
158
|
+
rescue ResponseError => e
|
159
|
+
raw_response = e.response.body
|
160
|
+
response = response_error(raw_response)
|
161
|
+
rescue JSON::ParserError
|
162
|
+
response = json_error(raw_response)
|
163
|
+
end
|
164
|
+
|
165
|
+
if response['orderCode']
|
166
|
+
authorization = response['orderCode']
|
167
|
+
elsif response['token']
|
168
|
+
authorization = response['token']
|
169
|
+
else
|
170
|
+
authorization = response['message']
|
171
|
+
end
|
172
|
+
|
173
|
+
Response.new(success,
|
174
|
+
success ? 'SUCCESS' : response['message'],
|
175
|
+
response,
|
176
|
+
test: test?,
|
177
|
+
authorization: authorization,
|
178
|
+
avs_result: {},
|
179
|
+
cvv_result: {},
|
180
|
+
error_code: success ? nil : response['customCode'])
|
181
|
+
end
|
182
|
+
|
183
|
+
def test?
|
184
|
+
@service_key[0] == 'T'
|
185
|
+
end
|
186
|
+
|
187
|
+
def response_error(raw_response)
|
188
|
+
parse(raw_response)
|
189
|
+
rescue JSON::ParserError
|
190
|
+
json_error(raw_response)
|
191
|
+
end
|
192
|
+
|
193
|
+
def json_error(raw_response)
|
194
|
+
msg = 'Invalid response received from the Worldpay Online Payments API. Please contact techsupport.online@worldpay.com if you continue to receive this message.'
|
195
|
+
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
196
|
+
{
|
197
|
+
'error' => {
|
198
|
+
'message' => msg
|
199
|
+
}
|
200
|
+
}
|
201
|
+
end
|
202
|
+
|
203
|
+
def handle_response(response)
|
204
|
+
response.body
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -1,78 +1,97 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class WorldpayUsGateway < Gateway
|
6
|
-
|
7
|
-
|
6
|
+
class_attribute :backup_url
|
7
|
+
|
8
|
+
self.display_name = 'Worldpay US'
|
9
|
+
self.homepage_url = 'http://www.worldpay.com/us'
|
8
10
|
|
9
11
|
# No sandbox, just use test cards.
|
10
|
-
self.live_url
|
12
|
+
self.live_url = 'https://trans.worldpay.us/cgi-bin/process.cgi'
|
13
|
+
self.backup_url = 'https://trans.gwtx01.com/cgi-bin/process.cgi'
|
11
14
|
|
12
15
|
self.supported_countries = ['US']
|
13
16
|
self.default_currency = 'USD'
|
14
17
|
self.money_format = :dollars
|
15
|
-
self.supported_cardtypes = [
|
18
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb]
|
16
19
|
|
17
|
-
def initialize(options={})
|
20
|
+
def initialize(options = {})
|
18
21
|
requires!(options, :acctid, :subid, :merchantpin)
|
19
22
|
super
|
20
23
|
end
|
21
24
|
|
22
|
-
def purchase(money, payment_method, options={})
|
25
|
+
def purchase(money, payment_method, options = {})
|
23
26
|
post = {}
|
24
27
|
add_invoice(post, money, options)
|
25
28
|
add_payment_method(post, payment_method)
|
26
29
|
add_customer_data(post, options)
|
27
30
|
|
28
|
-
commit('purchase', post)
|
31
|
+
commit('purchase', options, post)
|
29
32
|
end
|
30
33
|
|
31
|
-
def authorize(money, payment, options={})
|
34
|
+
def authorize(money, payment, options = {})
|
32
35
|
post = {}
|
33
36
|
add_invoice(post, money, options)
|
34
|
-
|
37
|
+
add_credit_card(post, payment)
|
35
38
|
add_customer_data(post, options)
|
36
39
|
|
37
|
-
commit('authorize', post)
|
40
|
+
commit('authorize', options, post)
|
38
41
|
end
|
39
42
|
|
40
|
-
def capture(amount, authorization, options={})
|
43
|
+
def capture(amount, authorization, options = {})
|
41
44
|
post = {}
|
42
45
|
add_invoice(post, amount, options)
|
43
46
|
add_reference(post, authorization)
|
44
47
|
add_customer_data(post, options)
|
45
48
|
|
46
|
-
commit('capture', post)
|
49
|
+
commit('capture', options, post)
|
47
50
|
end
|
48
51
|
|
49
|
-
def refund(amount, authorization, options={})
|
52
|
+
def refund(amount, authorization, options = {})
|
50
53
|
post = {}
|
51
54
|
add_invoice(post, amount, options)
|
52
55
|
add_reference(post, authorization)
|
53
56
|
add_customer_data(post, options)
|
54
57
|
|
55
|
-
commit(
|
58
|
+
commit('refund', options, post)
|
56
59
|
end
|
57
60
|
|
58
|
-
def void(authorization, options={})
|
61
|
+
def void(authorization, options = {})
|
59
62
|
post = {}
|
60
63
|
add_reference(post, authorization)
|
61
64
|
|
62
|
-
commit('void', post)
|
65
|
+
commit('void', options, post)
|
63
66
|
end
|
64
67
|
|
65
|
-
def verify(credit_card, options={})
|
68
|
+
def verify(credit_card, options = {})
|
66
69
|
MultiResponse.run(:use_first_response) do |r|
|
67
70
|
r.process { authorize(100, credit_card, options) }
|
68
71
|
r.process(:ignore_result) { void(r.authorization, options) }
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
75
|
+
def supports_scrubbing?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def scrub(transcript)
|
80
|
+
transcript.
|
81
|
+
gsub(%r((&?merchantpin=)[^&]*)i, '\1[FILTERED]').
|
82
|
+
gsub(%r((&?ccnum=)[^&]*)i, '\1[FILTERED]').
|
83
|
+
gsub(%r((&?ckacct=)[^&]*)i, '\1[FILTERED]').
|
84
|
+
gsub(%r((&?cvv2=)[^&]*)i, '\1[FILTERED]')
|
85
|
+
end
|
86
|
+
|
72
87
|
private
|
73
88
|
|
89
|
+
def url(options)
|
90
|
+
options[:use_backup_url].to_s == 'true' ? self.backup_url : self.live_url
|
91
|
+
end
|
92
|
+
|
74
93
|
def add_customer_data(post, options)
|
75
|
-
if(billing_address = (options[:billing_address] || options[:address]))
|
94
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
76
95
|
post[:ci_companyname] = billing_address[:company]
|
77
96
|
post[:ci_billaddr1] = billing_address[:address1]
|
78
97
|
post[:ci_billaddr2] = billing_address[:address2]
|
@@ -86,13 +105,13 @@ module ActiveMerchant #:nodoc:
|
|
86
105
|
post[:ci_ipaddress] = billing_address[:ip]
|
87
106
|
end
|
88
107
|
|
89
|
-
if(shipping_address = options[:shipping_address])
|
108
|
+
if (shipping_address = options[:shipping_address])
|
90
109
|
post[:ci_shipaddr1] = shipping_address[:address1]
|
91
110
|
post[:ci_shipaddr2] = shipping_address[:address2]
|
92
111
|
post[:ci_shipcity] = shipping_address[:city]
|
93
112
|
post[:ci_shipstate] = shipping_address[:state]
|
94
|
-
post[:ci_shipzip]
|
95
|
-
post[:ci_shipcountry]
|
113
|
+
post[:ci_shipzip] = shipping_address[:zip]
|
114
|
+
post[:ci_shipcountry] = shipping_address[:country]
|
96
115
|
end
|
97
116
|
end
|
98
117
|
|
@@ -103,6 +122,14 @@ module ActiveMerchant #:nodoc:
|
|
103
122
|
end
|
104
123
|
|
105
124
|
def add_payment_method(post, payment_method)
|
125
|
+
if card_brand(payment_method) == 'check'
|
126
|
+
add_check(post, payment_method)
|
127
|
+
else
|
128
|
+
add_credit_card(post, payment_method)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def add_credit_card(post, payment_method)
|
106
133
|
post[:ccname] = payment_method.name
|
107
134
|
post[:ccnum] = payment_method.number
|
108
135
|
post[:cvv2] = payment_method.verification_value
|
@@ -110,8 +137,21 @@ module ActiveMerchant #:nodoc:
|
|
110
137
|
post[:expmon] = format(payment_method.month, :two_digits)
|
111
138
|
end
|
112
139
|
|
140
|
+
ACCOUNT_TYPES = {
|
141
|
+
'checking' => '1',
|
142
|
+
'savings' => '2'
|
143
|
+
}
|
144
|
+
|
145
|
+
def add_check(post, payment_method)
|
146
|
+
post[:action] = 'ns_quicksale_check'
|
147
|
+
post[:ckacct] = payment_method.account_number
|
148
|
+
post[:ckaba] = payment_method.routing_number
|
149
|
+
post[:ckno] = payment_method.number
|
150
|
+
post[:ckaccttype] = ACCOUNT_TYPES[payment_method.account_type] if ACCOUNT_TYPES[payment_method.account_type]
|
151
|
+
end
|
152
|
+
|
113
153
|
def split_authorization(authorization)
|
114
|
-
historyid, orderid = authorization.split(
|
154
|
+
historyid, orderid = authorization.split('|')
|
115
155
|
[historyid, orderid]
|
116
156
|
end
|
117
157
|
|
@@ -125,7 +165,7 @@ module ActiveMerchant #:nodoc:
|
|
125
165
|
def parse(xml)
|
126
166
|
response = {}
|
127
167
|
doc = Nokogiri::XML(xml)
|
128
|
-
message = doc.xpath(
|
168
|
+
message = doc.xpath('//plaintext')
|
129
169
|
message.text.split(/\r?\n/).each do |line|
|
130
170
|
key, value = line.split(%r{=})
|
131
171
|
response[key] = value if key
|
@@ -134,47 +174,47 @@ module ActiveMerchant #:nodoc:
|
|
134
174
|
end
|
135
175
|
|
136
176
|
ACTIONS = {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
177
|
+
'purchase' => 'ns_quicksale_cc',
|
178
|
+
'refund' => 'ns_credit',
|
179
|
+
'authorize' => 'ns_quicksale_cc',
|
180
|
+
'capture' => 'ns_quicksale_cc',
|
181
|
+
'void' => 'ns_void'
|
142
182
|
}
|
143
183
|
|
144
|
-
def commit(action, post)
|
145
|
-
post[:action] = ACTIONS[action]
|
184
|
+
def commit(action, options, post)
|
185
|
+
post[:action] = ACTIONS[action] unless post[:action]
|
146
186
|
post[:acctid] = @options[:acctid]
|
147
187
|
post[:subid] = @options[:subid]
|
148
188
|
post[:merchantpin] = @options[:merchantpin]
|
149
189
|
|
150
190
|
post[:authonly] = '1' if action == 'authorize'
|
151
191
|
|
152
|
-
raw = parse(ssl_post(
|
192
|
+
raw = parse(ssl_post(url(options), post.to_query))
|
153
193
|
|
154
|
-
succeeded = success_from(raw['
|
194
|
+
succeeded = success_from(raw['result'])
|
155
195
|
Response.new(
|
156
196
|
succeeded,
|
157
197
|
message_from(succeeded, raw),
|
158
198
|
raw,
|
159
|
-
:
|
160
|
-
:
|
199
|
+
authorization: authorization_from(raw),
|
200
|
+
test: test?
|
161
201
|
)
|
162
202
|
end
|
163
203
|
|
164
204
|
def success_from(result)
|
165
|
-
result == '
|
205
|
+
result == '1'
|
166
206
|
end
|
167
207
|
|
168
208
|
def message_from(succeeded, response)
|
169
209
|
if succeeded
|
170
|
-
|
210
|
+
'Succeeded'
|
171
211
|
else
|
172
|
-
(response['transresult'] || response['Reason'] ||
|
212
|
+
(response['transresult'] || response['Reason'] || 'Unable to read error message')
|
173
213
|
end
|
174
214
|
end
|
175
215
|
|
176
216
|
def authorization_from(response)
|
177
|
-
[response['historyid'], response['orderid']].join(
|
217
|
+
[response['historyid'], response['orderid']].join('|')
|
178
218
|
end
|
179
219
|
end
|
180
220
|
end
|
@@ -1,17 +1,14 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module ActiveMerchant
|
2
4
|
module Billing
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# Add _gateway suffix
|
9
|
-
gateway_name = filename + '_gateway'
|
10
|
-
# Camelize the string to get the class name
|
11
|
-
gateway_class = gateway_name.camelize
|
5
|
+
load_path = Pathname.new(__FILE__ + '/../../..')
|
6
|
+
Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |filename|
|
7
|
+
gateway_name = File.basename(filename, '.rb')
|
8
|
+
gateway_classname = "#{gateway_name}_gateway".camelize
|
9
|
+
gateway_filename = Pathname.new(filename).relative_path_from(load_path).sub_ext('')
|
12
10
|
|
13
|
-
|
14
|
-
autoload gateway_class, f
|
11
|
+
autoload(gateway_classname, gateway_filename)
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class NetworkTokenizationCreditCard < CreditCard
|
4
|
+
# A +NetworkTokenizationCreditCard+ object represents a tokenized credit card
|
5
|
+
# using the EMV Network Tokenization specification, http://www.emvco.com/specifications.aspx?id=263.
|
6
|
+
#
|
7
|
+
# It includes all fields of the +CreditCard+ class with additional fields for
|
8
|
+
# verification data that must be given to gateways through existing fields (3DS / EMV).
|
9
|
+
#
|
10
|
+
# The only tested usage of this at the moment is with an Apple Pay decrypted PKPaymentToken,
|
11
|
+
# https://developer.apple.com/library/ios/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html
|
12
|
+
|
13
|
+
# These are not relevant (verification) or optional (name) for Apple Pay
|
14
|
+
self.require_verification_value = false
|
15
|
+
self.require_name = false
|
16
|
+
|
17
|
+
attr_accessor :payment_cryptogram, :eci, :transaction_id, :metadata
|
18
|
+
attr_writer :source
|
19
|
+
|
20
|
+
SOURCES = %i(apple_pay android_pay google_pay network_token)
|
21
|
+
|
22
|
+
def source
|
23
|
+
if defined?(@source) && SOURCES.include?(@source)
|
24
|
+
@source
|
25
|
+
else
|
26
|
+
:apple_pay
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def credit_card?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
def type
|
35
|
+
'network_tokenization'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
# implementations of your given cryptographer. Like credit cards, you must also return a string representing
|
7
7
|
# the token's type, like 'apple_pay' or 'stripe' should your target payment gateway process these tokens.
|
8
8
|
class PaymentToken
|
9
|
-
attr_reader :payment_data
|
9
|
+
attr_reader :payment_data
|
10
10
|
|
11
11
|
def initialize(payment_data, options = {})
|
12
12
|
@payment_data = payment_data
|
@@ -4,12 +4,16 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Response
|
7
|
-
attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code
|
7
|
+
attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code, :emv_authorization, :network_transaction_id
|
8
8
|
|
9
9
|
def success?
|
10
10
|
@success
|
11
11
|
end
|
12
12
|
|
13
|
+
def failure?
|
14
|
+
!success?
|
15
|
+
end
|
16
|
+
|
13
17
|
def test?
|
14
18
|
@test
|
15
19
|
end
|
@@ -24,18 +28,20 @@ module ActiveMerchant #:nodoc:
|
|
24
28
|
@authorization = options[:authorization]
|
25
29
|
@fraud_review = options[:fraud_review]
|
26
30
|
@error_code = options[:error_code]
|
31
|
+
@emv_authorization = options[:emv_authorization]
|
32
|
+
@network_transaction_id = options[:network_transaction_id]
|
27
33
|
|
28
34
|
@avs_result = if options[:avs_result].kind_of?(AVSResult)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
options[:avs_result].to_hash
|
36
|
+
else
|
37
|
+
AVSResult.new(options[:avs_result]).to_hash
|
38
|
+
end
|
33
39
|
|
34
40
|
@cvv_result = if options[:cvv_result].kind_of?(CVVResult)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
41
|
+
options[:cvv_result].to_hash
|
42
|
+
else
|
43
|
+
CVVResult.new(options[:cvv_result]).to_hash
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
@@ -52,14 +58,14 @@ module ActiveMerchant #:nodoc:
|
|
52
58
|
@primary_response = nil
|
53
59
|
end
|
54
60
|
|
55
|
-
def process(ignore_result=false)
|
61
|
+
def process(ignore_result = false)
|
56
62
|
return unless success?
|
57
63
|
|
58
64
|
response = yield
|
59
65
|
self << response
|
60
66
|
|
61
67
|
unless ignore_result
|
62
|
-
if
|
68
|
+
if @use_first_response && response.success?
|
63
69
|
@primary_response ||= response
|
64
70
|
else
|
65
71
|
@primary_response = response
|
@@ -69,7 +75,7 @@ module ActiveMerchant #:nodoc:
|
|
69
75
|
|
70
76
|
def <<(response)
|
71
77
|
if response.is_a?(MultiResponse)
|
72
|
-
response.responses.each{|r| @responses << r}
|
78
|
+
response.responses.each { |r| @responses << r }
|
73
79
|
else
|
74
80
|
@responses << response
|
75
81
|
end
|
@@ -79,7 +85,7 @@ module ActiveMerchant #:nodoc:
|
|
79
85
|
(primary_response ? primary_response.success? : true)
|
80
86
|
end
|
81
87
|
|
82
|
-
%w(params message test authorization avs_result cvv_result test? fraud_review?).each do |m|
|
88
|
+
%w(params message test authorization avs_result cvv_result error_code emv_authorization test? fraud_review?).each do |m|
|
83
89
|
class_eval %(
|
84
90
|
def #{m}
|
85
91
|
(@responses.empty? ? nil : primary_response.#{m})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module ThreeDSecureEciMapper
|
4
|
+
NON_THREE_D_SECURE_TRANSACTION = :non_three_d_secure_transaction
|
5
|
+
ATTEMPTED_AUTHENTICATION_TRANSACTION = :attempted_authentication_transaction
|
6
|
+
FULLY_AUTHENTICATED_TRANSACTION = :fully_authenticated_transaction
|
7
|
+
|
8
|
+
ECI_00_01_02_MAP = { '00' => NON_THREE_D_SECURE_TRANSACTION, '01' => ATTEMPTED_AUTHENTICATION_TRANSACTION, '02' => FULLY_AUTHENTICATED_TRANSACTION }.freeze
|
9
|
+
ECI_05_06_07_MAP = { '05' => FULLY_AUTHENTICATED_TRANSACTION, '06' => ATTEMPTED_AUTHENTICATION_TRANSACTION, '07' => NON_THREE_D_SECURE_TRANSACTION }.freeze
|
10
|
+
BRAND_TO_ECI_MAP = {
|
11
|
+
american_express: ECI_05_06_07_MAP,
|
12
|
+
dankort: ECI_05_06_07_MAP,
|
13
|
+
diners_club: ECI_05_06_07_MAP,
|
14
|
+
discover: ECI_05_06_07_MAP,
|
15
|
+
elo: ECI_05_06_07_MAP,
|
16
|
+
jcb: ECI_05_06_07_MAP,
|
17
|
+
maestro: ECI_00_01_02_MAP,
|
18
|
+
master: ECI_00_01_02_MAP,
|
19
|
+
visa: ECI_05_06_07_MAP
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
def self.map(brand, eci)
|
23
|
+
BRAND_TO_ECI_MAP.dig(brand, eci)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,9 +5,12 @@ require 'active_merchant/billing/cvv_result'
|
|
5
5
|
require 'active_merchant/billing/credit_card_methods'
|
6
6
|
require 'active_merchant/billing/credit_card_formatting'
|
7
7
|
require 'active_merchant/billing/credit_card'
|
8
|
+
require 'active_merchant/billing/network_tokenization_credit_card'
|
8
9
|
require 'active_merchant/billing/base'
|
9
10
|
require 'active_merchant/billing/check'
|
10
11
|
require 'active_merchant/billing/payment_token'
|
11
12
|
require 'active_merchant/billing/apple_pay_payment_token'
|
12
13
|
require 'active_merchant/billing/response'
|
13
14
|
require 'active_merchant/billing/gateways'
|
15
|
+
require 'active_merchant/billing/gateway'
|
16
|
+
require 'active_merchant/billing/three_d_secure_eci_mapper'
|