activemerchant 1.133.0 → 1.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +450 -0
- data/CONTRIBUTORS +1 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +2 -2
- data/lib/active_merchant/billing/base.rb +2 -2
- data/lib/active_merchant/billing/check.rb +16 -4
- data/lib/active_merchant/billing/compatibility.rb +4 -4
- data/lib/active_merchant/billing/credit_card.rb +35 -16
- data/lib/active_merchant/billing/credit_card_formatting.rb +13 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +74 -19
- data/lib/active_merchant/billing/gateway.rb +22 -2
- data/lib/active_merchant/billing/gateways/adyen.rb +282 -87
- data/lib/active_merchant/billing/gateways/airwallex.rb +46 -25
- data/lib/active_merchant/billing/gateways/alelo.rb +29 -11
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +49 -41
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +14 -10
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -5
- data/lib/active_merchant/billing/gateways/axcessms.rb +9 -5
- data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
- data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
- data/lib/active_merchant/billing/gateways/banwire.rb +6 -4
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +8 -8
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +2 -2
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -8
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +2 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +15 -7
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
- data/lib/active_merchant/billing/gateways/bogus.rb +2 -2
- data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
- data/lib/active_merchant/billing/gateways/bpoint.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +3 -1
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +68 -23
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +266 -89
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -3
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/cams.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_connect.rb +7 -4
- data/lib/active_merchant/billing/gateways/card_save.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_stream.rb +12 -13
- data/lib/active_merchant/billing/gateways/cardknox.rb +2 -2
- data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
- data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +331 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +9 -242
- data/lib/active_merchant/billing/gateways/cenpos.rb +9 -3
- data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +362 -50
- data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +117 -35
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
- data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
- data/lib/active_merchant/billing/gateways/credorax.rb +109 -20
- data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
- data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +379 -100
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +147 -76
- data/lib/active_merchant/billing/gateways/d_local.rb +45 -22
- data/lib/active_merchant/billing/gateways/data_cash.rb +22 -18
- data/lib/active_merchant/billing/gateways/datatrans.rb +284 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +82 -46
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +31 -35
- data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +3 -3
- data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +116 -68
- data/lib/active_merchant/billing/gateways/efsnet.rb +13 -8
- data/lib/active_merchant/billing/gateways/elavon.rb +80 -47
- data/lib/active_merchant/billing/gateways/element.rb +39 -10
- data/lib/active_merchant/billing/gateways/epay.rb +8 -4
- data/lib/active_merchant/billing/gateways/evo_ca.rb +8 -4
- data/lib/active_merchant/billing/gateways/eway.rb +6 -4
- data/lib/active_merchant/billing/gateways/eway_managed.rb +8 -4
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +3 -3
- data/lib/active_merchant/billing/gateways/exact.rb +8 -4
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +37 -7
- data/lib/active_merchant/billing/gateways/federated_canada.rb +8 -4
- data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +2 -2
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +8 -174
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +8 -4
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +9 -5
- data/lib/active_merchant/billing/gateways/flex_charge.rb +359 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -2
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +6 -4
- data/lib/active_merchant/billing/gateways/fortis.rb +347 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +6 -4
- data/lib/active_merchant/billing/gateways/global_collect.rb +69 -50
- data/lib/active_merchant/billing/gateways/global_transport.rb +2 -2
- data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
- data/lib/active_merchant/billing/gateways/hi_pay.rb +287 -0
- data/lib/active_merchant/billing/gateways/hps.rb +40 -47
- data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -6
- data/lib/active_merchant/billing/gateways/instapay.rb +9 -6
- data/lib/active_merchant/billing/gateways/ipg.rb +14 -10
- data/lib/active_merchant/billing/gateways/ipp.rb +2 -2
- data/lib/active_merchant/billing/gateways/iridium.rb +18 -8
- data/lib/active_merchant/billing/gateways/itransact.rb +8 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +12 -9
- data/lib/active_merchant/billing/gateways/ixopay.rb +4 -4
- data/lib/active_merchant/billing/gateways/jetpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +9 -6
- data/lib/active_merchant/billing/gateways/komoju.rb +2 -2
- data/lib/active_merchant/billing/gateways/kushki.rb +79 -16
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
- data/lib/active_merchant/billing/gateways/linkpoint.rb +8 -4
- data/lib/active_merchant/billing/gateways/litle.rb +37 -54
- data/lib/active_merchant/billing/gateways/loan_payment_pro.rb +267 -0
- data/lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb +93 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
- data/lib/active_merchant/billing/gateways/maxipago.rb +4 -4
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +32 -11
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +10 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +13 -6
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +13 -6
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -5
- data/lib/active_merchant/billing/gateways/mercury.rb +11 -5
- data/lib/active_merchant/billing/gateways/metrics_global.rb +10 -8
- data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -6
- data/lib/active_merchant/billing/gateways/migs.rb +8 -4
- data/lib/active_merchant/billing/gateways/mit.rb +10 -5
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +21 -13
- data/lib/active_merchant/billing/gateways/moka.rb +2 -2
- data/lib/active_merchant/billing/gateways/monei.rb +3 -3
- data/lib/active_merchant/billing/gateways/moneris.rb +11 -5
- data/lib/active_merchant/billing/gateways/money_movers.rb +8 -4
- data/lib/active_merchant/billing/gateways/multi_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +5 -3
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -10
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
- data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +4 -6
- data/lib/active_merchant/billing/gateways/netbilling.rb +8 -4
- data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +9 -5
- data/lib/active_merchant/billing/gateways/nmi.rb +29 -8
- data/lib/active_merchant/billing/gateways/nuvei.rb +573 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +8 -4
- data/lib/active_merchant/billing/gateways/omise.rb +2 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/opp.rb +3 -4
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +12 -6
- data/lib/active_merchant/billing/gateways/orbital/orbital_codes.rb +273 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +114 -94
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +9 -6
- data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
- data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_arc.rb +9 -7
- data/lib/active_merchant/billing/gateways/pay_conex.rb +6 -4
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -5
- data/lib/active_merchant/billing/gateways/pay_junction.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_trace.rb +36 -22
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +14 -14
- data/lib/active_merchant/billing/gateways/payeezy.rb +26 -13
- data/lib/active_merchant/billing/gateways/payex.rb +8 -6
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +12 -11
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +10 -6
- data/lib/active_merchant/billing/gateways/paymentez.rb +30 -16
- data/lib/active_merchant/billing/gateways/paymill.rb +6 -4
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +17 -12
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal.rb +4 -2
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -2
- data/lib/active_merchant/billing/gateways/paysafe.rb +48 -24
- data/lib/active_merchant/billing/gateways/payscout.rb +9 -6
- data/lib/active_merchant/billing/gateways/paystation.rb +9 -5
- data/lib/active_merchant/billing/gateways/payu_in.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -5
- data/lib/active_merchant/billing/gateways/payway.rb +6 -2
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +6 -6
- data/lib/active_merchant/billing/gateways/pin.rb +126 -41
- data/lib/active_merchant/billing/gateways/plexo.rb +71 -20
- data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
- data/lib/active_merchant/billing/gateways/priority.rb +29 -24
- data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/psigate.rb +8 -4
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +9 -5
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -5
- data/lib/active_merchant/billing/gateways/quickbooks.rb +27 -17
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +8 -4
- data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
- data/lib/active_merchant/billing/gateways/rapyd.rb +172 -53
- data/lib/active_merchant/billing/gateways/reach.rb +16 -9
- data/lib/active_merchant/billing/gateways/redsys.rb +7 -15
- data/lib/active_merchant/billing/gateways/redsys_rest.rb +545 -0
- data/lib/active_merchant/billing/gateways/s5.rb +5 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +47 -24
- data/lib/active_merchant/billing/gateways/sage.rb +14 -6
- data/lib/active_merchant/billing/gateways/sage_pay.rb +81 -7
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +8 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +9 -5
- data/lib/active_merchant/billing/gateways/secure_pay.rb +10 -8
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -15
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +8 -4
- data/lib/active_merchant/billing/gateways/securion_pay.rb +26 -12
- data/lib/active_merchant/billing/gateways/shift4.rb +34 -26
- data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +26 -17
- data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -4
- data/lib/active_merchant/billing/gateways/smart_ps.rb +10 -7
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -4
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -6
- data/lib/active_merchant/billing/gateways/stripe.rb +88 -84
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +388 -77
- data/lib/active_merchant/billing/gateways/sum_up.rb +224 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +6 -4
- data/lib/active_merchant/billing/gateways/telr.rb +6 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +6 -4
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +10 -18
- data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
- data/lib/active_merchant/billing/gateways/transax.rb +2 -2
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +9 -5
- data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -31
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -4
- data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
- data/lib/active_merchant/billing/gateways/vantiv_express.rb +668 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +12 -8
- data/lib/active_merchant/billing/gateways/versa_pay.rb +307 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +8 -4
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +5 -5
- data/lib/active_merchant/billing/gateways/vpos.rb +25 -13
- data/lib/active_merchant/billing/gateways/webpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/wepay.rb +6 -4
- data/lib/active_merchant/billing/gateways/wirecard.rb +10 -6
- data/lib/active_merchant/billing/gateways/wompi.rb +14 -7
- data/lib/active_merchant/billing/gateways/world_net.rb +2 -2
- data/lib/active_merchant/billing/gateways/worldpay.rb +297 -113
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +16 -13
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/gateways/xpay.rb +244 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -3
- data/lib/active_merchant/billing/payment_token.rb +2 -2
- data/lib/active_merchant/billing/response.rb +7 -6
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +8 -20
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +12 -2
- data/lib/active_merchant/net_http_ssl_connection.rb +35 -0
- data/lib/active_merchant/posts_data.rb +19 -4
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant/versionable.rb +29 -0
- data/lib/certs/cacert.pem +1326 -1491
- data/lib/support/gateway_support.rb +3 -3
- data/lib/support/ssl_verify.rb +6 -6
- data/lib/support/ssl_version.rb +8 -8
- metadata +35 -9
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
require 'active_merchant/billing/gateways/cyber_source/cyber_source_common'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
class CyberSourceRestGateway < Gateway
|
|
6
6
|
include ActiveMerchant::Billing::CyberSourceCommon
|
|
7
7
|
|
|
8
|
+
version 'v2'
|
|
9
|
+
|
|
8
10
|
self.test_url = 'https://apitest.cybersource.com'
|
|
9
11
|
self.live_url = 'https://api.cybersource.com'
|
|
10
12
|
|
|
@@ -12,7 +14,7 @@ module ActiveMerchant #:nodoc:
|
|
|
12
14
|
self.default_currency = 'USD'
|
|
13
15
|
self.currencies_without_fractions = ActiveMerchant::Billing::CyberSourceGateway.currencies_without_fractions
|
|
14
16
|
|
|
15
|
-
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro elo union_pay cartes_bancaires mada]
|
|
17
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro elo union_pay cartes_bancaires mada patagonia_365 tarjeta_sol]
|
|
16
18
|
|
|
17
19
|
self.homepage_url = 'http://www.cybersource.com'
|
|
18
20
|
self.display_name = 'Cybersource REST'
|
|
@@ -28,14 +30,20 @@ module ActiveMerchant #:nodoc:
|
|
|
28
30
|
maestro: '042',
|
|
29
31
|
master: '002',
|
|
30
32
|
unionpay: '062',
|
|
31
|
-
visa: '001'
|
|
33
|
+
visa: '001',
|
|
34
|
+
carnet: '002'
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
WALLET_PAYMENT_SOLUTION = {
|
|
35
38
|
apple_pay: '001',
|
|
36
39
|
google_pay: '012'
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
NT_PAYMENT_SOLUTION = {
|
|
43
|
+
'master' => '014',
|
|
44
|
+
'visa' => '015'
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
def initialize(options = {})
|
|
40
48
|
requires!(options, :merchant_id, :public_key, :private_key)
|
|
41
49
|
super
|
|
@@ -72,7 +80,7 @@ module ActiveMerchant #:nodoc:
|
|
|
72
80
|
|
|
73
81
|
def void(authorization, options = {})
|
|
74
82
|
payment, amount = authorization.split('|')
|
|
75
|
-
post = build_void_request(amount)
|
|
83
|
+
post = build_void_request(options, amount)
|
|
76
84
|
commit("payments/#{payment}/reversals", post)
|
|
77
85
|
end
|
|
78
86
|
|
|
@@ -93,6 +101,7 @@ module ActiveMerchant #:nodoc:
|
|
|
93
101
|
gsub(/(\\?"number\\?":\\?")\d+/, '\1[FILTERED]').
|
|
94
102
|
gsub(/(\\?"routingNumber\\?":\\?")\d+/, '\1[FILTERED]').
|
|
95
103
|
gsub(/(\\?"securityCode\\?":\\?")\d+/, '\1[FILTERED]').
|
|
104
|
+
gsub(/(\\?"cryptogram\\?":\\?")[^<]+/, '\1[FILTERED]').
|
|
96
105
|
gsub(/(signature=")[^"]*/, '\1[FILTERED]').
|
|
97
106
|
gsub(/(keyid=")[^"]*/, '\1[FILTERED]').
|
|
98
107
|
gsub(/(Digest: SHA-256=)[\w\/\+=]*/, '\1[FILTERED]')
|
|
@@ -100,9 +109,51 @@ module ActiveMerchant #:nodoc:
|
|
|
100
109
|
|
|
101
110
|
private
|
|
102
111
|
|
|
103
|
-
def
|
|
112
|
+
def add_level_2_data(post, options)
|
|
113
|
+
return unless options[:purchase_order_number]
|
|
114
|
+
|
|
115
|
+
post[:orderInformation][:invoiceDetails] ||= {}
|
|
116
|
+
post[:orderInformation][:invoiceDetails][:purchaseOrderNumber] = options[:purchase_order_number]
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def add_level_3_data(post, options)
|
|
120
|
+
return unless options[:line_items]
|
|
121
|
+
|
|
122
|
+
post[:orderInformation][:lineItems] = options[:line_items]
|
|
123
|
+
post[:processingInformation][:purchaseLevel] = '3'
|
|
124
|
+
post[:orderInformation][:shipping_details] = { shipFromPostalCode: options[:ships_from_postal_code] }
|
|
125
|
+
post[:orderInformation][:amountDetails] ||= {}
|
|
126
|
+
post[:orderInformation][:amountDetails][:discountAmount] = options[:discount_amount]
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def add_three_ds(post, payment_method, options)
|
|
130
|
+
return unless three_d_secure = options[:three_d_secure]
|
|
131
|
+
|
|
132
|
+
post[:consumerAuthenticationInformation] ||= {}
|
|
133
|
+
if payment_method.brand == 'master'
|
|
134
|
+
post[:consumerAuthenticationInformation][:ucafAuthenticationData] = three_d_secure[:cavv]
|
|
135
|
+
post[:consumerAuthenticationInformation][:ucafCollectionIndicator] = '2'
|
|
136
|
+
else
|
|
137
|
+
post[:consumerAuthenticationInformation][:cavv] = three_d_secure[:cavv]
|
|
138
|
+
end
|
|
139
|
+
post[:consumerAuthenticationInformation][:cavvAlgorithm] = three_d_secure[:cavv_algorithm] if three_d_secure[:cavv_algorithm]
|
|
140
|
+
post[:consumerAuthenticationInformation][:paSpecificationVersion] = three_d_secure[:version] if three_d_secure[:version]
|
|
141
|
+
post[:consumerAuthenticationInformation][:directoryServerTransactionID] = three_d_secure[:ds_transaction_id] if three_d_secure[:ds_transaction_id]
|
|
142
|
+
post[:consumerAuthenticationInformation][:eciRaw] = three_d_secure[:eci] if three_d_secure[:eci]
|
|
143
|
+
if three_d_secure[:xid].present?
|
|
144
|
+
post[:consumerAuthenticationInformation][:xid] = three_d_secure[:xid]
|
|
145
|
+
else
|
|
146
|
+
post[:consumerAuthenticationInformation][:xid] = three_d_secure[:cavv]
|
|
147
|
+
end
|
|
148
|
+
post[:consumerAuthenticationInformation][:veresEnrolled] = three_d_secure[:enrolled] if three_d_secure[:enrolled]
|
|
149
|
+
post[:consumerAuthenticationInformation][:paresStatus] = three_d_secure[:authentication_response_status] if three_d_secure[:authentication_response_status]
|
|
150
|
+
post
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def build_void_request(options, amount = nil)
|
|
104
154
|
{ reversalInformation: { amountDetails: { totalAmount: nil } } }.tap do |post|
|
|
105
155
|
add_reversal_amount(post, amount.to_i) if amount.present?
|
|
156
|
+
add_merchant_category_code(post, options)
|
|
106
157
|
end.compact
|
|
107
158
|
end
|
|
108
159
|
|
|
@@ -116,8 +167,12 @@ module ActiveMerchant #:nodoc:
|
|
|
116
167
|
add_address(post, payment, options[:billing_address], options, :billTo)
|
|
117
168
|
add_address(post, payment, options[:shipping_address], options, :shipTo)
|
|
118
169
|
add_business_rules_data(post, payment, options)
|
|
170
|
+
add_merchant_category_code(post, options)
|
|
119
171
|
add_partner_solution_id(post)
|
|
120
172
|
add_stored_credentials(post, payment, options)
|
|
173
|
+
add_three_ds(post, payment, options)
|
|
174
|
+
add_level_2_data(post, options)
|
|
175
|
+
add_level_3_data(post, options)
|
|
121
176
|
end.compact
|
|
122
177
|
end
|
|
123
178
|
|
|
@@ -126,6 +181,7 @@ module ActiveMerchant #:nodoc:
|
|
|
126
181
|
add_code(post, options)
|
|
127
182
|
add_mdd_fields(post, options)
|
|
128
183
|
add_amount(post, amount, options)
|
|
184
|
+
add_merchant_category_code(post, options)
|
|
129
185
|
add_partner_solution_id(post)
|
|
130
186
|
end.compact
|
|
131
187
|
end
|
|
@@ -136,6 +192,7 @@ module ActiveMerchant #:nodoc:
|
|
|
136
192
|
add_credit_card(post, payment)
|
|
137
193
|
add_mdd_fields(post, options)
|
|
138
194
|
add_amount(post, amount, options)
|
|
195
|
+
add_merchant_category_code(post, options)
|
|
139
196
|
add_address(post, payment, options[:billing_address], options, :billTo)
|
|
140
197
|
add_merchant_description(post, options)
|
|
141
198
|
end.compact
|
|
@@ -165,7 +222,7 @@ module ActiveMerchant #:nodoc:
|
|
|
165
222
|
currency = options[:currency] || currency(amount)
|
|
166
223
|
post[:orderInformation][:amountDetails] = {
|
|
167
224
|
totalAmount: localized_amount(amount, currency),
|
|
168
|
-
currency:
|
|
225
|
+
currency:
|
|
169
226
|
}
|
|
170
227
|
end
|
|
171
228
|
|
|
@@ -191,18 +248,40 @@ module ActiveMerchant #:nodoc:
|
|
|
191
248
|
end
|
|
192
249
|
|
|
193
250
|
def add_network_tokenization_card(post, payment, options)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
251
|
+
if options.dig(:stored_credential, :initiator) == 'merchant'
|
|
252
|
+
post[:paymentInformation][:tokenizedCard] = {
|
|
253
|
+
number: payment.number,
|
|
254
|
+
expirationMonth: payment.month,
|
|
255
|
+
expirationYear: payment.year,
|
|
256
|
+
type: CREDIT_CARD_CODES[card_brand(payment).to_sym],
|
|
257
|
+
transactionType: payment.source == :network_token ? '3' : '1'
|
|
258
|
+
}
|
|
259
|
+
else
|
|
260
|
+
post[:paymentInformation][:tokenizedCard] = {
|
|
261
|
+
number: payment.number,
|
|
262
|
+
expirationMonth: payment.month,
|
|
263
|
+
expirationYear: payment.year,
|
|
264
|
+
cryptogram: payment.payment_cryptogram,
|
|
265
|
+
type: CREDIT_CARD_CODES[card_brand(payment).to_sym],
|
|
266
|
+
transactionType: payment.source == :network_token ? '3' : '1'
|
|
267
|
+
}
|
|
268
|
+
add_apple_pay_google_pay_cryptogram(post, payment) unless payment.source == :network_token
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
post[:processingInformation][:commerceIndicator] = 'internet' unless options[:stored_credential] || card_brand(payment) == 'jcb'
|
|
272
|
+
|
|
273
|
+
add_payment_solution(post, payment)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def add_payment_solution(post, payment)
|
|
277
|
+
if payment.source == :network_token && NT_PAYMENT_SOLUTION[payment.brand]
|
|
278
|
+
post[:processingInformation][:paymentSolution] = NT_PAYMENT_SOLUTION[payment.brand]
|
|
279
|
+
else
|
|
280
|
+
post[:processingInformation][:paymentSolution] = WALLET_PAYMENT_SOLUTION[payment.source]
|
|
281
|
+
end
|
|
282
|
+
end
|
|
205
283
|
|
|
284
|
+
def add_apple_pay_google_pay_cryptogram(post, payment)
|
|
206
285
|
if card_brand(payment) == 'master'
|
|
207
286
|
post[:consumerAuthenticationInformation] = {
|
|
208
287
|
ucafAuthenticationData: payment.payment_cryptogram,
|
|
@@ -257,57 +336,51 @@ module ActiveMerchant #:nodoc:
|
|
|
257
336
|
merchant[:locality] = options[:merchant_descriptor_locality] if options[:merchant_descriptor_locality]
|
|
258
337
|
end
|
|
259
338
|
|
|
339
|
+
def add_merchant_category_code(post, options)
|
|
340
|
+
return unless options[:merchant_category_code]
|
|
341
|
+
|
|
342
|
+
post[:merchantInformation] ||= {}
|
|
343
|
+
post[:merchantInformation][:categoryCode] = options[:merchant_category_code] if options[:merchant_category_code]
|
|
344
|
+
end
|
|
345
|
+
|
|
260
346
|
def add_stored_credentials(post, payment, options)
|
|
261
|
-
return unless
|
|
347
|
+
return unless options[:stored_credential]
|
|
262
348
|
|
|
263
|
-
|
|
264
|
-
post
|
|
265
|
-
stored_credential[:initial_transaction] ? initial_transaction(post, options) : subsequent_transaction(post, options)
|
|
349
|
+
post[:processingInformation][:commerceIndicator] = commerce_indicator(options.dig(:stored_credential, :reason_type))
|
|
350
|
+
add_authorization_options(post, payment, options)
|
|
266
351
|
end
|
|
267
352
|
|
|
268
|
-
def
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
reason_code: reason_code,
|
|
278
|
-
stored_on_file: stored_on_file
|
|
279
|
-
})
|
|
353
|
+
def commerce_indicator(reason_type)
|
|
354
|
+
case reason_type
|
|
355
|
+
when 'recurring'
|
|
356
|
+
'recurring'
|
|
357
|
+
when 'installment'
|
|
358
|
+
'install'
|
|
359
|
+
else
|
|
360
|
+
'internet'
|
|
361
|
+
end
|
|
280
362
|
end
|
|
281
363
|
|
|
282
|
-
def
|
|
283
|
-
|
|
364
|
+
def add_authorization_options(post, payment, options)
|
|
365
|
+
initiator = options.dig(:stored_credential, :initiator) == 'cardholder' ? 'customer' : 'merchant'
|
|
366
|
+
authorization_options = {
|
|
284
367
|
authorizationOptions: {
|
|
285
368
|
initiator: {
|
|
286
|
-
type: initiator
|
|
287
|
-
merchantInitiatedTransaction: merchant_initiated_transaction_hash,
|
|
288
|
-
storedCredentialUsed: true
|
|
369
|
+
type: initiator
|
|
289
370
|
}
|
|
290
371
|
}
|
|
291
372
|
}.compact
|
|
292
|
-
end
|
|
293
373
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
processing_information = add_processing_information(options[:initiator], {
|
|
305
|
-
originalAuthorizedAmount: post.dig(:orderInformation, :amountDetails, :totalAmount),
|
|
306
|
-
previousTransactionID: network_transaction_id,
|
|
307
|
-
reason: options[:reason_code],
|
|
308
|
-
storedCredentialUsed: options[:stored_on_file]
|
|
309
|
-
})
|
|
310
|
-
post[:processingInformation].merge!(processing_information)
|
|
374
|
+
authorization_options[:authorizationOptions][:initiator][:storedCredentialUsed] = true if initiator == 'merchant'
|
|
375
|
+
authorization_options[:authorizationOptions][:initiator][:credentialStoredOnFile] = true if options.dig(:stored_credential, :initial_transaction)
|
|
376
|
+
authorization_options[:authorizationOptions][:initiator][:merchantInitiatedTransaction] ||= {}
|
|
377
|
+
unless options.dig(:stored_credential, :initial_transaction)
|
|
378
|
+
network_transaction_id = options[:network_transaction_id] || options.dig(:stored_credential, :network_transaction_id) || ''
|
|
379
|
+
authorization_options[:authorizationOptions][:initiator][:merchantInitiatedTransaction][:previousTransactionID] = network_transaction_id
|
|
380
|
+
authorization_options[:authorizationOptions][:initiator][:merchantInitiatedTransaction][:originalAuthorizedAmount] = post.dig(:orderInformation, :amountDetails, :totalAmount) if card_brand(payment) == 'discover'
|
|
381
|
+
end
|
|
382
|
+
authorization_options[:authorizationOptions][:initiator][:merchantInitiatedTransaction][:reason] = options[:reason_code] if options[:reason_code]
|
|
383
|
+
post[:processingInformation].merge!(authorization_options)
|
|
311
384
|
end
|
|
312
385
|
|
|
313
386
|
def network_transaction_id_from(response)
|
|
@@ -315,7 +388,7 @@ module ActiveMerchant #:nodoc:
|
|
|
315
388
|
end
|
|
316
389
|
|
|
317
390
|
def url(action)
|
|
318
|
-
"#{
|
|
391
|
+
"#{test? ? test_url : live_url}/pts/#{fetch_version}/#{action}"
|
|
319
392
|
end
|
|
320
393
|
|
|
321
394
|
def host
|
|
@@ -330,7 +403,7 @@ module ActiveMerchant #:nodoc:
|
|
|
330
403
|
add_reconciliation_id(post, options)
|
|
331
404
|
add_sec_code(post, options)
|
|
332
405
|
add_invoice_number(post, options)
|
|
333
|
-
response = parse(ssl_post(url(action), post.to_json, auth_headers(action, post)))
|
|
406
|
+
response = parse(ssl_post(url(action), post.to_json, auth_headers(action, options, post)))
|
|
334
407
|
Response.new(
|
|
335
408
|
success_from(response),
|
|
336
409
|
message_from(response),
|
|
@@ -355,38 +428,35 @@ module ActiveMerchant #:nodoc:
|
|
|
355
428
|
def message_from(response)
|
|
356
429
|
return response['status'] if success_from(response)
|
|
357
430
|
|
|
358
|
-
response
|
|
431
|
+
response.dig('errorInformation', 'message') || response['message']
|
|
359
432
|
end
|
|
360
433
|
|
|
361
434
|
def authorization_from(response)
|
|
362
435
|
id = response['id']
|
|
363
|
-
|
|
364
|
-
amount = response['orderInformation']['amountDetails']['authorizedAmount'].delete('.') if has_amount
|
|
365
|
-
|
|
366
|
-
return id if amount.blank?
|
|
436
|
+
amount = response.dig('orderInformation', 'amountDetails', 'authorizedAmount')&.delete('.')
|
|
367
437
|
|
|
368
|
-
[id, amount].join('|')
|
|
438
|
+
amount.present? ? [id, amount].join('|') : id
|
|
369
439
|
end
|
|
370
440
|
|
|
371
441
|
def error_code_from(response)
|
|
372
|
-
response
|
|
442
|
+
response.dig('errorInformation', 'reason') unless success_from(response)
|
|
373
443
|
end
|
|
374
444
|
|
|
375
445
|
# This implementation follows the Cybersource guide on how create the request signature, see:
|
|
376
446
|
# https://developer.cybersource.com/docs/cybs/en-us/payments/developer/all/rest/payments/GenerateHeader/httpSignatureAuthentication.html
|
|
377
447
|
def get_http_signature(resource, digest, http_method = 'post', gmtdatetime = Time.now.httpdate)
|
|
378
448
|
string_to_sign = {
|
|
379
|
-
host
|
|
449
|
+
host:,
|
|
380
450
|
date: gmtdatetime,
|
|
381
|
-
|
|
382
|
-
digest
|
|
383
|
-
|
|
451
|
+
'request-target': "#{http_method} /pts/#{fetch_version}/#{resource}",
|
|
452
|
+
digest:,
|
|
453
|
+
'v-c-merchant-id': @options[:merchant_id]
|
|
384
454
|
}.map { |k, v| "#{k}: #{v}" }.join("\n").force_encoding(Encoding::UTF_8)
|
|
385
455
|
|
|
386
456
|
{
|
|
387
457
|
keyid: @options[:public_key],
|
|
388
458
|
algorithm: 'HmacSHA256',
|
|
389
|
-
headers: "host date
|
|
459
|
+
headers: "host date request-target#{digest.present? ? ' digest' : ''} v-c-merchant-id",
|
|
390
460
|
signature: sign_payload(string_to_sign)
|
|
391
461
|
}.map { |k, v| %{#{k}="#{v}"} }.join(', ')
|
|
392
462
|
end
|
|
@@ -396,14 +466,14 @@ module ActiveMerchant #:nodoc:
|
|
|
396
466
|
Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', decoded_key, payload))
|
|
397
467
|
end
|
|
398
468
|
|
|
399
|
-
def auth_headers(action, post, http_method = 'post')
|
|
469
|
+
def auth_headers(action, options, post, http_method = 'post')
|
|
400
470
|
digest = "SHA-256=#{Digest::SHA256.base64digest(post.to_json)}" if post.present?
|
|
401
471
|
date = Time.now.httpdate
|
|
402
472
|
|
|
403
473
|
{
|
|
404
474
|
'Accept' => 'application/hal+json;charset=utf-8',
|
|
405
475
|
'Content-Type' => 'application/json;charset=utf-8',
|
|
406
|
-
'V-C-Merchant-Id' => @options[:merchant_id],
|
|
476
|
+
'V-C-Merchant-Id' => options[:merchant_id] || @options[:merchant_id],
|
|
407
477
|
'Date' => date,
|
|
408
478
|
'Host' => host,
|
|
409
479
|
'Signature' => get_http_signature(action, digest, http_method, date),
|
|
@@ -422,7 +492,7 @@ module ActiveMerchant #:nodoc:
|
|
|
422
492
|
return unless mdd_fields.present?
|
|
423
493
|
|
|
424
494
|
post[:merchantDefinedInformation] = mdd_fields.map do |key, value|
|
|
425
|
-
{ key
|
|
495
|
+
{ key:, value: }
|
|
426
496
|
end
|
|
427
497
|
end
|
|
428
498
|
|
|
@@ -441,7 +511,8 @@ module ActiveMerchant #:nodoc:
|
|
|
441
511
|
def add_invoice_number(post, options)
|
|
442
512
|
return unless options[:invoice_number].present?
|
|
443
513
|
|
|
444
|
-
post[:orderInformation][:invoiceDetails]
|
|
514
|
+
post[:orderInformation][:invoiceDetails] ||= {}
|
|
515
|
+
post[:orderInformation][:invoiceDetails][:invoiceNumber] = options[:invoice_number]
|
|
445
516
|
end
|
|
446
517
|
|
|
447
518
|
def add_partner_solution_id(post)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class DLocalGateway < Gateway
|
|
4
4
|
self.test_url = 'https://sandbox.dlocal.com'
|
|
5
5
|
self.live_url = 'https://api.dlocal.com'
|
|
6
6
|
|
|
7
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 = %i[visa master american_express discover jcb diners_club maestro naranja cabal elo alia carnet]
|
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro naranja cabal elo alia carnet patagonia_365 tarjeta_sol]
|
|
10
10
|
|
|
11
11
|
self.homepage_url = 'https://dlocal.com/'
|
|
12
12
|
self.display_name = 'dLocal'
|
|
@@ -42,6 +42,7 @@ module ActiveMerchant #:nodoc:
|
|
|
42
42
|
|
|
43
43
|
def refund(money, authorization, options = {})
|
|
44
44
|
post = {}
|
|
45
|
+
add_description(post, options)
|
|
45
46
|
post[:payment_id] = authorization
|
|
46
47
|
post[:notification_url] = options[:notification_url]
|
|
47
48
|
add_invoice(post, money, options) if money
|
|
@@ -90,9 +91,9 @@ module ActiveMerchant #:nodoc:
|
|
|
90
91
|
add_payer(post, card, options)
|
|
91
92
|
add_card(post, card, action, options)
|
|
92
93
|
add_additional_data(post, options)
|
|
94
|
+
add_description(post, options)
|
|
93
95
|
post[:order_id] = options[:order_id] || generate_unique_id
|
|
94
96
|
post[:original_order_id] = options[:original_order_id] if options[:original_order_id]
|
|
95
|
-
post[:description] = options[:description] if options[:description]
|
|
96
97
|
end
|
|
97
98
|
|
|
98
99
|
def add_invoice(post, money, options)
|
|
@@ -100,14 +101,19 @@ module ActiveMerchant #:nodoc:
|
|
|
100
101
|
post[:currency] = (options[:currency] || currency(money))
|
|
101
102
|
end
|
|
102
103
|
|
|
104
|
+
def add_description(post, options)
|
|
105
|
+
post[:description] = options[:description] if options[:description]
|
|
106
|
+
end
|
|
107
|
+
|
|
103
108
|
def add_additional_data(post, options)
|
|
104
109
|
post[:additional_risk_data] = options[:additional_data]
|
|
105
110
|
end
|
|
106
111
|
|
|
107
112
|
def add_country(post, card, options)
|
|
108
|
-
return unless address = options[:billing_address] || options[:address]
|
|
113
|
+
return unless (address = options[:billing_address] || options[:address]) || options[:country]
|
|
109
114
|
|
|
110
|
-
|
|
115
|
+
country = options[:country] ? lookup_country_code(options[:country]) : lookup_country_code(address[:country])
|
|
116
|
+
post[:country] = country
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
def lookup_country_code(country_field)
|
|
@@ -118,16 +124,18 @@ module ActiveMerchant #:nodoc:
|
|
|
118
124
|
|
|
119
125
|
def add_payer(post, card, options)
|
|
120
126
|
address = options[:billing_address] || options[:address]
|
|
127
|
+
phone_number = address[:phone] || address[:phone_number] if address
|
|
128
|
+
|
|
121
129
|
post[:payer] = {}
|
|
122
130
|
post[:payer][:name] = card.name
|
|
123
131
|
post[:payer][:email] = options[:email] if options[:email]
|
|
124
132
|
post[:payer][:birth_date] = options[:birth_date] if options[:birth_date]
|
|
125
|
-
post[:payer][:phone] =
|
|
133
|
+
post[:payer][:phone] = phone_number if phone_number
|
|
126
134
|
post[:payer][:document] = options[:document] if options[:document]
|
|
127
135
|
post[:payer][:document2] = options[:document2] if options[:document2]
|
|
128
136
|
post[:payer][:user_reference] = options[:user_reference] if options[:user_reference]
|
|
129
137
|
post[:payer][:event_uuid] = options[:device_id] if options[:device_id]
|
|
130
|
-
post[:payer][:
|
|
138
|
+
post[:payer][:ip] = options[:ip] if options[:ip]
|
|
131
139
|
post[:payer][:address] = add_address(post, card, options)
|
|
132
140
|
end
|
|
133
141
|
|
|
@@ -163,23 +171,20 @@ module ActiveMerchant #:nodoc:
|
|
|
163
171
|
post[:card][:network_token] = card.number
|
|
164
172
|
post[:card][:cryptogram] = card.payment_cryptogram
|
|
165
173
|
post[:card][:eci] = card.eci
|
|
166
|
-
|
|
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]
|
|
174
|
+
post[:card][:bin] = options[:issuer_identification_number] if options[:issuer_identification_number]
|
|
178
175
|
else
|
|
179
176
|
post[:card][:number] = card.number
|
|
180
177
|
post[:card][:cvv] = card.verification_value
|
|
181
178
|
end
|
|
182
179
|
|
|
180
|
+
if options[:stored_credential]
|
|
181
|
+
# required for MC debit recurrent in BR 'USED'(subsecuence Payments) . 'FIRST' an inital payment
|
|
182
|
+
post[:card][:stored_credential_usage] = (options[:stored_credential][:initial_transaction] ? 'FIRST' : 'USED')
|
|
183
|
+
post[:card][:network_payment_reference] = options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
|
184
|
+
# used case of Network Token: 'CARD_ON_FILE', 'SUBSCRIPTION', 'UNSCHEDULED_CARD_ON_FILE'
|
|
185
|
+
post[:card][:stored_credential_type] = fetch_stored_credential_type(options[:stored_credential])
|
|
186
|
+
end
|
|
187
|
+
|
|
183
188
|
post[:card][:holder_name] = card.name
|
|
184
189
|
post[:card][:expiration_month] = card.month
|
|
185
190
|
post[:card][:expiration_year] = card.year
|
|
@@ -191,6 +196,14 @@ module ActiveMerchant #:nodoc:
|
|
|
191
196
|
post[:card][:save] = options[:save] if options[:save]
|
|
192
197
|
end
|
|
193
198
|
|
|
199
|
+
def fetch_stored_credential_type(stored_credential)
|
|
200
|
+
if stored_credential[:reason_type] == 'unscheduled'
|
|
201
|
+
stored_credential[:initiator] == 'merchant' ? 'UNSCHEDULED_CARD_ON_FILE' : 'CARD_ON_FILE'
|
|
202
|
+
else
|
|
203
|
+
'SUBSCRIPTION'
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
194
207
|
def parse(body)
|
|
195
208
|
JSON.parse(body)
|
|
196
209
|
end
|
|
@@ -218,6 +231,7 @@ module ActiveMerchant #:nodoc:
|
|
|
218
231
|
message_from(action, response),
|
|
219
232
|
response,
|
|
220
233
|
authorization: authorization_from(response),
|
|
234
|
+
network_transaction_id: network_transaction_id_from(response),
|
|
221
235
|
avs_result: AVSResult.new(code: response['some_avs_response_key']),
|
|
222
236
|
cvv_result: CVVResult.new(response['some_cvv_response_key']),
|
|
223
237
|
test: test?,
|
|
@@ -231,7 +245,11 @@ module ActiveMerchant #:nodoc:
|
|
|
231
245
|
def success_from(action, response)
|
|
232
246
|
return false unless response['status_code']
|
|
233
247
|
|
|
234
|
-
|
|
248
|
+
if action == 'void'
|
|
249
|
+
response['status_code'].to_s == '400' && response['status'] == 'CANCELLED'
|
|
250
|
+
else
|
|
251
|
+
%w[100 200 400 600 700].include? response['status_code'].to_s
|
|
252
|
+
end
|
|
235
253
|
end
|
|
236
254
|
|
|
237
255
|
def message_from(action, response)
|
|
@@ -242,6 +260,10 @@ module ActiveMerchant #:nodoc:
|
|
|
242
260
|
response['id']
|
|
243
261
|
end
|
|
244
262
|
|
|
263
|
+
def network_transaction_id_from(response)
|
|
264
|
+
response.dig('card', 'network_tx_reference')
|
|
265
|
+
end
|
|
266
|
+
|
|
245
267
|
def error_code_from(action, response)
|
|
246
268
|
return if success_from(action, response)
|
|
247
269
|
|
|
@@ -250,7 +272,7 @@ module ActiveMerchant #:nodoc:
|
|
|
250
272
|
end
|
|
251
273
|
|
|
252
274
|
def url(action, parameters, options = {})
|
|
253
|
-
"#{
|
|
275
|
+
"#{test? ? test_url : live_url}/#{endpoint(action, parameters, options)}/"
|
|
254
276
|
end
|
|
255
277
|
|
|
256
278
|
def endpoint(action, parameters, options)
|
|
@@ -283,6 +305,7 @@ module ActiveMerchant #:nodoc:
|
|
|
283
305
|
'Authorization' => signature(post, timestamp)
|
|
284
306
|
}
|
|
285
307
|
headers['X-Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key]
|
|
308
|
+
headers['X-Dlocal-Payment-Source'] = application_id if application_id
|
|
286
309
|
headers
|
|
287
310
|
end
|
|
288
311
|
|
|
@@ -235,23 +235,23 @@ module ActiveMerchant
|
|
|
235
235
|
# a predefined one
|
|
236
236
|
xml.tag! :ExtendedPolicy do
|
|
237
237
|
xml.tag! :cv2_policy,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
notprovided: POLICY_REJECT,
|
|
239
|
+
notchecked: POLICY_REJECT,
|
|
240
|
+
matched: POLICY_ACCEPT,
|
|
241
|
+
notmatched: POLICY_REJECT,
|
|
242
|
+
partialmatch: POLICY_REJECT
|
|
243
243
|
xml.tag! :postcode_policy,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
notprovided: POLICY_ACCEPT,
|
|
245
|
+
notchecked: POLICY_ACCEPT,
|
|
246
|
+
matched: POLICY_ACCEPT,
|
|
247
|
+
notmatched: POLICY_REJECT,
|
|
248
|
+
partialmatch: POLICY_ACCEPT
|
|
249
249
|
xml.tag! :address_policy,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
notprovided: POLICY_ACCEPT,
|
|
251
|
+
notchecked: POLICY_ACCEPT,
|
|
252
|
+
matched: POLICY_ACCEPT,
|
|
253
|
+
notmatched: POLICY_REJECT,
|
|
254
|
+
partialmatch: POLICY_ACCEPT
|
|
255
255
|
end
|
|
256
256
|
end
|
|
257
257
|
end
|
|
@@ -260,9 +260,13 @@ module ActiveMerchant
|
|
|
260
260
|
def commit(request)
|
|
261
261
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
|
|
262
262
|
|
|
263
|
-
Response.new(
|
|
263
|
+
Response.new(
|
|
264
|
+
response[:status] == '1',
|
|
265
|
+
response[:reason],
|
|
266
|
+
response,
|
|
264
267
|
test: test?,
|
|
265
|
-
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}"
|
|
268
|
+
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}"
|
|
269
|
+
)
|
|
266
270
|
end
|
|
267
271
|
|
|
268
272
|
def format_date(month, year)
|
|
@@ -295,7 +299,7 @@ module ActiveMerchant
|
|
|
295
299
|
|
|
296
300
|
def parse_authorization_string(authorization)
|
|
297
301
|
reference, auth_code, ca_reference = authorization.to_s.split(';')
|
|
298
|
-
{ reference
|
|
302
|
+
{ reference:, auth_code:, ca_reference: }
|
|
299
303
|
end
|
|
300
304
|
end
|
|
301
305
|
end
|