activemerchant 1.130.0 → 1.137.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +268 -0
- data/lib/active_merchant/billing/check.rb +2 -2
- data/lib/active_merchant/billing/compatibility.rb +4 -4
- data/lib/active_merchant/billing/credit_card.rb +13 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +64 -7
- data/lib/active_merchant/billing/gateway.rb +9 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +240 -41
- data/lib/active_merchant/billing/gateways/airwallex.rb +26 -12
- data/lib/active_merchant/billing/gateways/alelo.rb +23 -5
- data/lib/active_merchant/billing/gateways/authorize_net.rb +44 -36
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -6
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/axcessms.rb +6 -2
- data/lib/active_merchant/billing/gateways/banwire.rb +4 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +7 -3
- data/lib/active_merchant/billing/gateways/blue_pay.rb +13 -5
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
- data/lib/active_merchant/billing/gateways/borgun.rb +6 -4
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +65 -20
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +226 -73
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +5 -2
- data/lib/active_merchant/billing/gateways/card_stream.rb +4 -6
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +316 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +7 -240
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +252 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +69 -8
- data/lib/active_merchant/billing/gateways/credorax.rb +3 -5
- data/lib/active_merchant/billing/gateways/cyber_source.rb +192 -41
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +102 -58
- data/lib/active_merchant/billing/gateways/d_local.rb +26 -15
- data/lib/active_merchant/billing/gateways/data_cash.rb +21 -17
- data/lib/active_merchant/billing/gateways/datatrans.rb +279 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +53 -18
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +4 -1
- data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +40 -36
- data/lib/active_merchant/billing/gateways/efsnet.rb +6 -2
- data/lib/active_merchant/billing/gateways/elavon.rb +99 -33
- data/lib/active_merchant/billing/gateways/element.rb +36 -7
- data/lib/active_merchant/billing/gateways/epay.rb +6 -2
- data/lib/active_merchant/billing/gateways/evo_ca.rb +6 -2
- data/lib/active_merchant/billing/gateways/eway.rb +4 -2
- data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -2
- data/lib/active_merchant/billing/gateways/exact.rb +6 -2
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +31 -3
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -2
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +6 -172
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +7 -3
- data/lib/active_merchant/billing/gateways/flex_charge.rb +347 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +4 -2
- data/lib/active_merchant/billing/gateways/global_collect.rb +45 -37
- data/lib/active_merchant/billing/gateways/hi_pay.rb +286 -0
- data/lib/active_merchant/billing/gateways/hps.rb +1 -1
- data/lib/active_merchant/billing/gateways/iats_payments.rb +7 -2
- data/lib/active_merchant/billing/gateways/inspire.rb +6 -4
- data/lib/active_merchant/billing/gateways/instapay.rb +7 -4
- data/lib/active_merchant/billing/gateways/ipg.rb +10 -6
- data/lib/active_merchant/billing/gateways/iridium.rb +15 -5
- data/lib/active_merchant/billing/gateways/itransact.rb +6 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +3 -3
- data/lib/active_merchant/billing/gateways/ixopay.rb +2 -2
- data/lib/active_merchant/billing/gateways/jetpay.rb +4 -2
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -2
- data/lib/active_merchant/billing/gateways/kushki.rb +73 -13
- data/lib/active_merchant/billing/gateways/linkpoint.rb +6 -2
- data/lib/active_merchant/billing/gateways/litle.rb +33 -50
- data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +8 -5
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +11 -4
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -4
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +19 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +6 -2
- data/lib/active_merchant/billing/gateways/metrics_global.rb +8 -6
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +1 -0
- data/lib/active_merchant/billing/gateways/migs.rb +6 -2
- data/lib/active_merchant/billing/gateways/mit.rb +25 -20
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +18 -10
- data/lib/active_merchant/billing/gateways/monei.rb +1 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +9 -3
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -2
- data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -4
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
- data/lib/active_merchant/billing/gateways/netbanx.rb +1 -3
- data/lib/active_merchant/billing/gateways/netbilling.rb +6 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +6 -2
- data/lib/active_merchant/billing/gateways/nmi.rb +23 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +6 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +4 -2
- data/lib/active_merchant/billing/gateways/opp.rb +1 -2
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +6 -2
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +83 -24
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -4
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_hub.rb +4 -2
- data/lib/active_merchant/billing/gateways/pay_junction.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_trace.rb +31 -18
- data/lib/active_merchant/billing/gateways/payeezy.rb +19 -8
- data/lib/active_merchant/billing/gateways/payex.rb +4 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +1 -3
- data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
- data/lib/active_merchant/billing/gateways/paymentez.rb +23 -11
- data/lib/active_merchant/billing/gateways/paysafe.rb +12 -11
- data/lib/active_merchant/billing/gateways/payscout.rb +7 -4
- data/lib/active_merchant/billing/gateways/paystation.rb +7 -3
- data/lib/active_merchant/billing/gateways/payway.rb +6 -2
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +3 -3
- data/lib/active_merchant/billing/gateways/pin.rb +22 -4
- data/lib/active_merchant/billing/gateways/plexo.rb +49 -10
- data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
- data/lib/active_merchant/billing/gateways/priority.rb +6 -5
- data/lib/active_merchant/billing/gateways/psigate.rb +6 -2
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +6 -2
- data/lib/active_merchant/billing/gateways/quantum.rb +6 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -5
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +6 -2
- data/lib/active_merchant/billing/gateways/rapyd.rb +148 -46
- data/lib/active_merchant/billing/gateways/reach.rb +11 -4
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -11
- data/lib/active_merchant/billing/gateways/redsys_rest.rb +507 -0
- data/lib/active_merchant/billing/gateways/s5.rb +3 -3
- data/lib/active_merchant/billing/gateways/safe_charge.rb +38 -17
- data/lib/active_merchant/billing/gateways/sage.rb +12 -4
- data/lib/active_merchant/billing/gateways/sage_pay.rb +79 -5
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +6 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +6 -2
- data/lib/active_merchant/billing/gateways/secure_pay.rb +8 -6
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -4
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +6 -2
- data/lib/active_merchant/billing/gateways/securion_pay.rb +24 -10
- data/lib/active_merchant/billing/gateways/shift4.rb +17 -20
- data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +17 -11
- data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -2
- data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -4
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +4 -2
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -4
- data/lib/active_merchant/billing/gateways/stripe.rb +63 -19
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +280 -88
- data/lib/active_merchant/billing/gateways/sum_up.rb +223 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -2
- data/lib/active_merchant/billing/gateways/telr.rb +3 -4
- data/lib/active_merchant/billing/gateways/trans_first.rb +1 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +8 -16
- data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -1
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +6 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +9 -8
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +6 -2
- data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
- data/lib/active_merchant/billing/gateways/vantiv_express.rb +587 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +6 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +6 -2
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +2 -2
- data/lib/active_merchant/billing/gateways/vpos.rb +4 -4
- data/lib/active_merchant/billing/gateways/wirecard.rb +7 -3
- data/lib/active_merchant/billing/gateways/wompi.rb +5 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +147 -93
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +13 -10
- data/lib/active_merchant/billing/gateways/xpay.rb +242 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/billing/response.rb +2 -2
- data/lib/active_merchant/connection.rb +3 -17
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/errors.rb +10 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/gateway_support.rb +2 -2
- data/lib/support/ssl_verify.rb +4 -4
- data/lib/support/ssl_version.rb +6 -6
- metadata +30 -9
@@ -1,248 +1,15 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/cecabank/cecabank_xml'
|
2
|
+
require 'active_merchant/billing/gateways/cecabank/cecabank_json'
|
3
|
+
|
1
4
|
module ActiveMerchant #:nodoc:
|
2
5
|
module Billing #:nodoc:
|
3
6
|
class CecabankGateway < Gateway
|
4
|
-
self.
|
5
|
-
self.live_url = 'https://pgw.ceca.es'
|
6
|
-
|
7
|
-
self.supported_countries = ['ES']
|
8
|
-
self.supported_cardtypes = %i[visa master american_express]
|
9
|
-
self.homepage_url = 'http://www.ceca.es/es/'
|
10
|
-
self.display_name = 'Cecabank'
|
11
|
-
self.default_currency = 'EUR'
|
12
|
-
self.money_format = :cents
|
13
|
-
|
14
|
-
#### CECA's MAGIC NUMBERS
|
15
|
-
CECA_NOTIFICATIONS_URL = 'NONE'
|
16
|
-
CECA_ENCRIPTION = 'SHA2'
|
17
|
-
CECA_DECIMALS = '2'
|
18
|
-
CECA_MODE = 'SSL'
|
19
|
-
CECA_UI_LESS_LANGUAGE = 'XML'
|
20
|
-
CECA_UI_LESS_LANGUAGE_REFUND = '1'
|
21
|
-
CECA_UI_LESS_REFUND_PAGE = 'anulacion_xml'
|
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
|
-
|
26
|
-
# Creates a new CecabankGateway
|
27
|
-
#
|
28
|
-
# The gateway requires four values for connection to be passed
|
29
|
-
# in the +options+ hash.
|
30
|
-
#
|
31
|
-
# ==== Options
|
32
|
-
#
|
33
|
-
# * <tt>:merchant_id</tt> -- Cecabank's merchant_id (REQUIRED)
|
34
|
-
# * <tt>:acquirer_bin</tt> -- Cecabank's acquirer_bin (REQUIRED)
|
35
|
-
# * <tt>:terminal_id</tt> -- Cecabank's terminal_id (REQUIRED)
|
36
|
-
# * <tt>:key</tt> -- Cecabank's cypher key (REQUIRED)
|
37
|
-
# * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
|
38
|
-
# Otherwise, perform transactions against the production server.
|
39
|
-
def initialize(options = {})
|
40
|
-
requires!(options, :merchant_id, :acquirer_bin, :terminal_id, :key)
|
41
|
-
super
|
42
|
-
end
|
43
|
-
|
44
|
-
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
45
|
-
#
|
46
|
-
# ==== Parameters
|
47
|
-
#
|
48
|
-
# * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
|
49
|
-
# * <tt>creditcard</tt> -- The CreditCard details for the transaction.
|
50
|
-
# * <tt>options</tt> -- A hash of optional parameters.
|
51
|
-
#
|
52
|
-
# ==== Options
|
53
|
-
#
|
54
|
-
# * <tt>:order_id</tt> -- order_id passed used purchase. (REQUIRED)
|
55
|
-
# * <tt>:currency</tt> -- currency. Supported: EUR, USD, GBP.
|
56
|
-
# * <tt>:description</tt> -- description to be pased to the gateway.
|
57
|
-
def purchase(money, creditcard, options = {})
|
58
|
-
requires!(options, :order_id)
|
59
|
-
|
60
|
-
post = { 'Descripcion' => options[:description],
|
61
|
-
'Num_operacion' => options[:order_id],
|
62
|
-
'Idioma' => CECA_UI_LESS_LANGUAGE,
|
63
|
-
'Pago_soportado' => CECA_MODE,
|
64
|
-
'URL_OK' => CECA_NOTIFICATIONS_URL,
|
65
|
-
'URL_NOK' => CECA_NOTIFICATIONS_URL,
|
66
|
-
'Importe' => amount(money),
|
67
|
-
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
|
68
|
-
|
69
|
-
add_creditcard(post, creditcard)
|
70
|
-
|
71
|
-
commit(CECA_ACTION_PURCHASE, post)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Refund a transaction.
|
75
|
-
#
|
76
|
-
# This transaction indicates to the gateway that
|
77
|
-
# money should flow from the merchant to the customer.
|
78
|
-
#
|
79
|
-
# ==== Parameters
|
80
|
-
#
|
81
|
-
# * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
|
82
|
-
# * <tt>identification</tt> -- The reference given from the gateway on purchase (reference, not operation).
|
83
|
-
# * <tt>options</tt> -- A hash of parameters.
|
84
|
-
def refund(money, identification, options = {})
|
85
|
-
reference, order_id = split_authorization(identification)
|
86
|
-
|
87
|
-
post = { 'Referencia' => reference,
|
88
|
-
'Num_operacion' => order_id,
|
89
|
-
'Idioma' => CECA_UI_LESS_LANGUAGE_REFUND,
|
90
|
-
'Pagina' => CECA_UI_LESS_REFUND_PAGE,
|
91
|
-
'Importe' => amount(money),
|
92
|
-
'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
|
93
|
-
|
94
|
-
commit(CECA_ACTION_REFUND, post)
|
95
|
-
end
|
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
|
-
|
108
|
-
private
|
109
|
-
|
110
|
-
def add_creditcard(post, creditcard)
|
111
|
-
post['PAN'] = creditcard.number
|
112
|
-
post['Caducidad'] = expdate(creditcard)
|
113
|
-
post['CVV2'] = creditcard.verification_value
|
114
|
-
post['Pago_elegido'] = CECA_MODE
|
115
|
-
end
|
7
|
+
self.abstract_class = true
|
116
8
|
|
117
|
-
def
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
def parse(body)
|
122
|
-
response = {}
|
123
|
-
|
124
|
-
root = REXML::Document.new(body).root
|
125
|
-
|
126
|
-
response[:success] = (root.attributes['valor'] == 'OK')
|
127
|
-
response[:date] = root.attributes['fecha']
|
128
|
-
response[:operation_number] = root.attributes['numeroOperacion']
|
129
|
-
response[:message] = root.attributes['valor']
|
130
|
-
|
131
|
-
if root.elements['OPERACION']
|
132
|
-
response[:operation_type] = root.elements['OPERACION'].attributes['tipo']
|
133
|
-
response[:amount] = root.elements['OPERACION/importe'].text.strip
|
134
|
-
end
|
135
|
-
|
136
|
-
response[:description] = root.elements['OPERACION/descripcion'].text if root.elements['OPERACION/descripcion']
|
137
|
-
response[:authorization_number] = root.elements['OPERACION/numeroAutorizacion'].text if root.elements['OPERACION/numeroAutorizacion']
|
138
|
-
response[:reference] = root.elements['OPERACION/referencia'].text if root.elements['OPERACION/referencia']
|
139
|
-
response[:pan] = root.elements['OPERACION/pan'].text if root.elements['OPERACION/pan']
|
140
|
-
|
141
|
-
if root.elements['ERROR']
|
142
|
-
response[:error_code] = root.elements['ERROR/codigo'].text
|
143
|
-
response[:error_message] = root.elements['ERROR/descripcion'].text
|
144
|
-
else
|
145
|
-
if root.elements['OPERACION'].attributes['numeroOperacion'] == '000'
|
146
|
-
response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text if root.elements['OPERACION/numeroAutorizacion']
|
147
|
-
else
|
148
|
-
response[:authorization] = root.attributes['numeroOperacion']
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
return response
|
153
|
-
rescue REXML::ParseException => e
|
154
|
-
response[:success] = false
|
155
|
-
response[:message] = 'Unable to parse the response.'
|
156
|
-
response[:error_message] = e.message
|
157
|
-
response
|
158
|
-
end
|
159
|
-
|
160
|
-
def commit(action, parameters)
|
161
|
-
parameters.merge!(
|
162
|
-
'Cifrado' => CECA_ENCRIPTION,
|
163
|
-
'Firma' => generate_signature(action, parameters),
|
164
|
-
'Exponente' => CECA_DECIMALS,
|
165
|
-
'MerchantID' => options[:merchant_id],
|
166
|
-
'AcquirerBIN' => options[:acquirer_bin],
|
167
|
-
'TerminalID' => options[:terminal_id]
|
168
|
-
)
|
169
|
-
url = (test? ? self.test_url : self.live_url) + "/tpvweb/#{action}.action"
|
170
|
-
xml = ssl_post("#{url}?", post_data(parameters))
|
171
|
-
response = parse(xml)
|
172
|
-
Response.new(
|
173
|
-
response[:success],
|
174
|
-
message_from(response),
|
175
|
-
response,
|
176
|
-
test: test?,
|
177
|
-
authorization: build_authorization(response),
|
178
|
-
error_code: response[:error_code]
|
179
|
-
)
|
180
|
-
end
|
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
|
-
|
192
|
-
def post_data(params)
|
193
|
-
return nil unless params
|
194
|
-
|
195
|
-
params.map do |key, value|
|
196
|
-
next if value.blank?
|
197
|
-
|
198
|
-
if value.is_a?(Hash)
|
199
|
-
h = {}
|
200
|
-
value.each do |k, v|
|
201
|
-
h["#{key}.#{k}"] = v unless v.blank?
|
202
|
-
end
|
203
|
-
post_data(h)
|
204
|
-
else
|
205
|
-
"#{key}=#{CGI.escape(value.to_s)}"
|
206
|
-
end
|
207
|
-
end.compact.join('&')
|
208
|
-
end
|
209
|
-
|
210
|
-
def build_authorization(response)
|
211
|
-
[response[:reference], response[:authorization]].join('|')
|
212
|
-
end
|
213
|
-
|
214
|
-
def split_authorization(authorization)
|
215
|
-
authorization.split('|')
|
216
|
-
end
|
9
|
+
def self.new(options = {})
|
10
|
+
return CecabankJsonGateway.new(options) if options[:is_rest_json]
|
217
11
|
|
218
|
-
|
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)
|
12
|
+
CecabankXmlGateway.new(options)
|
246
13
|
end
|
247
14
|
end
|
248
15
|
end
|