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,13 +1,17 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class CashnetGateway < Gateway
|
4
|
-
|
4
|
+
include Empty
|
5
5
|
|
6
|
-
self.
|
7
|
-
self.
|
8
|
-
|
9
|
-
self.
|
6
|
+
self.live_url = 'https://commerce.cashnet.com/'
|
7
|
+
self.test_url = 'https://train.cashnet.com/'
|
8
|
+
|
9
|
+
self.supported_countries = ['US']
|
10
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
11
|
+
self.homepage_url = 'https://transactcampus.com'
|
12
|
+
self.display_name = 'Cashnet'
|
10
13
|
self.money_format = :dollars
|
14
|
+
self.max_retries = 0
|
11
15
|
|
12
16
|
# Creates a new CashnetGateway
|
13
17
|
#
|
@@ -30,14 +34,14 @@ module ActiveMerchant #:nodoc:
|
|
30
34
|
:password,
|
31
35
|
:merchant_gateway_name
|
32
36
|
)
|
33
|
-
options[:default_item_code] ||=
|
37
|
+
options[:default_item_code] ||= 'FEE'
|
34
38
|
super
|
35
39
|
end
|
36
40
|
|
37
41
|
def purchase(money, payment_object, options = {})
|
38
42
|
post = {}
|
39
43
|
add_creditcard(post, payment_object)
|
40
|
-
add_invoice(post, options)
|
44
|
+
add_invoice(post, money, options)
|
41
45
|
add_address(post, options)
|
42
46
|
add_customer_data(post, options)
|
43
47
|
commit('SALE', money, post)
|
@@ -45,37 +49,56 @@ module ActiveMerchant #:nodoc:
|
|
45
49
|
|
46
50
|
def refund(money, identification, options = {})
|
47
51
|
post = {}
|
48
|
-
post[:origtx]
|
49
|
-
add_invoice(post, options)
|
52
|
+
post[:origtx] = identification
|
53
|
+
add_invoice(post, money, options)
|
54
|
+
add_customer_data(post, options)
|
50
55
|
commit('REFUND', money, post)
|
51
56
|
end
|
52
57
|
|
58
|
+
def supports_scrubbing?
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
def scrub(transcript)
|
63
|
+
transcript.
|
64
|
+
gsub(%r{(password=)[^&]+}, '\1[FILTERED]').
|
65
|
+
gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]').
|
66
|
+
gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
|
67
|
+
end
|
68
|
+
|
53
69
|
private
|
54
70
|
|
55
71
|
def commit(action, money, fields)
|
56
|
-
|
57
|
-
|
58
|
-
|
72
|
+
url = (test? ? test_url : live_url) + CGI.escape(@options[:merchant_gateway_name])
|
73
|
+
raw_response = ssl_post(url, post_data(action, fields))
|
74
|
+
parsed_response = parse(raw_response)
|
59
75
|
|
60
|
-
|
76
|
+
return unparsable_response(raw_response) unless parsed_response
|
77
|
+
|
78
|
+
success = success?(parsed_response)
|
61
79
|
Response.new(
|
62
80
|
success,
|
63
|
-
CASHNET_CODES[
|
64
|
-
|
81
|
+
CASHNET_CODES[parsed_response[:result]],
|
82
|
+
parsed_response,
|
65
83
|
test: test?,
|
66
|
-
authorization: (success ?
|
84
|
+
authorization: (success ? parsed_response[:tx] : '')
|
67
85
|
)
|
68
86
|
end
|
69
87
|
|
88
|
+
def success?(response)
|
89
|
+
response[:result] == '0'
|
90
|
+
end
|
91
|
+
|
70
92
|
def post_data(action, parameters = {})
|
71
93
|
post = {}
|
94
|
+
|
72
95
|
post[:command] = action
|
73
96
|
post[:merchant] = @options[:merchant]
|
74
97
|
post[:operator] = @options[:operator]
|
75
98
|
post[:password] = @options[:password]
|
76
|
-
post[:station] = (@options[:station] ||
|
99
|
+
post[:station] = (@options[:station] || 'WEB')
|
77
100
|
post[:custcode] = (@options[:custcode] || "ActiveMerchant/#{ActiveMerchant::VERSION}")
|
78
|
-
post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
101
|
+
post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
79
102
|
end
|
80
103
|
|
81
104
|
def add_creditcard(post, creditcard)
|
@@ -87,9 +110,19 @@ module ActiveMerchant #:nodoc:
|
|
87
110
|
post[:lname] = creditcard.last_name
|
88
111
|
end
|
89
112
|
|
90
|
-
def add_invoice(post, options)
|
91
|
-
post[:order_number]
|
92
|
-
|
113
|
+
def add_invoice(post, money, options)
|
114
|
+
post[:order_number] = options[:order_id] if options[:order_id].present?
|
115
|
+
|
116
|
+
if options[:item_codes].present?
|
117
|
+
codes_and_amounts = options[:item_codes].transform_keys { |key| key.to_s.delete('_') }
|
118
|
+
codes_and_amounts.each do |key, value|
|
119
|
+
post[key] = value if key.start_with?('itemcode')
|
120
|
+
post[key] = amount(value.to_i) if key.start_with?('amount')
|
121
|
+
end
|
122
|
+
else
|
123
|
+
post[:itemcode] = (options[:item_code] || @options[:default_item_code])
|
124
|
+
post[:amount] = amount(money.to_i)
|
125
|
+
end
|
93
126
|
end
|
94
127
|
|
95
128
|
def add_address(post, options)
|
@@ -102,7 +135,8 @@ module ActiveMerchant #:nodoc:
|
|
102
135
|
end
|
103
136
|
|
104
137
|
def add_customer_data(post, options)
|
105
|
-
post[:email_g]
|
138
|
+
post[:email_g] = options[:email]
|
139
|
+
post[:custcode] = options[:custcode] unless empty?(options[:custcode])
|
106
140
|
end
|
107
141
|
|
108
142
|
def expdate(creditcard)
|
@@ -113,19 +147,28 @@ module ActiveMerchant #:nodoc:
|
|
113
147
|
end
|
114
148
|
|
115
149
|
def parse(body)
|
116
|
-
|
117
|
-
|
150
|
+
match = body.match(/<cngateway>(.*)<\/cngateway>/)
|
151
|
+
return nil unless match
|
152
|
+
|
153
|
+
Hash[CGI::parse(match[1]).map { |k, v| [k.to_sym, v.first] }]
|
118
154
|
end
|
119
155
|
|
120
156
|
def handle_response(response)
|
121
|
-
if (200...300).
|
157
|
+
if (200...300).cover?(response.code.to_i)
|
122
158
|
return response.body
|
123
|
-
elsif
|
159
|
+
elsif response.code.to_i == 302
|
124
160
|
return ssl_get(URI.parse(response['location']))
|
125
161
|
end
|
162
|
+
|
126
163
|
raise ResponseError.new(response)
|
127
164
|
end
|
128
165
|
|
166
|
+
def unparsable_response(raw_response)
|
167
|
+
message = 'Unparsable response received from Cashnet. Please contact Cashnet if you continue to receive this message.'
|
168
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
169
|
+
return Response.new(false, message)
|
170
|
+
end
|
171
|
+
|
129
172
|
CASHNET_CODES = {
|
130
173
|
'0' => 'Success',
|
131
174
|
'1' => 'Invalid customer code, no customer code specified',
|
@@ -162,6 +205,7 @@ module ActiveMerchant #:nodoc:
|
|
162
205
|
'215' => 'Old PIN does not validate ',
|
163
206
|
'221' => 'Invalid credit card processor type specified in location or payment code',
|
164
207
|
'222' => 'Credit card processor error',
|
208
|
+
'230' => 'Host Error (USE VOID OR REVERSAL TO REFUND UNSETTLED TRANSACTIONS)',
|
165
209
|
'280' => 'SmartPay transaction not posted',
|
166
210
|
'301' => 'Original transaction not found for this customer',
|
167
211
|
'302' => 'Amount to refund exceeds original payment amount or is missing',
|
@@ -48,9 +48,9 @@ module ActiveMerchant #:nodoc:
|
|
48
48
|
protected
|
49
49
|
|
50
50
|
def build_sale_request(type, money, creditcard, options = {})
|
51
|
-
requires!(options,
|
51
|
+
requires!(options, :order_id)
|
52
52
|
|
53
|
-
xml = Builder::XmlMarkup.new :
|
53
|
+
xml = Builder::XmlMarkup.new indent: 2
|
54
54
|
|
55
55
|
xml.tag! 'CC5Request' do
|
56
56
|
add_login_tags(xml)
|
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
62
62
|
add_amount_tags(money, options, xml)
|
63
63
|
xml.tag! 'Email', options[:email] if options[:email]
|
64
64
|
|
65
|
-
if(address = (options[:billing_address] || options[:address]))
|
65
|
+
if (address = (options[:billing_address] || options[:address]))
|
66
66
|
xml.tag! 'BillTo' do
|
67
67
|
add_address(xml, address)
|
68
68
|
end
|
@@ -70,14 +70,13 @@ module ActiveMerchant #:nodoc:
|
|
70
70
|
add_address(xml, address)
|
71
71
|
end
|
72
72
|
end
|
73
|
-
|
74
73
|
end
|
75
74
|
|
76
75
|
xml.target!
|
77
76
|
end
|
78
77
|
|
79
78
|
def build_capture_request(money, authorization, options = {})
|
80
|
-
xml = Builder::XmlMarkup.new :
|
79
|
+
xml = Builder::XmlMarkup.new indent: 2
|
81
80
|
|
82
81
|
xml.tag! 'CC5Request' do
|
83
82
|
add_login_tags(xml)
|
@@ -88,7 +87,7 @@ module ActiveMerchant #:nodoc:
|
|
88
87
|
end
|
89
88
|
|
90
89
|
def build_void_request(authorization, options = {})
|
91
|
-
xml = Builder::XmlMarkup.new :
|
90
|
+
xml = Builder::XmlMarkup.new indent: 2
|
92
91
|
|
93
92
|
xml.tag! 'CC5Request' do
|
94
93
|
add_login_tags(xml)
|
@@ -98,7 +97,7 @@ module ActiveMerchant #:nodoc:
|
|
98
97
|
end
|
99
98
|
|
100
99
|
def build_authorization_credit_request(money, authorization, options = {})
|
101
|
-
xml = Builder::XmlMarkup.new :
|
100
|
+
xml = Builder::XmlMarkup.new indent: 2
|
102
101
|
|
103
102
|
xml.tag! 'CC5Request' do
|
104
103
|
add_login_tags(xml)
|
@@ -109,7 +108,7 @@ module ActiveMerchant #:nodoc:
|
|
109
108
|
end
|
110
109
|
|
111
110
|
def build_creditcard_credit_request(money, creditcard, options = {})
|
112
|
-
xml = Builder::XmlMarkup.new :
|
111
|
+
xml = Builder::XmlMarkup.new indent: 2
|
113
112
|
|
114
113
|
xml.tag! 'CC5Request' do
|
115
114
|
add_login_tags(xml)
|
@@ -148,7 +147,7 @@ module ActiveMerchant #:nodoc:
|
|
148
147
|
end
|
149
148
|
|
150
149
|
def commit(request)
|
151
|
-
raw_response = ssl_post((test? ? self.test_url : self.live_url),
|
150
|
+
raw_response = ssl_post((test? ? self.test_url : self.live_url), 'DATA=' + request)
|
152
151
|
|
153
152
|
response = parse(raw_response)
|
154
153
|
|
@@ -158,8 +157,8 @@ module ActiveMerchant #:nodoc:
|
|
158
157
|
success,
|
159
158
|
(success ? 'Approved' : "Declined (Reason: #{response[:proc_return_code]} - #{response[:err_msg]})"),
|
160
159
|
response,
|
161
|
-
:
|
162
|
-
:
|
160
|
+
test: test?,
|
161
|
+
authorization: response[:order_id]
|
163
162
|
)
|
164
163
|
end
|
165
164
|
|
@@ -175,25 +174,23 @@ module ActiveMerchant #:nodoc:
|
|
175
174
|
|
176
175
|
def parse_element(response, node)
|
177
176
|
if node.has_elements?
|
178
|
-
node.elements.each{|element| parse_element(response, element) }
|
177
|
+
node.elements.each { |element| parse_element(response, element) }
|
179
178
|
else
|
180
179
|
response[node.name.underscore.to_sym] = node.text
|
181
180
|
end
|
182
181
|
end
|
183
182
|
|
184
183
|
def success?(response)
|
185
|
-
(response[:response] ==
|
184
|
+
(response[:response] == 'Approved')
|
186
185
|
end
|
187
186
|
|
188
187
|
def normalize(text)
|
189
188
|
return unless text
|
190
189
|
|
191
190
|
if ActiveSupport::Inflector.method(:transliterate).arity == -2
|
192
|
-
ActiveSupport::Inflector.transliterate(text,'')
|
193
|
-
elsif RUBY_VERSION >= '1.9'
|
194
|
-
text.gsub(/[^\x00-\x7F]+/, '')
|
191
|
+
ActiveSupport::Inflector.transliterate(text, '')
|
195
192
|
else
|
196
|
-
|
193
|
+
text.gsub(/[^\x00-\x7F]+/, '')
|
197
194
|
end
|
198
195
|
end
|
199
196
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class CecabankGateway < Gateway
|
4
|
-
self.test_url = '
|
4
|
+
self.test_url = 'https://tpv.ceca.es'
|
5
5
|
self.live_url = 'https://pgw.ceca.es'
|
6
6
|
|
7
7
|
self.supported_countries = ['ES']
|
8
|
-
self.supported_cardtypes = [
|
8
|
+
self.supported_cardtypes = %i[visa master american_express]
|
9
9
|
self.homepage_url = 'http://www.ceca.es/es/'
|
10
10
|
self.display_name = 'Cecabank'
|
11
11
|
self.default_currency = 'EUR'
|
@@ -13,15 +13,15 @@ module ActiveMerchant #:nodoc:
|
|
13
13
|
|
14
14
|
#### CECA's MAGIC NUMBERS
|
15
15
|
CECA_NOTIFICATIONS_URL = 'NONE'
|
16
|
-
CECA_ENCRIPTION = '
|
16
|
+
CECA_ENCRIPTION = 'SHA2'
|
17
17
|
CECA_DECIMALS = '2'
|
18
18
|
CECA_MODE = 'SSL'
|
19
19
|
CECA_UI_LESS_LANGUAGE = 'XML'
|
20
20
|
CECA_UI_LESS_LANGUAGE_REFUND = '1'
|
21
21
|
CECA_UI_LESS_REFUND_PAGE = 'anulacion_xml'
|
22
|
-
CECA_ACTION_REFUND = '
|
23
|
-
CECA_ACTION_PURCHASE = 'tpv'
|
24
|
-
CECA_CURRENCIES_DICTIONARY = {'EUR' => 978, 'USD' => 840, 'GBP' => 826}
|
22
|
+
CECA_ACTION_REFUND = 'anulaciones/anularParcial' # use partial refund's URL to avoid time frame limitations and decision logic on client side
|
23
|
+
CECA_ACTION_PURCHASE = 'tpv/compra'
|
24
|
+
CECA_CURRENCIES_DICTIONARY = { 'EUR' => 978, 'USD' => 840, 'GBP' => 826 }
|
25
25
|
|
26
26
|
# Creates a new CecabankGateway
|
27
27
|
#
|
@@ -57,14 +57,14 @@ module ActiveMerchant #:nodoc:
|
|
57
57
|
def purchase(money, creditcard, options = {})
|
58
58
|
requires!(options, :order_id)
|
59
59
|
|
60
|
-
post = {'Descripcion' => options[:description],
|
60
|
+
post = { 'Descripcion' => options[:description],
|
61
61
|
'Num_operacion' => options[:order_id],
|
62
62
|
'Idioma' => CECA_UI_LESS_LANGUAGE,
|
63
63
|
'Pago_soportado' => CECA_MODE,
|
64
64
|
'URL_OK' => CECA_NOTIFICATIONS_URL,
|
65
65
|
'URL_NOK' => CECA_NOTIFICATIONS_URL,
|
66
66
|
'Importe' => amount(money),
|
67
|
-
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)]}
|
67
|
+
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
|
68
68
|
|
69
69
|
add_creditcard(post, creditcard)
|
70
70
|
|
@@ -84,16 +84,27 @@ module ActiveMerchant #:nodoc:
|
|
84
84
|
def refund(money, identification, options = {})
|
85
85
|
reference, order_id = split_authorization(identification)
|
86
86
|
|
87
|
-
post = {'Referencia' => reference,
|
87
|
+
post = { 'Referencia' => reference,
|
88
88
|
'Num_operacion' => order_id,
|
89
89
|
'Idioma' => CECA_UI_LESS_LANGUAGE_REFUND,
|
90
90
|
'Pagina' => CECA_UI_LESS_REFUND_PAGE,
|
91
91
|
'Importe' => amount(money),
|
92
|
-
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)]}
|
92
|
+
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
|
93
93
|
|
94
94
|
commit(CECA_ACTION_REFUND, post)
|
95
95
|
end
|
96
96
|
|
97
|
+
def supports_scrubbing
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def scrub(transcript)
|
102
|
+
transcript.
|
103
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
104
|
+
gsub(%r((&?pan=)[^&]*)i, '\1[FILTERED]').
|
105
|
+
gsub(%r((&?cvv2=)[^&]*)i, '\1[FILTERED]')
|
106
|
+
end
|
107
|
+
|
97
108
|
private
|
98
109
|
|
99
110
|
def add_creditcard(post, creditcard)
|
@@ -112,14 +123,14 @@ module ActiveMerchant #:nodoc:
|
|
112
123
|
|
113
124
|
root = REXML::Document.new(body).root
|
114
125
|
|
115
|
-
response[:success] = (root.attributes['valor'] ==
|
126
|
+
response[:success] = (root.attributes['valor'] == 'OK')
|
116
127
|
response[:date] = root.attributes['fecha']
|
117
128
|
response[:operation_number] = root.attributes['numeroOperacion']
|
118
129
|
response[:message] = root.attributes['valor']
|
119
130
|
|
120
131
|
if root.elements['OPERACION']
|
121
132
|
response[:operation_type] = root.elements['OPERACION'].attributes['tipo']
|
122
|
-
response[:amount] =
|
133
|
+
response[:amount] = root.elements['OPERACION/importe'].text.strip
|
123
134
|
end
|
124
135
|
|
125
136
|
response[:description] = root.elements['OPERACION/descripcion'].text if root.elements['OPERACION/descripcion']
|
@@ -131,20 +142,17 @@ module ActiveMerchant #:nodoc:
|
|
131
142
|
response[:error_code] = root.elements['ERROR/codigo'].text
|
132
143
|
response[:error_message] = root.elements['ERROR/descripcion'].text
|
133
144
|
else
|
134
|
-
if
|
135
|
-
if
|
136
|
-
response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text
|
137
|
-
end
|
145
|
+
if root.elements['OPERACION'].attributes['numeroOperacion'] == '000'
|
146
|
+
response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text if root.elements['OPERACION/numeroAutorizacion']
|
138
147
|
else
|
139
148
|
response[:authorization] = root.attributes['numeroOperacion']
|
140
149
|
end
|
141
150
|
end
|
142
151
|
|
143
152
|
return response
|
144
|
-
|
145
153
|
rescue REXML::ParseException => e
|
146
154
|
response[:success] = false
|
147
|
-
response[:message] =
|
155
|
+
response[:message] = 'Unable to parse the response.'
|
148
156
|
response[:error_message] = e.message
|
149
157
|
response
|
150
158
|
end
|
@@ -158,23 +166,35 @@ module ActiveMerchant #:nodoc:
|
|
158
166
|
'AcquirerBIN' => options[:acquirer_bin],
|
159
167
|
'TerminalID' => options[:terminal_id]
|
160
168
|
)
|
161
|
-
url = (test? ? self.test_url : self.live_url) + "/
|
162
|
-
xml = ssl_post(url, post_data(parameters))
|
169
|
+
url = (test? ? self.test_url : self.live_url) + "/tpvweb/#{action}.action"
|
170
|
+
xml = ssl_post("#{url}?", post_data(parameters))
|
163
171
|
response = parse(xml)
|
164
172
|
Response.new(
|
165
173
|
response[:success],
|
166
|
-
response
|
174
|
+
message_from(response),
|
167
175
|
response,
|
168
|
-
:
|
169
|
-
:
|
176
|
+
test: test?,
|
177
|
+
authorization: build_authorization(response),
|
178
|
+
error_code: response[:error_code]
|
170
179
|
)
|
171
180
|
end
|
172
181
|
|
182
|
+
def message_from(response)
|
183
|
+
if response[:message] == 'ERROR' && response[:error_message]
|
184
|
+
response[:error_message]
|
185
|
+
elsif response[:error_message]
|
186
|
+
"#{response[:message]} #{response[:error_message]}"
|
187
|
+
else
|
188
|
+
response[:message]
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
173
192
|
def post_data(params)
|
174
193
|
return nil unless params
|
175
194
|
|
176
195
|
params.map do |key, value|
|
177
196
|
next if value.blank?
|
197
|
+
|
178
198
|
if value.is_a?(Hash)
|
179
199
|
h = {}
|
180
200
|
value.each do |k, v|
|
@@ -184,46 +204,46 @@ module ActiveMerchant #:nodoc:
|
|
184
204
|
else
|
185
205
|
"#{key}=#{CGI.escape(value.to_s)}"
|
186
206
|
end
|
187
|
-
end.compact.join(
|
207
|
+
end.compact.join('&')
|
188
208
|
end
|
189
209
|
|
190
210
|
def build_authorization(response)
|
191
|
-
[response[:reference], response[:authorization]].join(
|
211
|
+
[response[:reference], response[:authorization]].join('|')
|
192
212
|
end
|
193
213
|
|
194
214
|
def split_authorization(authorization)
|
195
|
-
authorization.split(
|
215
|
+
authorization.split('|')
|
196
216
|
end
|
197
217
|
|
198
218
|
def generate_signature(action, parameters)
|
199
|
-
signature_fields =
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
219
|
+
signature_fields =
|
220
|
+
case action
|
221
|
+
when CECA_ACTION_REFUND
|
222
|
+
options[:key].to_s +
|
223
|
+
options[:merchant_id].to_s +
|
224
|
+
options[:acquirer_bin].to_s +
|
225
|
+
options[:terminal_id].to_s +
|
226
|
+
parameters['Num_operacion'].to_s +
|
227
|
+
parameters['Importe'].to_s +
|
228
|
+
parameters['TipoMoneda'].to_s +
|
229
|
+
CECA_DECIMALS +
|
230
|
+
parameters['Referencia'].to_s +
|
231
|
+
CECA_ENCRIPTION
|
232
|
+
else
|
233
|
+
options[:key].to_s +
|
234
|
+
options[:merchant_id].to_s +
|
235
|
+
options[:acquirer_bin].to_s +
|
236
|
+
options[:terminal_id].to_s +
|
237
|
+
parameters['Num_operacion'].to_s +
|
238
|
+
parameters['Importe'].to_s +
|
239
|
+
parameters['TipoMoneda'].to_s +
|
240
|
+
CECA_DECIMALS +
|
241
|
+
CECA_ENCRIPTION +
|
242
|
+
CECA_NOTIFICATIONS_URL +
|
243
|
+
CECA_NOTIFICATIONS_URL
|
244
|
+
end
|
245
|
+
Digest::SHA2.hexdigest(signature_fields)
|
225
246
|
end
|
226
247
|
end
|
227
248
|
end
|
228
249
|
end
|
229
|
-
|