activemerchant 1.79.2 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +33 -0
- data/README.md +10 -2
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/check.rb +4 -4
- data/lib/active_merchant/billing/compatibility.rb +1 -1
- data/lib/active_merchant/billing/credit_card.rb +21 -21
- data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
- data/lib/active_merchant/billing/gateway.rb +13 -13
- data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
- data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
- data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
- data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
- data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
- data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
- data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
- data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
- data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
- data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
- data/lib/active_merchant/billing/gateways/cams.rb +12 -12
- data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
- data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
- data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
- data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
- data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
- data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
- data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
- data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
- data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
- data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
- data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
- data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
- data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
- data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
- data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
- data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
- data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
- data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
- data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
- data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
- data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
- data/lib/active_merchant/billing/gateways/element.rb +35 -35
- data/lib/active_merchant/billing/gateways/epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +65 -65
- data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
- data/lib/active_merchant/billing/gateways/exact.rb +12 -12
- data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
- data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
- data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +26 -16
- data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
- data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
- data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
- data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
- data/lib/active_merchant/billing/gateways/hps.rb +28 -28
- data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
- data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
- data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
- data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
- data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
- data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
- data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
- data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
- data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
- data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
- data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
- data/lib/active_merchant/billing/gateways/litle.rb +4 -4
- data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
- data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
- data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
- data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
- data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
- data/lib/active_merchant/billing/gateways/migs.rb +11 -9
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
- data/lib/active_merchant/billing/gateways/monei.rb +5 -5
- data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
- data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
- data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
- data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
- data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
- data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
- data/lib/active_merchant/billing/gateways/omise.rb +3 -3
- data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/opp.rb +4 -4
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
- data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
- data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
- data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
- data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
- data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
- data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
- data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
- data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
- data/lib/active_merchant/billing/gateways/payex.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
- data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
- data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
- data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
- data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
- data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
- data/lib/active_merchant/billing/gateways/payway.rb +6 -6
- data/lib/active_merchant/billing/gateways/pin.rb +7 -7
- data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
- data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
- data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
- data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
- data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
- data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
- data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
- data/lib/active_merchant/billing/gateways/realex.rb +16 -15
- data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
- data/lib/active_merchant/billing/gateways/s5.rb +5 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
- data/lib/active_merchant/billing/gateways/sage.rb +20 -20
- data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
- data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
- data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
- data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
- data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/telr.rb +26 -26
- data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
- data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
- data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
- data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
- data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
- data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
- data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
- data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
- data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
- data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/connection.rb +10 -8
- data/lib/active_merchant/country.rb +1 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +12 -12
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +37 -0
- data/lib/support/gateway_support.rb +2 -2
- data/lib/support/ssl_verify.rb +5 -5
- data/lib/support/ssl_version.rb +7 -7
- metadata +3 -7
- 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
|
@@ -173,11 +173,11 @@ module ActiveMerchant #:nodoc:
|
|
|
173
173
|
requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily], :installments, :order_id )
|
|
174
174
|
|
|
175
175
|
options.update(
|
|
176
|
-
:ordertype =>
|
|
177
|
-
:action => options[:action] ||
|
|
176
|
+
:ordertype => 'SALE',
|
|
177
|
+
:action => options[:action] || 'SUBMIT',
|
|
178
178
|
:installments => options[:installments] || 12,
|
|
179
|
-
:startdate => options[:startdate] ||
|
|
180
|
-
:periodicity => options[:periodicity].to_s ||
|
|
179
|
+
:startdate => options[:startdate] || 'immediate',
|
|
180
|
+
:periodicity => options[:periodicity].to_s || 'monthly',
|
|
181
181
|
:comments => options[:comments] || nil,
|
|
182
182
|
:threshold => options[:threshold] || 3
|
|
183
183
|
)
|
|
@@ -188,7 +188,7 @@ module ActiveMerchant #:nodoc:
|
|
|
188
188
|
def purchase(money, creditcard, options={})
|
|
189
189
|
requires!(options, :order_id)
|
|
190
190
|
options.update(
|
|
191
|
-
:ordertype =>
|
|
191
|
+
:ordertype => 'SALE'
|
|
192
192
|
)
|
|
193
193
|
commit(money, creditcard, options)
|
|
194
194
|
end
|
|
@@ -201,7 +201,7 @@ module ActiveMerchant #:nodoc:
|
|
|
201
201
|
def authorize(money, creditcard, options = {})
|
|
202
202
|
requires!(options, :order_id)
|
|
203
203
|
options.update(
|
|
204
|
-
:ordertype =>
|
|
204
|
+
:ordertype => 'PREAUTH'
|
|
205
205
|
)
|
|
206
206
|
commit(money, creditcard, options)
|
|
207
207
|
end
|
|
@@ -215,7 +215,7 @@ module ActiveMerchant #:nodoc:
|
|
|
215
215
|
def capture(money, authorization, options = {})
|
|
216
216
|
options.update(
|
|
217
217
|
:order_id => authorization,
|
|
218
|
-
:ordertype =>
|
|
218
|
+
:ordertype => 'POSTAUTH'
|
|
219
219
|
)
|
|
220
220
|
commit(money, nil, options)
|
|
221
221
|
end
|
|
@@ -224,7 +224,7 @@ module ActiveMerchant #:nodoc:
|
|
|
224
224
|
def void(identification, options = {})
|
|
225
225
|
options.update(
|
|
226
226
|
:order_id => identification,
|
|
227
|
-
:ordertype =>
|
|
227
|
+
:ordertype => 'VOID'
|
|
228
228
|
)
|
|
229
229
|
commit(nil, nil, options)
|
|
230
230
|
end
|
|
@@ -236,7 +236,7 @@ module ActiveMerchant #:nodoc:
|
|
|
236
236
|
#
|
|
237
237
|
def refund(money, identification, options = {})
|
|
238
238
|
options.update(
|
|
239
|
-
:ordertype =>
|
|
239
|
+
:ordertype => 'CREDIT',
|
|
240
240
|
:order_id => identification
|
|
241
241
|
)
|
|
242
242
|
commit(money, nil, options)
|
|
@@ -272,7 +272,7 @@ module ActiveMerchant #:nodoc:
|
|
|
272
272
|
end
|
|
273
273
|
|
|
274
274
|
def successful?(response)
|
|
275
|
-
response[:approved] ==
|
|
275
|
+
response[:approved] == 'APPROVED'
|
|
276
276
|
end
|
|
277
277
|
|
|
278
278
|
# Build the XML file
|
|
@@ -280,11 +280,11 @@ module ActiveMerchant #:nodoc:
|
|
|
280
280
|
params = parameters(money, creditcard, options)
|
|
281
281
|
|
|
282
282
|
xml = REXML::Document.new
|
|
283
|
-
order = xml.add_element(
|
|
283
|
+
order = xml.add_element('order')
|
|
284
284
|
|
|
285
285
|
# Merchant Info
|
|
286
|
-
merchantinfo = order.add_element(
|
|
287
|
-
merchantinfo.add_element(
|
|
286
|
+
merchantinfo = order.add_element('merchantinfo')
|
|
287
|
+
merchantinfo.add_element('configfile').text = @options[:login]
|
|
288
288
|
|
|
289
289
|
# Loop over the params hash to construct the XML string
|
|
290
290
|
for key, value in params
|
|
@@ -305,14 +305,14 @@ module ActiveMerchant #:nodoc:
|
|
|
305
305
|
# adds LinkPoint's Items entity to the XML. Called from post_data
|
|
306
306
|
def build_items(element, items)
|
|
307
307
|
for item in items
|
|
308
|
-
item_element = element.add_element(
|
|
308
|
+
item_element = element.add_element('item')
|
|
309
309
|
for key, value in item
|
|
310
310
|
if key == :options
|
|
311
|
-
options_element = item_element.add_element(
|
|
311
|
+
options_element = item_element.add_element('options')
|
|
312
312
|
for option in value
|
|
313
|
-
opt_element = options_element.add_element(
|
|
314
|
-
opt_element.add_element(
|
|
315
|
-
opt_element.add_element(
|
|
313
|
+
opt_element = options_element.add_element('option')
|
|
314
|
+
opt_element.add_element('name').text = option[:name] unless option[:name].blank?
|
|
315
|
+
opt_element.add_element('value').text = option[:value] unless option[:value].blank?
|
|
316
316
|
end
|
|
317
317
|
else
|
|
318
318
|
item_element.add_element(key.to_s).text = item[key].to_s unless item[key].blank?
|
|
@@ -334,14 +334,14 @@ module ActiveMerchant #:nodoc:
|
|
|
334
334
|
:chargetotal => amount(money)
|
|
335
335
|
},
|
|
336
336
|
:transactiondetails => {
|
|
337
|
-
:transactionorigin => options[:transactionorigin] ||
|
|
337
|
+
:transactionorigin => options[:transactionorigin] || 'ECI',
|
|
338
338
|
:oid => options[:order_id],
|
|
339
339
|
:ponumber => options[:ponumber],
|
|
340
340
|
:taxexempt => options[:taxexempt],
|
|
341
341
|
:terminaltype => options[:terminaltype],
|
|
342
342
|
:ip => options[:ip],
|
|
343
343
|
:reference_number => options[:reference_number],
|
|
344
|
-
:recurring => options[:recurring] ||
|
|
344
|
+
:recurring => options[:recurring] || 'NO', #DO NOT USE if you are using the periodic billing option.
|
|
345
345
|
:tdate => options[:tdate]
|
|
346
346
|
},
|
|
347
347
|
:orderoptions => {
|
|
@@ -433,7 +433,7 @@ module ActiveMerchant #:nodoc:
|
|
|
433
433
|
# <r_approved>APPROVED</r_approved>
|
|
434
434
|
# <r_avs></r_avs>
|
|
435
435
|
|
|
436
|
-
response = {:message =>
|
|
436
|
+
response = {:message => 'Global Error Receipt', :complete => false}
|
|
437
437
|
|
|
438
438
|
xml = REXML::Document.new("<response>#{xml}</response>")
|
|
439
439
|
xml.root.elements.each do |node|
|
|
@@ -444,7 +444,7 @@ module ActiveMerchant #:nodoc:
|
|
|
444
444
|
end
|
|
445
445
|
|
|
446
446
|
def format_creditcard_expiry_year(year)
|
|
447
|
-
sprintf(
|
|
447
|
+
sprintf('%.4i', year)[-2..-1]
|
|
448
448
|
end
|
|
449
449
|
end
|
|
450
450
|
end
|
|
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
|
|
|
78
78
|
add_descriptor(doc, options)
|
|
79
79
|
doc.send(refund_type(payment), transaction_attributes(options)) do
|
|
80
80
|
if payment.is_a?(String)
|
|
81
|
-
transaction_id,
|
|
81
|
+
transaction_id, _, _ = split_authorization(payment)
|
|
82
82
|
doc.litleTxnId(transaction_id)
|
|
83
83
|
doc.amount(money) if money
|
|
84
84
|
elsif check?(payment)
|
|
@@ -192,7 +192,7 @@ module ActiveMerchant #:nodoc:
|
|
|
192
192
|
end
|
|
193
193
|
|
|
194
194
|
def refund_type(payment)
|
|
195
|
-
|
|
195
|
+
_, kind, _ = split_authorization(payment)
|
|
196
196
|
if check?(payment) || kind == 'echeckSales'
|
|
197
197
|
:echeckCredit
|
|
198
198
|
else
|
|
@@ -376,7 +376,7 @@ module ActiveMerchant #:nodoc:
|
|
|
376
376
|
|
|
377
377
|
if parsed.empty?
|
|
378
378
|
%w(response message).each do |attribute|
|
|
379
|
-
parsed[attribute.to_sym] = doc.xpath(
|
|
379
|
+
parsed[attribute.to_sym] = doc.xpath('//litleOnlineResponse').attribute(attribute).value
|
|
380
380
|
end
|
|
381
381
|
end
|
|
382
382
|
|
|
@@ -423,7 +423,7 @@ module ActiveMerchant #:nodoc:
|
|
|
423
423
|
{
|
|
424
424
|
merchantId: @options[:merchant_id],
|
|
425
425
|
version: SCHEMA_VERSION,
|
|
426
|
-
xmlns:
|
|
426
|
+
xmlns: 'http://www.litle.com/schema'
|
|
427
427
|
}
|
|
428
428
|
end
|
|
429
429
|
|
|
@@ -59,7 +59,7 @@ module ActiveMerchant
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def verify_credentials
|
|
62
|
-
url = build_url(SecureRandom.uuid,
|
|
62
|
+
url = build_url(SecureRandom.uuid, 'nonexistent')
|
|
63
63
|
begin
|
|
64
64
|
ssl_get(url, headers)
|
|
65
65
|
rescue ResponseError => e
|
|
@@ -164,7 +164,7 @@ module ActiveMerchant
|
|
|
164
164
|
|
|
165
165
|
def add_3dsecure_id(post, options)
|
|
166
166
|
return unless options[:threed_secure_id]
|
|
167
|
-
post.merge!({
|
|
167
|
+
post.merge!({'3DSecureId' => options[:threed_secure_id]})
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
def country_code(country)
|
|
@@ -221,7 +221,7 @@ module ActiveMerchant
|
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
def success_from(response)
|
|
224
|
-
response['result'] ==
|
|
224
|
+
response['result'] == 'SUCCESS'
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
def message_from(succeeded, response)
|
|
@@ -98,7 +98,7 @@ module ActiveMerchant #:nodoc:
|
|
|
98
98
|
|
|
99
99
|
def build_xml_request(action)
|
|
100
100
|
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8')
|
|
101
|
-
builder.send(
|
|
101
|
+
builder.send('transaction-request') do |xml|
|
|
102
102
|
xml.version '3.1.1.15'
|
|
103
103
|
xml.verification do
|
|
104
104
|
xml.merchantId @options[:login]
|
|
@@ -127,7 +127,7 @@ module ActiveMerchant #:nodoc:
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
def split_authorization(authorization)
|
|
130
|
-
authorization.split(
|
|
130
|
+
authorization.split('|')
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def parse(body)
|
|
@@ -11,8 +11,8 @@ module ActiveMerchant #:nodoc:
|
|
|
11
11
|
self.money_format = :dollars
|
|
12
12
|
|
|
13
13
|
CARD_BRAND = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'american_express' => 'amex',
|
|
15
|
+
'diners_club' => 'diners'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
def initialize(options={})
|
|
@@ -22,41 +22,41 @@ module ActiveMerchant #:nodoc:
|
|
|
22
22
|
|
|
23
23
|
def purchase(money, payment, options={})
|
|
24
24
|
MultiResponse.run do |r|
|
|
25
|
-
r.process { commit(
|
|
25
|
+
r.process { commit('tokenize', 'card_tokens', card_token_request(money, payment, options)) }
|
|
26
26
|
options.merge!(card_brand: (CARD_BRAND[payment.brand] || payment.brand))
|
|
27
|
-
options.merge!(card_token: r.authorization.split(
|
|
28
|
-
r.process { commit(
|
|
27
|
+
options.merge!(card_token: r.authorization.split('|').first)
|
|
28
|
+
r.process { commit('purchase', 'payments', purchase_request(money, payment, options) ) }
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def authorize(money, payment, options={})
|
|
33
33
|
MultiResponse.run do |r|
|
|
34
|
-
r.process { commit(
|
|
34
|
+
r.process { commit('tokenize', 'card_tokens', card_token_request(money, payment, options)) }
|
|
35
35
|
options.merge!(card_brand: (CARD_BRAND[payment.brand] || payment.brand))
|
|
36
|
-
options.merge!(card_token: r.authorization.split(
|
|
37
|
-
r.process { commit(
|
|
36
|
+
options.merge!(card_token: r.authorization.split('|').first)
|
|
37
|
+
r.process { commit('authorize', 'payments', authorize_request(money, payment, options) ) }
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def capture(money, authorization, options={})
|
|
42
42
|
post = {}
|
|
43
|
-
authorization, _ = authorization.split(
|
|
43
|
+
authorization, _ = authorization.split('|')
|
|
44
44
|
post[:capture] = true
|
|
45
45
|
post[:transaction_amount] = amount(money).to_f
|
|
46
|
-
commit(
|
|
46
|
+
commit('capture', "payments/#{authorization}", post)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def refund(money, authorization, options={})
|
|
50
50
|
post = {}
|
|
51
|
-
authorization, original_amount = authorization.split(
|
|
51
|
+
authorization, original_amount = authorization.split('|')
|
|
52
52
|
post[:amount] = amount(money).to_f if original_amount && original_amount.to_f > amount(money).to_f
|
|
53
|
-
commit(
|
|
53
|
+
commit('refund', "payments/#{authorization}/refunds", post)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def void(authorization, options={})
|
|
57
|
-
authorization, _ = authorization.split(
|
|
58
|
-
post = { status:
|
|
59
|
-
commit(
|
|
57
|
+
authorization, _ = authorization.split('|')
|
|
58
|
+
post = { status: 'cancelled' }
|
|
59
|
+
commit('void', "payments/#{authorization}", post)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def verify(credit_card, options={})
|
|
@@ -161,10 +161,10 @@ module ActiveMerchant #:nodoc:
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
def split_street_address(address1)
|
|
164
|
-
street_number = address1.split(
|
|
164
|
+
street_number = address1.split(' ').first
|
|
165
165
|
|
|
166
|
-
if street_name = address1.split(
|
|
167
|
-
street_name = street_name.join(
|
|
166
|
+
if street_name = address1.split(' ')[1..-1]
|
|
167
|
+
street_name = street_name.join(' ')
|
|
168
168
|
else
|
|
169
169
|
nil
|
|
170
170
|
end
|
|
@@ -190,7 +190,7 @@ module ActiveMerchant #:nodoc:
|
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
def commit(action, path, parameters)
|
|
193
|
-
if [
|
|
193
|
+
if ['capture', 'void'].include?(action)
|
|
194
194
|
response = parse(ssl_request(:put, url(path), post_data(parameters), headers))
|
|
195
195
|
else
|
|
196
196
|
response = parse(ssl_post(url(path), post_data(parameters), headers(parameters)))
|
|
@@ -207,19 +207,19 @@ module ActiveMerchant #:nodoc:
|
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
def success_from(action, response)
|
|
210
|
-
if action ==
|
|
211
|
-
response[
|
|
210
|
+
if action == 'refund'
|
|
211
|
+
response['error'].nil?
|
|
212
212
|
else
|
|
213
|
-
[
|
|
213
|
+
['active', 'approved', 'authorized', 'cancelled', 'in_process'].include?(response['status'])
|
|
214
214
|
end
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
def message_from(response)
|
|
218
|
-
(response[
|
|
218
|
+
(response['status_detail']) || (response['message'])
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
def authorization_from(response, params)
|
|
222
|
-
[response[
|
|
222
|
+
[response['id'], params[:transaction_amount]].join('|')
|
|
223
223
|
end
|
|
224
224
|
|
|
225
225
|
def post_data(parameters = {})
|
|
@@ -228,10 +228,10 @@ module ActiveMerchant #:nodoc:
|
|
|
228
228
|
|
|
229
229
|
def error_code_from(action, response)
|
|
230
230
|
unless success_from(action, response)
|
|
231
|
-
if cause = response[
|
|
232
|
-
cause.empty? ? nil : cause.first[
|
|
231
|
+
if cause = response['cause']
|
|
232
|
+
cause.empty? ? nil : cause.first['code']
|
|
233
233
|
else
|
|
234
|
-
response[
|
|
234
|
+
response['status']
|
|
235
235
|
end
|
|
236
236
|
end
|
|
237
237
|
end
|
|
@@ -243,7 +243,7 @@ module ActiveMerchant #:nodoc:
|
|
|
243
243
|
|
|
244
244
|
def headers(options = {})
|
|
245
245
|
headers = {
|
|
246
|
-
|
|
246
|
+
'Content-Type' => 'application/json'
|
|
247
247
|
}
|
|
248
248
|
headers['X-Device-Session-ID'] = options[:device_id] if options[:device_id]
|
|
249
249
|
headers
|
|
@@ -162,22 +162,22 @@ module ActiveMerchant #:nodoc:
|
|
|
162
162
|
response = begin
|
|
163
163
|
parse( ssl_post(url, post_data(action,parameters)) )
|
|
164
164
|
rescue ActiveMerchant::ResponseError => e
|
|
165
|
-
{
|
|
165
|
+
{ 'error_code' => '404', 'auth_response_text' => e.to_s }
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
-
Response.new(response[
|
|
169
|
-
:authorization => response[
|
|
168
|
+
Response.new(response['error_code'] == '000', message_from(response), response,
|
|
169
|
+
:authorization => response['transaction_id'],
|
|
170
170
|
:test => test?,
|
|
171
|
-
:cvv_result => response[
|
|
172
|
-
:avs_result => { :code => response[
|
|
171
|
+
:cvv_result => response['cvv2_result'],
|
|
172
|
+
:avs_result => { :code => response['avs_result'] }
|
|
173
173
|
)
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
def message_from(response)
|
|
177
|
-
if response[
|
|
178
|
-
|
|
177
|
+
if response['error_code'] == '000'
|
|
178
|
+
'This transaction has been approved'
|
|
179
179
|
else
|
|
180
|
-
response[
|
|
180
|
+
response['auth_response_text']
|
|
181
181
|
end
|
|
182
182
|
end
|
|
183
183
|
|
|
@@ -187,7 +187,7 @@ module ActiveMerchant #:nodoc:
|
|
|
187
187
|
post[:profile_key] = @options[:password]
|
|
188
188
|
post[:transaction_type] = action if action
|
|
189
189
|
|
|
190
|
-
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join(
|
|
190
|
+
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join('&')
|
|
191
191
|
request
|
|
192
192
|
end
|
|
193
193
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'cgi'
|
|
2
2
|
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
|
4
4
|
module Billing #:nodoc:
|
|
@@ -88,11 +88,11 @@ module ActiveMerchant #:nodoc:
|
|
|
88
88
|
|
|
89
89
|
def post_data(action, parameters = {})
|
|
90
90
|
parameters.merge!({:type => action})
|
|
91
|
-
ret =
|
|
91
|
+
ret = ''
|
|
92
92
|
for key in parameters.keys
|
|
93
93
|
ret += "#{key}=#{CGI.escape(parameters[key].to_s)}"
|
|
94
94
|
if key != parameters.keys.last
|
|
95
|
-
ret +=
|
|
95
|
+
ret += '&'
|
|
96
96
|
end
|
|
97
97
|
end
|
|
98
98
|
ret.to_s
|
|
@@ -101,11 +101,11 @@ module ActiveMerchant #:nodoc:
|
|
|
101
101
|
def parse(data)
|
|
102
102
|
responses = CGI.parse(data).inject({}){|h,(k, v)| h[k] = v.first; h}
|
|
103
103
|
Response.new(
|
|
104
|
-
(responses[
|
|
105
|
-
responses[
|
|
104
|
+
(responses['response'].to_i == 1),
|
|
105
|
+
responses['responsetext'],
|
|
106
106
|
responses,
|
|
107
107
|
:test => test?,
|
|
108
|
-
:authorization => responses[
|
|
108
|
+
:authorization => responses['transactionid']
|
|
109
109
|
)
|
|
110
110
|
end
|
|
111
111
|
end
|
|
@@ -3,13 +3,13 @@ require 'nokogiri'
|
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
|
4
4
|
module Billing #:nodoc:
|
|
5
5
|
class MerchantPartnersGateway < Gateway
|
|
6
|
-
self.display_name =
|
|
7
|
-
self.homepage_url =
|
|
6
|
+
self.display_name = 'Merchant Partners'
|
|
7
|
+
self.homepage_url = 'http://www.merchantpartners.com/'
|
|
8
8
|
|
|
9
|
-
self.live_url =
|
|
9
|
+
self.live_url = 'https://trans.merchantpartners.com/cgi-bin/ProcessXML.cgi'
|
|
10
10
|
|
|
11
|
-
self.supported_countries = [
|
|
12
|
-
self.default_currency =
|
|
11
|
+
self.supported_countries = ['US']
|
|
12
|
+
self.default_currency = 'USD'
|
|
13
13
|
self.money_format = :dollars
|
|
14
14
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
|
15
15
|
|
|
@@ -143,19 +143,19 @@ module ActiveMerchant #:nodoc:
|
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
ACTIONS = {
|
|
146
|
-
purchase:
|
|
147
|
-
authorize:
|
|
148
|
-
capture:
|
|
149
|
-
void:
|
|
150
|
-
refund:
|
|
151
|
-
credit:
|
|
152
|
-
store:
|
|
153
|
-
stored_purchase:
|
|
154
|
-
stored_credit:
|
|
146
|
+
purchase: '2',
|
|
147
|
+
authorize: '1',
|
|
148
|
+
capture: '3',
|
|
149
|
+
void: '5',
|
|
150
|
+
refund: '4',
|
|
151
|
+
credit: '6',
|
|
152
|
+
store: '7',
|
|
153
|
+
stored_purchase: '8',
|
|
154
|
+
stored_credit: '13'
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
STORE_TX_TYPES = {
|
|
158
|
-
store_only:
|
|
158
|
+
store_only: '3'
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
def commit(action, post)
|
|
@@ -172,15 +172,15 @@ module ActiveMerchant #:nodoc:
|
|
|
172
172
|
message_from(succeeded, response_data),
|
|
173
173
|
response_data,
|
|
174
174
|
authorization: authorization_from(post, response_data),
|
|
175
|
-
:avs_result => AVSResult.new(code: response_data[
|
|
176
|
-
:cvv_result => CVVResult.new(response_data[
|
|
175
|
+
:avs_result => AVSResult.new(code: response_data['avs_response']),
|
|
176
|
+
:cvv_result => CVVResult.new(response_data['cvv2_response']),
|
|
177
177
|
test: test?
|
|
178
178
|
)
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def headers
|
|
182
182
|
{
|
|
183
|
-
|
|
183
|
+
'Content-Type' => 'application/xml'
|
|
184
184
|
}
|
|
185
185
|
end
|
|
186
186
|
|
|
@@ -188,7 +188,7 @@ module ActiveMerchant #:nodoc:
|
|
|
188
188
|
Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
|
189
189
|
xml.interface_driver {
|
|
190
190
|
xml.trans_catalog {
|
|
191
|
-
xml.transaction(name:
|
|
191
|
+
xml.transaction(name: 'creditcard') {
|
|
192
192
|
xml.inputs {
|
|
193
193
|
post.each do |field, value|
|
|
194
194
|
xml.send(field, value)
|
|
@@ -202,7 +202,7 @@ module ActiveMerchant #:nodoc:
|
|
|
202
202
|
|
|
203
203
|
def parse(body)
|
|
204
204
|
response = {}
|
|
205
|
-
Nokogiri::XML(CGI.unescapeHTML(body)).xpath(
|
|
205
|
+
Nokogiri::XML(CGI.unescapeHTML(body)).xpath('//trans_catalog/transaction/outputs').children.each do |node|
|
|
206
206
|
parse_element(response, node)
|
|
207
207
|
end
|
|
208
208
|
response
|
|
@@ -217,11 +217,11 @@ module ActiveMerchant #:nodoc:
|
|
|
217
217
|
end
|
|
218
218
|
|
|
219
219
|
def success_from(response)
|
|
220
|
-
response[:status] ==
|
|
220
|
+
response[:status] == 'Approved'
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
def message_from(succeeded, response)
|
|
224
|
-
succeeded ?
|
|
224
|
+
succeeded ? 'Succeeded' : error_message_from(response)
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
def authorization_from(request, response)
|
|
@@ -231,11 +231,11 @@ module ActiveMerchant #:nodoc:
|
|
|
231
231
|
end
|
|
232
232
|
|
|
233
233
|
def split_authorization(authorization)
|
|
234
|
-
authorization.split(
|
|
234
|
+
authorization.split('|')
|
|
235
235
|
end
|
|
236
236
|
|
|
237
237
|
def error_message_from(response)
|
|
238
|
-
if(response[:status] ==
|
|
238
|
+
if(response[:status] == 'Declined')
|
|
239
239
|
match = response[:result].match(/DECLINED:\d{10}:(.+):/)
|
|
240
240
|
match[1] if match
|
|
241
241
|
end
|