activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- 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 +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- 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 +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- 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 +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- 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 +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- 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 +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- 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 +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- 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 +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- 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 +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- 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 +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- 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 +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- 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 +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- 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 +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- 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 -309
@@ -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,12 +84,12 @@ 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
|
@@ -123,14 +123,14 @@ module ActiveMerchant #:nodoc:
|
|
123
123
|
|
124
124
|
root = REXML::Document.new(body).root
|
125
125
|
|
126
|
-
response[:success] = (root.attributes['valor'] ==
|
126
|
+
response[:success] = (root.attributes['valor'] == 'OK')
|
127
127
|
response[:date] = root.attributes['fecha']
|
128
128
|
response[:operation_number] = root.attributes['numeroOperacion']
|
129
129
|
response[:message] = root.attributes['valor']
|
130
130
|
|
131
131
|
if root.elements['OPERACION']
|
132
132
|
response[:operation_type] = root.elements['OPERACION'].attributes['tipo']
|
133
|
-
response[:amount] =
|
133
|
+
response[:amount] = root.elements['OPERACION/importe'].text.strip
|
134
134
|
end
|
135
135
|
|
136
136
|
response[:description] = root.elements['OPERACION/descripcion'].text if root.elements['OPERACION/descripcion']
|
@@ -142,20 +142,17 @@ module ActiveMerchant #:nodoc:
|
|
142
142
|
response[:error_code] = root.elements['ERROR/codigo'].text
|
143
143
|
response[:error_message] = root.elements['ERROR/descripcion'].text
|
144
144
|
else
|
145
|
-
if
|
146
|
-
if
|
147
|
-
response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text
|
148
|
-
end
|
145
|
+
if root.elements['OPERACION'].attributes['numeroOperacion'] == '000'
|
146
|
+
response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text if root.elements['OPERACION/numeroAutorizacion']
|
149
147
|
else
|
150
148
|
response[:authorization] = root.attributes['numeroOperacion']
|
151
149
|
end
|
152
150
|
end
|
153
151
|
|
154
152
|
return response
|
155
|
-
|
156
153
|
rescue REXML::ParseException => e
|
157
154
|
response[:success] = false
|
158
|
-
response[:message] =
|
155
|
+
response[:message] = 'Unable to parse the response.'
|
159
156
|
response[:error_message] = e.message
|
160
157
|
response
|
161
158
|
end
|
@@ -169,23 +166,35 @@ module ActiveMerchant #:nodoc:
|
|
169
166
|
'AcquirerBIN' => options[:acquirer_bin],
|
170
167
|
'TerminalID' => options[:terminal_id]
|
171
168
|
)
|
172
|
-
url = (test? ? self.test_url : self.live_url) + "/
|
173
|
-
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))
|
174
171
|
response = parse(xml)
|
175
172
|
Response.new(
|
176
173
|
response[:success],
|
177
|
-
response
|
174
|
+
message_from(response),
|
178
175
|
response,
|
179
|
-
:
|
180
|
-
:
|
176
|
+
test: test?,
|
177
|
+
authorization: build_authorization(response),
|
178
|
+
error_code: response[:error_code]
|
181
179
|
)
|
182
180
|
end
|
183
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
|
+
|
184
192
|
def post_data(params)
|
185
193
|
return nil unless params
|
186
194
|
|
187
195
|
params.map do |key, value|
|
188
196
|
next if value.blank?
|
197
|
+
|
189
198
|
if value.is_a?(Hash)
|
190
199
|
h = {}
|
191
200
|
value.each do |k, v|
|
@@ -195,44 +204,45 @@ module ActiveMerchant #:nodoc:
|
|
195
204
|
else
|
196
205
|
"#{key}=#{CGI.escape(value.to_s)}"
|
197
206
|
end
|
198
|
-
end.compact.join(
|
207
|
+
end.compact.join('&')
|
199
208
|
end
|
200
209
|
|
201
210
|
def build_authorization(response)
|
202
|
-
[response[:reference], response[:authorization]].join(
|
211
|
+
[response[:reference], response[:authorization]].join('|')
|
203
212
|
end
|
204
213
|
|
205
214
|
def split_authorization(authorization)
|
206
|
-
authorization.split(
|
215
|
+
authorization.split('|')
|
207
216
|
end
|
208
217
|
|
209
218
|
def generate_signature(action, parameters)
|
210
|
-
signature_fields =
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
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)
|
236
246
|
end
|
237
247
|
end
|
238
248
|
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class CenposGateway < Gateway
|
6
|
-
self.display_name =
|
7
|
-
self.homepage_url =
|
6
|
+
self.display_name = 'CenPOS'
|
7
|
+
self.homepage_url = 'https://www.cenpos.com/'
|
8
8
|
|
9
|
-
self.live_url =
|
9
|
+
self.live_url = 'https://ww3.cenpos.net/6/transact.asmx'
|
10
10
|
|
11
|
-
self.supported_countries = %w(AD AI AG AR AU AT BS BB BE BZ BM BR BN BG CA HR CY CZ DK DM EE FI FR DE GR GD GY HK HU IS
|
12
|
-
self.default_currency =
|
11
|
+
self.supported_countries = %w(AD AI AG AR AU AT BS BB BE BZ BM BR BN BG CA HR CY CZ DK DM EE FI FR DE GR GD GY HK HU IS IL IT JP LV LI LT LU MY MT MX MC MS NL PA PL PT KN LC MF VC SM SG SK SI ZA ES SR SE CH TR GB US UY)
|
12
|
+
self.default_currency = 'USD'
|
13
13
|
self.money_format = :dollars
|
14
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
15
15
|
|
16
|
-
def initialize(options={})
|
16
|
+
def initialize(options = {})
|
17
17
|
requires!(options, :merchant_id, :password, :user_id)
|
18
18
|
super
|
19
19
|
end
|
20
20
|
|
21
|
-
def purchase(amount, payment_method, options={})
|
21
|
+
def purchase(amount, payment_method, options = {})
|
22
22
|
post = {}
|
23
23
|
add_invoice(post, amount, options)
|
24
24
|
add_payment_method(post, payment_method)
|
25
25
|
add_customer_data(post, options)
|
26
26
|
|
27
|
-
commit(
|
27
|
+
commit('Sale', post)
|
28
28
|
end
|
29
29
|
|
30
|
-
def authorize(amount, payment_method, options={})
|
30
|
+
def authorize(amount, payment_method, options = {})
|
31
31
|
post = {}
|
32
32
|
add_invoice(post, amount, options)
|
33
33
|
add_payment_method(post, payment_method)
|
34
34
|
add_customer_data(post, options)
|
35
35
|
|
36
|
-
commit(
|
36
|
+
commit('Auth', post)
|
37
37
|
end
|
38
38
|
|
39
|
-
def capture(amount, authorization, options={})
|
39
|
+
def capture(amount, authorization, options = {})
|
40
40
|
post = {}
|
41
41
|
add_invoice(post, amount, options)
|
42
42
|
add_reference(post, authorization)
|
43
43
|
add_customer_data(post, options)
|
44
44
|
|
45
|
-
commit(
|
45
|
+
commit('SpecialForce', post)
|
46
46
|
end
|
47
47
|
|
48
|
-
def void(authorization, options={})
|
48
|
+
def void(authorization, options = {})
|
49
49
|
post = {}
|
50
50
|
add_void_required_elements(post)
|
51
51
|
add_reference(post, authorization)
|
@@ -53,27 +53,27 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
add_tax(post, options)
|
54
54
|
add_order_id(post, options)
|
55
55
|
|
56
|
-
commit(
|
56
|
+
commit('Void', post)
|
57
57
|
end
|
58
58
|
|
59
|
-
def refund(amount, authorization, options={})
|
59
|
+
def refund(amount, authorization, options = {})
|
60
60
|
post = {}
|
61
61
|
add_invoice(post, amount, options)
|
62
62
|
add_reference(post, authorization)
|
63
63
|
add_customer_data(post, options)
|
64
64
|
|
65
|
-
commit(
|
65
|
+
commit('SpecialReturn', post)
|
66
66
|
end
|
67
67
|
|
68
|
-
def credit(amount, payment_method, options={})
|
68
|
+
def credit(amount, payment_method, options = {})
|
69
69
|
post = {}
|
70
70
|
add_invoice(post, amount, options)
|
71
71
|
add_payment_method(post, payment_method)
|
72
72
|
|
73
|
-
commit(
|
73
|
+
commit('Credit', post)
|
74
74
|
end
|
75
75
|
|
76
|
-
def verify(credit_card, options={})
|
76
|
+
def verify(credit_card, options = {})
|
77
77
|
MultiResponse.run(:use_first_response) do |r|
|
78
78
|
r.process { authorize(100, credit_card, options) }
|
79
79
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -112,7 +112,7 @@ module ActiveMerchant #:nodoc:
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def add_customer_data(post, options)
|
115
|
-
if(billing_address = (options[:billing_address] || options[:address]))
|
115
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
116
116
|
post[:CustomerEmailAddress] = billing_address[:email]
|
117
117
|
post[:CustomerPhone] = billing_address[:phone]
|
118
118
|
post[:CustomerBillingAddress] = billing_address[:address1]
|
@@ -156,9 +156,9 @@ module ActiveMerchant #:nodoc:
|
|
156
156
|
xml = ssl_post(self.live_url, data, headers)
|
157
157
|
raw = parse(xml)
|
158
158
|
rescue ActiveMerchant::ResponseError => e
|
159
|
-
if
|
159
|
+
if e.response.code == '500' && e.response.body.start_with?('<s:Envelope')
|
160
160
|
raw = {
|
161
|
-
message:
|
161
|
+
message: 'See transcript for detailed error description.'
|
162
162
|
}
|
163
163
|
else
|
164
164
|
raise
|
@@ -180,17 +180,17 @@ module ActiveMerchant #:nodoc:
|
|
180
180
|
|
181
181
|
def headers
|
182
182
|
{
|
183
|
-
|
184
|
-
|
185
|
-
|
183
|
+
'Accept-Encoding' => 'identity',
|
184
|
+
'Content-Type' => 'text/xml;charset=UTF-8',
|
185
|
+
'SOAPAction' => 'http://tempuri.org/Transactional/ProcessCreditCard'
|
186
186
|
}
|
187
187
|
end
|
188
188
|
|
189
189
|
def build_request(post)
|
190
|
-
xml = Builder::XmlMarkup.new :
|
191
|
-
xml.tag!(
|
192
|
-
xml.tag!(
|
193
|
-
xml.tag!(
|
190
|
+
xml = Builder::XmlMarkup.new indent: 8
|
191
|
+
xml.tag!('acr:MerchantId', post.delete(:MerchantId))
|
192
|
+
xml.tag!('acr:Password', post.delete(:Password))
|
193
|
+
xml.tag!('acr:UserId', post.delete(:UserId))
|
194
194
|
post.sort.each do |field, value|
|
195
195
|
xml.tag!("acr1:#{field}", value)
|
196
196
|
end
|
@@ -198,18 +198,18 @@ module ActiveMerchant #:nodoc:
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def envelope(body)
|
201
|
-
|
202
|
-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:acr="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.Common" xmlns:acr1="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.v6.Common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
203
|
-
<soapenv:Header/>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
</soapenv:Envelope>
|
212
|
-
|
201
|
+
<<~XML
|
202
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:acr="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.Common" xmlns:acr1="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.v6.Common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
203
|
+
<soapenv:Header/>
|
204
|
+
<soapenv:Body>
|
205
|
+
<tem:ProcessCreditCard>
|
206
|
+
<tem:request>
|
207
|
+
#{body}
|
208
|
+
</tem:request>
|
209
|
+
</tem:ProcessCreditCard>
|
210
|
+
</soapenv:Body>
|
211
|
+
</soapenv:Envelope>
|
212
|
+
XML
|
213
213
|
end
|
214
214
|
|
215
215
|
def parse(xml)
|
@@ -217,9 +217,9 @@ module ActiveMerchant #:nodoc:
|
|
217
217
|
|
218
218
|
doc = Nokogiri::XML(xml)
|
219
219
|
doc.remove_namespaces!
|
220
|
-
body = doc.xpath(
|
220
|
+
body = doc.xpath('//ProcessCreditCardResult')
|
221
221
|
body.children.each do |node|
|
222
|
-
if
|
222
|
+
if node.elements.size == 0
|
223
223
|
response[node.name.underscore.to_sym] = node.text
|
224
224
|
else
|
225
225
|
node.elements.each do |childnode|
|
@@ -233,32 +233,32 @@ module ActiveMerchant #:nodoc:
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def success_from(response)
|
236
|
-
response ==
|
236
|
+
response == '0'
|
237
237
|
end
|
238
238
|
|
239
239
|
def message_from(succeeded, response)
|
240
240
|
if succeeded
|
241
|
-
|
241
|
+
'Succeeded'
|
242
242
|
else
|
243
|
-
response[:message] ||
|
243
|
+
response[:message] || 'Unable to read error message'
|
244
244
|
end
|
245
245
|
end
|
246
246
|
|
247
247
|
STANDARD_ERROR_CODE_MAPPING = {
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
248
|
+
'211' => STANDARD_ERROR_CODE[:invalid_number],
|
249
|
+
'252' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
250
|
+
'257' => STANDARD_ERROR_CODE[:invalid_cvc],
|
251
|
+
'333' => STANDARD_ERROR_CODE[:expired_card],
|
252
|
+
'1' => STANDARD_ERROR_CODE[:card_declined],
|
253
|
+
'99' => STANDARD_ERROR_CODE[:processing_error]
|
254
254
|
}
|
255
255
|
|
256
256
|
def authorization_from(request, response)
|
257
|
-
[
|
257
|
+
[response[:reference_number], request[:CardLastFourDigits], request[:Amount]].join('|')
|
258
258
|
end
|
259
259
|
|
260
260
|
def split_authorization(authorization)
|
261
|
-
reference_number, last_four_digits, original_amount = authorization.split(
|
261
|
+
reference_number, last_four_digits, original_amount = authorization.split('|')
|
262
262
|
[reference_number, last_four_digits, original_amount]
|
263
263
|
end
|
264
264
|
|
@@ -275,14 +275,15 @@ module ActiveMerchant #:nodoc:
|
|
275
275
|
end
|
276
276
|
|
277
277
|
def cvv_result_code(xml)
|
278
|
-
cvv = validation_result_element(xml,
|
278
|
+
cvv = validation_result_element(xml, 'CVV')
|
279
279
|
return nil unless cvv
|
280
|
+
|
280
281
|
validation_result_matches?(*validation_result_element_text(cvv.parent)) ? 'M' : 'N'
|
281
282
|
end
|
282
283
|
|
283
284
|
def avs_result_code(xml)
|
284
|
-
billing_address_elem = validation_result_element(xml,
|
285
|
-
zip_code_elem = validation_result_element(xml,
|
285
|
+
billing_address_elem = validation_result_element(xml, 'Billing Address')
|
286
|
+
zip_code_elem = validation_result_element(xml, 'Zip Code')
|
286
287
|
|
287
288
|
return nil unless billing_address_elem && zip_code_elem
|
288
289
|
|
@@ -312,10 +313,10 @@ module ActiveMerchant #:nodoc:
|
|
312
313
|
|
313
314
|
def validation_result_element_text(element)
|
314
315
|
result_text = element.elements.detect { |elem|
|
315
|
-
elem.name ==
|
316
|
-
}.children.detect
|
316
|
+
elem.name == 'Result'
|
317
|
+
}.children.detect(&:text).text
|
317
318
|
|
318
|
-
result_text.split(
|
319
|
+
result_text.split(';').collect(&:strip)
|
319
320
|
end
|
320
321
|
|
321
322
|
def validation_result_matches?(present, match)
|
@@ -7,8 +7,8 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.default_currency = 'USD'
|
8
8
|
self.money_format = :cents
|
9
9
|
|
10
|
-
self.supported_countries = [
|
11
|
-
self.supported_cardtypes = [
|
10
|
+
self.supported_countries = %w[AD AT BE BG CH CY CZ DE DK EE ES FO FI FR GB GI GL GR HR HU IE IS IL IT LI LT LU LV MC MT NL NO PL PT RO SE SI SM SK SJ TR VA]
|
11
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
12
12
|
|
13
13
|
self.homepage_url = 'https://www.checkout.com/'
|
14
14
|
self.display_name = 'Checkout.com'
|
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def verify(credit_card, options={})
|
86
|
+
def verify(credit_card, options = {})
|
87
87
|
MultiResponse.run(:use_first_response) do |r|
|
88
88
|
r.process { authorize(100, credit_card, options) }
|
89
89
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -107,9 +107,7 @@ module ActiveMerchant #:nodoc:
|
|
107
107
|
xml.bill_cc_ payment_method.number
|
108
108
|
xml.bill_expmonth_ format(payment_method.month, :two_digits)
|
109
109
|
xml.bill_expyear_ format(payment_method.year, :four_digits)
|
110
|
-
if payment_method.verification_value?
|
111
|
-
xml.bill_cvv2_ payment_method.verification_value
|
112
|
-
end
|
110
|
+
xml.bill_cvv2_ payment_method.verification_value if payment_method.verification_value?
|
113
111
|
end
|
114
112
|
|
115
113
|
def add_billing_info(xml, options)
|
@@ -125,13 +123,13 @@ module ActiveMerchant #:nodoc:
|
|
125
123
|
|
126
124
|
def add_shipping_info(xml, options)
|
127
125
|
if options[:shipping_address]
|
128
|
-
xml.ship_address_
|
129
|
-
xml.ship_address2_
|
130
|
-
xml.ship_city_
|
131
|
-
xml.ship_state_
|
132
|
-
xml.ship_postal_
|
133
|
-
xml.ship_country_
|
134
|
-
xml.ship_phone_
|
126
|
+
xml.ship_address_ options[:shipping_address][:address1]
|
127
|
+
xml.ship_address2_ options[:shipping_address][:address2]
|
128
|
+
xml.ship_city_ options[:shipping_address][:city]
|
129
|
+
xml.ship_state_ options[:shipping_address][:state]
|
130
|
+
xml.ship_postal_ options[:shipping_address][:zip]
|
131
|
+
xml.ship_country_ options[:shipping_address][:country]
|
132
|
+
xml.ship_phone_ options[:shipping_address][:phone]
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
@@ -144,7 +142,7 @@ module ActiveMerchant #:nodoc:
|
|
144
142
|
end
|
145
143
|
|
146
144
|
def add_other_fields(xml, options)
|
147
|
-
xml.bill_email_
|
145
|
+
xml.bill_email_ options[:email]
|
148
146
|
xml.bill_customerip_ options[:ip]
|
149
147
|
xml.merchantcustomerid_ options[:customer]
|
150
148
|
xml.descriptor_name options[:descriptor_name]
|
@@ -152,7 +150,7 @@ module ActiveMerchant #:nodoc:
|
|
152
150
|
end
|
153
151
|
|
154
152
|
def add_reference(xml, authorization)
|
155
|
-
transid, trackid,
|
153
|
+
transid, trackid, = split_authorization(authorization)
|
156
154
|
xml.transid transid
|
157
155
|
add_track_id(xml, trackid)
|
158
156
|
end
|
@@ -161,11 +159,11 @@ module ActiveMerchant #:nodoc:
|
|
161
159
|
xml.trackid(trackid) if trackid
|
162
160
|
end
|
163
161
|
|
164
|
-
def commit(action, amount=nil, options={}, &builder)
|
162
|
+
def commit(action, amount = nil, options = {}, &builder)
|
165
163
|
response = parse_xml(ssl_post(live_url, build_xml(action, &builder)))
|
166
164
|
Response.new(
|
167
|
-
(response[:responsecode] ==
|
168
|
-
(response[:result] || response[:error_text] ||
|
165
|
+
(response[:responsecode] == '0'),
|
166
|
+
(response[:result] || response[:error_text] || 'Unknown Response'),
|
169
167
|
response,
|
170
168
|
authorization: authorization_from(response, action, amount, options),
|
171
169
|
test: test?
|
@@ -184,10 +182,10 @@ module ActiveMerchant #:nodoc:
|
|
184
182
|
def parse_xml(xml)
|
185
183
|
response = {}
|
186
184
|
|
187
|
-
Nokogiri::XML(CGI.unescapeHTML(xml)).xpath(
|
185
|
+
Nokogiri::XML(CGI.unescapeHTML(xml)).xpath('//response').children.each do |node|
|
188
186
|
if node.text?
|
189
187
|
next
|
190
|
-
elsif
|
188
|
+
elsif node.elements.size == 0
|
191
189
|
response[node.name.downcase.to_sym] = node.text
|
192
190
|
else
|
193
191
|
node.elements.each do |childnode|
|
@@ -200,13 +198,13 @@ module ActiveMerchant #:nodoc:
|
|
200
198
|
response
|
201
199
|
end
|
202
200
|
|
203
|
-
def authorization_from(response, action,
|
201
|
+
def authorization_from(response, action, amount, options)
|
204
202
|
currency = options[:currency] || currency(amount)
|
205
|
-
[response[:tranid], response[:trackid], action, amount, currency].join(
|
203
|
+
[response[:tranid], response[:trackid], action, amount, currency].join('|')
|
206
204
|
end
|
207
205
|
|
208
206
|
def split_authorization(authorization)
|
209
|
-
transid, trackid, action, amount, currency = authorization.split(
|
207
|
+
transid, trackid, action, amount, currency = authorization.split('|')
|
210
208
|
[transid, trackid, action, amount, currency]
|
211
209
|
end
|
212
210
|
end
|