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,368 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SimetrikGateway < Gateway
|
4
|
+
self.test_url = 'https://payments.sta.simetrik.com/v1'
|
5
|
+
self.live_url = 'https://payments.simetrik.com/v1'
|
6
|
+
|
7
|
+
class_attribute :test_auth_url, :live_auth_url, :test_audience, :live_audience
|
8
|
+
self.test_auth_url = 'https://tenant-payments-dev.us.auth0.com/oauth/token'
|
9
|
+
self.live_auth_url = 'https://tenant-payments-prod.us.auth0.com/oauth/token'
|
10
|
+
|
11
|
+
self.test_audience = 'https://tenant-payments-dev.us.auth0.com/api/v2/'
|
12
|
+
self.live_audience = 'https://tenant-payments-prod.us.auth0.com/api/v2/'
|
13
|
+
|
14
|
+
self.supported_countries = %w(PE AR)
|
15
|
+
self.default_currency = 'USD'
|
16
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
17
|
+
|
18
|
+
self.homepage_url = 'https://www.simetrik.com'
|
19
|
+
self.display_name = 'Simetrik'
|
20
|
+
|
21
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
22
|
+
'R101' => STANDARD_ERROR_CODE[:incorrect_number],
|
23
|
+
'R102' => STANDARD_ERROR_CODE[:invalid_number],
|
24
|
+
'R103' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
25
|
+
'R104' => STANDARD_ERROR_CODE[:invalid_cvc],
|
26
|
+
'R105' => STANDARD_ERROR_CODE[:expired_card],
|
27
|
+
'R106' => STANDARD_ERROR_CODE[:incorrect_cvc],
|
28
|
+
'R107' => STANDARD_ERROR_CODE[:incorrect_pin],
|
29
|
+
'R201' => STANDARD_ERROR_CODE[:incorrect_zip],
|
30
|
+
'R202' => STANDARD_ERROR_CODE[:incorrect_address],
|
31
|
+
'R301' => STANDARD_ERROR_CODE[:card_declined],
|
32
|
+
'R302' => STANDARD_ERROR_CODE[:processing_error],
|
33
|
+
'R303' => STANDARD_ERROR_CODE[:call_issuer],
|
34
|
+
'R304' => STANDARD_ERROR_CODE[:pick_up_card],
|
35
|
+
'R305' => STANDARD_ERROR_CODE[:processing_error],
|
36
|
+
'R306' => STANDARD_ERROR_CODE[:processing_error],
|
37
|
+
'R307' => STANDARD_ERROR_CODE[:processing_error],
|
38
|
+
'R401' => STANDARD_ERROR_CODE[:config_error],
|
39
|
+
'R402' => STANDARD_ERROR_CODE[:test_mode_live_card],
|
40
|
+
'R403' => STANDARD_ERROR_CODE[:unsupported_feature]
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
def initialize(options = {})
|
45
|
+
requires!(options, :client_id, :client_secret)
|
46
|
+
super
|
47
|
+
@access_token = {}
|
48
|
+
sign_access_token()
|
49
|
+
end
|
50
|
+
|
51
|
+
def authorize(money, payment, options = {})
|
52
|
+
requires!(options, :token_acquirer)
|
53
|
+
|
54
|
+
post = {}
|
55
|
+
add_forward_route(post, options)
|
56
|
+
add_forward_payload(post, money, payment, options)
|
57
|
+
add_stored_credential(post, options)
|
58
|
+
commit('authorize', post, { token_acquirer: options[:token_acquirer] })
|
59
|
+
end
|
60
|
+
|
61
|
+
def capture(money, authorization, options = {})
|
62
|
+
requires!(options, :token_acquirer)
|
63
|
+
post = {
|
64
|
+
forward_payload: {
|
65
|
+
amount: {
|
66
|
+
total_amount: amount(money).to_f,
|
67
|
+
currency: (options[:currency] || currency(money))
|
68
|
+
},
|
69
|
+
transaction: {
|
70
|
+
id: authorization
|
71
|
+
},
|
72
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
post[:forward_payload][:amount][:vat] = options[:vat].to_f / 100 if options[:vat]
|
76
|
+
|
77
|
+
add_forward_route(post, options)
|
78
|
+
commit('capture', post, { token_acquirer: options[:token_acquirer] })
|
79
|
+
end
|
80
|
+
|
81
|
+
def refund(money, authorization, options = {})
|
82
|
+
requires!(options, :token_acquirer)
|
83
|
+
post = {
|
84
|
+
forward_payload: {
|
85
|
+
amount: {
|
86
|
+
total_amount: amount(money).to_f,
|
87
|
+
currency: (options[:currency] || currency(money))
|
88
|
+
},
|
89
|
+
transaction: {
|
90
|
+
id: authorization
|
91
|
+
},
|
92
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
post[:forward_payload][:transaction][:comment] = options[:comment] if options[:comment]
|
96
|
+
|
97
|
+
add_forward_route(post, options)
|
98
|
+
commit('refund', post, { token_acquirer: options[:token_acquirer] })
|
99
|
+
end
|
100
|
+
|
101
|
+
def void(authorization, options = {})
|
102
|
+
requires!(options, :token_acquirer)
|
103
|
+
post = {
|
104
|
+
forward_payload: {
|
105
|
+
transaction: {
|
106
|
+
id: authorization
|
107
|
+
},
|
108
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
add_forward_route(post, options)
|
112
|
+
commit('void', post, { token_acquirer: options[:token_acquirer] })
|
113
|
+
end
|
114
|
+
|
115
|
+
def purchase(money, payment, options = {})
|
116
|
+
requires!(options, :token_acquirer)
|
117
|
+
|
118
|
+
post = {}
|
119
|
+
add_forward_route(post, options)
|
120
|
+
add_forward_payload(post, money, payment, options)
|
121
|
+
|
122
|
+
add_stored_credential(post, options)
|
123
|
+
commit('charge', post, { token_acquirer: options[:token_acquirer] })
|
124
|
+
end
|
125
|
+
|
126
|
+
def supports_scrubbing?
|
127
|
+
true
|
128
|
+
end
|
129
|
+
|
130
|
+
def scrub(transcript)
|
131
|
+
transcript.
|
132
|
+
gsub(%r((Authorization: Bearer ).+), '\1[FILTERED]').
|
133
|
+
gsub(%r(("client_secret\\?":\\?")\w+), '\1[FILTERED]').
|
134
|
+
gsub(%r(("number\\?":\\?")\d+), '\1[FILTERED]').
|
135
|
+
gsub(%r(("security_code\\?":\\?")\d+), '\1[FILTERED]')
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def add_forward_route(post, options)
|
141
|
+
forward_route = {}
|
142
|
+
forward_route[:trace_id] = options[:trace_id] if options[:trace_id]
|
143
|
+
|
144
|
+
forward_route[:psp_extra_fields] = options[:psp_extra_fields] || {}
|
145
|
+
post[:forward_route] = forward_route
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_forward_payload(post, money, payment, options)
|
149
|
+
forward_payload = {}
|
150
|
+
add_user(forward_payload, options[:user]) if options[:user]
|
151
|
+
add_order(forward_payload, money, options)
|
152
|
+
add_payment_method(forward_payload, payment, options[:payment_method]) if options[:payment_method] || payment
|
153
|
+
|
154
|
+
forward_payload[:payment_method] = {} unless forward_payload[:payment_method]
|
155
|
+
forward_payload[:payment_method][:card] = {} unless forward_payload[:payment_method][:card]
|
156
|
+
add_address('billing_address', forward_payload[:payment_method][:card], options[:billing_address]) if options[:billing_address]
|
157
|
+
|
158
|
+
add_three_ds_fields(forward_payload[:authentication] = {}, options[:three_ds_fields]) if options[:three_ds_fields]
|
159
|
+
add_sub_merchant(forward_payload, options[:sub_merchant]) if options[:sub_merchant]
|
160
|
+
forward_payload[:acquire_extra_options] = options[:acquire_extra_options] || {}
|
161
|
+
post[:forward_payload] = forward_payload
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_sub_merchant(post, sub_merchant_options)
|
165
|
+
sub_merchant = {}
|
166
|
+
sub_merchant[:merchant_id] = sub_merchant_options[:merchant_id] if sub_merchant_options[:merchant_id]
|
167
|
+
sub_merchant[:extra_params] = sub_merchant_options[:extra_params] if sub_merchant_options[:extra_params]
|
168
|
+
sub_merchant[:mcc] = sub_merchant_options[:mcc] if sub_merchant_options[:mcc]
|
169
|
+
sub_merchant[:name] = sub_merchant_options[:name] if sub_merchant_options[:name]
|
170
|
+
sub_merchant[:address] = sub_merchant_options[:address] if sub_merchant_options[:address]
|
171
|
+
sub_merchant[:postal_code] = sub_merchant_options[:postal_code] if sub_merchant_options[:postal_code]
|
172
|
+
sub_merchant[:url] = sub_merchant_options[:url] if sub_merchant_options[:url]
|
173
|
+
sub_merchant[:phone_number] = sub_merchant_options[:phone_number] if sub_merchant_options[:phone_number]
|
174
|
+
|
175
|
+
post[:sub_merchant] = sub_merchant
|
176
|
+
end
|
177
|
+
|
178
|
+
def add_payment_method(post, payment, payment_method_options)
|
179
|
+
payment_method = {}
|
180
|
+
opts = nil
|
181
|
+
opts = payment_method_options[:card] if payment_method_options
|
182
|
+
add_card(payment_method, payment, opts) if opts || payment
|
183
|
+
|
184
|
+
post[:payment_method] = payment_method
|
185
|
+
end
|
186
|
+
|
187
|
+
def add_three_ds_fields(post, three_ds_options)
|
188
|
+
three_ds = {}
|
189
|
+
three_ds[:version] = three_ds_options[:version] if three_ds_options[:version]
|
190
|
+
three_ds[:eci] = three_ds_options[:eci] if three_ds_options[:eci]
|
191
|
+
three_ds[:cavv] = three_ds_options[:cavv] if three_ds_options[:cavv]
|
192
|
+
three_ds[:ds_transaction_id] = three_ds_options[:ds_transaction_id] if three_ds_options[:ds_transaction_id]
|
193
|
+
three_ds[:acs_transaction_id] = three_ds_options[:acs_transaction_id] if three_ds_options[:acs_transaction_id]
|
194
|
+
three_ds[:xid] = three_ds_options[:xid] if three_ds_options[:xid]
|
195
|
+
three_ds[:enrolled] = three_ds_options[:enrolled] if three_ds_options[:enrolled]
|
196
|
+
three_ds[:cavv_algorithm] = three_ds_options[:cavv_algorithm] if three_ds_options[:cavv_algorithm]
|
197
|
+
three_ds[:directory_response_status] = three_ds_options[:directory_response_status] if three_ds_options[:directory_response_status]
|
198
|
+
three_ds[:authentication_response_status] = three_ds_options[:authentication_response_status] if three_ds_options[:authentication_response_status]
|
199
|
+
three_ds[:three_ds_server_trans_id] = three_ds_options[:three_ds_server_trans_id] if three_ds_options[:three_ds_server_trans_id]
|
200
|
+
|
201
|
+
post[:three_ds_fields] = three_ds
|
202
|
+
end
|
203
|
+
|
204
|
+
def add_card(post, card, card_options = {})
|
205
|
+
card_hash = {}
|
206
|
+
card_hash[:number] = card.number
|
207
|
+
card_hash[:exp_month] = card.month
|
208
|
+
card_hash[:exp_year] = card.year
|
209
|
+
card_hash[:security_code] = card.verification_value
|
210
|
+
card_hash[:type] = card.brand
|
211
|
+
card_hash[:holder_first_name] = card.first_name
|
212
|
+
card_hash[:holder_last_name] = card.last_name
|
213
|
+
post[:card] = card_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
def add_user(post, user_options)
|
217
|
+
user = {}
|
218
|
+
user[:id] = user_options[:id] if user_options[:id]
|
219
|
+
user[:email] = user_options[:email] if user_options[:email]
|
220
|
+
|
221
|
+
post[:user] = user
|
222
|
+
end
|
223
|
+
|
224
|
+
def add_stored_credential(post, options)
|
225
|
+
return unless options[:stored_credential]
|
226
|
+
|
227
|
+
check_initiator = %w[merchant cardholder].any? { |item| item == options[:stored_credential][:initiator] }
|
228
|
+
check_reason_type = %w[recurring installment unscheduled].any? { |item| item == options[:stored_credential][:reason_type] }
|
229
|
+
post[:forward_payload][:authentication] = {} unless post[:forward_payload].key?(:authentication)
|
230
|
+
post[:forward_payload][:authentication][:stored_credential] = options[:stored_credential] if check_initiator && check_reason_type
|
231
|
+
end
|
232
|
+
|
233
|
+
def add_order(post, money, options)
|
234
|
+
return unless options[:order] || money
|
235
|
+
|
236
|
+
order = {}
|
237
|
+
order_options = options[:order] || {}
|
238
|
+
order[:id] = options[:order_id] if options[:order_id]
|
239
|
+
order[:description] = options[:description] if options[:description]
|
240
|
+
order[:installments] = order_options[:installments].to_i if order_options[:installments]
|
241
|
+
order[:datetime_local_transaction] = order_options[:datetime_local_transaction] if order_options[:datetime_local_transaction]
|
242
|
+
|
243
|
+
add_amount(order, money, options)
|
244
|
+
add_address('shipping_address', order, options)
|
245
|
+
|
246
|
+
post[:order] = order
|
247
|
+
end
|
248
|
+
|
249
|
+
def add_amount(post, money, options)
|
250
|
+
amount_obj = {}
|
251
|
+
amount_obj[:total_amount] = amount(money).to_f
|
252
|
+
amount_obj[:currency] = (options[:currency] || currency(money))
|
253
|
+
amount_obj[:vat] = options[:vat].to_f / 100 if options[:vat]
|
254
|
+
|
255
|
+
post[:amount] = amount_obj
|
256
|
+
end
|
257
|
+
|
258
|
+
def add_address(tag, post, options)
|
259
|
+
return unless address_options = options[:shipping_address]
|
260
|
+
|
261
|
+
address = {}
|
262
|
+
address[:name] = address_options[:name] if address_options[:name]
|
263
|
+
address[:address1] = address_options[:address1] if address_options[:address1]
|
264
|
+
address[:address2] = address_options[:address2] if address_options[:address2]
|
265
|
+
address[:company] = address_options[:company] if address_options[:company]
|
266
|
+
address[:city] = address_options[:city] if address_options[:city]
|
267
|
+
address[:state] = address_options[:state] if address_options[:state]
|
268
|
+
address[:zip] = address_options[:zip] if address_options[:zip]
|
269
|
+
address[:country] = address_options[:country] if address_options[:country]
|
270
|
+
address[:phone] = address_options[:phone] if address_options[:phone]
|
271
|
+
address[:fax] = address_options[:fax] if address_options[:fax]
|
272
|
+
|
273
|
+
post[tag] = address
|
274
|
+
end
|
275
|
+
|
276
|
+
def parse(body)
|
277
|
+
JSON.parse(body)
|
278
|
+
end
|
279
|
+
|
280
|
+
def commit(action, parameters, url_params = {})
|
281
|
+
begin
|
282
|
+
response = JSON.parse ssl_post(url(action, url_params), post_data(parameters), authorized_headers())
|
283
|
+
rescue ResponseError => exception
|
284
|
+
case exception.response.code.to_i
|
285
|
+
when 400...499
|
286
|
+
response = JSON.parse exception.response.body
|
287
|
+
else
|
288
|
+
raise exception
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
Response.new(
|
293
|
+
success_from(response['code']),
|
294
|
+
message_from(response),
|
295
|
+
response,
|
296
|
+
authorization: authorization_from(response),
|
297
|
+
avs_result: AVSResult.new(code: avs_code_from(response)),
|
298
|
+
cvv_result: CVVResult.new(cvv_code_from(response)),
|
299
|
+
test: test?,
|
300
|
+
error_code: error_code_from(response)
|
301
|
+
)
|
302
|
+
end
|
303
|
+
|
304
|
+
def avs_code_from(response)
|
305
|
+
response['avs_result']
|
306
|
+
end
|
307
|
+
|
308
|
+
def cvv_code_from(response)
|
309
|
+
response['cvv_result']
|
310
|
+
end
|
311
|
+
|
312
|
+
def success_from(code)
|
313
|
+
code == 'S001'
|
314
|
+
end
|
315
|
+
|
316
|
+
def message_from(response)
|
317
|
+
response['message']
|
318
|
+
end
|
319
|
+
|
320
|
+
def url(action, url_params)
|
321
|
+
"#{(test? ? test_url : live_url)}/#{url_params[:token_acquirer]}/#{action}"
|
322
|
+
end
|
323
|
+
|
324
|
+
def post_data(data = {})
|
325
|
+
data.to_json
|
326
|
+
end
|
327
|
+
|
328
|
+
def authorization_from(response)
|
329
|
+
response['simetrik_authorization_id']
|
330
|
+
end
|
331
|
+
|
332
|
+
def error_code_from(response)
|
333
|
+
STANDARD_ERROR_CODE_MAPPING[response['code']] unless success_from(response['code'])
|
334
|
+
end
|
335
|
+
|
336
|
+
def authorized_headers
|
337
|
+
{
|
338
|
+
'content-Type' => 'application/json',
|
339
|
+
'Authorization' => "Bearer #{sign_access_token()}"
|
340
|
+
}
|
341
|
+
end
|
342
|
+
|
343
|
+
# if this method is refactored, ensure that the client_secret is properly scrubbed
|
344
|
+
def sign_access_token
|
345
|
+
fetch_access_token() if Time.new.to_i > (@access_token[:expires_at] || 0) + 10
|
346
|
+
@access_token[:access_token]
|
347
|
+
end
|
348
|
+
|
349
|
+
def auth_url
|
350
|
+
(test? ? test_auth_url : live_auth_url)
|
351
|
+
end
|
352
|
+
|
353
|
+
def fetch_access_token
|
354
|
+
login_info = {}
|
355
|
+
login_info[:client_id] = @options[:client_id]
|
356
|
+
login_info[:client_secret] = @options[:client_secret]
|
357
|
+
login_info[:audience] = test? ? test_audience : live_audience
|
358
|
+
login_info[:grant_type] = 'client_credentials'
|
359
|
+
response = parse(ssl_post(auth_url(), login_info.to_json, {
|
360
|
+
'content-Type' => 'application/json'
|
361
|
+
}))
|
362
|
+
|
363
|
+
@access_token[:access_token] = response['access_token']
|
364
|
+
@access_token[:expires_at] = Time.new.to_i + response['expires_in']
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#!ruby19
|
2
1
|
# encoding: utf-8
|
3
2
|
|
4
3
|
module ActiveMerchant #:nodoc:
|
@@ -6,53 +5,53 @@ module ActiveMerchant #:nodoc:
|
|
6
5
|
class SkipJackGateway < Gateway
|
7
6
|
API_VERSION = '?.?'
|
8
7
|
|
9
|
-
self.live_url =
|
10
|
-
self.test_url =
|
8
|
+
self.live_url = 'https://www.skipjackic.com'
|
9
|
+
self.test_url = 'https://developer.skipjackic.com'
|
11
10
|
|
12
|
-
BASIC_PATH =
|
13
|
-
ADVANCED_PATH =
|
11
|
+
BASIC_PATH = '/scripts/evolvcc.dll'
|
12
|
+
ADVANCED_PATH = '/evolvcc/evolvcc.aspx'
|
14
13
|
|
15
14
|
ACTIONS = {
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
15
|
+
authorization: 'AuthorizeAPI',
|
16
|
+
change_status: 'SJAPI_TransactionChangeStatusRequest',
|
17
|
+
get_status: 'SJAPI_TransactionStatusRequest'
|
19
18
|
}
|
20
19
|
|
21
20
|
SUCCESS_MESSAGE = 'The transaction was successful.'
|
22
21
|
|
23
22
|
MONETARY_CHANGE_STATUSES = ['SETTLE', 'AUTHORIZE', 'AUTHORIZE ADDITIONAL', 'CREDIT', 'SPLITSETTLE']
|
24
23
|
|
25
|
-
CARD_CODE_ERRORS = %w(
|
24
|
+
CARD_CODE_ERRORS = %w(N S "")
|
26
25
|
|
27
26
|
CARD_CODE_MESSAGES = {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
'M' => 'Card verification number matched',
|
28
|
+
'N' => "Card verification number didn't match",
|
29
|
+
'P' => 'Card verification number was not processed',
|
30
|
+
'S' => 'Card verification number should be on card but was not indicated',
|
31
|
+
'U' => 'Issuer was not certified for card verification',
|
32
|
+
'' => 'Transaction failed because incorrect card verification number was entered or no number was entered'
|
34
33
|
}
|
35
34
|
|
36
|
-
AVS_ERRORS = %w(
|
35
|
+
AVS_ERRORS = %w(A B C E I N O P R W Z)
|
37
36
|
|
38
37
|
AVS_MESSAGES = {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
38
|
+
'A' => 'Street address matches billing information, zip/postal code does not',
|
39
|
+
'B' => 'Street address match for international transaction. Postal code not verified due to incompatible formats',
|
40
|
+
'C' => 'Street address and postal code not verified for internation transaction due to incompatible formats',
|
41
|
+
'D' => 'Street address and postal code match for international transaction',
|
42
|
+
'E' => 'Address verification service error',
|
43
|
+
'I' => 'Address information not verified by international issuer',
|
44
|
+
'M' => 'Street address and postal code match for international transaction',
|
45
|
+
'N' => 'Neither street address nor zip/postal match billing information',
|
46
|
+
'O' => 'Non-US issuer does not participate',
|
47
|
+
'P' => 'Postal codes match for international transaction but street address not verified due to incompatible formats',
|
48
|
+
'R' => 'Payment gateway was unavailable or timed out',
|
49
|
+
'S' => 'Address verification service not supported by issuer',
|
50
|
+
'U' => 'Address information is unavailable',
|
51
|
+
'W' => '9-digit zip/postal code matches billing information, street address does not',
|
52
|
+
'X' => 'Street address and 9-digit zip/postal code matches billing information',
|
53
|
+
'Y' => 'Street address and 5-digit zip/postal code matches billing information',
|
54
|
+
'Z' => '5-digit zip/postal code matches billing information, street address does not'
|
56
55
|
}
|
57
56
|
|
58
57
|
CHANGE_STATUS_ERROR_MESSAGES = {
|
@@ -161,8 +160,8 @@ module ActiveMerchant #:nodoc:
|
|
161
160
|
'-117' => 'POS Check Invalid Cashier Number'
|
162
161
|
}
|
163
162
|
|
164
|
-
self.supported_countries = [
|
165
|
-
self.supported_cardtypes = [
|
163
|
+
self.supported_countries = %w[US CA]
|
164
|
+
self.supported_cardtypes = %i[visa master american_express jcb discover diners_club]
|
166
165
|
self.homepage_url = 'http://www.skipjack.com/'
|
167
166
|
self.display_name = 'SkipJack'
|
168
167
|
|
@@ -214,7 +213,7 @@ module ActiveMerchant #:nodoc:
|
|
214
213
|
#
|
215
214
|
# * <tt>:force_settlement</tt> -- Force the settlement to occur as soon as possible. This option is not supported by other gateways. See the SkipJack API reference for more details
|
216
215
|
def capture(money, authorization, options = {})
|
217
|
-
post = {
|
216
|
+
post = {}
|
218
217
|
add_status_action(post, 'SETTLE')
|
219
218
|
add_forced_settlement(post, options)
|
220
219
|
add_transaction_id(post, authorization)
|
@@ -243,7 +242,7 @@ module ActiveMerchant #:nodoc:
|
|
243
242
|
end
|
244
243
|
|
245
244
|
def status(order_id)
|
246
|
-
commit(:get_status, nil, :
|
245
|
+
commit(:get_status, nil, szOrderNumber: order_id)
|
247
246
|
end
|
248
247
|
|
249
248
|
private
|
@@ -261,21 +260,20 @@ module ActiveMerchant #:nodoc:
|
|
261
260
|
end
|
262
261
|
|
263
262
|
def commit(action, money, parameters)
|
264
|
-
response = parse(
|
263
|
+
response = parse(ssl_post(url_for(action), post_data(action, money, parameters)), action)
|
265
264
|
|
266
265
|
# Pass along the original transaction id in the case an update transaction
|
267
266
|
Response.new(response[:success], message_from(response, action), response,
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
272
|
-
)
|
267
|
+
test: test?,
|
268
|
+
authorization: response[:szTransactionFileName] || parameters[:szTransactionId],
|
269
|
+
avs_result: { code: response[:szAVSResponseCode] },
|
270
|
+
cvv_result: response[:szCVV2ResponseCode])
|
273
271
|
end
|
274
272
|
|
275
273
|
def url_for(action)
|
276
274
|
result = test? ? self.test_url : self.live_url
|
277
275
|
result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH
|
278
|
-
result
|
276
|
+
result + "?#{ACTIONS[action]}"
|
279
277
|
end
|
280
278
|
|
281
279
|
def add_credentials(params, action)
|
@@ -301,9 +299,9 @@ module ActiveMerchant #:nodoc:
|
|
301
299
|
when :authorization
|
302
300
|
parse_authorization_response(body)
|
303
301
|
when :get_status
|
304
|
-
parse_status_response(body, [
|
302
|
+
parse_status_response(body, %i[SerialNumber TransactionAmount TransactionStatusCode TransactionStatusMessage OrderNumber TransactionDateTime TransactionID ApprovalCode BatchNumber])
|
305
303
|
else
|
306
|
-
parse_status_response(body, [
|
304
|
+
parse_status_response(body, %i[SerialNumber TransactionAmount DesiredStatus StatusResponse StatusResponseMessage OrderNumber AuditID])
|
307
305
|
end
|
308
306
|
end
|
309
307
|
|
@@ -318,7 +316,7 @@ module ActiveMerchant #:nodoc:
|
|
318
316
|
def authorize_response_map(body)
|
319
317
|
lines = split_lines(body)
|
320
318
|
keys, values = split_line(lines[0]), split_line(lines[1])
|
321
|
-
Hash[*
|
319
|
+
Hash[*keys.zip(values).flatten].symbolize_keys
|
322
320
|
end
|
323
321
|
|
324
322
|
def parse_authorization_response(body)
|
@@ -330,10 +328,10 @@ module ActiveMerchant #:nodoc:
|
|
330
328
|
def parse_status_response(body, response_keys)
|
331
329
|
lines = split_lines(body)
|
332
330
|
|
333
|
-
keys = [
|
331
|
+
keys = %i[szSerialNumber szErrorCode szNumberRecords]
|
334
332
|
values = split_line(lines[0])[0..2]
|
335
333
|
|
336
|
-
result = Hash[*
|
334
|
+
result = Hash[*keys.zip(values).flatten]
|
337
335
|
|
338
336
|
result[:szErrorMessage] = ''
|
339
337
|
result[:success] = (result[:szErrorCode] == '0')
|
@@ -354,8 +352,8 @@ module ActiveMerchant #:nodoc:
|
|
354
352
|
def post_data(action, money, params = {})
|
355
353
|
add_credentials(params, action)
|
356
354
|
add_amount(params, action, money)
|
357
|
-
sorted_params = params.to_a.
|
358
|
-
sorted_params.collect { |key, value| "#{key
|
355
|
+
sorted_params = params.to_a.sort_by(&:to_s).reverse
|
356
|
+
sorted_params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
359
357
|
end
|
360
358
|
|
361
359
|
def add_transaction_id(post, transaction_id)
|
@@ -369,14 +367,14 @@ module ActiveMerchant #:nodoc:
|
|
369
367
|
post[:OrderDescription] = options[:description]
|
370
368
|
|
371
369
|
if order_items = options[:items]
|
372
|
-
post[:OrderString] = order_items.collect { |item| "#{item[:sku]}~#{item[:description].tr('~','-')}~#{item[:declared_value]}~#{item[:quantity]}~#{item[:taxable]}~~~~~~~~#{item[:tax_rate]}~||"}.join
|
370
|
+
post[:OrderString] = order_items.collect { |item| "#{item[:sku]}~#{item[:description].tr('~', '-')}~#{item[:declared_value]}~#{item[:quantity]}~#{item[:taxable]}~~~~~~~~#{item[:tax_rate]}~||" }.join
|
373
371
|
else
|
374
372
|
post[:OrderString] = '1~None~0.00~0~N~||'
|
375
373
|
end
|
376
374
|
end
|
377
375
|
|
378
376
|
def add_creditcard(post, creditcard)
|
379
|
-
post[:AccountNumber]
|
377
|
+
post[:AccountNumber] = creditcard.number
|
380
378
|
post[:Month] = creditcard.month
|
381
379
|
post[:Year] = creditcard.year
|
382
380
|
post[:CVV2] = creditcard.verification_value if creditcard.verification_value?
|
@@ -435,6 +433,7 @@ module ActiveMerchant #:nodoc:
|
|
435
433
|
return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
|
436
434
|
return AVS_MESSAGES[response[:szAVSResponseMessage]] if AVS_ERRORS.include?(response[:szAVSResponseCode])
|
437
435
|
return RETURN_CODE_MESSAGES[response[:szReturnCode]] if response[:szReturnCode] != '1'
|
436
|
+
|
438
437
|
return response[:szAuthorizationDeclinedMessage]
|
439
438
|
end
|
440
439
|
end
|