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
@@ -11,8 +11,8 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
POST_LIVE_URL = 'https://api.merchantwarrior.com/post/'
|
12
12
|
|
13
13
|
self.supported_countries = ['AU']
|
14
|
-
self.supported_cardtypes = [
|
15
|
-
|
14
|
+
self.supported_cardtypes = %i[visa master american_express
|
15
|
+
diners_club discover jcb]
|
16
16
|
self.homepage_url = 'https://www.merchantwarrior.com/'
|
17
17
|
self.display_name = 'Merchant Warrior'
|
18
18
|
|
@@ -30,6 +30,8 @@ module ActiveMerchant #:nodoc:
|
|
30
30
|
add_order_id(post, options)
|
31
31
|
add_address(post, options)
|
32
32
|
add_payment_method(post, payment_method)
|
33
|
+
add_recurring_flag(post, options)
|
34
|
+
add_soft_descriptors(post, options)
|
33
35
|
commit('processAuth', post)
|
34
36
|
end
|
35
37
|
|
@@ -39,6 +41,8 @@ module ActiveMerchant #:nodoc:
|
|
39
41
|
add_order_id(post, options)
|
40
42
|
add_address(post, options)
|
41
43
|
add_payment_method(post, payment_method)
|
44
|
+
add_recurring_flag(post, options)
|
45
|
+
add_soft_descriptors(post, options)
|
42
46
|
commit('processCard', post)
|
43
47
|
end
|
44
48
|
|
@@ -46,7 +50,8 @@ module ActiveMerchant #:nodoc:
|
|
46
50
|
post = {}
|
47
51
|
add_amount(post, money, options)
|
48
52
|
add_transaction(post, identification)
|
49
|
-
post
|
53
|
+
add_soft_descriptors(post, options)
|
54
|
+
post['captureAmount'] = amount(money)
|
50
55
|
commit('processCapture', post)
|
51
56
|
end
|
52
57
|
|
@@ -54,10 +59,21 @@ module ActiveMerchant #:nodoc:
|
|
54
59
|
post = {}
|
55
60
|
add_amount(post, money, options)
|
56
61
|
add_transaction(post, identification)
|
62
|
+
add_soft_descriptors(post, options)
|
57
63
|
post['refundAmount'] = amount(money)
|
58
64
|
commit('refundCard', post)
|
59
65
|
end
|
60
66
|
|
67
|
+
def void(identification, options = {})
|
68
|
+
post = {}
|
69
|
+
# The amount parameter is required for void transactions
|
70
|
+
# on the Merchant Warrior gateway.
|
71
|
+
post['transactionAmount'] = options[:amount]
|
72
|
+
post['hash'] = void_verification_hash(identification)
|
73
|
+
add_transaction(post, identification)
|
74
|
+
commit('processVoid', post)
|
75
|
+
end
|
76
|
+
|
61
77
|
def store(creditcard, options = {})
|
62
78
|
post = {
|
63
79
|
'cardName' => scrub_name(creditcard.name),
|
@@ -87,7 +103,7 @@ module ActiveMerchant #:nodoc:
|
|
87
103
|
end
|
88
104
|
|
89
105
|
def add_address(post, options)
|
90
|
-
return unless(address = (options[:billing_address] || options[:address]))
|
106
|
+
return unless (address = (options[:billing_address] || options[:address]))
|
91
107
|
|
92
108
|
post['customerName'] = scrub_name(address[:name])
|
93
109
|
post['customerCountry'] = address[:country]
|
@@ -119,7 +135,7 @@ module ActiveMerchant #:nodoc:
|
|
119
135
|
def add_creditcard(post, creditcard)
|
120
136
|
post['paymentCardNumber'] = creditcard.number
|
121
137
|
post['paymentCardName'] = scrub_name(creditcard.name)
|
122
|
-
post['paymentCardExpiry'] = creditcard.expiry_date.expiration.strftime(
|
138
|
+
post['paymentCardExpiry'] = creditcard.expiry_date.expiration.strftime('%m%y')
|
123
139
|
post['paymentCardCSC'] = creditcard.verification_value if creditcard.verification_value?
|
124
140
|
end
|
125
141
|
|
@@ -135,6 +151,18 @@ module ActiveMerchant #:nodoc:
|
|
135
151
|
post['hash'] = verification_hash(amount(money), currency)
|
136
152
|
end
|
137
153
|
|
154
|
+
def add_recurring_flag(post, options)
|
155
|
+
return if options[:recurring_flag].nil?
|
156
|
+
|
157
|
+
post['recurringFlag'] = options[:recurring_flag]
|
158
|
+
end
|
159
|
+
|
160
|
+
def add_soft_descriptors(post, options)
|
161
|
+
post['descriptorName'] = options[:descriptor_name] if options[:descriptor_name]
|
162
|
+
post['descriptorCity'] = options[:descriptor_city] if options[:descriptor_city]
|
163
|
+
post['descriptorState'] = options[:descriptor_state] if options[:descriptor_state]
|
164
|
+
end
|
165
|
+
|
138
166
|
def verification_hash(money, currency)
|
139
167
|
Digest::MD5.hexdigest(
|
140
168
|
(
|
@@ -146,9 +174,21 @@ module ActiveMerchant #:nodoc:
|
|
146
174
|
)
|
147
175
|
end
|
148
176
|
|
177
|
+
def void_verification_hash(transaction_id)
|
178
|
+
Digest::MD5.hexdigest(
|
179
|
+
(
|
180
|
+
@options[:api_passphrase].to_s +
|
181
|
+
@options[:merchant_uuid].to_s +
|
182
|
+
transaction_id
|
183
|
+
).downcase
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
149
187
|
def parse(body)
|
150
188
|
xml = REXML::Document.new(body)
|
151
189
|
|
190
|
+
return { response_message: 'Invalid gateway response' } unless xml.root.present?
|
191
|
+
|
152
192
|
response = {}
|
153
193
|
xml.root.elements.to_a.each do |node|
|
154
194
|
parse_element(response, node)
|
@@ -158,7 +198,7 @@ module ActiveMerchant #:nodoc:
|
|
158
198
|
|
159
199
|
def parse_element(response, node)
|
160
200
|
if node.has_elements?
|
161
|
-
node.elements.each{|element| parse_element(response, element)}
|
201
|
+
node.elements.each { |element| parse_element(response, element) }
|
162
202
|
else
|
163
203
|
response[node.name.underscore.to_sym] = node.text
|
164
204
|
end
|
@@ -173,29 +213,27 @@ module ActiveMerchant #:nodoc:
|
|
173
213
|
success?(response),
|
174
214
|
response[:response_message],
|
175
215
|
response,
|
176
|
-
:
|
177
|
-
:
|
216
|
+
test: test?,
|
217
|
+
authorization: (response[:card_id] || response[:transaction_id])
|
178
218
|
)
|
179
219
|
end
|
180
220
|
|
181
221
|
def add_auth(action, post)
|
182
222
|
post['merchantUUID'] = @options[:merchant_uuid]
|
183
223
|
post['apiKey'] = @options[:api_key]
|
184
|
-
unless token?(post)
|
185
|
-
post['method'] = action
|
186
|
-
end
|
224
|
+
post['method'] = action unless token?(post)
|
187
225
|
end
|
188
226
|
|
189
227
|
def url_for(action, post)
|
190
228
|
if token?(post)
|
191
|
-
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join(
|
229
|
+
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join('/')
|
192
230
|
else
|
193
231
|
(test? ? POST_TEST_URL : POST_LIVE_URL)
|
194
232
|
end
|
195
233
|
end
|
196
234
|
|
197
235
|
def token?(post)
|
198
|
-
(post[
|
236
|
+
(post['cardID'] || post['cardName'])
|
199
237
|
end
|
200
238
|
|
201
239
|
def success?(response)
|
@@ -203,7 +241,7 @@ module ActiveMerchant #:nodoc:
|
|
203
241
|
end
|
204
242
|
|
205
243
|
def post_data(post)
|
206
|
-
post.collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join(
|
244
|
+
post.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
207
245
|
end
|
208
246
|
end
|
209
247
|
end
|
@@ -12,14 +12,14 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
# and +refund+ will become mandatory.
|
13
13
|
class MercuryGateway < Gateway
|
14
14
|
URLS = {
|
15
|
-
:
|
16
|
-
:
|
15
|
+
test: 'https://w1.mercurycert.net/ws/ws.asmx',
|
16
|
+
live: 'https://w1.mercurypay.com/ws/ws.asmx'
|
17
17
|
}
|
18
18
|
|
19
19
|
self.homepage_url = 'http://www.mercurypay.com'
|
20
20
|
self.display_name = 'Mercury'
|
21
|
-
self.supported_countries = [
|
22
|
-
self.supported_cardtypes = [
|
21
|
+
self.supported_countries = %w[US CA]
|
22
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
23
23
|
self.default_currency = 'USD'
|
24
24
|
|
25
25
|
STANDARD_ERROR_CODE_MAPPING = {
|
@@ -51,14 +51,14 @@ module ActiveMerchant #:nodoc:
|
|
51
51
|
def authorize(money, credit_card, options = {})
|
52
52
|
requires!(options, :order_id)
|
53
53
|
|
54
|
-
request = build_non_authorized_request('PreAuth', money, credit_card, options.merge(:
|
54
|
+
request = build_non_authorized_request('PreAuth', money, credit_card, options.merge(authorized: money))
|
55
55
|
commit('PreAuth', request)
|
56
56
|
end
|
57
57
|
|
58
58
|
def capture(money, authorization, options = {})
|
59
59
|
requires!(options, :credit_card) unless @use_tokenization
|
60
60
|
|
61
|
-
request = build_authorized_request('PreAuthCapture', money, authorization, options[:credit_card], options.merge(:
|
61
|
+
request = build_authorized_request('PreAuthCapture', money, authorization, options[:credit_card], options.merge(authorized: money))
|
62
62
|
commit('PreAuthCapture', request)
|
63
63
|
end
|
64
64
|
|
@@ -69,14 +69,14 @@ module ActiveMerchant #:nodoc:
|
|
69
69
|
commit('Return', request)
|
70
70
|
end
|
71
71
|
|
72
|
-
def void(authorization, options={})
|
72
|
+
def void(authorization, options = {})
|
73
73
|
requires!(options, :credit_card) unless @use_tokenization
|
74
74
|
|
75
75
|
request = build_authorized_request('VoidSale', nil, authorization, options[:credit_card], options)
|
76
76
|
commit('VoidSale', request)
|
77
77
|
end
|
78
78
|
|
79
|
-
def store(credit_card, options={})
|
79
|
+
def store(credit_card, options = {})
|
80
80
|
request = build_card_lookup_request(credit_card, options)
|
81
81
|
commit('CardLookup', request)
|
82
82
|
end
|
@@ -87,8 +87,8 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
|
88
88
|
def scrub(transcript)
|
89
89
|
transcript.
|
90
|
-
gsub(%r(<),
|
91
|
-
gsub(%r(>),
|
90
|
+
gsub(%r(<), '<').
|
91
|
+
gsub(%r(>), '>').
|
92
92
|
gsub(%r((<pw>).*(</pw>))i, '\1[FILTERED]\2').
|
93
93
|
gsub(%r((<AcctNo>)(\d|x)*(</AcctNo>))i, '\1[FILTERED]\3').
|
94
94
|
gsub(%r((<CVVData>)\d*(</CVVData>))i, '\1[FILTERED]\2')
|
@@ -99,15 +99,13 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
def build_non_authorized_request(action, money, credit_card, options)
|
100
100
|
xml = Builder::XmlMarkup.new
|
101
101
|
|
102
|
-
xml.tag!
|
103
|
-
xml.tag!
|
102
|
+
xml.tag! 'TStream' do
|
103
|
+
xml.tag! 'Transaction' do
|
104
104
|
xml.tag! 'TranType', 'Credit'
|
105
105
|
xml.tag! 'TranCode', action
|
106
|
-
if options[:allow_partial_auth] &&
|
107
|
-
xml.tag! "PartialAuth", "Allow"
|
108
|
-
end
|
106
|
+
xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && %w[PreAuth Sale].include?(action)
|
109
107
|
add_invoice(xml, options[:order_id], nil, options)
|
110
|
-
add_reference(xml,
|
108
|
+
add_reference(xml, 'RecordNumberRequested')
|
111
109
|
add_customer_data(xml, options)
|
112
110
|
add_amount(xml, money, options)
|
113
111
|
add_credit_card(xml, credit_card, action)
|
@@ -121,15 +119,13 @@ module ActiveMerchant #:nodoc:
|
|
121
119
|
xml = Builder::XmlMarkup.new
|
122
120
|
|
123
121
|
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
|
124
|
-
ref_no =
|
122
|
+
ref_no = '1' if ref_no.blank?
|
125
123
|
|
126
|
-
xml.tag!
|
127
|
-
xml.tag!
|
124
|
+
xml.tag! 'TStream' do
|
125
|
+
xml.tag! 'Transaction' do
|
128
126
|
xml.tag! 'TranType', 'Credit'
|
129
|
-
if options[:allow_partial_auth] && (action == 'PreAuthCapture')
|
130
|
-
|
131
|
-
end
|
132
|
-
xml.tag! 'TranCode', (@use_tokenization ? (action + "ByRecordNo") : action)
|
127
|
+
xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && (action == 'PreAuthCapture')
|
128
|
+
xml.tag! 'TranCode', (@use_tokenization ? (action + 'ByRecordNo') : action)
|
133
129
|
add_invoice(xml, invoice_no, ref_no, options)
|
134
130
|
add_reference(xml, record_no)
|
135
131
|
add_customer_data(xml, options)
|
@@ -137,9 +133,9 @@ module ActiveMerchant #:nodoc:
|
|
137
133
|
add_credit_card(xml, credit_card, action) if credit_card
|
138
134
|
add_address(xml, options)
|
139
135
|
xml.tag! 'TranInfo' do
|
140
|
-
xml.tag!
|
141
|
-
xml.tag!
|
142
|
-
xml.tag!
|
136
|
+
xml.tag! 'AuthCode', auth_code
|
137
|
+
xml.tag! 'AcqRefData', acq_ref_data
|
138
|
+
xml.tag! 'ProcessData', process_data
|
143
139
|
end
|
144
140
|
end
|
145
141
|
end
|
@@ -149,8 +145,8 @@ module ActiveMerchant #:nodoc:
|
|
149
145
|
def build_card_lookup_request(credit_card, options)
|
150
146
|
xml = Builder::XmlMarkup.new
|
151
147
|
|
152
|
-
xml.tag!
|
153
|
-
xml.tag!
|
148
|
+
xml.tag! 'TStream' do
|
149
|
+
xml.tag! 'Transaction' do
|
154
150
|
xml.tag! 'TranType', 'CardLookup'
|
155
151
|
xml.tag! 'RecordNo', 'RecordNumberRequested'
|
156
152
|
xml.tag! 'Frequency', 'OneTime'
|
@@ -172,15 +168,15 @@ module ActiveMerchant #:nodoc:
|
|
172
168
|
|
173
169
|
def add_reference(xml, record_no)
|
174
170
|
if @use_tokenization
|
175
|
-
xml.tag!
|
176
|
-
xml.tag!
|
171
|
+
xml.tag! 'Frequency', 'OneTime'
|
172
|
+
xml.tag! 'RecordNo', record_no
|
177
173
|
end
|
178
174
|
end
|
179
175
|
|
180
176
|
def add_customer_data(xml, options)
|
181
177
|
xml.tag! 'IpAddress', options[:ip] if options[:ip]
|
182
178
|
if options[:customer]
|
183
|
-
xml.tag!
|
179
|
+
xml.tag! 'TranInfo' do
|
184
180
|
xml.tag! 'CustomerCode', options[:customer]
|
185
181
|
end
|
186
182
|
end
|
@@ -212,14 +208,14 @@ module ActiveMerchant #:nodoc:
|
|
212
208
|
# Track 1 and 2 have identical end sentinels (ETX) of '?'
|
213
209
|
# Tracks may or may not have checksum (LRC) after the ETX
|
214
210
|
# If the track has no STX or is corrupt, we send it as track 1, to let Mercury
|
215
|
-
#handle with the validation error as it sees fit.
|
211
|
+
# handle with the validation error as it sees fit.
|
216
212
|
# Track 2 requires having the STX and ETX stripped. Track 1 does not.
|
217
213
|
# Max-length track 1s require having the STX and ETX stripped. Max is 79 bytes including LRC.
|
218
|
-
|
214
|
+
is_track2 = credit_card.track_data[0] == ';'
|
219
215
|
etx_index = credit_card.track_data.rindex('?') || credit_card.track_data.length
|
220
216
|
is_max_track1 = etx_index >= 77
|
221
217
|
|
222
|
-
if
|
218
|
+
if is_track2
|
223
219
|
xml.tag! 'Track2', credit_card.track_data[1...etx_index]
|
224
220
|
elsif is_max_track1
|
225
221
|
xml.tag! 'Track1', credit_card.track_data[1...etx_index]
|
@@ -234,7 +230,7 @@ module ActiveMerchant #:nodoc:
|
|
234
230
|
xml.tag! 'CardType', CARD_CODES[credit_card.brand] if credit_card.brand
|
235
231
|
|
236
232
|
include_cvv = !%w(Return PreAuthCapture).include?(action) && !credit_card.track_data.present?
|
237
|
-
xml.tag! 'CVVData', credit_card.verification_value if
|
233
|
+
xml.tag! 'CVVData', credit_card.verification_value if include_cvv && credit_card.verification_value
|
238
234
|
end
|
239
235
|
|
240
236
|
def add_address(xml, options)
|
@@ -255,12 +251,12 @@ module ActiveMerchant #:nodoc:
|
|
255
251
|
def hashify_xml!(xml, response)
|
256
252
|
xml = REXML::Document.new(xml)
|
257
253
|
|
258
|
-
xml.elements.each(
|
254
|
+
xml.elements.each('//CmdResponse/*') do |node|
|
259
255
|
response[node.name.underscore.to_sym] = node.text
|
260
256
|
end
|
261
257
|
|
262
|
-
xml.elements.each(
|
263
|
-
if node.name.to_s ==
|
258
|
+
xml.elements.each('//TranResponse/*') do |node|
|
259
|
+
if node.name.to_s == 'Amount'
|
264
260
|
node.elements.each do |amt|
|
265
261
|
response[amt.name.underscore.to_sym] = amt.text
|
266
262
|
end
|
@@ -293,12 +289,12 @@ module ActiveMerchant #:nodoc:
|
|
293
289
|
|
294
290
|
def build_header
|
295
291
|
{
|
296
|
-
|
297
|
-
|
292
|
+
'SOAPAction' => 'http://www.mercurypay.com/CreditTransaction',
|
293
|
+
'Content-Type' => 'text/xml; charset=utf-8'
|
298
294
|
}
|
299
295
|
end
|
300
296
|
|
301
|
-
SUCCESS_CODES = [
|
297
|
+
SUCCESS_CODES = %w[Approved Success]
|
302
298
|
|
303
299
|
def commit(action, request)
|
304
300
|
response = parse(action, ssl_post(endpoint_url, build_soap_request(request), build_header))
|
@@ -307,11 +303,11 @@ module ActiveMerchant #:nodoc:
|
|
307
303
|
message = success ? 'Success' : message_from(response)
|
308
304
|
|
309
305
|
Response.new(success, message, response,
|
310
|
-
:
|
311
|
-
:
|
312
|
-
:
|
313
|
-
:
|
314
|
-
:
|
306
|
+
test: test?,
|
307
|
+
authorization: authorization_from(response),
|
308
|
+
avs_result: { code: response[:avs_result] },
|
309
|
+
cvv_result: response[:cvv_result],
|
310
|
+
error_code: success ? nil : STANDARD_ERROR_CODE_MAPPING[response[:dsix_return_code]])
|
315
311
|
end
|
316
312
|
|
317
313
|
def message_from(response)
|
@@ -319,7 +315,7 @@ module ActiveMerchant #:nodoc:
|
|
319
315
|
end
|
320
316
|
|
321
317
|
def authorization_from(response)
|
322
|
-
dollars, cents = (response[:purchase] ||
|
318
|
+
dollars, cents = (response[:purchase] || '').split('.').collect(&:to_i)
|
323
319
|
dollars ||= 0
|
324
320
|
cents ||= 0
|
325
321
|
[
|
@@ -330,17 +326,17 @@ module ActiveMerchant #:nodoc:
|
|
330
326
|
response[:process_data],
|
331
327
|
response[:record_no],
|
332
328
|
((dollars * 100) + cents).to_s
|
333
|
-
].join(
|
329
|
+
].join(';')
|
334
330
|
end
|
335
331
|
|
336
332
|
def split_authorization(authorization)
|
337
|
-
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = authorization.split(
|
333
|
+
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = authorization.split(';')
|
338
334
|
[invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount]
|
339
335
|
end
|
340
336
|
|
341
337
|
ENVELOPE_NAMESPACES = {
|
342
338
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
343
|
-
'xmlns:soap' =>
|
339
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
344
340
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
|
345
341
|
}
|
346
342
|
|
@@ -349,7 +345,7 @@ module ActiveMerchant #:nodoc:
|
|
349
345
|
end
|
350
346
|
|
351
347
|
def unescape_xml(escaped_xml)
|
352
|
-
escaped_xml.gsub(/\>/,'>').gsub(/\</,'<')
|
348
|
+
escaped_xml.gsub(/\>/, '>').gsub(/\</, '<')
|
353
349
|
end
|
354
350
|
end
|
355
351
|
end
|
@@ -20,8 +20,8 @@ module ActiveMerchant #:nodoc:
|
|
20
20
|
|
21
21
|
class_attribute :test_url, :live_url
|
22
22
|
|
23
|
-
self.test_url =
|
24
|
-
self.live_url =
|
23
|
+
self.test_url = 'https://secure.metricsglobalgateway.com/gateway/transact.dll?testing=true'
|
24
|
+
self.live_url = 'https://secure.metricsglobalgateway.com/gateway/transact.dll'
|
25
25
|
|
26
26
|
class_attribute :duplicate_window
|
27
27
|
|
@@ -31,12 +31,12 @@ module ActiveMerchant #:nodoc:
|
|
31
31
|
AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE = 5, 6, 38
|
32
32
|
|
33
33
|
self.supported_countries = ['US']
|
34
|
-
self.supported_cardtypes = [
|
34
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
35
35
|
self.homepage_url = 'http://www.metricsglobal.com'
|
36
36
|
self.display_name = 'Metrics Global'
|
37
37
|
|
38
|
-
CARD_CODE_ERRORS = %w(
|
39
|
-
AVS_ERRORS = %w(
|
38
|
+
CARD_CODE_ERRORS = %w(N S)
|
39
|
+
AVS_ERRORS = %w(A E N R W Z)
|
40
40
|
AVS_REASON_CODES = %w(27 45)
|
41
41
|
|
42
42
|
# Creates a new MetricsGlobalGateway
|
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
100
100
|
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
|
101
101
|
def capture(money, authorization, options = {})
|
102
|
-
post = {:
|
102
|
+
post = { trans_id: authorization }
|
103
103
|
add_customer_data(post, options)
|
104
104
|
commit('PRIOR_AUTH_CAPTURE', money, post)
|
105
105
|
end
|
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
|
|
110
110
|
#
|
111
111
|
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
|
112
112
|
def void(authorization, options = {})
|
113
|
-
post = {:
|
113
|
+
post = { trans_id: authorization }
|
114
114
|
add_duplicate_window(post)
|
115
115
|
commit('VOID', nil, post)
|
116
116
|
end
|
@@ -135,9 +135,8 @@ module ActiveMerchant #:nodoc:
|
|
135
135
|
def refund(money, identification, options = {})
|
136
136
|
requires!(options, :card_number)
|
137
137
|
|
138
|
-
post = { :
|
139
|
-
:
|
140
|
-
}
|
138
|
+
post = { trans_id: identification,
|
139
|
+
card_num: options[:card_number] }
|
141
140
|
|
142
141
|
post[:first_name] = options[:first_name] if options[:first_name]
|
143
142
|
post[:last_name] = options[:last_name] if options[:last_name]
|
@@ -177,12 +176,11 @@ module ActiveMerchant #:nodoc:
|
|
177
176
|
test_mode = test? || message =~ /TESTMODE/
|
178
177
|
|
179
178
|
Response.new(success?(response), message, response,
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
:
|
185
|
-
)
|
179
|
+
test: test_mode,
|
180
|
+
authorization: response[:transaction_id],
|
181
|
+
fraud_review: fraud_review?(response),
|
182
|
+
avs_result: { code: response[:avs_result_code] },
|
183
|
+
cvv_result: response[:card_code])
|
186
184
|
end
|
187
185
|
|
188
186
|
def success?(response)
|
@@ -197,12 +195,12 @@ module ActiveMerchant #:nodoc:
|
|
197
195
|
fields = split(body)
|
198
196
|
|
199
197
|
results = {
|
200
|
-
:
|
201
|
-
:
|
202
|
-
:
|
203
|
-
:
|
204
|
-
:
|
205
|
-
:
|
198
|
+
response_code: fields[RESPONSE_CODE].to_i,
|
199
|
+
response_reason_code: fields[RESPONSE_REASON_CODE],
|
200
|
+
response_reason_text: fields[RESPONSE_REASON_TEXT],
|
201
|
+
avs_result_code: fields[AVS_RESULT_CODE],
|
202
|
+
transaction_id: fields[TRANSACTION_ID],
|
203
|
+
card_code: fields[CARD_CODE_RESPONSE_CODE]
|
206
204
|
}
|
207
205
|
results
|
208
206
|
end
|
@@ -213,14 +211,14 @@ module ActiveMerchant #:nodoc:
|
|
213
211
|
post[:version] = API_VERSION
|
214
212
|
post[:login] = @options[:login]
|
215
213
|
post[:tran_key] = @options[:password]
|
216
|
-
post[:relay_response] =
|
214
|
+
post[:relay_response] = 'FALSE'
|
217
215
|
post[:type] = action
|
218
|
-
post[:delim_data] =
|
219
|
-
post[:delim_char] =
|
220
|
-
post[:encap_char] =
|
216
|
+
post[:delim_data] = 'TRUE'
|
217
|
+
post[:delim_char] = ','
|
218
|
+
post[:encap_char] = '$'
|
221
219
|
post[:solution_ID] = application_id if application_id
|
222
220
|
|
223
|
-
request = post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join(
|
221
|
+
request = post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
224
222
|
request
|
225
223
|
end
|
226
224
|
|
@@ -243,21 +241,15 @@ module ActiveMerchant #:nodoc:
|
|
243
241
|
post[:email_customer] = false
|
244
242
|
end
|
245
243
|
|
246
|
-
if options.has_key? :customer
|
247
|
-
post[:cust_id] = options[:customer]
|
248
|
-
end
|
244
|
+
post[:cust_id] = options[:customer] if options.has_key? :customer
|
249
245
|
|
250
|
-
if options.has_key? :ip
|
251
|
-
post[:customer_ip] = options[:ip]
|
252
|
-
end
|
246
|
+
post[:customer_ip] = options[:ip] if options.has_key? :ip
|
253
247
|
end
|
254
248
|
|
255
249
|
# x_duplicate_window won't be sent by default, because sending it changes the response.
|
256
250
|
# "If this field is present in the request with or without a value, an enhanced duplicate transaction response will be sent."
|
257
251
|
def add_duplicate_window(post)
|
258
|
-
unless duplicate_window.nil?
|
259
|
-
post[:duplicate_window] = duplicate_window
|
260
|
-
end
|
252
|
+
post[:duplicate_window] = duplicate_window unless duplicate_window.nil?
|
261
253
|
end
|
262
254
|
|
263
255
|
def add_address(post, options)
|
@@ -268,7 +260,7 @@ module ActiveMerchant #:nodoc:
|
|
268
260
|
post[:zip] = address[:zip].to_s
|
269
261
|
post[:city] = address[:city].to_s
|
270
262
|
post[:country] = address[:country].to_s
|
271
|
-
post[:state] = address[:state].blank?
|
263
|
+
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
272
264
|
end
|
273
265
|
|
274
266
|
if address = options[:shipping_address]
|
@@ -280,16 +272,14 @@ module ActiveMerchant #:nodoc:
|
|
280
272
|
post[:ship_to_zip] = address[:zip].to_s
|
281
273
|
post[:ship_to_city] = address[:city].to_s
|
282
274
|
post[:ship_to_country] = address[:country].to_s
|
283
|
-
post[:ship_to_state] = address[:state].blank?
|
275
|
+
post[:ship_to_state] = address[:state].blank? ? 'n/a' : address[:state]
|
284
276
|
end
|
285
277
|
end
|
286
278
|
|
287
279
|
def message_from(results)
|
288
280
|
if results[:response_code] == DECLINED
|
289
|
-
return CVVResult.messages[
|
290
|
-
if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
291
|
-
return AVSResult.messages[ results[:avs_result_code] ]
|
292
|
-
end
|
281
|
+
return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
|
282
|
+
return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
293
283
|
end
|
294
284
|
|
295
285
|
(results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
|