activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- 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 +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- 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 +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- 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 +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- 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 +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- 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 +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- 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 +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -0,0 +1,342 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class DLocalGateway < Gateway
|
4
|
+
self.test_url = 'https://sandbox.dlocal.com'
|
5
|
+
self.live_url = 'https://api.dlocal.com'
|
6
|
+
|
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
|
+
self.default_currency = 'USD'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro naranja cabal elo alia carnet]
|
10
|
+
|
11
|
+
self.homepage_url = 'https://dlocal.com/'
|
12
|
+
self.display_name = 'dLocal'
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
requires!(options, :login, :trans_key, :secret_key)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def purchase(money, payment, options = {})
|
20
|
+
post = {}
|
21
|
+
add_auth_purchase_params(post, money, payment, 'purchase', options)
|
22
|
+
add_three_ds(post, options)
|
23
|
+
|
24
|
+
commit('purchase', post, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def authorize(money, payment, options = {})
|
28
|
+
post = {}
|
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'
|
32
|
+
|
33
|
+
commit('authorize', post, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def capture(money, authorization, options = {})
|
37
|
+
post = {}
|
38
|
+
post[:authorization_id] = authorization
|
39
|
+
add_invoice(post, money, options) if money
|
40
|
+
commit('capture', post, options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def refund(money, authorization, options = {})
|
44
|
+
post = {}
|
45
|
+
post[:payment_id] = authorization
|
46
|
+
post[:notification_url] = options[:notification_url]
|
47
|
+
add_invoice(post, money, options) if money
|
48
|
+
commit('refund', post, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
def void(authorization, options = {})
|
52
|
+
post = {}
|
53
|
+
post[:authorization_id] = authorization
|
54
|
+
commit('void', post, options)
|
55
|
+
end
|
56
|
+
|
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)
|
66
|
+
end
|
67
|
+
|
68
|
+
def supports_scrubbing?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
def supports_network_tokenization?
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
|
+
def scrub(transcript)
|
77
|
+
transcript.
|
78
|
+
gsub(%r((X-Trans-Key: )\w+), '\1[FILTERED]').
|
79
|
+
gsub(%r((\"number\\\":\\\")\d+), '\1[FILTERED]').
|
80
|
+
gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def add_auth_purchase_params(post, money, card, action, options)
|
86
|
+
add_invoice(post, money, options)
|
87
|
+
post[:payment_method_id] = 'CARD'
|
88
|
+
post[:payment_method_flow] = 'DIRECT'
|
89
|
+
add_country(post, card, options)
|
90
|
+
add_payer(post, card, options)
|
91
|
+
add_card(post, card, action, options)
|
92
|
+
add_additional_data(post, options)
|
93
|
+
post[:order_id] = options[:order_id] || generate_unique_id
|
94
|
+
post[:original_order_id] = options[:original_order_id] if options[:original_order_id]
|
95
|
+
post[:description] = options[:description] if options[:description]
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_invoice(post, money, options)
|
99
|
+
post[:amount] = amount(money)
|
100
|
+
post[:currency] = (options[:currency] || currency(money))
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_additional_data(post, options)
|
104
|
+
post[:additional_risk_data] = options[:additional_data]
|
105
|
+
end
|
106
|
+
|
107
|
+
def add_country(post, card, options)
|
108
|
+
return unless address = options[:billing_address] || options[:address]
|
109
|
+
|
110
|
+
post[:country] = lookup_country_code(address[:country])
|
111
|
+
end
|
112
|
+
|
113
|
+
def lookup_country_code(country_field)
|
114
|
+
Country.find(country_field).code(:alpha2).value
|
115
|
+
rescue InvalidCountryCodeError
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_payer(post, card, options)
|
120
|
+
address = options[:billing_address] || options[:address]
|
121
|
+
post[:payer] = {}
|
122
|
+
post[:payer][:name] = card.name
|
123
|
+
post[:payer][:email] = options[:email] if options[:email]
|
124
|
+
post[:payer][:birth_date] = options[:birth_date] if options[:birth_date]
|
125
|
+
post[:payer][:phone] = address[:phone] if address && address[:phone]
|
126
|
+
post[:payer][:document] = options[:document] if options[:document]
|
127
|
+
post[:payer][:document2] = options[:document2] if options[:document2]
|
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]
|
131
|
+
post[:payer][:address] = add_address(post, card, options)
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_address(post, card, options)
|
135
|
+
return unless address = options[:billing_address] || options[:address]
|
136
|
+
|
137
|
+
address_object = {}
|
138
|
+
address_object[:state] = address[:state] if address[:state]
|
139
|
+
address_object[:city] = address[:city] if address[:city]
|
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)
|
143
|
+
address_object
|
144
|
+
end
|
145
|
+
|
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 = {})
|
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
|
+
|
183
|
+
post[:card][:holder_name] = card.name
|
184
|
+
post[:card][:expiration_month] = card.month
|
185
|
+
post[:card][:expiration_year] = card.year
|
186
|
+
post[:card][:descriptor] = options[:dynamic_descriptor] if options[:dynamic_descriptor]
|
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
|
+
end
|
192
|
+
|
193
|
+
def parse(body)
|
194
|
+
JSON.parse(body)
|
195
|
+
end
|
196
|
+
|
197
|
+
def commit(action, parameters, options = {})
|
198
|
+
three_ds_errors = validate_three_ds_params(parameters[:three_dsecure]) if parameters[:three_dsecure].present?
|
199
|
+
return three_ds_errors if three_ds_errors
|
200
|
+
|
201
|
+
url = url(action, parameters, options)
|
202
|
+
post = post_data(action, parameters)
|
203
|
+
begin
|
204
|
+
raw = if %w(status orders).include?(action)
|
205
|
+
ssl_get(url, headers(nil, options))
|
206
|
+
else
|
207
|
+
ssl_post(url, post, headers(post, options))
|
208
|
+
end
|
209
|
+
response = parse(raw)
|
210
|
+
rescue ResponseError => e
|
211
|
+
raw = e.response.body
|
212
|
+
response = parse(raw)
|
213
|
+
end
|
214
|
+
|
215
|
+
Response.new(
|
216
|
+
success_from(action, response),
|
217
|
+
message_from(action, response),
|
218
|
+
response,
|
219
|
+
authorization: authorization_from(response),
|
220
|
+
avs_result: AVSResult.new(code: response['some_avs_response_key']),
|
221
|
+
cvv_result: CVVResult.new(response['some_cvv_response_key']),
|
222
|
+
test: test?,
|
223
|
+
error_code: error_code_from(action, response)
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
227
|
+
# A refund may not be immediate, and return a status_code of 100, "Pending".
|
228
|
+
# Since we aren't handling async notifications of eventual success,
|
229
|
+
# we count 100 as a success.
|
230
|
+
def success_from(action, response)
|
231
|
+
return false unless response['status_code']
|
232
|
+
|
233
|
+
%w[100 200 400 600 700].include? response['status_code'].to_s
|
234
|
+
end
|
235
|
+
|
236
|
+
def message_from(action, response)
|
237
|
+
response['status_detail'] || response['message']
|
238
|
+
end
|
239
|
+
|
240
|
+
def authorization_from(response)
|
241
|
+
response['id']
|
242
|
+
end
|
243
|
+
|
244
|
+
def error_code_from(action, response)
|
245
|
+
return if success_from(action, response)
|
246
|
+
|
247
|
+
code = response['status_code'] || response['code']
|
248
|
+
code&.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
def url(action, parameters, options = {})
|
252
|
+
"#{(test? ? test_url : live_url)}/#{endpoint(action, parameters, options)}/"
|
253
|
+
end
|
254
|
+
|
255
|
+
def endpoint(action, parameters, options)
|
256
|
+
case action
|
257
|
+
when 'purchase'
|
258
|
+
'secure_payments'
|
259
|
+
when 'authorize'
|
260
|
+
'secure_payments'
|
261
|
+
when 'refund'
|
262
|
+
'refunds'
|
263
|
+
when 'capture'
|
264
|
+
'payments'
|
265
|
+
when 'void'
|
266
|
+
"payments/#{parameters[:authorization_id]}/cancel"
|
267
|
+
when 'status'
|
268
|
+
"payments/#{parameters[:payment_id]}/status"
|
269
|
+
when 'orders'
|
270
|
+
"orders/#{options[:order_id]}"
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def headers(post, options = {})
|
275
|
+
timestamp = Time.now.utc.iso8601
|
276
|
+
headers = {
|
277
|
+
'Content-Type' => 'application/json',
|
278
|
+
'X-Date' => timestamp,
|
279
|
+
'X-Login' => @options[:login],
|
280
|
+
'X-Trans-Key' => @options[:trans_key],
|
281
|
+
'X-Version' => '2.1',
|
282
|
+
'Authorization' => signature(post, timestamp)
|
283
|
+
}
|
284
|
+
headers['X-Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key]
|
285
|
+
headers
|
286
|
+
end
|
287
|
+
|
288
|
+
def signature(post, timestamp)
|
289
|
+
content = "#{@options[:login]}#{timestamp}#{post}"
|
290
|
+
digest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @options[:secret_key], content)
|
291
|
+
"V2-HMAC-SHA256, Signature: #{digest}"
|
292
|
+
end
|
293
|
+
|
294
|
+
def post_data(action, parameters = {})
|
295
|
+
parameters.to_json
|
296
|
+
end
|
297
|
+
|
298
|
+
def xid_or_ds_trans_id(three_d_secure)
|
299
|
+
if three_d_secure[:version].to_f >= 2
|
300
|
+
{ ds_transaction_id: three_d_secure[:ds_transaction_id] }
|
301
|
+
else
|
302
|
+
{ xid: three_d_secure[:xid] }
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
def add_three_ds(post, options)
|
307
|
+
return unless three_d_secure = options[:three_d_secure]
|
308
|
+
|
309
|
+
post[:three_dsecure] = {
|
310
|
+
mpi: true,
|
311
|
+
three_dsecure_version: three_d_secure[:version],
|
312
|
+
cavv: three_d_secure[:cavv],
|
313
|
+
eci: three_d_secure[:eci],
|
314
|
+
enrollment_response: formatted_enrollment(three_d_secure[:enrolled]),
|
315
|
+
authentication_response: three_d_secure[:authentication_response_status]
|
316
|
+
}.merge(xid_or_ds_trans_id(three_d_secure))
|
317
|
+
end
|
318
|
+
|
319
|
+
def validate_three_ds_params(three_ds)
|
320
|
+
errors = {}
|
321
|
+
supported_version = %w{1.0 2.0 2.1.0 2.2.0}.include?(three_ds[:three_dsecure_version])
|
322
|
+
supported_enrollment = ['Y', 'N', 'U', nil].include?(three_ds[:enrollment_response])
|
323
|
+
supported_auth_response = ['Y', 'N', 'U', nil].include?(three_ds[:authentication_response])
|
324
|
+
|
325
|
+
errors[:three_ds_version] = 'ThreeDs version not supported' unless supported_version
|
326
|
+
errors[:enrollment] = 'Enrollment value not supported' unless supported_enrollment
|
327
|
+
errors[:auth_response] = 'Authentication response value not supported' unless supported_auth_response
|
328
|
+
errors.compact!
|
329
|
+
|
330
|
+
errors.present? ? Response.new(false, 'ThreeDs data is invalid', errors) : nil
|
331
|
+
end
|
332
|
+
|
333
|
+
def formatted_enrollment(val)
|
334
|
+
case val
|
335
|
+
when 'Y', 'N', 'U' then val
|
336
|
+
when true, 'true' then 'Y'
|
337
|
+
when false, 'false' then 'N'
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'active_support/core_ext/string/access'
|
2
2
|
|
3
3
|
module ActiveMerchant
|
4
4
|
module Billing
|
@@ -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
|
@@ -142,21 +140,21 @@ module ActiveMerchant
|
|
142
140
|
|
143
141
|
def build_purchase_or_authorization_request_with_continuous_authority_reference_request(type, money, authorization, options)
|
144
142
|
parsed_authorization = parse_authorization_string(authorization)
|
145
|
-
raise ArgumentError,
|
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
|
@@ -214,23 +212,11 @@ module ActiveMerchant
|
|
214
212
|
end
|
215
213
|
|
216
214
|
def add_credit_card(xml, credit_card, address)
|
217
|
-
|
218
215
|
xml.tag! :Card do
|
219
|
-
|
220
216
|
# DataCash calls the CC number 'pan'
|
221
217
|
xml.tag! :pan, credit_card.number
|
222
218
|
xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)
|
223
219
|
|
224
|
-
# optional values - for Solo etc
|
225
|
-
if [ 'switch', 'solo' ].include?(card_brand(credit_card).to_s)
|
226
|
-
|
227
|
-
xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?
|
228
|
-
|
229
|
-
if !credit_card.start_month.blank? && !credit_card.start_year.blank?
|
230
|
-
xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
220
|
xml.tag! :Cv2Avs do
|
235
221
|
xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?
|
236
222
|
if address
|
@@ -249,23 +235,23 @@ module ActiveMerchant
|
|
249
235
|
# a predefined one
|
250
236
|
xml.tag! :ExtendedPolicy do
|
251
237
|
xml.tag! :cv2_policy,
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
238
|
+
notprovided: POLICY_REJECT,
|
239
|
+
notchecked: POLICY_REJECT,
|
240
|
+
matched: POLICY_ACCEPT,
|
241
|
+
notmatched: POLICY_REJECT,
|
242
|
+
partialmatch: POLICY_REJECT
|
257
243
|
xml.tag! :postcode_policy,
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
244
|
+
notprovided: POLICY_ACCEPT,
|
245
|
+
notchecked: POLICY_ACCEPT,
|
246
|
+
matched: POLICY_ACCEPT,
|
247
|
+
notmatched: POLICY_REJECT,
|
248
|
+
partialmatch: POLICY_ACCEPT
|
263
249
|
xml.tag! :address_policy,
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
250
|
+
notprovided: POLICY_ACCEPT,
|
251
|
+
notchecked: POLICY_ACCEPT,
|
252
|
+
matched: POLICY_ACCEPT,
|
253
|
+
notmatched: POLICY_REJECT,
|
254
|
+
partialmatch: POLICY_ACCEPT
|
269
255
|
end
|
270
256
|
end
|
271
257
|
end
|
@@ -275,20 +261,18 @@ module ActiveMerchant
|
|
275
261
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
|
276
262
|
|
277
263
|
Response.new(response[:status] == '1', response[:reason], response,
|
278
|
-
:
|
279
|
-
:
|
280
|
-
)
|
264
|
+
test: test?,
|
265
|
+
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}")
|
281
266
|
end
|
282
267
|
|
283
268
|
def format_date(month, year)
|
284
|
-
"#{format(month
|
269
|
+
"#{format(month, :two_digits)}/#{format(year, :two_digits)}"
|
285
270
|
end
|
286
271
|
|
287
272
|
def parse(body)
|
288
|
-
|
289
273
|
response = {}
|
290
274
|
xml = REXML::Document.new(body)
|
291
|
-
root = REXML::XPath.first(xml,
|
275
|
+
root = REXML::XPath.first(xml, '//Response')
|
292
276
|
|
293
277
|
root.elements.to_a.each do |node|
|
294
278
|
parse_element(response, node)
|
@@ -299,19 +283,19 @@ module ActiveMerchant
|
|
299
283
|
|
300
284
|
def parse_element(response, node)
|
301
285
|
if node.has_elements?
|
302
|
-
node.elements.each{|e| parse_element(response, e) }
|
286
|
+
node.elements.each { |e| parse_element(response, e) }
|
303
287
|
else
|
304
288
|
response[node.name.underscore.to_sym] = node.text
|
305
289
|
end
|
306
290
|
end
|
307
291
|
|
308
292
|
def format_reference_number(number)
|
309
|
-
number.to_s.gsub(/[^A-Za-z0-9]/, '').rjust(6,
|
293
|
+
number.to_s.gsub(/[^A-Za-z0-9]/, '').rjust(6, '0').first(30)
|
310
294
|
end
|
311
295
|
|
312
296
|
def parse_authorization_string(authorization)
|
313
297
|
reference, auth_code, ca_reference = authorization.to_s.split(';')
|
314
|
-
{:
|
298
|
+
{ reference: reference, auth_code: auth_code, ca_reference: ca_reference }
|
315
299
|
end
|
316
300
|
end
|
317
301
|
end
|