activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- 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 +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- 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 +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- 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 +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- 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 +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- 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 +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- 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 +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- 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 +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- 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 +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- 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 +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- 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 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = self.test_url = 'https://secure.networkmerchants.com/api/transact.php'
|
5
5
|
|
6
6
|
self.supported_countries = ['US']
|
7
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
8
8
|
|
9
9
|
self.homepage_url = 'http://www.nmi.com/'
|
10
10
|
self.display_name = 'Network Merchants (NMI)'
|
@@ -190,7 +190,7 @@ module ActiveMerchant #:nodoc:
|
|
190
190
|
end
|
191
191
|
|
192
192
|
def commit_vault(action, parameters)
|
193
|
-
commit(nil, parameters.merge(:
|
193
|
+
commit(nil, parameters.merge(customer_vault: action))
|
194
194
|
end
|
195
195
|
|
196
196
|
def commit(action, parameters)
|
@@ -201,11 +201,10 @@ module ActiveMerchant #:nodoc:
|
|
201
201
|
authorization = authorization_from(success, parameters, raw)
|
202
202
|
|
203
203
|
Response.new(success, raw['responsetext'], raw,
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
)
|
204
|
+
test: test?,
|
205
|
+
authorization: authorization,
|
206
|
+
avs_result: { code: raw['avsresponse'] },
|
207
|
+
cvv_result: raw['cvvresponse'])
|
209
208
|
end
|
210
209
|
|
211
210
|
def build_request(action, parameters)
|
@@ -218,9 +217,7 @@ module ActiveMerchant #:nodoc:
|
|
218
217
|
return nil unless success
|
219
218
|
|
220
219
|
authorization = response['transactionid']
|
221
|
-
if
|
222
|
-
authorization = response['customer_vault_id']
|
223
|
-
end
|
220
|
+
authorization = response['customer_vault_id'] if parameters[:customer_vault] && (authorization.nil? || authorization.empty?)
|
224
221
|
|
225
222
|
authorization
|
226
223
|
end
|
@@ -239,4 +236,3 @@ module ActiveMerchant #:nodoc:
|
|
239
236
|
end
|
240
237
|
end
|
241
238
|
end
|
242
|
-
|
@@ -1,256 +1,361 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class NmiGateway < Gateway
|
4
|
-
|
4
|
+
include Empty
|
5
5
|
|
6
|
-
|
7
|
-
self.live_url = 'https://secure.networkmerchants.com/gateway/transact.dll'
|
8
|
-
|
9
|
-
class_attribute :duplicate_window
|
10
|
-
|
11
|
-
APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4
|
12
|
-
|
13
|
-
RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT, AUTHORIZATION_CODE = 0, 2, 3, 4
|
14
|
-
AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE, CARDHOLDER_AUTH_CODE = 5, 6, 38, 39
|
6
|
+
DUP_WINDOW_DEPRECATION_MESSAGE = 'The class-level duplicate_window variable is deprecated. Please use the :dup_seconds transaction option instead.'
|
15
7
|
|
8
|
+
self.test_url = self.live_url = 'https://secure.networkmerchants.com/api/transact.php'
|
16
9
|
self.default_currency = 'USD'
|
17
|
-
|
10
|
+
self.money_format = :dollars
|
18
11
|
self.supported_countries = ['US']
|
19
|
-
self.supported_cardtypes = [
|
12
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
20
13
|
self.homepage_url = 'http://nmi.com/'
|
21
14
|
self.display_name = 'NMI'
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
def self.duplicate_window=(seconds)
|
17
|
+
ActiveMerchant.deprecated(DUP_WINDOW_DEPRECATION_MESSAGE)
|
18
|
+
@dup_seconds = seconds
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.duplicate_window
|
22
|
+
instance_variable_defined?(:@dup_seconds) ? @dup_seconds : nil
|
23
|
+
end
|
27
24
|
|
28
25
|
def initialize(options = {})
|
29
|
-
|
26
|
+
if options.has_key?(:security_key)
|
27
|
+
requires!(options, :security_key)
|
28
|
+
else
|
29
|
+
requires!(options, :login, :password)
|
30
|
+
end
|
30
31
|
super
|
31
32
|
end
|
32
33
|
|
33
|
-
def
|
34
|
+
def purchase(amount, payment_method, options = {})
|
34
35
|
post = {}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
add_address(post, options)
|
36
|
+
add_invoice(post, amount, options)
|
37
|
+
add_payment_method(post, payment_method, options)
|
38
|
+
add_stored_credential(post, options)
|
39
39
|
add_customer_data(post, options)
|
40
|
-
|
40
|
+
add_vendor_data(post, options)
|
41
|
+
add_merchant_defined_fields(post, options)
|
42
|
+
add_level3_fields(post, options)
|
43
|
+
add_three_d_secure(post, options)
|
41
44
|
|
42
|
-
commit('
|
45
|
+
commit('sale', post)
|
43
46
|
end
|
44
47
|
|
45
|
-
def
|
48
|
+
def authorize(amount, payment_method, options = {})
|
46
49
|
post = {}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
add_address(post, options)
|
50
|
+
add_invoice(post, amount, options)
|
51
|
+
add_payment_method(post, payment_method, options)
|
52
|
+
add_stored_credential(post, options)
|
51
53
|
add_customer_data(post, options)
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
add_vendor_data(post, options)
|
55
|
+
add_merchant_defined_fields(post, options)
|
56
|
+
add_level3_fields(post, options)
|
57
|
+
add_three_d_secure(post, options)
|
58
|
+
commit('auth', post)
|
55
59
|
end
|
56
60
|
|
57
|
-
def capture(
|
58
|
-
post = {
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
def capture(amount, authorization, options = {})
|
62
|
+
post = {}
|
63
|
+
add_invoice(post, amount, options)
|
64
|
+
add_reference(post, authorization)
|
65
|
+
add_merchant_defined_fields(post, options)
|
66
|
+
|
67
|
+
commit('capture', post)
|
62
68
|
end
|
63
69
|
|
64
70
|
def void(authorization, options = {})
|
65
|
-
post = {
|
66
|
-
|
67
|
-
|
71
|
+
post = {}
|
72
|
+
add_reference(post, authorization)
|
73
|
+
add_payment_type(post, authorization)
|
74
|
+
|
75
|
+
commit('void', post)
|
68
76
|
end
|
69
77
|
|
70
|
-
def refund(
|
71
|
-
|
78
|
+
def refund(amount, authorization, options = {})
|
79
|
+
post = {}
|
80
|
+
add_invoice(post, amount, options)
|
81
|
+
add_reference(post, authorization)
|
82
|
+
add_payment_type(post, authorization)
|
72
83
|
|
73
|
-
post
|
74
|
-
|
75
|
-
}
|
84
|
+
commit('refund', post)
|
85
|
+
end
|
76
86
|
|
77
|
-
|
78
|
-
post
|
79
|
-
post
|
87
|
+
def credit(amount, payment_method, options = {})
|
88
|
+
post = {}
|
89
|
+
add_invoice(post, amount, options)
|
90
|
+
add_payment_method(post, payment_method, options)
|
91
|
+
add_customer_data(post, options)
|
92
|
+
add_vendor_data(post, options)
|
93
|
+
add_level3_fields(post, options)
|
80
94
|
|
81
|
-
|
82
|
-
|
95
|
+
commit('credit', post)
|
96
|
+
end
|
83
97
|
|
84
|
-
|
98
|
+
def verify(payment_method, options = {})
|
99
|
+
post = {}
|
100
|
+
add_payment_method(post, payment_method, options)
|
101
|
+
add_customer_data(post, options)
|
102
|
+
add_vendor_data(post, options)
|
103
|
+
add_merchant_defined_fields(post, options)
|
104
|
+
add_level3_fields(post, options)
|
105
|
+
|
106
|
+
commit('validate', post)
|
85
107
|
end
|
86
108
|
|
87
|
-
def
|
88
|
-
|
89
|
-
|
109
|
+
def store(payment_method, options = {})
|
110
|
+
post = {}
|
111
|
+
add_invoice(post, nil, options)
|
112
|
+
add_payment_method(post, payment_method, options)
|
113
|
+
add_customer_data(post, options)
|
114
|
+
add_vendor_data(post, options)
|
115
|
+
add_merchant_defined_fields(post, options)
|
116
|
+
|
117
|
+
commit('add_customer', post)
|
90
118
|
end
|
91
119
|
|
92
|
-
def
|
93
|
-
|
94
|
-
|
95
|
-
r.process(:ignore_result) { void(r.authorization, options) }
|
96
|
-
end
|
120
|
+
def verify_credentials
|
121
|
+
response = void('0')
|
122
|
+
response.message != 'Authentication Failed'
|
97
123
|
end
|
98
124
|
|
99
|
-
|
125
|
+
def supports_scrubbing?
|
126
|
+
true
|
127
|
+
end
|
100
128
|
|
101
|
-
def
|
102
|
-
|
129
|
+
def scrub(transcript)
|
130
|
+
transcript.
|
131
|
+
gsub(%r((password=)[^&\n]*), '\1[FILTERED]').
|
132
|
+
gsub(%r((security_key=)[^&\n]*), '\1[FILTERED]').
|
133
|
+
gsub(%r((ccnumber=)\d+), '\1[FILTERED]').
|
134
|
+
gsub(%r((cvv=)\d+), '\1[FILTERED]').
|
135
|
+
gsub(%r((checkaba=)\d+), '\1[FILTERED]').
|
136
|
+
gsub(%r((checkaccount=)\d+), '\1[FILTERED]').
|
137
|
+
gsub(%r((cryptogram=)[^&]+(&?)), '\1[FILTERED]\2')
|
138
|
+
end
|
103
139
|
|
104
|
-
|
105
|
-
|
140
|
+
def supports_network_tokenization?
|
141
|
+
true
|
142
|
+
end
|
106
143
|
|
107
|
-
|
108
|
-
response[:action] = action
|
144
|
+
private
|
109
145
|
|
110
|
-
|
146
|
+
def add_level3_fields(post, options)
|
147
|
+
add_fields_to_post_if_present(post, options, %i[tax shipping ponumber])
|
148
|
+
end
|
111
149
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
)
|
150
|
+
def add_invoice(post, money, options)
|
151
|
+
post[:amount] = amount(money)
|
152
|
+
post[:orderid] = options[:order_id]
|
153
|
+
post[:orderdescription] = options[:description]
|
154
|
+
post[:currency] = options[:currency] || currency(money)
|
155
|
+
post[:billing_method] = 'recurring' if options[:recurring]
|
156
|
+
if (dup_seconds = (options[:dup_seconds] || self.class.duplicate_window))
|
157
|
+
post[:dup_seconds] = dup_seconds
|
158
|
+
end
|
119
159
|
end
|
120
160
|
|
121
|
-
def
|
122
|
-
|
161
|
+
def add_payment_method(post, payment_method, options)
|
162
|
+
if payment_method.is_a?(String)
|
163
|
+
customer_vault_id, = split_authorization(payment_method)
|
164
|
+
post[:customer_vault_id] = customer_vault_id
|
165
|
+
elsif payment_method.is_a?(NetworkTokenizationCreditCard)
|
166
|
+
post[:ccnumber] = payment_method.number
|
167
|
+
post[:ccexp] = exp_date(payment_method)
|
168
|
+
post[:token_cryptogram] = payment_method.payment_cryptogram
|
169
|
+
elsif card_brand(payment_method) == 'check'
|
170
|
+
post[:payment] = 'check'
|
171
|
+
post[:firstname] = payment_method.first_name
|
172
|
+
post[:lastname] = payment_method.last_name
|
173
|
+
post[:checkname] = payment_method.name
|
174
|
+
post[:checkaba] = payment_method.routing_number
|
175
|
+
post[:checkaccount] = payment_method.account_number
|
176
|
+
post[:account_holder_type] = payment_method.account_holder_type
|
177
|
+
post[:account_type] = payment_method.account_type
|
178
|
+
post[:sec_code] = options[:sec_code] || 'WEB'
|
179
|
+
else
|
180
|
+
post[:payment] = 'creditcard'
|
181
|
+
post[:firstname] = payment_method.first_name
|
182
|
+
post[:lastname] = payment_method.last_name
|
183
|
+
post[:ccnumber] = payment_method.number
|
184
|
+
post[:cvv] = payment_method.verification_value unless empty?(payment_method.verification_value)
|
185
|
+
post[:ccexp] = exp_date(payment_method)
|
186
|
+
end
|
123
187
|
end
|
124
188
|
|
125
|
-
def
|
126
|
-
|
189
|
+
def add_stored_credential(post, options)
|
190
|
+
return unless (stored_credential = options[:stored_credential])
|
191
|
+
|
192
|
+
if stored_credential[:initiator] == 'cardholder'
|
193
|
+
post[:initiated_by] = 'customer'
|
194
|
+
else
|
195
|
+
post[:initiated_by] = 'merchant'
|
196
|
+
end
|
197
|
+
|
198
|
+
# :reason_type, when provided, overrides anything previously set in
|
199
|
+
# post[:billing_method] (see `add_invoice` and the :recurring) option
|
200
|
+
case stored_credential[:reason_type]
|
201
|
+
when 'recurring'
|
202
|
+
post[:billing_method] = 'recurring'
|
203
|
+
when 'installment'
|
204
|
+
post[:billing_method] = 'installment'
|
205
|
+
when 'unscheduled'
|
206
|
+
post.delete(:billing_method)
|
207
|
+
end
|
208
|
+
|
209
|
+
if stored_credential[:initial_transaction]
|
210
|
+
post[:stored_credential_indicator] = 'stored'
|
211
|
+
else
|
212
|
+
post[:stored_credential_indicator] = 'used'
|
213
|
+
# should only send :initial_transaction_id if it is a MIT
|
214
|
+
post[:initial_transaction_id] = stored_credential[:network_transaction_id] if post[:initiated_by] == 'merchant'
|
215
|
+
end
|
127
216
|
end
|
128
217
|
|
129
|
-
def
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
def post_data(action, parameters = {})
|
146
|
-
post = {}
|
218
|
+
def add_customer_data(post, options)
|
219
|
+
post[:email] = options[:email]
|
220
|
+
post[:ipaddress] = options[:ip]
|
221
|
+
post[:customer_id] = options[:customer_id] || options[:customer]
|
222
|
+
|
223
|
+
if (billing_address = options[:billing_address] || options[:address])
|
224
|
+
post[:company] = billing_address[:company]
|
225
|
+
post[:address1] = billing_address[:address1]
|
226
|
+
post[:address2] = billing_address[:address2]
|
227
|
+
post[:city] = billing_address[:city]
|
228
|
+
post[:state] = billing_address[:state]
|
229
|
+
post[:country] = billing_address[:country]
|
230
|
+
post[:zip] = billing_address[:zip]
|
231
|
+
post[:phone] = billing_address[:phone]
|
232
|
+
end
|
147
233
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
234
|
+
if (shipping_address = options[:shipping_address])
|
235
|
+
post[:shipping_company] = shipping_address[:company]
|
236
|
+
post[:shipping_address1] = shipping_address[:address1]
|
237
|
+
post[:shipping_address2] = shipping_address[:address2]
|
238
|
+
post[:shipping_city] = shipping_address[:city]
|
239
|
+
post[:shipping_state] = shipping_address[:state]
|
240
|
+
post[:shipping_country] = shipping_address[:country]
|
241
|
+
post[:shipping_zip] = shipping_address[:zip]
|
242
|
+
post[:shipping_phone] = shipping_address[:phone]
|
243
|
+
end
|
157
244
|
|
158
|
-
|
159
|
-
|
245
|
+
if (descriptor = options[:descriptors])
|
246
|
+
post[:descriptor] = descriptor[:descriptor]
|
247
|
+
post[:descriptor_phone] = descriptor[:descriptor_phone]
|
248
|
+
post[:descriptor_address] = descriptor[:descriptor_address]
|
249
|
+
post[:descriptor_city] = descriptor[:descriptor_city]
|
250
|
+
post[:descriptor_state] = descriptor[:descriptor_state]
|
251
|
+
post[:descriptor_postal] = descriptor[:descriptor_postal]
|
252
|
+
post[:descriptor_country] = descriptor[:descriptor_country]
|
253
|
+
post[:descriptor_mcc] = descriptor[:descriptor_mcc]
|
254
|
+
post[:descriptor_merchant_id] = descriptor[:descriptor_merchant_id]
|
255
|
+
post[:descriptor_url] = descriptor[:descriptor_url]
|
256
|
+
end
|
160
257
|
end
|
161
258
|
|
162
|
-
def
|
163
|
-
post[:
|
259
|
+
def add_vendor_data(post, options)
|
260
|
+
post[:vendor_id] = options[:vendor_id] if options[:vendor_id]
|
261
|
+
post[:processor_id] = options[:processor_id] if options[:processor_id]
|
164
262
|
end
|
165
263
|
|
166
|
-
def
|
167
|
-
|
168
|
-
|
264
|
+
def add_merchant_defined_fields(post, options)
|
265
|
+
(1..20).each do |each|
|
266
|
+
key = "merchant_defined_field_#{each}".to_sym
|
267
|
+
post[key] = options[key] if options[key]
|
268
|
+
end
|
169
269
|
end
|
170
270
|
|
171
|
-
def
|
172
|
-
|
173
|
-
|
174
|
-
post[:exp_date] = expdate(creditcard)
|
175
|
-
post[:first_name] = creditcard.first_name
|
176
|
-
post[:last_name] = creditcard.last_name
|
271
|
+
def add_three_d_secure(post, options)
|
272
|
+
three_d_secure = options[:three_d_secure]
|
273
|
+
return unless three_d_secure
|
177
274
|
|
178
|
-
post[:
|
275
|
+
post[:cardholder_auth] = cardholder_auth(three_d_secure[:authentication_response_status])
|
276
|
+
post[:cavv] = three_d_secure[:cavv]
|
277
|
+
post[:xid] = three_d_secure[:xid]
|
278
|
+
post[:three_ds_version] = three_d_secure[:version]
|
279
|
+
post[:directory_server_id] = three_d_secure[:ds_transaction_id]
|
179
280
|
end
|
180
281
|
|
181
|
-
def
|
182
|
-
|
282
|
+
def cardholder_auth(trans_status)
|
283
|
+
return nil if trans_status.nil?
|
284
|
+
|
285
|
+
trans_status == 'Y' ? 'verified' : 'attempted'
|
183
286
|
end
|
184
287
|
|
185
|
-
def
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
288
|
+
def add_reference(post, authorization)
|
289
|
+
transaction_id, = split_authorization(authorization)
|
290
|
+
post[:transactionid] = transaction_id
|
291
|
+
end
|
190
292
|
|
191
|
-
|
192
|
-
|
193
|
-
|
293
|
+
def add_payment_type(post, authorization)
|
294
|
+
_, payment_type = split_authorization(authorization)
|
295
|
+
post[:payment] = payment_type if payment_type
|
296
|
+
end
|
194
297
|
|
195
|
-
|
196
|
-
|
197
|
-
|
298
|
+
def exp_date(payment_method)
|
299
|
+
"#{format(payment_method.month, :two_digits)}#{format(payment_method.year, :two_digits)}"
|
300
|
+
end
|
198
301
|
|
199
|
-
|
200
|
-
|
201
|
-
|
302
|
+
def commit(action, params)
|
303
|
+
params[action == 'add_customer' ? :customer_vault : :type] = action
|
304
|
+
params[:username] = @options[:login] unless @options[:login].nil?
|
305
|
+
params[:password] = @options[:password] unless @options[:password].nil?
|
306
|
+
params[:security_key] = @options[:security_key] unless @options[:security_key].nil?
|
307
|
+
raw_response = ssl_post(url, post_data(action, params), headers)
|
308
|
+
response = parse(raw_response)
|
309
|
+
succeeded = success_from(response)
|
310
|
+
|
311
|
+
Response.new(
|
312
|
+
succeeded,
|
313
|
+
message_from(succeeded, response),
|
314
|
+
response,
|
315
|
+
authorization: authorization_from(response, params[:payment], action),
|
316
|
+
avs_result: AVSResult.new(code: response[:avsresponse]),
|
317
|
+
cvv_result: CVVResult.new(response[:cvvresponse]),
|
318
|
+
test: test?
|
319
|
+
)
|
320
|
+
end
|
202
321
|
|
203
|
-
|
204
|
-
|
205
|
-
|
322
|
+
def authorization_from(response, payment_type, action)
|
323
|
+
authorization = (action == 'add_customer' ? response[:customer_vault_id] : response[:transactionid])
|
324
|
+
[authorization, payment_type].join('#')
|
325
|
+
end
|
206
326
|
|
327
|
+
def split_authorization(authorization)
|
328
|
+
authorization.split('#')
|
207
329
|
end
|
208
330
|
|
209
|
-
def
|
210
|
-
|
211
|
-
|
212
|
-
end
|
331
|
+
def headers
|
332
|
+
headers = { 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' }
|
333
|
+
headers
|
213
334
|
end
|
214
335
|
|
215
|
-
def
|
216
|
-
|
217
|
-
|
218
|
-
post[:company] = address[:company].to_s
|
219
|
-
post[:phone] = address[:phone].to_s
|
220
|
-
post[:zip] = address[:zip].to_s
|
221
|
-
post[:city] = address[:city].to_s
|
222
|
-
post[:country] = address[:country].to_s
|
223
|
-
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
224
|
-
end
|
336
|
+
def post_data(action, params)
|
337
|
+
params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
338
|
+
end
|
225
339
|
|
226
|
-
|
227
|
-
|
228
|
-
post[:ship_to_last_name] = address[:last_name].to_s
|
229
|
-
post[:ship_to_address] = address[:address1].to_s
|
230
|
-
post[:ship_to_company] = address[:company].to_s
|
231
|
-
post[:ship_to_phone] = address[:phone].to_s
|
232
|
-
post[:ship_to_zip] = address[:zip].to_s
|
233
|
-
post[:ship_to_city] = address[:city].to_s
|
234
|
-
post[:ship_to_country] = address[:country].to_s
|
235
|
-
post[:ship_to_state] = address[:state].blank? ? 'n/a' : address[:state]
|
236
|
-
end
|
340
|
+
def url
|
341
|
+
test? ? test_url : live_url
|
237
342
|
end
|
238
343
|
|
239
|
-
def
|
240
|
-
|
241
|
-
|
242
|
-
if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
243
|
-
return AVSResult.messages[ results[:avs_result_code] ]
|
244
|
-
end
|
245
|
-
end
|
344
|
+
def parse(body)
|
345
|
+
Hash[CGI::parse(body).map { |k, v| [k.intern, v.first] }]
|
346
|
+
end
|
246
347
|
|
247
|
-
|
348
|
+
def success_from(response)
|
349
|
+
response[:response] == '1'
|
248
350
|
end
|
249
351
|
|
250
|
-
def
|
251
|
-
|
352
|
+
def message_from(succeeded, response)
|
353
|
+
if succeeded
|
354
|
+
'Succeeded'
|
355
|
+
else
|
356
|
+
response[:responsetext]
|
357
|
+
end
|
252
358
|
end
|
253
359
|
end
|
254
360
|
end
|
255
361
|
end
|
256
|
-
|