swiss-crm-activemerchant 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +252 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +48 -0
- data/lib/active_merchant/billing/check.rb +112 -0
- data/lib/active_merchant/billing/compatibility.rb +118 -0
- data/lib/active_merchant/billing/credit_card.rb +451 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +512 -0
- data/lib/active_merchant/billing/cvv_result.rb +37 -0
- data/lib/active_merchant/billing/gateway.rb +332 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +774 -0
- 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 +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +1125 -0
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +424 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +977 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +242 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +263 -0
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +474 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +238 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +644 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +190 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +272 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +28 -0
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +952 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +338 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +21 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +394 -0
- 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 +235 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +212 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +587 -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/commerce_hub.rb +366 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +230 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +526 -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/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1148 -0
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +343 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +302 -0
- 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 +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +346 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +475 -0
- data/lib/active_merchant/billing/gateways/element.rb +406 -0
- data/lib/active_merchant/billing/gateways/epay.rb +296 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +307 -0
- data/lib/active_merchant/billing/gateways/eway.rb +226 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +289 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +578 -0
- data/lib/active_merchant/billing/gateways/exact.rb +219 -0
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +223 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +158 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +452 -0
- 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/fluidpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +256 -0
- data/lib/active_merchant/billing/gateways/global_collect.rb +580 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +193 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +205 -0
- data/lib/active_merchant/billing/gateways/hps.rb +472 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +312 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +213 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +159 -0
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +467 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +290 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +395 -0
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/klarna.rb +317 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +297 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +448 -0
- data/lib/active_merchant/billing/gateways/litle.rb +643 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +286 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +348 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +228 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +110 -0
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +313 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +284 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +248 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +352 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +293 -0
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +329 -0
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +215 -0
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +424 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +488 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +150 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +366 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +299 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +229 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/network_merchants.rb +238 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +396 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +509 -0
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +246 -0
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +331 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +45 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +1267 -0
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +120 -0
- 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 +277 -0
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +110 -0
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +224 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +513 -0
- data/lib/active_merchant/billing/gateways/payex.rb +409 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +42 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +473 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +373 -0
- data/lib/active_merchant/billing/gateways/paymentez.rb +365 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +369 -0
- data/lib/active_merchant/billing/gateways/paynetworx.rb +228 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +718 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +69 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +136 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +272 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paypal_standard.rb +281 -0
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +159 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +204 -0
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +482 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +273 -0
- data/lib/active_merchant/billing/gateways/pixxels.rb +263 -0
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +295 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +302 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +274 -0
- 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 +24 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- 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 +400 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +723 -0
- 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 +446 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +141 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +260 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +191 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +290 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +103 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +305 -0
- 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 +450 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +274 -0
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +354 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +866 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +602 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +151 -0
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +23 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +240 -0
- 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 +21 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +500 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +24 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1612 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +367 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +303 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +224 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +235 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +430 -0
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +1050 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +14 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +121 -0
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +16 -0
- data/lib/active_merchant/connection.rb +194 -0
- data/lib/active_merchant/country.rb +338 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +38 -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 +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +69 -0
- data/lib/support/outbound_hosts.rb +28 -0
- data/lib/support/ssl_verify.rb +88 -0
- data/lib/support/ssl_version.rb +86 -0
- metadata +506 -0
@@ -0,0 +1,223 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
#
|
4
|
+
# NETPAY Gateway
|
5
|
+
#
|
6
|
+
# Support for NETPAY's HTTP Connector payment gateway in Mexico.
|
7
|
+
#
|
8
|
+
# The gateway sends requests as HTTP POST and receives the response details
|
9
|
+
# in the HTTP header, making the process really rather simple.
|
10
|
+
#
|
11
|
+
# Support for calls to the authorize and capture methods have been included
|
12
|
+
# as per the Netpay manuals, however, your millage may vary with these
|
13
|
+
# methods. At the time of writing (January 2013) they were not fully
|
14
|
+
# supported by the production or test gateways. This situation is
|
15
|
+
# expected to change within a few weeks/months.
|
16
|
+
#
|
17
|
+
# Purchases can be cancelled (`#void`) only within 24 hours of the
|
18
|
+
# transaction. After this, a refund should be performed instead.
|
19
|
+
#
|
20
|
+
# In addition to the regular ActiveMerchant transaction options, NETPAY
|
21
|
+
# also supports a `:mode` parameter. This allows testing to be performed
|
22
|
+
# in production and force specific results.
|
23
|
+
#
|
24
|
+
# * 'P' - Production
|
25
|
+
# * 'A' - Approved
|
26
|
+
# * 'D' - Declined
|
27
|
+
# * 'R' - Random (Approved or Declined)
|
28
|
+
# * 'T' - Test
|
29
|
+
#
|
30
|
+
# For example:
|
31
|
+
#
|
32
|
+
# response = @gateway.purchase(1000, card, :mode => 'D')
|
33
|
+
# response.success # false
|
34
|
+
#
|
35
|
+
class NetpayGateway < Gateway
|
36
|
+
self.test_url = 'http://200.57.87.243:8855'
|
37
|
+
self.live_url = 'https://suite.netpay.com.mx/acquirerprd'
|
38
|
+
|
39
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
40
|
+
self.supported_countries = ['MX']
|
41
|
+
|
42
|
+
self.default_currency = 'MXN'
|
43
|
+
|
44
|
+
# The card types supported by the payment gateway
|
45
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
46
|
+
|
47
|
+
# The homepage URL of the gateway
|
48
|
+
self.homepage_url = 'http://www.netpay.com.mx'
|
49
|
+
|
50
|
+
# The name of the gateway
|
51
|
+
self.display_name = 'NETPAY Gateway'
|
52
|
+
|
53
|
+
CURRENCY_CODES = {
|
54
|
+
'MXN' => '484'
|
55
|
+
}
|
56
|
+
|
57
|
+
# The header keys that we will provide in the response params hash
|
58
|
+
RESPONSE_KEYS = %w[ResponseMsg ResponseText ResponseCode TimeIn TimeOut AuthCode OrderId CardTypeName MerchantId IssuerAuthDate]
|
59
|
+
|
60
|
+
def initialize(options = {})
|
61
|
+
requires!(options, :store_id, :login, :password)
|
62
|
+
super
|
63
|
+
end
|
64
|
+
|
65
|
+
# Send an authorization request
|
66
|
+
def authorize(money, creditcard, options = {})
|
67
|
+
post = {}
|
68
|
+
add_invoice(post, options)
|
69
|
+
add_creditcard(post, creditcard)
|
70
|
+
add_customer_data(post, options)
|
71
|
+
add_amount(post, money, options)
|
72
|
+
|
73
|
+
commit('PreAuth', post, options)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Capture an authorization
|
77
|
+
def capture(money, authorization, options = {})
|
78
|
+
post = {}
|
79
|
+
add_order_id(post, order_id_from(authorization))
|
80
|
+
add_amount(post, money, options)
|
81
|
+
|
82
|
+
commit('PostAuth', post, options)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Cancel an auth/purchase within first 24 hours
|
86
|
+
def void(authorization, options = {})
|
87
|
+
post = {}
|
88
|
+
order_id, amount, currency = split_authorization(authorization)
|
89
|
+
add_order_id(post, order_id)
|
90
|
+
post['Total'] = (options[:amount] || amount)
|
91
|
+
post['CurrencyCode'] = currency
|
92
|
+
|
93
|
+
commit('Refund', post, options)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Make a purchase.
|
97
|
+
def purchase(money, creditcard, options = {})
|
98
|
+
post = {}
|
99
|
+
add_invoice(post, options)
|
100
|
+
add_creditcard(post, creditcard)
|
101
|
+
add_customer_data(post, options)
|
102
|
+
add_amount(post, money, options)
|
103
|
+
|
104
|
+
commit('Auth', post, options)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Perform a Credit transaction.
|
108
|
+
def refund(money, authorization, options = {})
|
109
|
+
post = {}
|
110
|
+
add_order_id(post, order_id_from(authorization))
|
111
|
+
add_amount(post, money, options)
|
112
|
+
|
113
|
+
commit('Credit', post, options)
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
def add_login_data(post)
|
119
|
+
post['StoreId'] = @options[:store_id]
|
120
|
+
post['UserName'] = @options[:login]
|
121
|
+
post['Password'] = @options[:password]
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_action(post, action, options)
|
125
|
+
post['ResourceName'] = action
|
126
|
+
post['ContentType'] = 'Transaction'
|
127
|
+
post['Mode'] = options[:mode] || 'P'
|
128
|
+
end
|
129
|
+
|
130
|
+
def add_order_id(post, order_id)
|
131
|
+
post['OrderId'] = order_id
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_amount(post, money, options)
|
135
|
+
post['Total'] = amount(money)
|
136
|
+
post['CurrencyCode'] = currency_code(options[:currency] || currency(money))
|
137
|
+
end
|
138
|
+
|
139
|
+
def add_customer_data(post, options)
|
140
|
+
post['IPAddress'] = options[:ip] unless options[:ip].blank?
|
141
|
+
end
|
142
|
+
|
143
|
+
def add_invoice(post, options)
|
144
|
+
post['Comments'] = options[:description] if options[:description]
|
145
|
+
end
|
146
|
+
|
147
|
+
def add_creditcard(post, creditcard)
|
148
|
+
post['CardNumber'] = creditcard.number
|
149
|
+
post['ExpDate'] = expdate(creditcard)
|
150
|
+
post['CustomerName'] = creditcard.name
|
151
|
+
post['CVV2'] = creditcard.verification_value unless creditcard.verification_value.nil?
|
152
|
+
end
|
153
|
+
|
154
|
+
def build_authorization(request_params, response_params)
|
155
|
+
[response_params['OrderId'], request_params['Total'], request_params['CurrencyCode']].join('|')
|
156
|
+
end
|
157
|
+
|
158
|
+
def split_authorization(authorization)
|
159
|
+
order_id, amount, currency = authorization.split('|')
|
160
|
+
[order_id, amount, currency]
|
161
|
+
end
|
162
|
+
|
163
|
+
def order_id_from(authorization)
|
164
|
+
split_authorization(authorization).first
|
165
|
+
end
|
166
|
+
|
167
|
+
def expdate(credit_card)
|
168
|
+
year = sprintf('%.4i', credit_card.year)
|
169
|
+
month = sprintf('%.2i', credit_card.month)
|
170
|
+
|
171
|
+
"#{month}/#{year[-2..-1]}"
|
172
|
+
end
|
173
|
+
|
174
|
+
def url
|
175
|
+
test? ? test_url : live_url
|
176
|
+
end
|
177
|
+
|
178
|
+
def parse(response, request_params)
|
179
|
+
response_params = params_from_response(response)
|
180
|
+
|
181
|
+
success = (response_params['ResponseCode'] == '00')
|
182
|
+
message = response_params['ResponseText'] || response_params['ResponseMsg']
|
183
|
+
options = @options.merge(test: test?,
|
184
|
+
authorization: build_authorization(request_params, response_params))
|
185
|
+
|
186
|
+
Response.new(success, message, response_params, options)
|
187
|
+
end
|
188
|
+
|
189
|
+
def commit(action, parameters, options)
|
190
|
+
add_login_data(parameters)
|
191
|
+
add_action(parameters, action, options)
|
192
|
+
|
193
|
+
post = parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
194
|
+
parse(ssl_post(url, post), parameters)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Override the regular handle response so we can access the headers
|
198
|
+
def handle_response(response)
|
199
|
+
case response.code.to_i
|
200
|
+
when 200...300
|
201
|
+
response
|
202
|
+
else
|
203
|
+
raise ResponseError.new(response)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Return a hash containing all the useful, or informative values from netpay
|
208
|
+
def params_from_response(response)
|
209
|
+
params = {}
|
210
|
+
RESPONSE_KEYS.each do |k|
|
211
|
+
params[k] = response[k] unless response[k].to_s.empty?
|
212
|
+
end
|
213
|
+
params
|
214
|
+
end
|
215
|
+
|
216
|
+
def currency_code(currency)
|
217
|
+
return currency if currency =~ /^\d+$/
|
218
|
+
|
219
|
+
CURRENCY_CODES[currency]
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
@@ -0,0 +1,238 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class NetworkMerchantsGateway < Gateway
|
4
|
+
self.live_url = self.test_url = 'https://secure.networkmerchants.com/api/transact.php'
|
5
|
+
|
6
|
+
self.supported_countries = ['US']
|
7
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
8
|
+
|
9
|
+
self.homepage_url = 'http://www.nmi.com/'
|
10
|
+
self.display_name = 'Network Merchants (NMI)'
|
11
|
+
|
12
|
+
self.money_format = :dollars
|
13
|
+
self.default_currency = 'USD'
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
requires!(options, :login, :password)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def authorize(money, creditcard_or_vault_id, options = {})
|
21
|
+
post = build_auth_post(money, creditcard_or_vault_id, options)
|
22
|
+
commit('auth', post)
|
23
|
+
end
|
24
|
+
|
25
|
+
def purchase(money, creditcard_or_vault_id, options = {})
|
26
|
+
post = build_purchase_post(money, creditcard_or_vault_id, options)
|
27
|
+
commit('sale', post)
|
28
|
+
end
|
29
|
+
|
30
|
+
def capture(money, authorization, options = {})
|
31
|
+
post = build_capture_post(money, authorization, options)
|
32
|
+
commit('capture', post)
|
33
|
+
end
|
34
|
+
|
35
|
+
def void(authorization, options = {})
|
36
|
+
post = build_void_post(authorization, options)
|
37
|
+
commit('void', post)
|
38
|
+
end
|
39
|
+
|
40
|
+
def refund(money, authorization, options = {})
|
41
|
+
post = build_refund_post(money, authorization, options)
|
42
|
+
commit('refund', post)
|
43
|
+
end
|
44
|
+
|
45
|
+
def store(creditcard, options = {})
|
46
|
+
post = build_store_post(creditcard, options)
|
47
|
+
commit_vault('add_customer', post)
|
48
|
+
end
|
49
|
+
|
50
|
+
def unstore(customer_vault_id, options = {})
|
51
|
+
post = build_unstore_post(customer_vault_id, options)
|
52
|
+
commit_vault('delete_customer', post)
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def build_auth_post(money, creditcard_or_vault_id, options)
|
58
|
+
post = {}
|
59
|
+
add_order(post, options)
|
60
|
+
add_address(post, options)
|
61
|
+
add_shipping_address(post, options)
|
62
|
+
add_payment_method(post, creditcard_or_vault_id, options)
|
63
|
+
add_amount(post, money, options)
|
64
|
+
post
|
65
|
+
end
|
66
|
+
|
67
|
+
def build_purchase_post(money, creditcard, options)
|
68
|
+
build_auth_post(money, creditcard, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_capture_post(money, authorization, options)
|
72
|
+
post = {}
|
73
|
+
post[:transactionid] = authorization
|
74
|
+
add_amount(post, money, options)
|
75
|
+
post
|
76
|
+
end
|
77
|
+
|
78
|
+
def build_void_post(authorization, options)
|
79
|
+
post = {}
|
80
|
+
post[:transactionid] = authorization
|
81
|
+
post
|
82
|
+
end
|
83
|
+
|
84
|
+
def build_refund_post(money, authorization, options)
|
85
|
+
post = {}
|
86
|
+
post[:transactionid] = authorization
|
87
|
+
add_amount(post, money, options)
|
88
|
+
post
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_store_post(creditcard_or_check, options)
|
92
|
+
post = {}
|
93
|
+
add_address(post, options)
|
94
|
+
add_shipping_address(post, options)
|
95
|
+
add_payment_method(post, creditcard_or_check, options)
|
96
|
+
post
|
97
|
+
end
|
98
|
+
|
99
|
+
def build_unstore_post(customer_vault_id, options)
|
100
|
+
post = {}
|
101
|
+
post['customer_vault_id'] = customer_vault_id
|
102
|
+
post
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_order(post, options)
|
106
|
+
post[:orderid] = options[:order_id]
|
107
|
+
post[:orderdescription] = options[:description]
|
108
|
+
end
|
109
|
+
|
110
|
+
def add_address(post, options)
|
111
|
+
post[:email] = options[:email]
|
112
|
+
post[:ipaddress] = options[:ip]
|
113
|
+
|
114
|
+
address = options[:billing_address] || options[:address] || {}
|
115
|
+
post[:address1] = address[:address1]
|
116
|
+
post[:address2] = address[:address2]
|
117
|
+
post[:city] = address[:city]
|
118
|
+
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
119
|
+
post[:zip] = address[:zip]
|
120
|
+
post[:country] = address[:country]
|
121
|
+
post[:phone] = address[:phone]
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_shipping_address(post, options)
|
125
|
+
shipping_address = options[:shipping_address] || {}
|
126
|
+
post[:shipping_address1] = shipping_address[:address1]
|
127
|
+
post[:shipping_address2] = shipping_address[:address2]
|
128
|
+
post[:shipping_city] = shipping_address[:city]
|
129
|
+
post[:shipping_state] = shipping_address[:state]
|
130
|
+
post[:shipping_zip] = shipping_address[:zip]
|
131
|
+
post[:shipping_country] = shipping_address[:country]
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_swipe_data(post, creditcard, options)
|
135
|
+
# unencrypted tracks
|
136
|
+
if creditcard.respond_to?(:track_data) && creditcard.track_data.present?
|
137
|
+
post[:track_1] = creditcard.track_data
|
138
|
+
else
|
139
|
+
post[:track_1] = options[:track_1]
|
140
|
+
post[:track_2] = options[:track_2]
|
141
|
+
post[:track_3] = options[:track_3]
|
142
|
+
end
|
143
|
+
|
144
|
+
# encrypted tracks
|
145
|
+
post[:magnesafe_track_1] = options[:magnesafe_track_1]
|
146
|
+
post[:magnesafe_track_2] = options[:magnesafe_track_2]
|
147
|
+
post[:magnesafe_track_3] = options[:magnesafe_track_3]
|
148
|
+
post[:magnesafe_magneprint] = options[:magnesafe_magneprint]
|
149
|
+
post[:magnesafe_ksn] = options[:magnesafe_ksn]
|
150
|
+
post[:magnesafe_magneprint_status] = options[:magnesafe_magneprint_status]
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_payment_method(post, payment_source, options)
|
154
|
+
post[:processor_id] = options[:processor_id]
|
155
|
+
post[:customer_vault] = 'add_customer' if options[:store]
|
156
|
+
|
157
|
+
add_swipe_data(post, payment_source, options)
|
158
|
+
|
159
|
+
if payment_source.is_a?(Check)
|
160
|
+
check = payment_source
|
161
|
+
post[:firstname] = check.first_name
|
162
|
+
post[:lastname] = check.last_name
|
163
|
+
post[:checkname] = check.name
|
164
|
+
post[:checkaba] = check.routing_number
|
165
|
+
post[:checkaccount] = check.account_number
|
166
|
+
post[:account_type] = check.account_type
|
167
|
+
post[:account_holder_type] = check.account_holder_type
|
168
|
+
post[:payment] = 'check'
|
169
|
+
elsif payment_source.respond_to?(:number)
|
170
|
+
creditcard = payment_source
|
171
|
+
post[:firstname] = creditcard.first_name
|
172
|
+
post[:lastname] = creditcard.last_name
|
173
|
+
post[:ccnumber] = creditcard.number
|
174
|
+
post[:ccexp] = format(creditcard.month, :two_digits) + format(creditcard.year, :two_digits)
|
175
|
+
post[:cvv] = creditcard.verification_value
|
176
|
+
post[:payment] = 'creditcard'
|
177
|
+
else
|
178
|
+
post[:customer_vault_id] = payment_source
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def add_login(post)
|
183
|
+
post[:username] = @options[:login]
|
184
|
+
post[:password] = @options[:password]
|
185
|
+
end
|
186
|
+
|
187
|
+
def add_amount(post, money, options)
|
188
|
+
post[:currency] = options[:currency] || currency(money)
|
189
|
+
post[:amount] = amount(money)
|
190
|
+
end
|
191
|
+
|
192
|
+
def commit_vault(action, parameters)
|
193
|
+
commit(nil, parameters.merge(customer_vault: action))
|
194
|
+
end
|
195
|
+
|
196
|
+
def commit(action, parameters)
|
197
|
+
raw = parse(ssl_post(self.live_url, build_request(action, parameters)))
|
198
|
+
|
199
|
+
success = (raw['response'] == ResponseCodes::APPROVED)
|
200
|
+
|
201
|
+
authorization = authorization_from(success, parameters, raw)
|
202
|
+
|
203
|
+
Response.new(success, raw['responsetext'], raw,
|
204
|
+
test: test?,
|
205
|
+
authorization: authorization,
|
206
|
+
avs_result: { code: raw['avsresponse'] },
|
207
|
+
cvv_result: raw['cvvresponse'])
|
208
|
+
end
|
209
|
+
|
210
|
+
def build_request(action, parameters)
|
211
|
+
parameters[:type] = action if action
|
212
|
+
add_login(parameters)
|
213
|
+
parameters.to_query
|
214
|
+
end
|
215
|
+
|
216
|
+
def authorization_from(success, parameters, response)
|
217
|
+
return nil unless success
|
218
|
+
|
219
|
+
authorization = response['transactionid']
|
220
|
+
authorization = response['customer_vault_id'] if parameters[:customer_vault] && (authorization.nil? || authorization.empty?)
|
221
|
+
|
222
|
+
authorization
|
223
|
+
end
|
224
|
+
|
225
|
+
class ResponseCodes
|
226
|
+
APPROVED = '1'
|
227
|
+
DENIED = '2'
|
228
|
+
ERROR = '3'
|
229
|
+
end
|
230
|
+
|
231
|
+
def parse(raw_response)
|
232
|
+
rsp = CGI.parse(raw_response)
|
233
|
+
rsp.keys.each { |k| rsp[k] = rsp[k].first } # flatten out the values
|
234
|
+
rsp
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|