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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
|
+
class DatatransGateway < Gateway
|
|
4
|
+
version 'v1'
|
|
5
|
+
|
|
6
|
+
self.test_url = "https://api.sandbox.datatrans.com/#{fetch_version}/"
|
|
7
|
+
self.live_url = "https://api.datatrans.com/#{fetch_version}/"
|
|
8
|
+
|
|
9
|
+
self.supported_countries = %w(CH GR US) # to confirm the countries supported.
|
|
10
|
+
self.default_currency = 'CHF'
|
|
11
|
+
self.currencies_without_fractions = %w(CHF EUR USD)
|
|
12
|
+
self.currencies_with_three_decimal_places = %w()
|
|
13
|
+
self.supported_cardtypes = %i[master visa american_express unionpay diners_club discover jcb maestro dankort]
|
|
14
|
+
|
|
15
|
+
self.money_format = :cents
|
|
16
|
+
|
|
17
|
+
self.homepage_url = 'https://www.datatrans.ch/'
|
|
18
|
+
self.display_name = 'Datatrans'
|
|
19
|
+
|
|
20
|
+
CREDIT_CARD_SOURCE = {
|
|
21
|
+
visa: 'VISA',
|
|
22
|
+
master: 'MASTERCARD'
|
|
23
|
+
}.with_indifferent_access
|
|
24
|
+
|
|
25
|
+
DEVICE_SOURCE = {
|
|
26
|
+
apple_pay: 'APPLE_PAY',
|
|
27
|
+
google_pay: 'GOOGLE_PAY'
|
|
28
|
+
}.with_indifferent_access
|
|
29
|
+
|
|
30
|
+
def initialize(options = {})
|
|
31
|
+
requires!(options, :merchant_id, :password)
|
|
32
|
+
@merchant_id, @password = options.values_at(:merchant_id, :password)
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def purchase(money, payment, options = {})
|
|
37
|
+
authorize(money, payment, options.merge(auto_settle: true))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def verify(payment, options = {})
|
|
41
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
42
|
+
r.process { authorize(100, payment, options) }
|
|
43
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def authorize(money, payment, options = {})
|
|
48
|
+
post = { refno: options.fetch(:order_id, '') }
|
|
49
|
+
add_payment_method(post, payment)
|
|
50
|
+
add_3ds_data(post, payment, options)
|
|
51
|
+
add_currency_amount(post, money, options)
|
|
52
|
+
add_billing_address(post, options)
|
|
53
|
+
post[:autoSettle] = options[:auto_settle] if options[:auto_settle]
|
|
54
|
+
commit('authorize', post)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def capture(money, authorization, options = {})
|
|
58
|
+
post = { refno: options.fetch(:order_id, '') }
|
|
59
|
+
transaction_id = authorization.split('|').first
|
|
60
|
+
add_currency_amount(post, money, options)
|
|
61
|
+
commit('settle', post, { transaction_id: })
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def refund(money, authorization, options = {})
|
|
65
|
+
post = { refno: options.fetch(:order_id, '') }
|
|
66
|
+
transaction_id = authorization.split('|').first
|
|
67
|
+
add_currency_amount(post, money, options)
|
|
68
|
+
commit('credit', post, { transaction_id: })
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def void(authorization, options = {})
|
|
72
|
+
post = {}
|
|
73
|
+
transaction_id = authorization.split('|').first
|
|
74
|
+
commit('cancel', post, { transaction_id: })
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def store(payment_method, options = {})
|
|
78
|
+
exp_year = format(payment_method.year, :two_digits)
|
|
79
|
+
exp_month = format(payment_method.month, :two_digits)
|
|
80
|
+
|
|
81
|
+
post = {
|
|
82
|
+
requests: [
|
|
83
|
+
{
|
|
84
|
+
type: 'CARD',
|
|
85
|
+
pan: payment_method.number,
|
|
86
|
+
expiryMonth: exp_month,
|
|
87
|
+
expiryYear: exp_year
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
commit('tokenize', post, { expiry_month: exp_month, expiry_year: exp_year })
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def unstore(authorization, options = {})
|
|
95
|
+
data_alias = authorization.split('|')[2]
|
|
96
|
+
commit('delete_alias', {}, { alias_id: data_alias }, :delete)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def supports_scrubbing?
|
|
100
|
+
true
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def scrub(transcript)
|
|
104
|
+
transcript.
|
|
105
|
+
gsub(%r((Authorization: Basic )[\w =]+), '\1[FILTERED]').
|
|
106
|
+
gsub(%r((\"number\\":\\")\d+), '\1[FILTERED]\2').
|
|
107
|
+
gsub(%r((\"cvv\\":\\")\d+), '\1[FILTERED]\2').
|
|
108
|
+
gsub(%r((\"pan\\":\\")\d+), '\1[FILTERED]\2')
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
private
|
|
112
|
+
|
|
113
|
+
def add_payment_method(post, payment_method)
|
|
114
|
+
case payment_method
|
|
115
|
+
when String
|
|
116
|
+
token, exp_month, exp_year = payment_method.split('|')[2..4]
|
|
117
|
+
card = {
|
|
118
|
+
type: 'ALIAS',
|
|
119
|
+
alias: token,
|
|
120
|
+
expiryMonth: exp_month,
|
|
121
|
+
expiryYear: exp_year
|
|
122
|
+
}
|
|
123
|
+
when NetworkTokenizationCreditCard
|
|
124
|
+
card = {
|
|
125
|
+
type: DEVICE_SOURCE[payment_method.source] ? 'DEVICE_TOKEN' : 'NETWORK_TOKEN',
|
|
126
|
+
tokenType: DEVICE_SOURCE[payment_method.source] || CREDIT_CARD_SOURCE[card_brand(payment_method)],
|
|
127
|
+
token: payment_method.number,
|
|
128
|
+
cryptogram: payment_method.payment_cryptogram,
|
|
129
|
+
expiryMonth: format(payment_method.month, :two_digits),
|
|
130
|
+
expiryYear: format(payment_method.year, :two_digits)
|
|
131
|
+
}
|
|
132
|
+
when CreditCard
|
|
133
|
+
card = {
|
|
134
|
+
number: payment_method.number,
|
|
135
|
+
cvv: payment_method.verification_value.to_s,
|
|
136
|
+
expiryMonth: format(payment_method.month, :two_digits),
|
|
137
|
+
expiryYear: format(payment_method.year, :two_digits)
|
|
138
|
+
}
|
|
139
|
+
end
|
|
140
|
+
post[:card] = card
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def add_3ds_data(post, payment_method, options)
|
|
144
|
+
return unless three_d_secure = options[:three_d_secure]
|
|
145
|
+
|
|
146
|
+
three_ds =
|
|
147
|
+
{
|
|
148
|
+
'3D':
|
|
149
|
+
{
|
|
150
|
+
eci: three_d_secure[:eci],
|
|
151
|
+
xid: three_d_secure[:ds_transaction_id],
|
|
152
|
+
threeDSTransactionId: three_d_secure[:three_ds_server_trans_id],
|
|
153
|
+
cavv: three_d_secure[:cavv],
|
|
154
|
+
threeDSVersion: three_d_secure[:version],
|
|
155
|
+
cavvAlgorithm: three_d_secure[:cavv_algorithm],
|
|
156
|
+
directoryResponse: three_d_secure[:directory_response_status],
|
|
157
|
+
authenticationResponse: three_d_secure[:authentication_response_status],
|
|
158
|
+
transStatusReason: three_d_secure[:trans_status_reason]
|
|
159
|
+
}.compact
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
post[:card].merge!(three_ds)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def country_code(country)
|
|
166
|
+
Country.find(country).code(:alpha3).value if country
|
|
167
|
+
rescue InvalidCountryCodeError
|
|
168
|
+
nil
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def add_billing_address(post, options)
|
|
172
|
+
return unless billing_address = options[:billing_address]
|
|
173
|
+
|
|
174
|
+
post[:billing] = {
|
|
175
|
+
name: billing_address[:name],
|
|
176
|
+
street: billing_address[:address1],
|
|
177
|
+
street2: billing_address[:address2],
|
|
178
|
+
city: billing_address[:city],
|
|
179
|
+
country: country_code(billing_address[:country]),
|
|
180
|
+
phoneNumber: billing_address[:phone],
|
|
181
|
+
zipCode: billing_address[:zip],
|
|
182
|
+
email: options[:email]
|
|
183
|
+
}.compact
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def add_currency_amount(post, money, options)
|
|
187
|
+
post[:currency] = (options[:currency] || currency(money))
|
|
188
|
+
post[:amount] = amount(money)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def commit(action, post, options = {}, method = :post)
|
|
192
|
+
response = parse(ssl_request(method, url(action, options), post.to_json, headers))
|
|
193
|
+
succeeded = success_from(action, response)
|
|
194
|
+
|
|
195
|
+
Response.new(
|
|
196
|
+
succeeded,
|
|
197
|
+
message_from(succeeded, response),
|
|
198
|
+
response,
|
|
199
|
+
authorization: authorization_from(response, action, options),
|
|
200
|
+
test: test?,
|
|
201
|
+
error_code: error_code_from(response)
|
|
202
|
+
)
|
|
203
|
+
rescue ResponseError => e
|
|
204
|
+
response = parse(e.response.body)
|
|
205
|
+
Response.new(false, message_from(false, response), response, test: test?, error_code: error_code_from(response))
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def parse(response)
|
|
209
|
+
JSON.parse response
|
|
210
|
+
rescue JSON::ParserError
|
|
211
|
+
msg = 'Invalid JSON response received from Datatrans. Please contact them for support if you continue to receive this message.'
|
|
212
|
+
msg += " (The raw response returned by the API was #{response.inspect})"
|
|
213
|
+
{
|
|
214
|
+
'successful' => false,
|
|
215
|
+
'response' => {},
|
|
216
|
+
'errors' => [msg]
|
|
217
|
+
}
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def headers
|
|
221
|
+
{
|
|
222
|
+
'Content-Type' => 'application/json; charset=UTF-8',
|
|
223
|
+
'Authorization' => "Basic #{Base64.strict_encode64("#{@merchant_id}:#{@password}")}"
|
|
224
|
+
}
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def url(endpoint, options = {})
|
|
228
|
+
case endpoint
|
|
229
|
+
when 'settle', 'credit', 'cancel'
|
|
230
|
+
"#{test? ? test_url : live_url}transactions/#{options[:transaction_id]}/#{endpoint}"
|
|
231
|
+
when 'tokenize'
|
|
232
|
+
"#{test? ? test_url : live_url}aliases/#{endpoint}"
|
|
233
|
+
when 'delete_alias'
|
|
234
|
+
"#{test? ? test_url : live_url}aliases/#{options[:alias_id]}"
|
|
235
|
+
else
|
|
236
|
+
"#{test? ? test_url : live_url}transactions/#{endpoint}"
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def success_from(action, response)
|
|
241
|
+
case action
|
|
242
|
+
when 'authorize', 'credit'
|
|
243
|
+
response.include?('transactionId') && response.include?('acquirerAuthorizationCode')
|
|
244
|
+
when 'settle', 'cancel'
|
|
245
|
+
response.dig('response_code') == 204
|
|
246
|
+
when 'tokenize'
|
|
247
|
+
response.dig('responses', 0, 'alias') && response.dig('overview', 'failed') == 0
|
|
248
|
+
when 'delete_alias'
|
|
249
|
+
response.dig('response_code') == 204
|
|
250
|
+
else
|
|
251
|
+
false
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def authorization_from(response, action, options)
|
|
256
|
+
token_array = [response.dig('responses', 0, 'alias'), options[:expiry_month], options[:expiry_year]].join('|') if action == 'tokenize'
|
|
257
|
+
|
|
258
|
+
auth = [response['transactionId'], response['acquirerAuthorizationCode'], token_array].join('|')
|
|
259
|
+
auth = options[:transaction_id] if action == 'settle'
|
|
260
|
+
|
|
261
|
+
return auth unless auth == '||'
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def message_from(succeeded, response)
|
|
265
|
+
return if succeeded
|
|
266
|
+
|
|
267
|
+
response.dig('error', 'message')
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def error_code_from(response)
|
|
271
|
+
response.dig('error', 'code')
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def handle_response(response)
|
|
275
|
+
case response.code.to_i
|
|
276
|
+
when 200...300
|
|
277
|
+
response.body || { response_code: response.code.to_i }.to_json
|
|
278
|
+
else
|
|
279
|
+
raise ResponseError.new(response)
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class DecidirGateway < Gateway
|
|
4
4
|
self.test_url = 'https://developers.decidir.com/api/v2'
|
|
5
5
|
self.live_url = 'https://live.decidir.com/api/v2'
|
|
@@ -7,12 +7,13 @@ module ActiveMerchant #:nodoc:
|
|
|
7
7
|
self.supported_countries = ['AR']
|
|
8
8
|
self.money_format = :cents
|
|
9
9
|
self.default_currency = 'ARS'
|
|
10
|
-
self.supported_cardtypes = %i[visa master american_express diners_club naranja cabal]
|
|
10
|
+
self.supported_cardtypes = %i[visa master american_express diners_club naranja cabal tuya patagonia_365 tarjeta_sol discover]
|
|
11
11
|
|
|
12
12
|
self.homepage_url = 'http://www.decidir.com'
|
|
13
13
|
self.display_name = 'Decidir'
|
|
14
14
|
|
|
15
15
|
STANDARD_ERROR_CODE_MAPPING = {
|
|
16
|
+
-1 => STANDARD_ERROR_CODE[:processing_error],
|
|
16
17
|
1 => STANDARD_ERROR_CODE[:call_issuer],
|
|
17
18
|
2 => STANDARD_ERROR_CODE[:call_issuer],
|
|
18
19
|
3 => STANDARD_ERROR_CODE[:config_error],
|
|
@@ -106,7 +107,9 @@ module ActiveMerchant #:nodoc:
|
|
|
106
107
|
gsub(%r((apikey: )\w+)i, '\1[FILTERED]').
|
|
107
108
|
gsub(%r((\"card_number\\\":\\\")\d+), '\1[FILTERED]').
|
|
108
109
|
gsub(%r((\"security_code\\\":\\\")\d+), '\1[FILTERED]').
|
|
109
|
-
gsub(%r((\"emv_issuer_data\\\":\\\")\d+), '\1[FILTERED]')
|
|
110
|
+
gsub(%r((\"emv_issuer_data\\\":\\\")\d+), '\1[FILTERED]').
|
|
111
|
+
gsub(%r((\"cryptogram\\\":\\\"/)\w+), '\1[FILTERED]').
|
|
112
|
+
gsub(%r((\"token_card_data\\\":{.*\\\"token\\\":\\\")\d+), '\1[FILTERED]')
|
|
110
113
|
end
|
|
111
114
|
|
|
112
115
|
private
|
|
@@ -116,6 +119,7 @@ module ActiveMerchant #:nodoc:
|
|
|
116
119
|
post[:site_transaction_id] = options[:order_id]
|
|
117
120
|
post[:bin] = credit_card.number[0..5]
|
|
118
121
|
post[:payment_type] = options[:payment_type] || 'single'
|
|
122
|
+
post[:wallet_id] = options[:wallet_id] if options[:wallet_id]
|
|
119
123
|
post[:installments] = options[:installments] ? options[:installments].to_i : 1
|
|
120
124
|
post[:description] = options[:description] if options[:description]
|
|
121
125
|
post[:email] = options[:email] if options[:email]
|
|
@@ -127,34 +131,29 @@ module ActiveMerchant #:nodoc:
|
|
|
127
131
|
add_payment(post, credit_card, options)
|
|
128
132
|
add_aggregate_data(post, options) if options[:aggregate_data]
|
|
129
133
|
add_sub_payments(post, options)
|
|
134
|
+
add_customer_data(post, options)
|
|
130
135
|
end
|
|
131
136
|
|
|
132
137
|
def add_payment_method_id(credit_card, options)
|
|
133
|
-
if options[:payment_method_id]
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
63
|
|
153
|
-
elsif CreditCard.brand?(credit_card.number) == 'naranja'
|
|
154
|
-
24
|
|
155
|
-
else
|
|
156
|
-
1
|
|
157
|
-
end
|
|
138
|
+
return options[:payment_method_id].to_i if options[:payment_method_id]
|
|
139
|
+
|
|
140
|
+
card_brand = CreditCard.brand?(credit_card.number)
|
|
141
|
+
debit = options[:debit]
|
|
142
|
+
|
|
143
|
+
payment_method_ids = {
|
|
144
|
+
'visa' => debit ? 31 : 1,
|
|
145
|
+
'master' => debit ? 105 : 104,
|
|
146
|
+
'maestro' => 106,
|
|
147
|
+
'cabal' => debit ? 108 : 63,
|
|
148
|
+
'american_express' => 65,
|
|
149
|
+
'diners_club' => 8,
|
|
150
|
+
'naranja' => 24,
|
|
151
|
+
'patagonia_365' => 55,
|
|
152
|
+
'tarjeta_sol' => 64,
|
|
153
|
+
'discover' => 139
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
payment_method_ids.fetch(card_brand, 1)
|
|
158
157
|
end
|
|
159
158
|
|
|
160
159
|
def add_invoice(post, money, options)
|
|
@@ -167,29 +166,58 @@ module ActiveMerchant #:nodoc:
|
|
|
167
166
|
post[:amount] = localized_amount(money, currency).to_i
|
|
168
167
|
end
|
|
169
168
|
|
|
170
|
-
def add_payment(post,
|
|
171
|
-
|
|
169
|
+
def add_payment(post, payment_method, options)
|
|
170
|
+
add_common_payment_data(post, payment_method, options)
|
|
171
|
+
|
|
172
|
+
case payment_method
|
|
173
|
+
when NetworkTokenizationCreditCard
|
|
174
|
+
add_network_token(post, payment_method, options)
|
|
175
|
+
else
|
|
176
|
+
add_credit_card(post, payment_method, options)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def add_common_payment_data(post, payment_method, options)
|
|
181
|
+
post[:card_data] = {}
|
|
182
|
+
|
|
183
|
+
data = post[:card_data]
|
|
184
|
+
data[:card_holder_identification] = {}
|
|
185
|
+
data[:card_holder_identification][:type] = options[:card_holder_identification_type] if options[:card_holder_identification_type]
|
|
186
|
+
data[:card_holder_identification][:number] = options[:card_holder_identification_number] if options[:card_holder_identification_number]
|
|
187
|
+
data[:card_holder_name] = payment_method.name if payment_method.name
|
|
188
|
+
|
|
189
|
+
# additional data used for Visa transactions
|
|
190
|
+
data[:card_holder_door_number] = options[:card_holder_door_number].to_i if options[:card_holder_door_number]
|
|
191
|
+
data[:card_holder_birthday] = options[:card_holder_birthday] if options[:card_holder_birthday]
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def add_network_token(post, payment_method, options)
|
|
195
|
+
post[:is_tokenized_payment] = true
|
|
196
|
+
post[:fraud_detection] ||= {}
|
|
197
|
+
post[:fraud_detection][:sent_to_cs] = false
|
|
198
|
+
post[:card_data][:last_four_digits] = options[:last_4]
|
|
199
|
+
post[:card_data][:security_code] = payment_method.verification_value if payment_method.verification_value?
|
|
200
|
+
|
|
201
|
+
post[:token_card_data] = {
|
|
202
|
+
expiration_month: format(payment_method.month, :two_digits),
|
|
203
|
+
expiration_year: format(payment_method.year, :two_digits),
|
|
204
|
+
token: payment_method.number,
|
|
205
|
+
eci: payment_method.eci,
|
|
206
|
+
cryptogram: payment_method.payment_cryptogram
|
|
207
|
+
}
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def add_credit_card(post, credit_card, options)
|
|
211
|
+
card_data = post[:card_data]
|
|
172
212
|
card_data[:card_number] = credit_card.number
|
|
173
213
|
card_data[:card_expiration_month] = format(credit_card.month, :two_digits)
|
|
174
214
|
card_data[:card_expiration_year] = format(credit_card.year, :two_digits)
|
|
175
215
|
card_data[:security_code] = credit_card.verification_value if credit_card.verification_value?
|
|
176
|
-
card_data[:card_holder_name] = credit_card.name if credit_card.name
|
|
177
216
|
|
|
178
217
|
# the device_unique_id has to be sent in via the card data (as device_unique_identifier) no other fraud detection fields require this
|
|
179
|
-
if options
|
|
180
|
-
card_data[:fraud_detection] = {
|
|
181
|
-
card_data[:fraud_detection][:device_unique_identifier] = (options[:fraud_detection][:device_unique_id]) if (options[:fraud_detection][:device_unique_id]).present?
|
|
218
|
+
if (device_id = options.dig(:fraud_detection, :device_unique_id))
|
|
219
|
+
card_data[:fraud_detection] = { device_unique_identifier: device_id }
|
|
182
220
|
end
|
|
183
|
-
|
|
184
|
-
# additional data used for Visa transactions
|
|
185
|
-
card_data[:card_holder_door_number] = options[:card_holder_door_number].to_i if options[:card_holder_door_number]
|
|
186
|
-
card_data[:card_holder_birthday] = options[:card_holder_birthday] if options[:card_holder_birthday]
|
|
187
|
-
|
|
188
|
-
card_data[:card_holder_identification] = {}
|
|
189
|
-
card_data[:card_holder_identification][:type] = options[:card_holder_identification_type] if options[:card_holder_identification_type]
|
|
190
|
-
card_data[:card_holder_identification][:number] = options[:card_holder_identification_number] if options[:card_holder_identification_number]
|
|
191
|
-
|
|
192
|
-
post[:card_data] = card_data
|
|
193
221
|
end
|
|
194
222
|
|
|
195
223
|
def add_aggregate_data(post, options)
|
|
@@ -215,6 +243,14 @@ module ActiveMerchant #:nodoc:
|
|
|
215
243
|
post[:aggregate_data] = aggregate_data
|
|
216
244
|
end
|
|
217
245
|
|
|
246
|
+
def add_customer_data(post, options = {})
|
|
247
|
+
return unless options[:customer_email] || options[:customer_id]
|
|
248
|
+
|
|
249
|
+
post[:customer] = {}
|
|
250
|
+
post[:customer][:id] = options[:customer_id] if options[:customer_id]
|
|
251
|
+
post[:customer][:email] = options[:customer_email] if options[:customer_email]
|
|
252
|
+
end
|
|
253
|
+
|
|
218
254
|
def add_sub_payments(post, options)
|
|
219
255
|
# sub_payments field is required for purchase transactions, even if empty
|
|
220
256
|
post[:sub_payments] = []
|
|
@@ -262,7 +298,7 @@ module ActiveMerchant #:nodoc:
|
|
|
262
298
|
end
|
|
263
299
|
|
|
264
300
|
def commit(method, endpoint, parameters, options = {})
|
|
265
|
-
url = "#{
|
|
301
|
+
url = "#{test? ? test_url : live_url}/#{endpoint}"
|
|
266
302
|
|
|
267
303
|
begin
|
|
268
304
|
raw_response = ssl_request(method, url, post_data(parameters), headers(options))
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class DecidirPlusGateway < Gateway
|
|
4
4
|
self.test_url = 'https://developers.decidir.com/api/v2'
|
|
5
5
|
self.live_url = 'https://live.decidir.com/api/v2'
|
|
6
6
|
|
|
7
7
|
self.supported_countries = ['AR']
|
|
8
8
|
self.default_currency = 'ARS'
|
|
9
|
-
self.supported_cardtypes = %i[visa master american_express discover diners_club naranja cabal]
|
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club naranja cabal patagonia_365 tarjeta_sol discover]
|
|
10
10
|
|
|
11
11
|
self.homepage_url = 'http://decidir.com.ar/home'
|
|
12
12
|
self.display_name = 'Decidir Plus'
|
|
@@ -93,6 +93,12 @@ module ActiveMerchant #:nodoc:
|
|
|
93
93
|
authorization.split('|')[0]
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
def add_wallet_id(post, options)
|
|
97
|
+
return unless options[:wallet_id]
|
|
98
|
+
|
|
99
|
+
post[:wallet_id] = options[:wallet_id]
|
|
100
|
+
end
|
|
101
|
+
|
|
96
102
|
def add_payment(post, payment, options = {})
|
|
97
103
|
if payment.is_a?(String)
|
|
98
104
|
token, bin = payment.split('|')
|
|
@@ -133,6 +139,7 @@ module ActiveMerchant #:nodoc:
|
|
|
133
139
|
|
|
134
140
|
add_aggregate_data(post, options) if options[:aggregate_data]
|
|
135
141
|
add_sub_payments(post, options)
|
|
142
|
+
add_wallet_id(post, options)
|
|
136
143
|
end
|
|
137
144
|
|
|
138
145
|
def add_aggregate_data(post, options)
|
|
@@ -177,37 +184,23 @@ module ActiveMerchant #:nodoc:
|
|
|
177
184
|
def add_payment_method_id(options)
|
|
178
185
|
return options[:payment_method_id].to_i if options[:payment_method_id]
|
|
179
186
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
when 'master'
|
|
198
|
-
104
|
|
199
|
-
when 'american_express'
|
|
200
|
-
65
|
|
201
|
-
when 'american_express_prisma'
|
|
202
|
-
111
|
|
203
|
-
when 'cabal'
|
|
204
|
-
63
|
|
205
|
-
when 'diners_club'
|
|
206
|
-
8
|
|
207
|
-
else
|
|
208
|
-
1
|
|
209
|
-
end
|
|
210
|
-
end
|
|
187
|
+
card_brand = options[:card_brand]
|
|
188
|
+
debit = options[:debit]
|
|
189
|
+
|
|
190
|
+
payment_method_ids = {
|
|
191
|
+
'visa' => debit ? 31 : 1,
|
|
192
|
+
'master' => debit ? 105 : 104,
|
|
193
|
+
'maestro' => 106,
|
|
194
|
+
'cabal' => debit ? 108 : 63,
|
|
195
|
+
'american_express' => 65,
|
|
196
|
+
'american_express_prisma' => 111,
|
|
197
|
+
'diners_club' => 8,
|
|
198
|
+
'patagonia_365' => 55,
|
|
199
|
+
'tarjeta_sol' => 64,
|
|
200
|
+
'discover' => 139
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
payment_method_ids.fetch(card_brand, debit ? 31 : 1)
|
|
211
204
|
end
|
|
212
205
|
|
|
213
206
|
def add_fraud_detection(post, options)
|
|
@@ -321,8 +314,11 @@ module ActiveMerchant #:nodoc:
|
|
|
321
314
|
return error_code_from(response) unless validation_errors = response.dig('validation_errors')
|
|
322
315
|
|
|
323
316
|
validation_errors = validation_errors[0]
|
|
317
|
+
message = "#{validation_errors&.dig('code')}: #{validation_errors&.dig('param')}"
|
|
318
|
+
return message unless message == ': '
|
|
324
319
|
|
|
325
|
-
"#{
|
|
320
|
+
errors = response['validation_errors'].map { |k, v| "#{k}: #{v}" }.join(', ')
|
|
321
|
+
"#{response['error_type']} - #{errors}"
|
|
326
322
|
end
|
|
327
323
|
|
|
328
324
|
def rejected?(response)
|