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,29 +1,108 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class CardStreamGateway < Gateway
|
4
|
+
THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
|
5
|
+
|
4
6
|
self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
|
5
7
|
self.money_format = :cents
|
6
8
|
self.default_currency = 'GBP'
|
7
|
-
self.
|
8
|
-
self.
|
9
|
+
self.currencies_without_fractions = %w(CVE ISK JPY UGX)
|
10
|
+
self.supported_countries = %w[GB US CH SE SG NO JP IS HK NL CZ CA AU]
|
11
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
|
9
12
|
self.homepage_url = 'http://www.cardstream.com/'
|
10
13
|
self.display_name = 'CardStream'
|
11
14
|
|
12
15
|
CURRENCY_CODES = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
'AED' => '784',
|
17
|
+
'ALL' => '008',
|
18
|
+
'AMD' => '051',
|
19
|
+
'ANG' => '532',
|
20
|
+
'ARS' => '032',
|
21
|
+
'AUD' => '036',
|
22
|
+
'AWG' => '533',
|
23
|
+
'BAM' => '977',
|
24
|
+
'BBD' => '052',
|
25
|
+
'BGN' => '975',
|
26
|
+
'BMD' => '060',
|
27
|
+
'BOB' => '068',
|
28
|
+
'BRL' => '986',
|
29
|
+
'BSD' => '044',
|
30
|
+
'BWP' => '072',
|
31
|
+
'BZD' => '084',
|
32
|
+
'CAD' => '124',
|
33
|
+
'CHF' => '756',
|
34
|
+
'CLP' => '152',
|
35
|
+
'CNY' => '156',
|
36
|
+
'COP' => '170',
|
37
|
+
'CRC' => '188',
|
38
|
+
'CZK' => '203',
|
39
|
+
'DKK' => '208',
|
40
|
+
'DOP' => '214',
|
41
|
+
'EGP' => '818',
|
42
|
+
'EUR' => '978',
|
43
|
+
'GBP' => '826',
|
44
|
+
'GEL' => '981',
|
45
|
+
'GIP' => '292',
|
46
|
+
'GTQ' => '320',
|
47
|
+
'GYD' => '328',
|
48
|
+
'HKD' => '344',
|
49
|
+
'HNL' => '340',
|
50
|
+
'HRK' => '191',
|
51
|
+
'HUF' => '348',
|
52
|
+
'ISK' => '352',
|
53
|
+
'IDR' => '360',
|
54
|
+
'ILS' => '376',
|
55
|
+
'INR' => '356',
|
56
|
+
'JPY' => '392',
|
57
|
+
'JMD' => '388',
|
58
|
+
'KES' => '404',
|
59
|
+
'KRW' => '410',
|
60
|
+
'KYD' => '136',
|
61
|
+
'LBP' => '422',
|
62
|
+
'LKR' => '144',
|
63
|
+
'MAD' => '504',
|
64
|
+
'MVR' => '462',
|
65
|
+
'MWK' => '454',
|
66
|
+
'MXN' => '484',
|
67
|
+
'MYR' => '458',
|
68
|
+
'NAD' => '516',
|
69
|
+
'NGN' => '566',
|
70
|
+
'NIO' => '558',
|
71
|
+
'NOK' => '578',
|
72
|
+
'NPR' => '524',
|
73
|
+
'NZD' => '554',
|
74
|
+
'PAB' => '590',
|
75
|
+
'PEN' => '604',
|
76
|
+
'PGK' => '598',
|
77
|
+
'PHP' => '608',
|
78
|
+
'PKR' => '586',
|
79
|
+
'PLN' => '985',
|
80
|
+
'PYG' => '600',
|
81
|
+
'QAR' => '634',
|
82
|
+
'RON' => '946',
|
83
|
+
'RSD' => '941',
|
84
|
+
'RUB' => '643',
|
85
|
+
'RWF' => '646',
|
86
|
+
'SAR' => '682',
|
87
|
+
'SEK' => '752',
|
88
|
+
'SGD' => '702',
|
89
|
+
'SRD' => '968',
|
90
|
+
'THB' => '764',
|
91
|
+
'TND' => '788',
|
92
|
+
'TRY' => '949',
|
93
|
+
'TTD' => '780',
|
94
|
+
'TWD' => '901',
|
95
|
+
'TZS' => '834',
|
96
|
+
'UAH' => '980',
|
97
|
+
'UGX' => '800',
|
98
|
+
'USD' => '840',
|
99
|
+
'UYU' => '858',
|
100
|
+
'VND' => '704',
|
101
|
+
'WST' => '882',
|
102
|
+
'XAF' => '950',
|
103
|
+
'XCD' => '951',
|
104
|
+
'XOF' => '952',
|
105
|
+
'ZAR' => '710'
|
27
106
|
}
|
28
107
|
|
29
108
|
CVV_CODE = {
|
@@ -39,11 +118,11 @@ module ActiveMerchant #:nodoc:
|
|
39
118
|
# 4 - Postcode not matched.
|
40
119
|
# 8 - Postcode partially matched.
|
41
120
|
AVS_POSTAL_MATCH = {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
121
|
+
'0' => nil,
|
122
|
+
'1' => nil,
|
123
|
+
'2' => 'Y',
|
124
|
+
'4' => 'N',
|
125
|
+
'8' => 'N'
|
47
126
|
}
|
48
127
|
|
49
128
|
# 0 - No additional information available.
|
@@ -52,115 +131,172 @@ module ActiveMerchant #:nodoc:
|
|
52
131
|
# 4 - Address numeric not matched.
|
53
132
|
# 8 - Address numeric partially matched.
|
54
133
|
AVS_STREET_MATCH = {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
134
|
+
'0' => nil,
|
135
|
+
'1' => nil,
|
136
|
+
'2' => 'Y',
|
137
|
+
'4' => 'N',
|
138
|
+
'8' => 'N'
|
60
139
|
}
|
61
140
|
|
62
141
|
def initialize(options = {})
|
63
142
|
requires!(options, :login, :shared_secret)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@
|
143
|
+
@threeds_required = false
|
144
|
+
if options[:threeDSRequired]
|
145
|
+
ActiveMerchant.deprecated(THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE)
|
146
|
+
@threeds_required = options[:threeDSRequired]
|
68
147
|
end
|
69
148
|
super
|
70
149
|
end
|
71
150
|
|
72
|
-
def authorize(money,
|
151
|
+
def authorize(money, credit_card_or_reference, options = {})
|
73
152
|
post = {}
|
74
|
-
|
75
|
-
|
76
|
-
add_creditcard(post, creditcard)
|
77
|
-
add_address(post, creditcard, options)
|
78
|
-
add_customer_data(post, options)
|
79
|
-
commit('PREAUTH', post)
|
153
|
+
add_auth_purchase(post, -1, money, credit_card_or_reference, options)
|
154
|
+
commit('SALE', post)
|
80
155
|
end
|
81
156
|
|
82
|
-
def purchase(money,
|
157
|
+
def purchase(money, credit_card_or_reference, options = {})
|
83
158
|
post = {}
|
84
|
-
|
85
|
-
add_invoice(post, creditcard, money, options)
|
86
|
-
add_creditcard(post, creditcard)
|
87
|
-
add_address(post, creditcard, options)
|
88
|
-
add_customer_data(post, options)
|
159
|
+
add_auth_purchase(post, 0, money, credit_card_or_reference, options)
|
89
160
|
commit('SALE', post)
|
90
161
|
end
|
91
162
|
|
92
163
|
def capture(money, authorization, options = {})
|
93
164
|
post = {}
|
94
165
|
add_pair(post, :xref, authorization)
|
95
|
-
|
96
|
-
|
166
|
+
add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), required: true)
|
167
|
+
add_remote_address(post, options)
|
168
|
+
|
169
|
+
commit('CAPTURE', post)
|
97
170
|
end
|
98
171
|
|
99
172
|
def refund(money, authorization, options = {})
|
100
173
|
post = {}
|
101
174
|
add_pair(post, :xref, authorization)
|
102
175
|
add_amount(post, money, options)
|
103
|
-
|
176
|
+
add_remote_address(post, options)
|
177
|
+
add_country_code(post, options)
|
178
|
+
response = commit('REFUND_SALE', post)
|
179
|
+
|
180
|
+
return response if response.success?
|
181
|
+
return response unless options[:force_full_refund_if_unsettled]
|
182
|
+
|
183
|
+
if response.params['responseCode'] == '65541'
|
184
|
+
void(authorization, options)
|
185
|
+
else
|
186
|
+
response
|
187
|
+
end
|
104
188
|
end
|
105
189
|
|
106
190
|
def void(authorization, options = {})
|
107
191
|
post = {}
|
108
192
|
add_pair(post, :xref, authorization)
|
109
|
-
|
193
|
+
add_remote_address(post, options)
|
194
|
+
commit('CANCEL', post)
|
195
|
+
end
|
196
|
+
|
197
|
+
def verify(creditcard, options = {})
|
198
|
+
MultiResponse.run(:use_first_response) do |r|
|
199
|
+
r.process { authorize(100, creditcard, options) }
|
200
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def supports_scrubbing?
|
205
|
+
true
|
206
|
+
end
|
207
|
+
|
208
|
+
def scrub(transcript)
|
209
|
+
transcript.
|
210
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
211
|
+
gsub(%r((cardNumber=)\d+), '\1[FILTERED]').
|
212
|
+
gsub(%r((CVV=)\d+), '\1[FILTERED]')
|
110
213
|
end
|
111
214
|
|
112
215
|
private
|
113
216
|
|
217
|
+
def add_auth_purchase(post, pair_value, money, credit_card_or_reference, options)
|
218
|
+
add_pair(post, :captureDelay, pair_value)
|
219
|
+
add_amount(post, money, options)
|
220
|
+
add_invoice(post, credit_card_or_reference, money, options)
|
221
|
+
add_credit_card_or_reference(post, credit_card_or_reference)
|
222
|
+
add_customer_data(post, options)
|
223
|
+
add_remote_address(post, options)
|
224
|
+
add_country_code(post, options)
|
225
|
+
end
|
226
|
+
|
114
227
|
def add_amount(post, money, options)
|
115
|
-
|
116
|
-
add_pair(post, :
|
228
|
+
currency = options[:currency] || currency(money)
|
229
|
+
add_pair(post, :amount, localized_amount(money, currency), required: true)
|
230
|
+
add_pair(post, :currencyCode, currency_code(currency))
|
117
231
|
end
|
118
232
|
|
119
233
|
def add_customer_data(post, options)
|
120
|
-
address = options[:billing_address] || options[:address]
|
121
|
-
add_pair(post, :customerPostCode, address[:zip])
|
122
234
|
add_pair(post, :customerEmail, options[:email])
|
123
|
-
|
235
|
+
if (address = options[:billing_address] || options[:address])
|
236
|
+
add_pair(post, :customerAddress, "#{address[:address1]} #{address[:address2]}".strip)
|
237
|
+
add_pair(post, :customerPostCode, address[:zip])
|
238
|
+
add_pair(post, :customerPhone, options[:phone])
|
239
|
+
add_pair(post, :customerCountryCode, address[:country] || 'GB')
|
240
|
+
else
|
241
|
+
add_pair(post, :customerCountryCode, 'GB')
|
242
|
+
end
|
124
243
|
end
|
125
244
|
|
126
|
-
def
|
127
|
-
|
128
|
-
|
129
|
-
|
245
|
+
def add_invoice(post, credit_card_or_reference, money, options)
|
246
|
+
add_pair(post, :transactionUnique, options[:order_id], required: true)
|
247
|
+
add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
|
248
|
+
add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
|
249
|
+
add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
|
250
|
+
if credit_card_or_reference.respond_to?(:number)
|
251
|
+
if %w[american_express diners_club].include?(card_brand(credit_card_or_reference).to_s)
|
252
|
+
add_pair(post, :item1Quantity, 1)
|
253
|
+
add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
|
254
|
+
add_pair(post, :item1GrossValue, localized_amount(money, options[:currency] || currency(money)))
|
255
|
+
end
|
256
|
+
end
|
130
257
|
|
131
|
-
add_pair(post, :
|
132
|
-
|
258
|
+
add_pair(post, :type, options[:type] || '1')
|
259
|
+
add_threeds_required(post, options)
|
133
260
|
end
|
134
261
|
|
135
|
-
def
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
|
141
|
-
add_pair(post, :item1GrossValue, amount(money))
|
262
|
+
def add_credit_card_or_reference(post, credit_card_or_reference)
|
263
|
+
if credit_card_or_reference.respond_to?(:number)
|
264
|
+
add_credit_card(post, credit_card_or_reference)
|
265
|
+
else
|
266
|
+
add_reference(post, credit_card_or_reference.to_s)
|
142
267
|
end
|
143
268
|
end
|
144
269
|
|
145
|
-
def
|
146
|
-
add_pair(post, :
|
147
|
-
|
270
|
+
def add_reference(post, reference)
|
271
|
+
add_pair(post, :xref, reference, required: true)
|
272
|
+
end
|
148
273
|
|
149
|
-
|
150
|
-
add_pair(post, :
|
274
|
+
def add_credit_card(post, credit_card)
|
275
|
+
add_pair(post, :customerName, credit_card.name, required: true)
|
276
|
+
add_pair(post, :cardNumber, credit_card.number, required: true)
|
277
|
+
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), required: true)
|
278
|
+
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), required: true)
|
279
|
+
add_pair(post, :cardCVV, credit_card.verification_value)
|
280
|
+
end
|
151
281
|
|
152
|
-
|
153
|
-
|
154
|
-
|
282
|
+
def add_threeds_required(post, options)
|
283
|
+
add_pair(post, :threeDSRequired, options[:threeds_required] || @threeds_required ? 'Y' : 'N')
|
284
|
+
end
|
155
285
|
|
156
|
-
|
157
|
-
|
286
|
+
def add_remote_address(post, options = {})
|
287
|
+
add_pair(post, :remoteAddress, options[:ip] || '1.1.1.1')
|
288
|
+
end
|
158
289
|
|
159
|
-
|
290
|
+
def add_country_code(post, options)
|
291
|
+
post[:countryCode] = options[:country_code] || self.supported_countries[0]
|
292
|
+
end
|
293
|
+
|
294
|
+
def normalize_line_endings(str)
|
295
|
+
str.gsub(/%0D%0A|%0A%0D|%0D/, '%0A')
|
160
296
|
end
|
161
297
|
|
162
298
|
def add_hmac(post)
|
163
|
-
result = post.sort.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
299
|
+
result = post.sort.collect { |key, value| "#{key}=#{normalize_line_endings(CGI.escape(value.to_s))}" }.join('&')
|
164
300
|
result = Digest::SHA512.hexdigest("#{result}#{@options[:shared_secret]}")
|
165
301
|
|
166
302
|
add_pair(post, :signature, result)
|
@@ -168,48 +304,63 @@ module ActiveMerchant #:nodoc:
|
|
168
304
|
|
169
305
|
def parse(body)
|
170
306
|
result = {}
|
171
|
-
pairs = body.split(
|
307
|
+
pairs = body.split('&')
|
172
308
|
pairs.each do |pair|
|
173
|
-
a = pair.split(
|
174
|
-
# because some
|
309
|
+
a = pair.split('=')
|
310
|
+
# because some value pairs don't have a value
|
175
311
|
result[a[0].to_sym] = a[1] == nil ? '' : CGI.unescape(a[1])
|
176
312
|
end
|
177
313
|
result
|
178
314
|
end
|
179
315
|
|
180
316
|
def commit(action, parameters)
|
181
|
-
|
182
317
|
parameters.update(
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:type => '1', #Ecommerce
|
186
|
-
:countryCode => self.supported_countries[0],
|
187
|
-
:threeDSRequired => @threeDSRequired #Disable 3d secure by default
|
318
|
+
merchantID: @options[:login],
|
319
|
+
action: action
|
188
320
|
)
|
189
321
|
# adds a signature to the post hash/array
|
190
322
|
add_hmac(parameters)
|
191
323
|
|
192
324
|
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
193
325
|
|
194
|
-
Response.new(
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
:street_match => AVS_STREET_MATCH[response[:avscv2ResponseCode].to_s[2, 1]]
|
203
|
-
}
|
326
|
+
Response.new(
|
327
|
+
response[:responseCode] == '0',
|
328
|
+
response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
|
329
|
+
response,
|
330
|
+
test: test?,
|
331
|
+
authorization: response[:xref],
|
332
|
+
cvv_result: CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
|
333
|
+
avs_result: avs_from(response)
|
204
334
|
)
|
205
335
|
end
|
206
336
|
|
337
|
+
def avs_from(response)
|
338
|
+
postal_match = AVS_POSTAL_MATCH[response[:avscv2ResponseCode].to_s[1, 1]]
|
339
|
+
street_match = AVS_STREET_MATCH[response[:avscv2ResponseCode].to_s[2, 1]]
|
340
|
+
|
341
|
+
code = if postal_match == 'Y' && street_match == 'Y'
|
342
|
+
'M'
|
343
|
+
elsif postal_match == 'Y'
|
344
|
+
'P'
|
345
|
+
elsif street_match == 'Y'
|
346
|
+
'A'
|
347
|
+
else
|
348
|
+
'I'
|
349
|
+
end
|
350
|
+
|
351
|
+
AVSResult.new({
|
352
|
+
code: code,
|
353
|
+
postal_match: postal_match,
|
354
|
+
street_match: street_match
|
355
|
+
})
|
356
|
+
end
|
357
|
+
|
207
358
|
def currency_code(currency)
|
208
359
|
CURRENCY_CODES[currency]
|
209
360
|
end
|
210
361
|
|
211
362
|
def post_data(action, parameters = {})
|
212
|
-
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
363
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
213
364
|
end
|
214
365
|
|
215
366
|
def add_pair(post, key, value, options = {})
|