activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -4,40 +4,43 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.test_url = 'https://sandbox.dlocal.com'
|
5
5
|
self.live_url = 'https://api.dlocal.com'
|
6
6
|
|
7
|
-
self.supported_countries = [
|
7
|
+
self.supported_countries = %w[AR BD BO BR CL CM CN CO CR DO EC EG GH GT IN ID JP KE MY MX MA NG PA PY PE PH SN SV TH TR TZ UG UY VN ZA]
|
8
8
|
self.default_currency = 'USD'
|
9
|
-
self.supported_cardtypes = [
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro naranja cabal elo alia carnet]
|
10
10
|
|
11
11
|
self.homepage_url = 'https://dlocal.com/'
|
12
12
|
self.display_name = 'dLocal'
|
13
13
|
|
14
|
-
def initialize(options={})
|
14
|
+
def initialize(options = {})
|
15
15
|
requires!(options, :login, :trans_key, :secret_key)
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
|
-
def purchase(money, payment, options={})
|
19
|
+
def purchase(money, payment, options = {})
|
20
20
|
post = {}
|
21
21
|
add_auth_purchase_params(post, money, payment, 'purchase', options)
|
22
|
+
add_three_ds(post, options)
|
22
23
|
|
23
24
|
commit('purchase', post, options)
|
24
25
|
end
|
25
26
|
|
26
|
-
def authorize(money, payment, options={})
|
27
|
+
def authorize(money, payment, options = {})
|
27
28
|
post = {}
|
28
29
|
add_auth_purchase_params(post, money, payment, 'authorize', options)
|
30
|
+
add_three_ds(post, options)
|
31
|
+
post[:card][:verify] = true if options[:verify].to_s == 'true'
|
29
32
|
|
30
33
|
commit('authorize', post, options)
|
31
34
|
end
|
32
35
|
|
33
|
-
def capture(money, authorization, options={})
|
36
|
+
def capture(money, authorization, options = {})
|
34
37
|
post = {}
|
35
|
-
post[:
|
38
|
+
post[:authorization_id] = authorization
|
36
39
|
add_invoice(post, money, options) if money
|
37
40
|
commit('capture', post, options)
|
38
41
|
end
|
39
42
|
|
40
|
-
def refund(money, authorization, options={})
|
43
|
+
def refund(money, authorization, options = {})
|
41
44
|
post = {}
|
42
45
|
post[:payment_id] = authorization
|
43
46
|
post[:notification_url] = options[:notification_url]
|
@@ -45,23 +48,31 @@ module ActiveMerchant #:nodoc:
|
|
45
48
|
commit('refund', post, options)
|
46
49
|
end
|
47
50
|
|
48
|
-
def void(authorization, options={})
|
51
|
+
def void(authorization, options = {})
|
49
52
|
post = {}
|
50
|
-
post[:
|
53
|
+
post[:authorization_id] = authorization
|
51
54
|
commit('void', post, options)
|
52
55
|
end
|
53
56
|
|
54
|
-
def verify(credit_card, options={})
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
def verify(credit_card, options = {})
|
58
|
+
authorize(0, credit_card, options.merge(verify: 'true'))
|
59
|
+
end
|
60
|
+
|
61
|
+
def inquire(authorization, options = {})
|
62
|
+
post = {}
|
63
|
+
post[:payment_id] = authorization
|
64
|
+
action = authorization ? 'status' : 'orders'
|
65
|
+
commit(action, post, options)
|
59
66
|
end
|
60
67
|
|
61
68
|
def supports_scrubbing?
|
62
69
|
true
|
63
70
|
end
|
64
71
|
|
72
|
+
def supports_network_tokenization?
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
65
76
|
def scrub(transcript)
|
66
77
|
transcript.
|
67
78
|
gsub(%r((X-Trans-Key: )\w+), '\1[FILTERED]').
|
@@ -78,7 +89,9 @@ module ActiveMerchant #:nodoc:
|
|
78
89
|
add_country(post, card, options)
|
79
90
|
add_payer(post, card, options)
|
80
91
|
add_card(post, card, action, options)
|
92
|
+
add_additional_data(post, options)
|
81
93
|
post[:order_id] = options[:order_id] || generate_unique_id
|
94
|
+
post[:original_order_id] = options[:original_order_id] if options[:original_order_id]
|
82
95
|
post[:description] = options[:description] if options[:description]
|
83
96
|
end
|
84
97
|
|
@@ -87,13 +100,20 @@ module ActiveMerchant #:nodoc:
|
|
87
100
|
post[:currency] = (options[:currency] || currency(money))
|
88
101
|
end
|
89
102
|
|
103
|
+
def add_additional_data(post, options)
|
104
|
+
post[:additional_risk_data] = options[:additional_data]
|
105
|
+
end
|
106
|
+
|
90
107
|
def add_country(post, card, options)
|
91
108
|
return unless address = options[:billing_address] || options[:address]
|
109
|
+
|
92
110
|
post[:country] = lookup_country_code(address[:country])
|
93
111
|
end
|
94
112
|
|
95
|
-
def lookup_country_code(
|
96
|
-
Country.find(
|
113
|
+
def lookup_country_code(country_field)
|
114
|
+
Country.find(country_field).code(:alpha2).value
|
115
|
+
rescue InvalidCountryCodeError
|
116
|
+
nil
|
97
117
|
end
|
98
118
|
|
99
119
|
def add_payer(post, card, options)
|
@@ -106,40 +126,87 @@ module ActiveMerchant #:nodoc:
|
|
106
126
|
post[:payer][:document] = options[:document] if options[:document]
|
107
127
|
post[:payer][:document2] = options[:document2] if options[:document2]
|
108
128
|
post[:payer][:user_reference] = options[:user_reference] if options[:user_reference]
|
129
|
+
post[:payer][:event_uuid] = options[:device_id] if options[:device_id]
|
130
|
+
post[:payer][:onboarding_ip_address] = options[:ip] if options[:ip]
|
109
131
|
post[:payer][:address] = add_address(post, card, options)
|
110
132
|
end
|
111
133
|
|
112
134
|
def add_address(post, card, options)
|
113
135
|
return unless address = options[:billing_address] || options[:address]
|
136
|
+
|
114
137
|
address_object = {}
|
115
138
|
address_object[:state] = address[:state] if address[:state]
|
116
139
|
address_object[:city] = address[:city] if address[:city]
|
117
|
-
address_object[:zip_code] = address[:
|
118
|
-
address_object[:street] = address[:street] if address
|
119
|
-
address_object[:number] = address[:number] if address
|
140
|
+
address_object[:zip_code] = address[:zip] if address[:zip]
|
141
|
+
address_object[:street] = address[:street] || parse_street(address) if parse_street(address)
|
142
|
+
address_object[:number] = address[:number] || parse_house_number(address) if parse_house_number(address)
|
120
143
|
address_object
|
121
144
|
end
|
122
145
|
|
123
|
-
def
|
146
|
+
def parse_street(address)
|
147
|
+
return unless address[:address1]
|
148
|
+
|
149
|
+
street = address[:address1].split(/\s+/).keep_if { |x| x !~ /\d/ }.join(' ')
|
150
|
+
street.empty? ? nil : street
|
151
|
+
end
|
152
|
+
|
153
|
+
def parse_house_number(address)
|
154
|
+
return unless address[:address1]
|
155
|
+
|
156
|
+
house = address[:address1].split(/\s+/).keep_if { |x| x =~ /\d/ }.join(' ')
|
157
|
+
house.empty? ? nil : house
|
158
|
+
end
|
159
|
+
|
160
|
+
def add_card(post, card, action, options = {})
|
124
161
|
post[:card] = {}
|
162
|
+
if card.is_a?(NetworkTokenizationCreditCard)
|
163
|
+
post[:card][:network_token] = card.number
|
164
|
+
post[:card][:cryptogram] = card.payment_cryptogram
|
165
|
+
post[:card][:eci] = card.eci
|
166
|
+
# used case of Network Token: 'CARD_ON_FILE', 'SUBSCRIPTION', 'UNSCHEDULED_CARD_ON_FILE'
|
167
|
+
if options.dig(:stored_credential, :reason_type) == 'unscheduled'
|
168
|
+
if options.dig(:stored_credential, :initiator) == 'merchant'
|
169
|
+
post[:card][:stored_credential_type] = 'UNSCHEDULED_CARD_ON_FILE'
|
170
|
+
else
|
171
|
+
post[:card][:stored_credential_type] = 'CARD_ON_FILE'
|
172
|
+
end
|
173
|
+
else
|
174
|
+
post[:card][:stored_credential_type] = 'SUBSCRIPTION'
|
175
|
+
end
|
176
|
+
# required for MC debit recurrent in BR 'USED'(subsecuence Payments) . 'FIRST' an inital payment
|
177
|
+
post[:card][:stored_credential_usage] = (options[:stored_credential][:initial_transaction] ? 'FIRST' : 'USED') if options[:stored_credential]
|
178
|
+
else
|
179
|
+
post[:card][:number] = card.number
|
180
|
+
post[:card][:cvv] = card.verification_value
|
181
|
+
end
|
182
|
+
|
125
183
|
post[:card][:holder_name] = card.name
|
126
184
|
post[:card][:expiration_month] = card.month
|
127
185
|
post[:card][:expiration_year] = card.year
|
128
|
-
post[:card][:number] = card.number
|
129
|
-
post[:card][:cvv] = card.verification_value
|
130
186
|
post[:card][:descriptor] = options[:dynamic_descriptor] if options[:dynamic_descriptor]
|
131
187
|
post[:card][:capture] = (action == 'purchase')
|
188
|
+
post[:card][:installments] = options[:installments] if options[:installments]
|
189
|
+
post[:card][:installments_id] = options[:installments_id] if options[:installments_id]
|
190
|
+
post[:card][:force_type] = options[:force_type].to_s.upcase if options[:force_type]
|
191
|
+
post[:card][:save] = options[:save] if options[:save]
|
132
192
|
end
|
133
193
|
|
134
194
|
def parse(body)
|
135
195
|
JSON.parse(body)
|
136
196
|
end
|
137
197
|
|
138
|
-
def commit(action, parameters, options={})
|
198
|
+
def commit(action, parameters, options = {})
|
199
|
+
three_ds_errors = validate_three_ds_params(parameters[:three_dsecure]) if parameters[:three_dsecure].present?
|
200
|
+
return three_ds_errors if three_ds_errors
|
201
|
+
|
139
202
|
url = url(action, parameters, options)
|
140
203
|
post = post_data(action, parameters)
|
141
204
|
begin
|
142
|
-
raw =
|
205
|
+
raw = if %w(status orders).include?(action)
|
206
|
+
ssl_get(url, headers(nil, options))
|
207
|
+
else
|
208
|
+
ssl_post(url, post, headers(post, options))
|
209
|
+
end
|
143
210
|
response = parse(raw)
|
144
211
|
rescue ResponseError => e
|
145
212
|
raw = e.response.body
|
@@ -163,7 +230,8 @@ module ActiveMerchant #:nodoc:
|
|
163
230
|
# we count 100 as a success.
|
164
231
|
def success_from(action, response)
|
165
232
|
return false unless response['status_code']
|
166
|
-
|
233
|
+
|
234
|
+
%w[100 200 400 600 700].include? response['status_code'].to_s
|
167
235
|
end
|
168
236
|
|
169
237
|
def message_from(action, response)
|
@@ -176,11 +244,12 @@ module ActiveMerchant #:nodoc:
|
|
176
244
|
|
177
245
|
def error_code_from(action, response)
|
178
246
|
return if success_from(action, response)
|
247
|
+
|
179
248
|
code = response['status_code'] || response['code']
|
180
249
|
code&.to_s
|
181
250
|
end
|
182
251
|
|
183
|
-
def url(action, parameters, options={})
|
252
|
+
def url(action, parameters, options = {})
|
184
253
|
"#{(test? ? test_url : live_url)}/#{endpoint(action, parameters, options)}/"
|
185
254
|
end
|
186
255
|
|
@@ -193,22 +262,27 @@ module ActiveMerchant #:nodoc:
|
|
193
262
|
when 'refund'
|
194
263
|
'refunds'
|
195
264
|
when 'capture'
|
196
|
-
|
265
|
+
'payments'
|
197
266
|
when 'void'
|
198
|
-
"payments/#{parameters[:
|
267
|
+
"payments/#{parameters[:authorization_id]}/cancel"
|
268
|
+
when 'status'
|
269
|
+
"payments/#{parameters[:payment_id]}/status"
|
270
|
+
when 'orders'
|
271
|
+
"orders/#{options[:order_id]}"
|
199
272
|
end
|
200
273
|
end
|
201
274
|
|
202
|
-
def headers(post, options={})
|
275
|
+
def headers(post, options = {})
|
203
276
|
timestamp = Time.now.utc.iso8601
|
204
277
|
headers = {
|
205
278
|
'Content-Type' => 'application/json',
|
206
279
|
'X-Date' => timestamp,
|
207
280
|
'X-Login' => @options[:login],
|
208
281
|
'X-Trans-Key' => @options[:trans_key],
|
282
|
+
'X-Version' => '2.1',
|
209
283
|
'Authorization' => signature(post, timestamp)
|
210
284
|
}
|
211
|
-
headers
|
285
|
+
headers['X-Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key]
|
212
286
|
headers
|
213
287
|
end
|
214
288
|
|
@@ -221,6 +295,49 @@ module ActiveMerchant #:nodoc:
|
|
221
295
|
def post_data(action, parameters = {})
|
222
296
|
parameters.to_json
|
223
297
|
end
|
298
|
+
|
299
|
+
def xid_or_ds_trans_id(three_d_secure)
|
300
|
+
if three_d_secure[:version].to_f >= 2
|
301
|
+
{ ds_transaction_id: three_d_secure[:ds_transaction_id] }
|
302
|
+
else
|
303
|
+
{ xid: three_d_secure[:xid] }
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
def add_three_ds(post, options)
|
308
|
+
return unless three_d_secure = options[:three_d_secure]
|
309
|
+
|
310
|
+
post[:three_dsecure] = {
|
311
|
+
mpi: true,
|
312
|
+
three_dsecure_version: three_d_secure[:version],
|
313
|
+
cavv: three_d_secure[:cavv],
|
314
|
+
eci: three_d_secure[:eci],
|
315
|
+
enrollment_response: formatted_enrollment(three_d_secure[:enrolled]),
|
316
|
+
authentication_response: three_d_secure[:authentication_response_status]
|
317
|
+
}.merge(xid_or_ds_trans_id(three_d_secure))
|
318
|
+
end
|
319
|
+
|
320
|
+
def validate_three_ds_params(three_ds)
|
321
|
+
errors = {}
|
322
|
+
supported_version = %w{1.0 2.0 2.1.0 2.2.0}.include?(three_ds[:three_dsecure_version])
|
323
|
+
supported_enrollment = ['Y', 'N', 'U', nil].include?(three_ds[:enrollment_response])
|
324
|
+
supported_auth_response = ['Y', 'N', 'U', nil].include?(three_ds[:authentication_response])
|
325
|
+
|
326
|
+
errors[:three_ds_version] = 'ThreeDs version not supported' unless supported_version
|
327
|
+
errors[:enrollment] = 'Enrollment value not supported' unless supported_enrollment
|
328
|
+
errors[:auth_response] = 'Authentication response value not supported' unless supported_auth_response
|
329
|
+
errors.compact!
|
330
|
+
|
331
|
+
errors.present? ? Response.new(false, 'ThreeDs data is invalid', errors) : nil
|
332
|
+
end
|
333
|
+
|
334
|
+
def formatted_enrollment(val)
|
335
|
+
case val
|
336
|
+
when 'Y', 'N', 'U' then val
|
337
|
+
when true, 'true' then 'Y'
|
338
|
+
when false, 'false' then 'N'
|
339
|
+
end
|
340
|
+
end
|
224
341
|
end
|
225
342
|
end
|
226
343
|
end
|
@@ -6,7 +6,7 @@ module ActiveMerchant
|
|
6
6
|
self.default_currency = 'GBP'
|
7
7
|
self.supported_countries = ['GB']
|
8
8
|
|
9
|
-
self.supported_cardtypes = [
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro]
|
10
10
|
|
11
11
|
self.homepage_url = 'http://www.datacash.com/'
|
12
12
|
self.display_name = 'DataCash'
|
@@ -92,9 +92,9 @@ module ActiveMerchant
|
|
92
92
|
|
93
93
|
def build_void_or_capture_request(type, money, authorization, options)
|
94
94
|
parsed_authorization = parse_authorization_string(authorization)
|
95
|
-
xml = Builder::XmlMarkup.new :
|
95
|
+
xml = Builder::XmlMarkup.new indent: 2
|
96
96
|
xml.instruct!
|
97
|
-
xml.tag! :Request, :
|
97
|
+
xml.tag! :Request, version: '2' do
|
98
98
|
add_authentication(xml)
|
99
99
|
|
100
100
|
xml.tag! :Transaction do
|
@@ -107,7 +107,7 @@ module ActiveMerchant
|
|
107
107
|
if money
|
108
108
|
xml.tag! :TxnDetails do
|
109
109
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
110
|
-
xml.tag! :amount, amount(money), :
|
110
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
111
111
|
xml.tag! :capturemethod, 'ecomm'
|
112
112
|
end
|
113
113
|
end
|
@@ -117,22 +117,20 @@ module ActiveMerchant
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def build_purchase_or_authorization_request_with_credit_card_request(type, money, credit_card, options)
|
120
|
-
xml = Builder::XmlMarkup.new :
|
120
|
+
xml = Builder::XmlMarkup.new indent: 2
|
121
121
|
xml.instruct!
|
122
|
-
xml.tag! :Request, :
|
122
|
+
xml.tag! :Request, version: '2' do
|
123
123
|
add_authentication(xml)
|
124
124
|
|
125
125
|
xml.tag! :Transaction do
|
126
|
-
if options[:set_up_continuous_authority]
|
127
|
-
xml.tag! :ContAuthTxn, :type => 'setup'
|
128
|
-
end
|
126
|
+
xml.tag! :ContAuthTxn, type: 'setup' if options[:set_up_continuous_authority]
|
129
127
|
xml.tag! :CardTxn do
|
130
128
|
xml.tag! :method, type
|
131
129
|
add_credit_card(xml, credit_card, options[:billing_address])
|
132
130
|
end
|
133
131
|
xml.tag! :TxnDetails do
|
134
132
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
135
|
-
xml.tag! :amount, amount(money), :
|
133
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
136
134
|
xml.tag! :capturemethod, 'ecomm'
|
137
135
|
end
|
138
136
|
end
|
@@ -144,19 +142,19 @@ module ActiveMerchant
|
|
144
142
|
parsed_authorization = parse_authorization_string(authorization)
|
145
143
|
raise ArgumentError, 'The continuous authority reference is required for continuous authority transactions' if parsed_authorization[:ca_reference].blank?
|
146
144
|
|
147
|
-
xml = Builder::XmlMarkup.new :
|
145
|
+
xml = Builder::XmlMarkup.new indent: 2
|
148
146
|
xml.instruct!
|
149
|
-
xml.tag! :Request, :
|
147
|
+
xml.tag! :Request, version: '2' do
|
150
148
|
add_authentication(xml)
|
151
149
|
xml.tag! :Transaction do
|
152
|
-
xml.tag! :ContAuthTxn, :
|
150
|
+
xml.tag! :ContAuthTxn, type: 'historic'
|
153
151
|
xml.tag! :HistoricTxn do
|
154
152
|
xml.tag! :reference, parsed_authorization[:ca_reference]
|
155
153
|
xml.tag! :method, type
|
156
154
|
end
|
157
155
|
xml.tag! :TxnDetails do
|
158
156
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
159
|
-
xml.tag! :amount, amount(money), :
|
157
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
160
158
|
xml.tag! :capturemethod, 'cont_auth'
|
161
159
|
end
|
162
160
|
end
|
@@ -166,9 +164,9 @@ module ActiveMerchant
|
|
166
164
|
|
167
165
|
def build_transaction_refund_request(money, authorization)
|
168
166
|
parsed_authorization = parse_authorization_string(authorization)
|
169
|
-
xml = Builder::XmlMarkup.new :
|
167
|
+
xml = Builder::XmlMarkup.new indent: 2
|
170
168
|
xml.instruct!
|
171
|
-
xml.tag! :Request, :
|
169
|
+
xml.tag! :Request, version: '2' do
|
172
170
|
add_authentication(xml)
|
173
171
|
xml.tag! :Transaction do
|
174
172
|
xml.tag! :HistoricTxn do
|
@@ -187,9 +185,9 @@ module ActiveMerchant
|
|
187
185
|
end
|
188
186
|
|
189
187
|
def build_credit_request(money, credit_card, options)
|
190
|
-
xml = Builder::XmlMarkup.new :
|
188
|
+
xml = Builder::XmlMarkup.new indent: 2
|
191
189
|
xml.instruct!
|
192
|
-
xml.tag! :Request, :
|
190
|
+
xml.tag! :Request, version: '2' do
|
193
191
|
add_authentication(xml)
|
194
192
|
xml.tag! :Transaction do
|
195
193
|
xml.tag! :CardTxn do
|
@@ -237,23 +235,23 @@ module ActiveMerchant
|
|
237
235
|
# a predefined one
|
238
236
|
xml.tag! :ExtendedPolicy do
|
239
237
|
xml.tag! :cv2_policy,
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
244
|
-
:
|
238
|
+
notprovided: POLICY_REJECT,
|
239
|
+
notchecked: POLICY_REJECT,
|
240
|
+
matched: POLICY_ACCEPT,
|
241
|
+
notmatched: POLICY_REJECT,
|
242
|
+
partialmatch: POLICY_REJECT
|
245
243
|
xml.tag! :postcode_policy,
|
246
|
-
:
|
247
|
-
:
|
248
|
-
:
|
249
|
-
:
|
250
|
-
:
|
244
|
+
notprovided: POLICY_ACCEPT,
|
245
|
+
notchecked: POLICY_ACCEPT,
|
246
|
+
matched: POLICY_ACCEPT,
|
247
|
+
notmatched: POLICY_REJECT,
|
248
|
+
partialmatch: POLICY_ACCEPT
|
251
249
|
xml.tag! :address_policy,
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
255
|
-
:
|
256
|
-
:
|
250
|
+
notprovided: POLICY_ACCEPT,
|
251
|
+
notchecked: POLICY_ACCEPT,
|
252
|
+
matched: POLICY_ACCEPT,
|
253
|
+
notmatched: POLICY_REJECT,
|
254
|
+
partialmatch: POLICY_ACCEPT
|
257
255
|
end
|
258
256
|
end
|
259
257
|
end
|
@@ -263,9 +261,8 @@ module ActiveMerchant
|
|
263
261
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
|
264
262
|
|
265
263
|
Response.new(response[:status] == '1', response[:reason], response,
|
266
|
-
:
|
267
|
-
:
|
268
|
-
)
|
264
|
+
test: test?,
|
265
|
+
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}")
|
269
266
|
end
|
270
267
|
|
271
268
|
def format_date(month, year)
|
@@ -298,7 +295,7 @@ module ActiveMerchant
|
|
298
295
|
|
299
296
|
def parse_authorization_string(authorization)
|
300
297
|
reference, auth_code, ca_reference = authorization.to_s.split(';')
|
301
|
-
{:
|
298
|
+
{ reference: reference, auth_code: auth_code, ca_reference: ca_reference }
|
302
299
|
end
|
303
300
|
end
|
304
301
|
end
|