activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- 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 +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- 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 +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- 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 +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- 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 +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- 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 +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- 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 +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -9,11 +9,13 @@ module ActiveMerchant #:nodoc:
|
|
9
9
|
# Response Values", available at Moneris' {eSelect Plus Documentation
|
10
10
|
# Centre}[https://www3.moneris.com/connect/en/documents/index.html].
|
11
11
|
class MonerisGateway < Gateway
|
12
|
+
WALLETS = %w(APP GPP)
|
13
|
+
|
12
14
|
self.test_url = 'https://esqa.moneris.com/gateway2/servlet/MpgRequest'
|
13
15
|
self.live_url = 'https://www3.moneris.com/gateway2/servlet/MpgRequest'
|
14
16
|
|
15
17
|
self.supported_countries = ['CA']
|
16
|
-
self.supported_cardtypes = [
|
18
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover]
|
17
19
|
self.homepage_url = 'http://www.moneris.com/'
|
18
20
|
self.display_name = 'Moneris'
|
19
21
|
|
@@ -47,18 +49,19 @@ module ActiveMerchant #:nodoc:
|
|
47
49
|
post = {}
|
48
50
|
add_payment_source(post, creditcard_or_datakey, options)
|
49
51
|
post[:amount] = amount(money)
|
50
|
-
post[:order_id] = options[:order_id]
|
52
|
+
post[:order_id] = format_order_id(post[:wallet_indicator], options[:order_id])
|
51
53
|
post[:address] = options[:billing_address] || options[:address]
|
52
54
|
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
55
|
+
add_external_mpi_fields(post, options)
|
53
56
|
add_stored_credential(post, options)
|
54
|
-
action = if post[:cavv]
|
57
|
+
action = if post[:cavv] || options[:three_d_secure]
|
55
58
|
'cavv_preauth'
|
56
59
|
elsif post[:data_key].blank?
|
57
60
|
'preauth'
|
58
61
|
else
|
59
62
|
'res_preauth_cc'
|
60
63
|
end
|
61
|
-
commit(action, post)
|
64
|
+
commit(action, post, options)
|
62
65
|
end
|
63
66
|
|
64
67
|
# This action verifies funding on a customer's card and readies them for
|
@@ -70,18 +73,19 @@ module ActiveMerchant #:nodoc:
|
|
70
73
|
post = {}
|
71
74
|
add_payment_source(post, creditcard_or_datakey, options)
|
72
75
|
post[:amount] = amount(money)
|
73
|
-
post[:order_id] = options[:order_id]
|
76
|
+
post[:order_id] = format_order_id(post[:wallet_indicator], options[:order_id])
|
74
77
|
post[:address] = options[:billing_address] || options[:address]
|
75
78
|
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
79
|
+
add_external_mpi_fields(post, options)
|
76
80
|
add_stored_credential(post, options)
|
77
|
-
action = if post[:cavv]
|
81
|
+
action = if post[:cavv] || options[:three_d_secure]
|
78
82
|
'cavv_purchase'
|
79
83
|
elsif post[:data_key].blank?
|
80
84
|
'purchase'
|
81
85
|
else
|
82
86
|
'res_purchase_cc'
|
83
87
|
end
|
84
|
-
commit(action, post)
|
88
|
+
commit(action, post, options)
|
85
89
|
end
|
86
90
|
|
87
91
|
# This method retrieves locked funds from a customer's account (from a
|
@@ -92,7 +96,7 @@ module ActiveMerchant #:nodoc:
|
|
92
96
|
# gateways the two numbers are concatenated together with a ; separator as
|
93
97
|
# the authorization number returned by authorization
|
94
98
|
def capture(money, authorization, options = {})
|
95
|
-
commit 'completion', crediting_params(authorization, :
|
99
|
+
commit 'completion', crediting_params(authorization, comp_amount: amount(money))
|
96
100
|
end
|
97
101
|
|
98
102
|
# Voiding requires the original transaction ID and order ID of some open
|
@@ -130,22 +134,43 @@ module ActiveMerchant #:nodoc:
|
|
130
134
|
end
|
131
135
|
|
132
136
|
def refund(money, authorization, options = {})
|
133
|
-
commit 'refund', crediting_params(authorization, :
|
137
|
+
commit 'refund', crediting_params(authorization, amount: amount(money))
|
134
138
|
end
|
135
139
|
|
136
|
-
def verify(credit_card, options={})
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
def verify(credit_card, options = {})
|
141
|
+
requires!(options, :order_id)
|
142
|
+
post = {}
|
143
|
+
add_payment_source(post, credit_card, options)
|
144
|
+
post[:order_id] = options[:order_id]
|
145
|
+
post[:address] = options[:billing_address] || options[:address]
|
146
|
+
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
147
|
+
add_stored_credential(post, options)
|
148
|
+
action = if post[:data_key].blank?
|
149
|
+
'card_verification'
|
150
|
+
else
|
151
|
+
'res_card_verification_cc'
|
152
|
+
end
|
153
|
+
commit(action, post)
|
141
154
|
end
|
142
155
|
|
156
|
+
# When passing a :duration option (time in seconds) you can create a
|
157
|
+
# temporary vault record to avoid incurring Moneris vault storage fees
|
158
|
+
#
|
159
|
+
# https://developer.moneris.com/Documentation/NA/E-Commerce%20Solutions/API/Vault#vaulttokenadd
|
143
160
|
def store(credit_card, options = {})
|
144
161
|
post = {}
|
145
162
|
post[:pan] = credit_card.number
|
146
163
|
post[:expdate] = expdate(credit_card)
|
164
|
+
post[:address] = options[:billing_address] || options[:address]
|
147
165
|
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
148
|
-
|
166
|
+
add_stored_credential(post, options)
|
167
|
+
|
168
|
+
if options[:duration]
|
169
|
+
post[:duration] = options[:duration]
|
170
|
+
commit('res_temp_add', post)
|
171
|
+
else
|
172
|
+
commit('res_add_cc', post)
|
173
|
+
end
|
149
174
|
end
|
150
175
|
|
151
176
|
def unstore(data_key, options = {})
|
@@ -182,6 +207,21 @@ module ActiveMerchant #:nodoc:
|
|
182
207
|
sprintf('%.4i', creditcard.year)[-2..-1] + sprintf('%.2i', creditcard.month)
|
183
208
|
end
|
184
209
|
|
210
|
+
def add_external_mpi_fields(post, options)
|
211
|
+
# See these pages:
|
212
|
+
# https://developer.moneris.com/livedemo/3ds2/cavv_purchase/tool/php
|
213
|
+
# https://developer.moneris.com/livedemo/3ds2/cavv_preauth/guide/php
|
214
|
+
return unless options[:three_d_secure]
|
215
|
+
|
216
|
+
three_d_secure_options = options[:three_d_secure]
|
217
|
+
|
218
|
+
post[:threeds_version] = three_d_secure_options[:version]
|
219
|
+
post[:crypt_type] = three_d_secure_options[:eci]
|
220
|
+
post[:cavv] = three_d_secure_options[:cavv]
|
221
|
+
post[:threeds_server_trans_id] = three_d_secure_options[:three_ds_server_trans_id]
|
222
|
+
post[:ds_trans_id] = three_d_secure_options[:ds_transaction_id]
|
223
|
+
end
|
224
|
+
|
185
225
|
def add_payment_source(post, payment_method, options)
|
186
226
|
if payment_method.is_a?(String)
|
187
227
|
post[:data_key] = payment_method
|
@@ -213,6 +253,7 @@ module ActiveMerchant #:nodoc:
|
|
213
253
|
# if any of :issuer_id, :payment_information, or :payment_indicator is not passed,
|
214
254
|
# then check for :stored credential options
|
215
255
|
return unless (stored_credential = options[:stored_credential]) && !cof_details_present?(options)
|
256
|
+
|
216
257
|
if stored_credential[:initial_transaction]
|
217
258
|
add_stored_credential_initial(post, options)
|
218
259
|
else
|
@@ -253,9 +294,9 @@ module ActiveMerchant #:nodoc:
|
|
253
294
|
# Common params used amongst the +credit+, +void+ and +capture+ methods
|
254
295
|
def crediting_params(authorization, options = {})
|
255
296
|
{
|
256
|
-
:
|
257
|
-
:
|
258
|
-
:
|
297
|
+
txn_number: split_authorization(authorization).first,
|
298
|
+
order_id: split_authorization(authorization).last,
|
299
|
+
crypt_type: options[:crypt_type] || @options[:crypt_type]
|
259
300
|
}.merge(options)
|
260
301
|
end
|
261
302
|
|
@@ -269,38 +310,47 @@ module ActiveMerchant #:nodoc:
|
|
269
310
|
end
|
270
311
|
end
|
271
312
|
|
272
|
-
def commit(action, parameters = {})
|
313
|
+
def commit(action, parameters = {}, options = {})
|
314
|
+
threed_ds_transaction = options[:three_d_secure].present?
|
315
|
+
|
273
316
|
data = post_data(action, parameters)
|
274
317
|
url = test? ? self.test_url : self.live_url
|
275
318
|
raw = ssl_post(url, data)
|
276
319
|
response = parse(raw)
|
277
320
|
|
278
321
|
Response.new(
|
279
|
-
successful?(response),
|
322
|
+
successful?(action, response, threed_ds_transaction),
|
280
323
|
message_from(response[:message]),
|
281
324
|
response,
|
282
|
-
:
|
283
|
-
:
|
284
|
-
:
|
285
|
-
:
|
325
|
+
test: test?,
|
326
|
+
avs_result: { code: response[:avs_result_code] },
|
327
|
+
cvv_result: response[:cvd_result_code] && response[:cvd_result_code][-1, 1],
|
328
|
+
authorization: authorization_from(response)
|
329
|
+
)
|
286
330
|
end
|
287
331
|
|
288
332
|
# Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
|
289
333
|
def authorization_from(response = {})
|
290
|
-
if response[:trans_id] && response[:receipt_id]
|
291
|
-
"#{response[:trans_id]};#{response[:receipt_id]}"
|
292
|
-
end
|
334
|
+
"#{response[:trans_id]};#{response[:receipt_id]}" if response[:trans_id] && response[:receipt_id]
|
293
335
|
end
|
294
336
|
|
295
337
|
# Tests for a successful response from Moneris' servers
|
296
|
-
def successful?(response)
|
297
|
-
|
298
|
-
|
299
|
-
|
338
|
+
def successful?(action, response, threed_ds_transaction = false)
|
339
|
+
# See 9.4 CAVV Result Codes in https://developer.moneris.com/livedemo/3ds2/reference/guide/php
|
340
|
+
cavv_accepted = if threed_ds_transaction
|
341
|
+
response[:cavv_result_code] && response[:cavv_result_code] == '2'
|
342
|
+
else
|
343
|
+
true
|
344
|
+
end
|
345
|
+
|
346
|
+
cavv_accepted &&
|
347
|
+
response[:response_code] &&
|
348
|
+
response[:complete] &&
|
349
|
+
(0..49).cover?(response[:response_code].to_i)
|
300
350
|
end
|
301
351
|
|
302
352
|
def parse(xml)
|
303
|
-
response = { :
|
353
|
+
response = { message: 'Global Error Receipt', complete: false }
|
304
354
|
hashify_xml!(xml, response)
|
305
355
|
response
|
306
356
|
end
|
@@ -308,6 +358,7 @@ module ActiveMerchant #:nodoc:
|
|
308
358
|
def hashify_xml!(xml, response)
|
309
359
|
xml = REXML::Document.new(xml)
|
310
360
|
return if xml.root.nil?
|
361
|
+
|
311
362
|
xml.elements.each('//receipt/*') do |node|
|
312
363
|
response[node.name.underscore.to_sym] = normalize(node.text)
|
313
364
|
end
|
@@ -382,36 +433,54 @@ module ActiveMerchant #:nodoc:
|
|
382
433
|
end
|
383
434
|
|
384
435
|
def wallet_indicator(token_source)
|
385
|
-
return
|
386
|
-
|
387
|
-
|
436
|
+
return {
|
437
|
+
'apple_pay' => 'APP',
|
438
|
+
'google_pay' => 'GPP',
|
439
|
+
'android_pay' => 'ANP'
|
440
|
+
}[token_source]
|
441
|
+
end
|
442
|
+
|
443
|
+
def format_order_id(wallet_indicator_code, order_id = nil)
|
444
|
+
# Truncate (max 100 characters) order id for
|
445
|
+
# google pay and apple pay (specific wallets / token sources)
|
446
|
+
return truncate_order_id(order_id) if WALLETS.include?(wallet_indicator_code)
|
447
|
+
|
448
|
+
order_id
|
449
|
+
end
|
450
|
+
|
451
|
+
def truncate_order_id(order_id = nil)
|
452
|
+
order_id.present? ? order_id[0, 100] : SecureRandom.alphanumeric(100)
|
388
453
|
end
|
389
454
|
|
390
455
|
def message_from(message)
|
391
456
|
return 'Unspecified error' if message.blank?
|
457
|
+
|
392
458
|
message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
|
393
459
|
end
|
394
460
|
|
395
461
|
def actions
|
396
462
|
{
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
463
|
+
'purchase' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
|
464
|
+
'preauth' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
|
465
|
+
'command' => [:order_id],
|
466
|
+
'refund' => %i[order_id amount txn_number crypt_type],
|
467
|
+
'indrefund' => %i[order_id cust_id amount pan expdate crypt_type],
|
468
|
+
'completion' => %i[order_id comp_amount txn_number crypt_type],
|
469
|
+
'purchasecorrection' => %i[order_id txn_number crypt_type],
|
470
|
+
'cavv_preauth' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
|
471
|
+
'cavv_purchase' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
|
472
|
+
'card_verification' => %i[order_id cust_id pan expdate crypt_type avs_info cvd_info cof_info],
|
473
|
+
'transact' => %i[order_id cust_id amount pan expdate crypt_type],
|
474
|
+
'Batchcloseall' => [],
|
475
|
+
'opentotals' => [:ecr_number],
|
476
|
+
'batchclose' => [:ecr_number],
|
477
|
+
'res_add_cc' => %i[pan expdate crypt_type avs_info cof_info],
|
478
|
+
'res_temp_add' => %i[pan expdate crypt_type duration],
|
479
|
+
'res_delete' => [:data_key],
|
480
|
+
'res_update_cc' => %i[data_key pan expdate crypt_type avs_info cof_info],
|
481
|
+
'res_purchase_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
|
482
|
+
'res_preauth_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
|
483
|
+
'res_card_verification_cc' => %i[order_id data_key expdate crypt_type cof_info]
|
415
484
|
}
|
416
485
|
end
|
417
486
|
end
|
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
self.homepage_url = 'http://mmoa.us/'
|
9
9
|
self.display_name = 'MoneyMovers'
|
10
10
|
self.supported_countries = ['US']
|
11
|
-
self.supported_cardtypes = [
|
11
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
14
|
requires!(options, :login, :password)
|
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def refund(money, authorization, options = {})
|
48
|
-
commit('refund', money, options.merge(:
|
48
|
+
commit('refund', money, options.merge(transactionid: authorization))
|
49
49
|
end
|
50
50
|
|
51
51
|
def credit(money, authorization, options = {})
|
@@ -114,11 +114,10 @@ module ActiveMerchant #:nodoc:
|
|
114
114
|
message = message_from(response)
|
115
115
|
|
116
116
|
Response.new(success?(response), message, response,
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
)
|
117
|
+
test: test?,
|
118
|
+
authorization: response['transactionid'],
|
119
|
+
avs_result: { code: response['avsresponse'] },
|
120
|
+
cvv_result: response['cvvresponse'])
|
122
121
|
end
|
123
122
|
|
124
123
|
def success?(response)
|
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
|
6
6
|
self.supported_countries = ['US']
|
7
7
|
self.default_currency = 'USD'
|
8
|
-
self.supported_cardtypes = [
|
8
|
+
self.supported_cardtypes = %i[visa master american_express discover alelo]
|
9
9
|
|
10
10
|
self.homepage_url = 'https://www.mundipagg.com/'
|
11
11
|
self.display_name = 'Mundipagg'
|
@@ -28,56 +28,62 @@ module ActiveMerchant #:nodoc:
|
|
28
28
|
'500' => 'An internal error occurred;'
|
29
29
|
}
|
30
30
|
|
31
|
-
def initialize(options={})
|
31
|
+
def initialize(options = {})
|
32
32
|
requires!(options, :api_key)
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
def purchase(money, payment, options={})
|
36
|
+
def purchase(money, payment, options = {})
|
37
37
|
post = {}
|
38
38
|
add_invoice(post, money, options)
|
39
39
|
add_customer_data(post, options) unless payment.is_a?(String)
|
40
40
|
add_shipping_address(post, options)
|
41
41
|
add_payment(post, payment, options)
|
42
|
-
|
42
|
+
add_submerchant(post, options)
|
43
|
+
add_auth_key(post, options)
|
43
44
|
commit('sale', post)
|
44
45
|
end
|
45
46
|
|
46
|
-
def authorize(money, payment, options={})
|
47
|
+
def authorize(money, payment, options = {})
|
47
48
|
post = {}
|
48
49
|
add_invoice(post, money, options)
|
49
50
|
add_customer_data(post, options) unless payment.is_a?(String)
|
50
51
|
add_shipping_address(post, options)
|
51
52
|
add_payment(post, payment, options)
|
52
53
|
add_capture_flag(post, payment)
|
54
|
+
add_submerchant(post, options)
|
55
|
+
add_auth_key(post, options)
|
53
56
|
commit('authonly', post)
|
54
57
|
end
|
55
58
|
|
56
|
-
def capture(money, authorization, options={})
|
59
|
+
def capture(money, authorization, options = {})
|
57
60
|
post = {}
|
58
61
|
post[:code] = authorization
|
59
62
|
add_invoice(post, money, options)
|
63
|
+
add_auth_key(post, options)
|
60
64
|
commit('capture', post, authorization)
|
61
65
|
end
|
62
66
|
|
63
|
-
def refund(money, authorization, options={})
|
64
|
-
add_invoice(post={}, money, options)
|
67
|
+
def refund(money, authorization, options = {})
|
68
|
+
add_invoice(post = {}, money, options)
|
69
|
+
add_auth_key(post, options)
|
65
70
|
commit('refund', post, authorization)
|
66
71
|
end
|
67
72
|
|
68
|
-
def void(authorization, options={})
|
73
|
+
def void(authorization, options = {})
|
69
74
|
commit('void', nil, authorization)
|
70
75
|
end
|
71
76
|
|
72
|
-
def store(payment, options={})
|
77
|
+
def store(payment, options = {})
|
73
78
|
post = {}
|
74
79
|
options.update(name: payment.name)
|
75
80
|
options = add_customer(options) unless options[:customer_id]
|
76
81
|
add_payment(post, payment, options)
|
82
|
+
add_auth_key(post, options)
|
77
83
|
commit('store', post, options[:customer_id])
|
78
84
|
end
|
79
85
|
|
80
|
-
def verify(credit_card, options={})
|
86
|
+
def verify(credit_card, options = {})
|
81
87
|
MultiResponse.run(:use_first_response) do |r|
|
82
88
|
r.process { authorize(100, credit_card, options) }
|
83
89
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -198,12 +204,45 @@ module ActiveMerchant #:nodoc:
|
|
198
204
|
|
199
205
|
def voucher?(payment)
|
200
206
|
return false if payment.is_a?(String)
|
207
|
+
|
201
208
|
%w[sodexo vr].include? card_brand(payment)
|
202
209
|
end
|
203
210
|
|
204
|
-
def
|
211
|
+
def add_submerchant(post, options)
|
212
|
+
if submerchant = options[:submerchant]
|
213
|
+
post[:SubMerchant] = {}
|
214
|
+
post[:SubMerchant][:Merchant_Category_Code] = submerchant[:merchant_category_code] if submerchant[:merchant_category_code]
|
215
|
+
post[:SubMerchant][:Payment_Facilitator_Code] = submerchant[:payment_facilitator_code] if submerchant[:payment_facilitator_code]
|
216
|
+
post[:SubMerchant][:Code] = submerchant[:code] if submerchant[:code]
|
217
|
+
post[:SubMerchant][:Name] = submerchant[:name] if submerchant[:name]
|
218
|
+
post[:SubMerchant][:Document] = submerchant[:document] if submerchant[:document]
|
219
|
+
post[:SubMerchant][:Type] = submerchant[:type] if submerchant[:type]
|
220
|
+
post[:SubMerchant][:Phone] = {}
|
221
|
+
post[:SubMerchant][:Phone][:Country_Code] = submerchant[:phone][:country_code] if submerchant.dig(:phone, :country_code)
|
222
|
+
post[:SubMerchant][:Phone][:Number] = submerchant[:phone][:number] if submerchant.dig(:phone, :number)
|
223
|
+
post[:SubMerchant][:Phone][:Area_Code] = submerchant[:phone][:area_code] if submerchant.dig(:phone, :area_code)
|
224
|
+
post[:SubMerchant][:Address] = {}
|
225
|
+
post[:SubMerchant][:Address][:Street] = submerchant[:address][:street] if submerchant.dig(:address, :street)
|
226
|
+
post[:SubMerchant][:Address][:Number] = submerchant[:address][:number] if submerchant.dig(:address, :number)
|
227
|
+
post[:SubMerchant][:Address][:Complement] = submerchant[:address][:complement] if submerchant.dig(:address, :complement)
|
228
|
+
post[:SubMerchant][:Address][:Neighborhood] = submerchant[:address][:neighborhood] if submerchant.dig(:address, :neighborhood)
|
229
|
+
post[:SubMerchant][:Address][:City] = submerchant[:address][:city] if submerchant.dig(:address, :city)
|
230
|
+
post[:SubMerchant][:Address][:State] = submerchant[:address][:state] if submerchant.dig(:address, :state)
|
231
|
+
post[:SubMerchant][:Address][:Country] = submerchant[:address][:country] if submerchant.dig(:address, :country)
|
232
|
+
post[:SubMerchant][:Address][:Zip_Code] = submerchant[:address][:zip_code] if submerchant.dig(:address, :zip_code)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def add_auth_key(post, options)
|
237
|
+
if authorization_secret_key = options[:authorization_secret_key]
|
238
|
+
post[:authorization_secret_key] = authorization_secret_key
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def headers(authorization_secret_key = nil)
|
243
|
+
basic_token = authorization_secret_key || @options[:api_key]
|
205
244
|
{
|
206
|
-
'Authorization' => 'Basic ' + Base64.strict_encode64("#{
|
245
|
+
'Authorization' => 'Basic ' + Base64.strict_encode64("#{basic_token}:"),
|
207
246
|
'Content-Type' => 'application/json',
|
208
247
|
'Accept' => 'application/json'
|
209
248
|
}
|
@@ -231,22 +270,23 @@ module ActiveMerchant #:nodoc:
|
|
231
270
|
|
232
271
|
def commit(action, parameters, auth = nil)
|
233
272
|
url = url_for(action, auth)
|
273
|
+
authorization_secret_key = parameters[:authorization_secret_key] if parameters
|
234
274
|
parameters.merge!(parameters[:payment][:credit_card].delete(:card)).delete(:payment) if action == 'store'
|
235
275
|
response = if %w[refund void].include? action
|
236
|
-
parse(ssl_request(:delete, url, post_data(parameters), headers))
|
276
|
+
parse(ssl_request(:delete, url, post_data(parameters), headers(authorization_secret_key)))
|
237
277
|
else
|
238
|
-
parse(ssl_post(url, post_data(parameters), headers))
|
278
|
+
parse(ssl_post(url, post_data(parameters), headers(authorization_secret_key)))
|
239
279
|
end
|
240
280
|
|
241
281
|
Response.new(
|
242
|
-
success_from(response),
|
282
|
+
success_from(response, action),
|
243
283
|
message_from(response),
|
244
284
|
response,
|
245
285
|
authorization: authorization_from(response, action),
|
246
286
|
avs_result: AVSResult.new(code: response['some_avs_response_key']),
|
247
287
|
cvv_result: CVVResult.new(response['some_cvv_response_key']),
|
248
288
|
test: test?,
|
249
|
-
error_code: error_code_from(response)
|
289
|
+
error_code: error_code_from(response, action)
|
250
290
|
)
|
251
291
|
rescue ResponseError => e
|
252
292
|
message = get_error_messages(e)
|
@@ -260,8 +300,10 @@ module ActiveMerchant #:nodoc:
|
|
260
300
|
)
|
261
301
|
end
|
262
302
|
|
263
|
-
def success_from(response)
|
264
|
-
|
303
|
+
def success_from(response, action)
|
304
|
+
success = response.try(:[], 'last_transaction').try(:[], 'success') unless action == 'store'
|
305
|
+
success = !response.try(:[], 'id').nil? if action == 'store'
|
306
|
+
success
|
265
307
|
end
|
266
308
|
|
267
309
|
def message_from(response)
|
@@ -274,7 +316,7 @@ module ActiveMerchant #:nodoc:
|
|
274
316
|
parsed_response_body = parse(error.response.body)
|
275
317
|
message = parsed_response_body['message']
|
276
318
|
|
277
|
-
parsed_response_body['errors']&.each do |
|
319
|
+
parsed_response_body['errors']&.each do |_type, descriptions|
|
278
320
|
message += ' | '
|
279
321
|
message += descriptions.join(', ')
|
280
322
|
end
|
@@ -290,7 +332,7 @@ module ActiveMerchant #:nodoc:
|
|
290
332
|
error_string = ''
|
291
333
|
|
292
334
|
response['last_transaction']['gateway_response']['errors']&.each do |error|
|
293
|
-
error.each do |
|
335
|
+
error.each do |_key, value|
|
294
336
|
error_string += ' | ' unless error_string.blank?
|
295
337
|
error_string += value
|
296
338
|
end
|
@@ -301,6 +343,7 @@ module ActiveMerchant #:nodoc:
|
|
301
343
|
|
302
344
|
def authorization_from(response, action)
|
303
345
|
return "#{response['customer']['id']}|#{response['id']}" if action == 'store'
|
346
|
+
|
304
347
|
response['id']
|
305
348
|
end
|
306
349
|
|
@@ -312,8 +355,11 @@ module ActiveMerchant #:nodoc:
|
|
312
355
|
parameters.to_json
|
313
356
|
end
|
314
357
|
|
315
|
-
def error_code_from(response)
|
316
|
-
|
358
|
+
def error_code_from(response, action)
|
359
|
+
return if success_from(response, action)
|
360
|
+
return response['last_transaction']['acquirer_return_code'] if response['last_transaction']
|
361
|
+
|
362
|
+
STANDARD_ERROR_CODE[:processing_error]
|
317
363
|
end
|
318
364
|
end
|
319
365
|
end
|
@@ -16,7 +16,7 @@ module ActiveMerchant #:nodoc:
|
|
16
16
|
self.live_periodic_url = 'https://transact.nab.com.au/xmlapi/periodic'
|
17
17
|
|
18
18
|
self.supported_countries = ['AU']
|
19
|
-
self.supported_cardtypes = [
|
19
|
+
self.supported_cardtypes = %i[visa master american_express diners_club jcb]
|
20
20
|
|
21
21
|
self.homepage_url = 'http://transact.nab.com.au'
|
22
22
|
self.display_name = 'NAB Transact'
|
@@ -25,21 +25,21 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
|
26
26
|
# Transactions currently accepted by NAB Transact XML API
|
27
27
|
TRANSACTIONS = {
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
28
|
+
purchase: 0, # Standard Payment
|
29
|
+
refund: 4, # Refund
|
30
|
+
void: 6, # Client Reversal (Void)
|
31
|
+
unmatched_refund: 666, # Unmatched Refund
|
32
|
+
authorization: 10, # Preauthorise
|
33
|
+
capture: 11 # Preauthorise Complete (Advice)
|
34
34
|
}
|
35
35
|
|
36
36
|
PERIODIC_TYPES = {
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
37
|
+
addcrn: 5,
|
38
|
+
deletecrn: 5,
|
39
|
+
trigger: 8
|
40
40
|
}
|
41
41
|
|
42
|
-
SUCCESS_CODES = [
|
42
|
+
SUCCESS_CODES = %w[00 08 11 16 77]
|
43
43
|
|
44
44
|
def initialize(options = {})
|
45
45
|
requires!(options, :login, :password)
|
@@ -84,6 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
84
84
|
|
85
85
|
def scrub(transcript)
|
86
86
|
return '' if transcript.blank?
|
87
|
+
|
87
88
|
transcript.
|
88
89
|
gsub(%r((<cardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
|
89
90
|
gsub(%r((<cvv>)[^<]+(<))i, '\1[FILTERED]\2').
|
@@ -95,8 +96,8 @@ module ActiveMerchant #:nodoc:
|
|
95
96
|
def add_metadata(xml, options)
|
96
97
|
if options[:merchant_name] || options[:merchant_location]
|
97
98
|
xml.tag! 'metadata' do
|
98
|
-
xml.tag! 'meta', :
|
99
|
-
xml.tag! 'meta', :
|
99
|
+
xml.tag! 'meta', name: 'ca_name', value: options[:merchant_name] if options[:merchant_name]
|
100
|
+
xml.tag! 'meta', name: 'ca_location', value: options[:merchant_location] if options[:merchant_location]
|
100
101
|
end
|
101
102
|
end
|
102
103
|
end
|
@@ -233,17 +234,15 @@ module ActiveMerchant #:nodoc:
|
|
233
234
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
|
234
235
|
|
235
236
|
Response.new(success?(response), message_from(response), response,
|
236
|
-
:
|
237
|
-
:
|
238
|
-
)
|
237
|
+
test: test?,
|
238
|
+
authorization: authorization_from(action, response))
|
239
239
|
end
|
240
240
|
|
241
241
|
def commit_periodic(action, request)
|
242
242
|
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, build_periodic_request(action, request)))
|
243
243
|
Response.new(success?(response), message_from(response), response,
|
244
|
-
:
|
245
|
-
:
|
246
|
-
)
|
244
|
+
test: test?,
|
245
|
+
authorization: authorization_from(action, response))
|
247
246
|
end
|
248
247
|
|
249
248
|
def success?(response)
|
@@ -295,7 +294,6 @@ module ActiveMerchant #:nodoc:
|
|
295
294
|
def request_timeout
|
296
295
|
@options[:request_timeout] || 60
|
297
296
|
end
|
298
|
-
|
299
297
|
end
|
300
298
|
end
|
301
299
|
end
|