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
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/smart_ps.rb'
|
2
|
+
require 'active_merchant/billing/gateways/braintree/braintree_common'
|
3
3
|
|
4
4
|
module ActiveMerchant #:nodoc:
|
5
5
|
module Billing #:nodoc:
|
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
include BraintreeCommon
|
8
8
|
|
9
9
|
self.display_name = 'Braintree (Orange Platform)'
|
10
|
-
self.supported_countries = [
|
10
|
+
self.supported_countries = ['US']
|
11
11
|
|
12
12
|
self.live_url = self.test_url = 'https://secure.braintreepaymentgateway.com/api/transact.php'
|
13
13
|
|
@@ -17,4 +17,3 @@ module ActiveMerchant #:nodoc:
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
@@ -1,48 +1,47 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class BridgePayGateway < Gateway
|
6
|
-
self.display_name =
|
7
|
-
self.homepage_url =
|
6
|
+
self.display_name = 'BridgePay'
|
7
|
+
self.homepage_url = 'http://www.bridgepaynetwork.com/'
|
8
8
|
|
9
|
-
self.test_url =
|
10
|
-
self.live_url =
|
9
|
+
self.test_url = 'https://gatewaystage.itstgate.com/SmartPayments/transact3.asmx'
|
10
|
+
self.live_url = 'https://gateway.itstgate.com/SmartPayments/transact3.asmx'
|
11
11
|
|
12
|
-
self.supported_countries = [
|
13
|
-
self.default_currency =
|
14
|
-
self.supported_cardtypes = [
|
12
|
+
self.supported_countries = %w[CA US]
|
13
|
+
self.default_currency = 'USD'
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
15
15
|
|
16
|
-
|
17
|
-
def initialize(options={})
|
16
|
+
def initialize(options = {})
|
18
17
|
requires!(options, :user_name, :password)
|
19
18
|
super
|
20
19
|
end
|
21
20
|
|
22
|
-
def purchase(amount,
|
23
|
-
post =
|
21
|
+
def purchase(amount, payment_method, options = {})
|
22
|
+
post = initialize_required_fields('Sale')
|
24
23
|
|
25
24
|
# Allow the same amount in multiple transactions.
|
26
|
-
post[:ExtData] =
|
25
|
+
post[:ExtData] = '<Force>T</Force>'
|
27
26
|
add_invoice(post, amount, options)
|
28
|
-
|
27
|
+
add_payment_method(post, payment_method)
|
29
28
|
add_customer_data(post, options)
|
30
29
|
|
31
30
|
commit(post)
|
32
31
|
end
|
33
32
|
|
34
|
-
def authorize(amount,
|
35
|
-
post =
|
33
|
+
def authorize(amount, payment_method, options = {})
|
34
|
+
post = initialize_required_fields('Auth')
|
36
35
|
|
37
36
|
add_invoice(post, amount, options)
|
38
|
-
|
37
|
+
add_payment_method(post, payment_method)
|
39
38
|
add_customer_data(post, options)
|
40
39
|
|
41
40
|
commit(post)
|
42
41
|
end
|
43
42
|
|
44
|
-
def capture(amount, authorization, options={})
|
45
|
-
post =
|
43
|
+
def capture(amount, authorization, options = {})
|
44
|
+
post = initialize_required_fields('Force')
|
46
45
|
|
47
46
|
add_invoice(post, amount, options)
|
48
47
|
add_reference(post, authorization)
|
@@ -51,8 +50,8 @@ module ActiveMerchant #:nodoc:
|
|
51
50
|
commit(post)
|
52
51
|
end
|
53
52
|
|
54
|
-
def refund(amount, authorization, options={})
|
55
|
-
post =
|
53
|
+
def refund(amount, authorization, options = {})
|
54
|
+
post = initialize_required_fields('Return')
|
56
55
|
|
57
56
|
add_invoice(post, amount, options)
|
58
57
|
add_reference(post, authorization)
|
@@ -60,8 +59,8 @@ module ActiveMerchant #:nodoc:
|
|
60
59
|
commit(post)
|
61
60
|
end
|
62
61
|
|
63
|
-
def void(authorization, options={})
|
64
|
-
post =
|
62
|
+
def void(authorization, options = {})
|
63
|
+
post = initialize_required_fields('Void')
|
65
64
|
|
66
65
|
add_reference(post, authorization)
|
67
66
|
|
@@ -75,28 +74,80 @@ module ActiveMerchant #:nodoc:
|
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
77
|
+
def store(creditcard, options = {})
|
78
|
+
post = initialize_required_fields('')
|
79
|
+
post[:transaction] = 'Create'
|
80
|
+
post[:CardNumber] = creditcard.number
|
81
|
+
post[:CustomerPaymentInfoKey] = ''
|
82
|
+
post[:token] = ''
|
83
|
+
add_payment_method(post, creditcard)
|
84
|
+
|
85
|
+
commit(post)
|
86
|
+
end
|
87
|
+
|
88
|
+
def supports_scrubbing?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
def scrub(transcript)
|
93
|
+
transcript.
|
94
|
+
gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
|
95
|
+
gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
|
96
|
+
gsub(%r((&?Password=)[^&]*)i, '\1[FILTERED]').
|
97
|
+
gsub(%r((&?TransitNum=)[^&]*)i, '\1[FILTERED]').
|
98
|
+
gsub(%r((&?AccountNum=)[^&]*)i, '\1[FILTERED]')
|
99
|
+
end
|
100
|
+
|
78
101
|
private
|
79
102
|
|
80
|
-
def
|
103
|
+
def add_payment_method(post, payment_method)
|
104
|
+
if payment_method.respond_to? :brand
|
105
|
+
post[:NameOnCard] = payment_method.name if payment_method.name
|
106
|
+
post[:ExpDate] = expdate(payment_method)
|
107
|
+
post[:CardNum] = payment_method.number
|
108
|
+
post[:CVNum] = payment_method.verification_value
|
109
|
+
elsif payment_method.is_a?(String)
|
110
|
+
add_token(post, payment_method)
|
111
|
+
else
|
112
|
+
post[:CheckNum] = payment_method.number
|
113
|
+
post[:TransitNum] = payment_method.routing_number
|
114
|
+
post[:AccountNum] = payment_method.account_number
|
115
|
+
post[:NameOnCheck] = payment_method.name
|
116
|
+
post[:ExtData] = "<AccountType>#{payment_method.account_type.capitalize}</AccountType>" if payment_method.account_type
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def add_token(post, payment_method)
|
121
|
+
payment_method = payment_method.split('|')
|
122
|
+
post[:ExtData] = "<Force>T</Force><CardVault><Transaction>Read</Transaction><CustomerPaymentInfoKey>#{payment_method[1]}</CustomerPaymentInfoKey><Token>#{payment_method[0]}</Token><ExpDate>#{payment_method[2]}</ExpDate></CardVault>"
|
123
|
+
end
|
124
|
+
|
125
|
+
def initialize_required_fields(transaction_type)
|
81
126
|
post = {}
|
82
127
|
post[:TransType] = transaction_type
|
83
|
-
post[:Amount] =
|
84
|
-
post[:PNRef] =
|
85
|
-
post[:InvNum] =
|
86
|
-
post[:CardNum] =
|
87
|
-
post[:ExpDate] =
|
88
|
-
post[:MagData] =
|
89
|
-
post[:NameOnCard] =
|
90
|
-
post[:Zip] =
|
91
|
-
post[:Street] =
|
92
|
-
post[:CVNum] =
|
93
|
-
post[:MagData] =
|
94
|
-
post[:ExtData] =
|
128
|
+
post[:Amount] = ''
|
129
|
+
post[:PNRef] = ''
|
130
|
+
post[:InvNum] = ''
|
131
|
+
post[:CardNum] = ''
|
132
|
+
post[:ExpDate] = ''
|
133
|
+
post[:MagData] = ''
|
134
|
+
post[:NameOnCard] = ''
|
135
|
+
post[:Zip] = ''
|
136
|
+
post[:Street] = ''
|
137
|
+
post[:CVNum] = ''
|
138
|
+
post[:MagData] = ''
|
139
|
+
post[:ExtData] = ''
|
140
|
+
post[:MICR] = ''
|
141
|
+
post[:DL] = ''
|
142
|
+
post[:SS] = ''
|
143
|
+
post[:DOB] = ''
|
144
|
+
post[:StateCode] = ''
|
145
|
+
post[:CheckType] = ''
|
95
146
|
post
|
96
147
|
end
|
97
148
|
|
98
149
|
def add_customer_data(post, options)
|
99
|
-
if(billing_address = (options[:billing_address] || options[:address]))
|
150
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
100
151
|
post[:Street] = billing_address[:address1]
|
101
152
|
post[:Zip] = billing_address[:zip]
|
102
153
|
end
|
@@ -107,13 +158,6 @@ module ActiveMerchant #:nodoc:
|
|
107
158
|
post[:InvNum] = options[:order_id]
|
108
159
|
end
|
109
160
|
|
110
|
-
def add_creditcard(post, creditcard)
|
111
|
-
post[:NameOnCard] = creditcard.name if creditcard.name
|
112
|
-
post[:ExpDate] = expdate(creditcard)
|
113
|
-
post[:CardNum] = creditcard.number
|
114
|
-
post[:CVNum] = creditcard.verification_value
|
115
|
-
end
|
116
|
-
|
117
161
|
def expdate(creditcard)
|
118
162
|
"#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :two_digits)}"
|
119
163
|
end
|
@@ -122,8 +166,8 @@ module ActiveMerchant #:nodoc:
|
|
122
166
|
response = {}
|
123
167
|
|
124
168
|
doc = Nokogiri::XML(xml)
|
125
|
-
doc.root
|
126
|
-
if
|
169
|
+
doc.root&.xpath('*')&.each do |node|
|
170
|
+
if node.elements.size == 0
|
127
171
|
response[node.name.downcase.to_sym] = node.text
|
128
172
|
else
|
129
173
|
node.elements.each do |childnode|
|
@@ -131,18 +175,17 @@ module ActiveMerchant #:nodoc:
|
|
131
175
|
response[name.to_sym] = childnode.text
|
132
176
|
end
|
133
177
|
end
|
134
|
-
end
|
178
|
+
end
|
135
179
|
|
136
180
|
response
|
137
181
|
end
|
138
182
|
|
139
183
|
def commit(parameters)
|
140
|
-
url = (test? ? test_url : live_url)
|
141
184
|
data = post_data(parameters)
|
142
|
-
raw = parse(ssl_post(url, data))
|
185
|
+
raw = parse(ssl_post(url(parameters), data))
|
143
186
|
|
144
187
|
Response.new(
|
145
|
-
success_from(raw
|
188
|
+
success_from(raw),
|
146
189
|
message_from(raw),
|
147
190
|
raw,
|
148
191
|
authorization: authorization_from(raw),
|
@@ -150,25 +193,37 @@ module ActiveMerchant #:nodoc:
|
|
150
193
|
)
|
151
194
|
end
|
152
195
|
|
153
|
-
def
|
154
|
-
|
155
|
-
|
156
|
-
true
|
196
|
+
def url(params)
|
197
|
+
if params[:transaction]
|
198
|
+
"#{base_url}/ManageCardVault"
|
157
199
|
else
|
158
|
-
|
200
|
+
action = params[:TransitNum] ? 'ProcessCheck' : 'ProcessCreditCard'
|
201
|
+
"#{base_url}/#{action}"
|
159
202
|
end
|
160
203
|
end
|
161
204
|
|
205
|
+
def base_url
|
206
|
+
test? ? test_url : live_url
|
207
|
+
end
|
208
|
+
|
209
|
+
def success_from(response)
|
210
|
+
response[:result] == '0'
|
211
|
+
end
|
212
|
+
|
162
213
|
def message_from(response)
|
163
|
-
response[:respmsg]
|
214
|
+
response[:respmsg] || response[:message]
|
164
215
|
end
|
165
216
|
|
166
217
|
def authorization_from(response)
|
167
|
-
|
218
|
+
if response[:token]
|
219
|
+
[response[:token], response[:customerpaymentinfokey], response[:expdate]].join('|')
|
220
|
+
else
|
221
|
+
[response[:authcode], response[:pnref]].join('|')
|
222
|
+
end
|
168
223
|
end
|
169
224
|
|
170
225
|
def split_authorization(authorization)
|
171
|
-
authcode, pnref = authorization.split(
|
226
|
+
authcode, pnref = authorization.split('|')
|
172
227
|
[authcode, pnref]
|
173
228
|
end
|
174
229
|
|
@@ -180,9 +235,9 @@ module ActiveMerchant #:nodoc:
|
|
180
235
|
|
181
236
|
def post_data(post)
|
182
237
|
{
|
183
|
-
:
|
184
|
-
:
|
185
|
-
}.merge(post).collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join(
|
238
|
+
UserName: @options[:user_name],
|
239
|
+
Password: @options[:password]
|
240
|
+
}.merge(post).collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
186
241
|
end
|
187
242
|
end
|
188
243
|
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CamsGateway < Gateway
|
4
|
+
self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
|
5
|
+
|
6
|
+
self.supported_countries = ['US']
|
7
|
+
self.default_currency = 'USD'
|
8
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
9
|
+
|
10
|
+
self.homepage_url = 'https://www.centralams.com/'
|
11
|
+
self.display_name = 'CAMS: Central Account Management System'
|
12
|
+
|
13
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
14
|
+
'200' => STANDARD_ERROR_CODE[:card_declined],
|
15
|
+
'201' => STANDARD_ERROR_CODE[:card_declined],
|
16
|
+
'202' => STANDARD_ERROR_CODE[:card_declined],
|
17
|
+
'203' => STANDARD_ERROR_CODE[:card_declined],
|
18
|
+
'204' => STANDARD_ERROR_CODE[:card_declined],
|
19
|
+
'220' => STANDARD_ERROR_CODE[:card_declined],
|
20
|
+
'221' => STANDARD_ERROR_CODE[:card_declined],
|
21
|
+
'222' => STANDARD_ERROR_CODE[:incorrect_number],
|
22
|
+
'223' => STANDARD_ERROR_CODE[:expired_card],
|
23
|
+
'224' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
24
|
+
'225' => STANDARD_ERROR_CODE[:invalid_cvc],
|
25
|
+
'240' => STANDARD_ERROR_CODE[:call_issuer],
|
26
|
+
'250' => STANDARD_ERROR_CODE[:pickup_card],
|
27
|
+
'251' => STANDARD_ERROR_CODE[:pickup_card],
|
28
|
+
'252' => STANDARD_ERROR_CODE[:pickup_card],
|
29
|
+
'253' => STANDARD_ERROR_CODE[:pickup_card],
|
30
|
+
'260' => STANDARD_ERROR_CODE[:card_declined],
|
31
|
+
'261' => STANDARD_ERROR_CODE[:card_declined],
|
32
|
+
'262' => STANDARD_ERROR_CODE[:card_declined],
|
33
|
+
'263' => STANDARD_ERROR_CODE[:processing_error],
|
34
|
+
'264' => STANDARD_ERROR_CODE[:card_declined],
|
35
|
+
'300' => STANDARD_ERROR_CODE[:card_declined],
|
36
|
+
'400' => STANDARD_ERROR_CODE[:processing_error],
|
37
|
+
'410' => STANDARD_ERROR_CODE[:processing_error],
|
38
|
+
'411' => STANDARD_ERROR_CODE[:processing_error],
|
39
|
+
'420' => STANDARD_ERROR_CODE[:processing_error],
|
40
|
+
'421' => STANDARD_ERROR_CODE[:processing_error],
|
41
|
+
'430' => STANDARD_ERROR_CODE[:processing_error],
|
42
|
+
'440' => STANDARD_ERROR_CODE[:processing_error],
|
43
|
+
'441' => STANDARD_ERROR_CODE[:processing_error],
|
44
|
+
'460' => STANDARD_ERROR_CODE[:invalid_number],
|
45
|
+
'461' => STANDARD_ERROR_CODE[:processing_error],
|
46
|
+
'801' => STANDARD_ERROR_CODE[:processing_error],
|
47
|
+
'811' => STANDARD_ERROR_CODE[:processing_error],
|
48
|
+
'812' => STANDARD_ERROR_CODE[:processing_error],
|
49
|
+
'813' => STANDARD_ERROR_CODE[:processing_error],
|
50
|
+
'814' => STANDARD_ERROR_CODE[:processing_error],
|
51
|
+
'815' => STANDARD_ERROR_CODE[:processing_error],
|
52
|
+
'823' => STANDARD_ERROR_CODE[:processing_error],
|
53
|
+
'824' => STANDARD_ERROR_CODE[:processing_error],
|
54
|
+
'881' => STANDARD_ERROR_CODE[:processing_error],
|
55
|
+
'882' => STANDARD_ERROR_CODE[:processing_error],
|
56
|
+
'883' => STANDARD_ERROR_CODE[:processing_error],
|
57
|
+
'884' => STANDARD_ERROR_CODE[:card_declined],
|
58
|
+
'885' => STANDARD_ERROR_CODE[:card_declined],
|
59
|
+
'886' => STANDARD_ERROR_CODE[:card_declined],
|
60
|
+
'887' => STANDARD_ERROR_CODE[:processing_error],
|
61
|
+
'888' => STANDARD_ERROR_CODE[:processing_error],
|
62
|
+
'889' => STANDARD_ERROR_CODE[:processing_error],
|
63
|
+
'890' => STANDARD_ERROR_CODE[:processing_error],
|
64
|
+
'891' => STANDARD_ERROR_CODE[:incorrect_cvc],
|
65
|
+
'892' => STANDARD_ERROR_CODE[:incorrect_cvc],
|
66
|
+
'893' => STANDARD_ERROR_CODE[:processing_error],
|
67
|
+
'894' => STANDARD_ERROR_CODE[:processing_error]
|
68
|
+
}
|
69
|
+
|
70
|
+
def initialize(options = {})
|
71
|
+
requires!(options, :username, :password)
|
72
|
+
super
|
73
|
+
end
|
74
|
+
|
75
|
+
def purchase(money, payment, options = {})
|
76
|
+
post = {}
|
77
|
+
add_invoice(post, money, options)
|
78
|
+
|
79
|
+
if payment.respond_to?(:number)
|
80
|
+
add_payment(post, payment)
|
81
|
+
add_address(post, payment, options)
|
82
|
+
elsif payment.kind_of?(String)
|
83
|
+
post[:transactionid] = split_authorization(payment)[0]
|
84
|
+
end
|
85
|
+
|
86
|
+
commit('sale', post)
|
87
|
+
end
|
88
|
+
|
89
|
+
def authorize(money, payment, options = {})
|
90
|
+
post = {}
|
91
|
+
add_invoice(post, money, options)
|
92
|
+
add_payment(post, payment)
|
93
|
+
add_address(post, payment, options)
|
94
|
+
|
95
|
+
commit('auth', post)
|
96
|
+
end
|
97
|
+
|
98
|
+
def capture(money, authorization, options = {})
|
99
|
+
post = {}
|
100
|
+
add_reference(post, authorization)
|
101
|
+
add_invoice(post, money, options)
|
102
|
+
|
103
|
+
commit('capture', post)
|
104
|
+
end
|
105
|
+
|
106
|
+
def refund(money, authorization, options = {})
|
107
|
+
post = {}
|
108
|
+
add_reference(post, authorization)
|
109
|
+
add_invoice(post, money, options)
|
110
|
+
commit('refund', post)
|
111
|
+
end
|
112
|
+
|
113
|
+
def void(authorization, options = {})
|
114
|
+
post = {}
|
115
|
+
add_reference(post, authorization)
|
116
|
+
commit('void', post)
|
117
|
+
end
|
118
|
+
|
119
|
+
def verify(credit_card, options = {})
|
120
|
+
post = {}
|
121
|
+
add_invoice(post, 0, options)
|
122
|
+
add_payment(post, credit_card)
|
123
|
+
add_address(post, credit_card, options)
|
124
|
+
commit('verify', post)
|
125
|
+
end
|
126
|
+
|
127
|
+
def supports_scrubbing?
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
def scrub(transcript)
|
132
|
+
%w(ccnumber cvv password).each do |field|
|
133
|
+
transcript = transcript.gsub(%r((#{field}=)[^&]+), '\1[FILTERED]\2')
|
134
|
+
end
|
135
|
+
|
136
|
+
transcript
|
137
|
+
end
|
138
|
+
|
139
|
+
private
|
140
|
+
|
141
|
+
def add_address(post, creditcard, options = {})
|
142
|
+
post[:firstname] = creditcard.first_name
|
143
|
+
post[:lastname] = creditcard.last_name
|
144
|
+
|
145
|
+
return unless options[:billing_address]
|
146
|
+
|
147
|
+
address = options[:billing_address]
|
148
|
+
post[:address1] = address[:address1]
|
149
|
+
post[:address2] = address[:address2]
|
150
|
+
post[:city] = address[:city]
|
151
|
+
post[:state] = address[:state]
|
152
|
+
post[:zip] = address[:zip]
|
153
|
+
post[:country] = address[:country]
|
154
|
+
post[:phone] = address[:phone]
|
155
|
+
end
|
156
|
+
|
157
|
+
def add_reference(post, authorization)
|
158
|
+
transaction_id, authcode = split_authorization(authorization)
|
159
|
+
post['transactionid'] = transaction_id
|
160
|
+
post['authcode'] = authcode
|
161
|
+
end
|
162
|
+
|
163
|
+
def add_invoice(post, money, options)
|
164
|
+
post[:amount] = amount(money)
|
165
|
+
post[:currency] = (options[:currency] || default_currency)
|
166
|
+
end
|
167
|
+
|
168
|
+
def add_payment(post, payment)
|
169
|
+
post[:ccnumber] = payment.number
|
170
|
+
post[:ccexp] = "#{payment.month.to_s.rjust(2, '0')}#{payment.year.to_s[-2..-1]}"
|
171
|
+
post[:cvv] = payment.verification_value
|
172
|
+
end
|
173
|
+
|
174
|
+
def parse(body)
|
175
|
+
kvs = body.split('&')
|
176
|
+
|
177
|
+
kvs.inject({}) { |h, kv|
|
178
|
+
k, v = kv.split('=')
|
179
|
+
h[k] = v
|
180
|
+
h
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
184
|
+
def commit(action, parameters)
|
185
|
+
url = live_url
|
186
|
+
parameters[:type] = action
|
187
|
+
|
188
|
+
response_body = ssl_post(url, post_data(parameters))
|
189
|
+
response = parse(response_body)
|
190
|
+
|
191
|
+
Response.new(
|
192
|
+
success_from(response),
|
193
|
+
message_from(response),
|
194
|
+
response,
|
195
|
+
authorization: authorization_from(response),
|
196
|
+
test: test?,
|
197
|
+
error_code: error_code_from(response)
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
def success_from(response)
|
202
|
+
response['response_code'] == '100'
|
203
|
+
end
|
204
|
+
|
205
|
+
def message_from(response)
|
206
|
+
response['responsetext']
|
207
|
+
end
|
208
|
+
|
209
|
+
def authorization_from(response)
|
210
|
+
[response['transactionid'], response['authcode']].join('#')
|
211
|
+
end
|
212
|
+
|
213
|
+
def split_authorization(authorization)
|
214
|
+
transaction_id, authcode = authorization.split('#')
|
215
|
+
[transaction_id, authcode]
|
216
|
+
end
|
217
|
+
|
218
|
+
def post_data(parameters = {})
|
219
|
+
parameters[:password] = @options[:password]
|
220
|
+
parameters[:username] = @options[:username]
|
221
|
+
|
222
|
+
parameters.collect { |k, v| "#{k}=#{v}" }.join('&')
|
223
|
+
end
|
224
|
+
|
225
|
+
def error_code_from(response)
|
226
|
+
STANDARD_ERROR_CODE_MAPPING[response['response_code']]
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|