activemerchant 1.62.0 → 1.79.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +420 -2
- data/README.md +1 -2
- data/lib/active_merchant/billing/credit_card.rb +13 -14
- data/lib/active_merchant/billing/credit_card_methods.rb +3 -1
- data/lib/active_merchant/billing/gateway.rb +25 -9
- data/lib/active_merchant/billing/gateways/adyen.rb +299 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +168 -56
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +4 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +65 -22
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +87 -7
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +3 -8
- data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +49 -15
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +97 -2
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +14 -2
- data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +44 -14
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +0 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +4 -4
- data/lib/active_merchant/billing/gateways/creditcall.rb +71 -9
- data/lib/active_merchant/billing/gateways/credorax.rb +117 -5
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +54 -15
- data/lib/active_merchant/billing/gateways/data_cash.rb +12 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +0 -1
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +37 -95
- data/lib/active_merchant/billing/gateways/element.rb +11 -1
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -29
- data/lib/active_merchant/billing/gateways/first_pay.rb +12 -10
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +37 -20
- data/lib/active_merchant/billing/gateways/forte.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +55 -16
- data/lib/active_merchant/billing/gateways/global_transport.rb +16 -2
- data/lib/active_merchant/billing/gateways/hps.rb +12 -1
- data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +12 -9
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -2
- data/lib/active_merchant/billing/gateways/litle.rb +107 -30
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +11 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -4
- data/lib/active_merchant/billing/gateways/mercury.rb +14 -1
- data/lib/active_merchant/billing/gateways/migs.rb +28 -6
- data/lib/active_merchant/billing/gateways/moneris.rb +20 -12
- data/lib/active_merchant/billing/gateways/moneris_us.rb +11 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +60 -16
- data/lib/active_merchant/billing/gateways/netbilling.rb +0 -1
- data/lib/active_merchant/billing/gateways/nmi.rb +12 -1
- data/lib/active_merchant/billing/gateways/ogone.rb +1 -1
- data/lib/active_merchant/billing/gateways/omise.rb +9 -5
- data/lib/active_merchant/billing/gateways/openpay.rb +13 -0
- data/lib/active_merchant/billing/gateways/opp.rb +124 -114
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +14 -1
- data/lib/active_merchant/billing/gateways/orbital.rb +83 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +2 -2
- data/lib/active_merchant/billing/gateways/payeezy.rb +152 -46
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +24 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +3 -2
- data/lib/active_merchant/billing/gateways/paymentez.rb +276 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +18 -10
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +14 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +0 -12
- data/lib/active_merchant/billing/gateways/paystation.rb +14 -1
- data/lib/active_merchant/billing/gateways/payu_latam.rb +102 -62
- data/lib/active_merchant/billing/gateways/pin.rb +5 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +12 -1
- data/lib/active_merchant/billing/gateways/qbms.rb +11 -0
- data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +21 -17
- data/lib/active_merchant/billing/gateways/quickpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +60 -3
- data/lib/active_merchant/billing/gateways/realex.rb +16 -6
- data/lib/active_merchant/billing/gateways/redsys.rb +8 -2
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +8 -3
- data/lib/active_merchant/billing/gateways/sage_pay.rb +29 -13
- data/lib/active_merchant/billing/gateways/secure_net.rb +11 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +1 -1
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +53 -7
- data/lib/active_merchant/billing/gateways/stripe.rb +84 -26
- data/lib/active_merchant/billing/gateways/tns.rb +0 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +3 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +61 -26
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +114 -9
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +45 -22
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/wepay.rb +79 -46
- data/lib/active_merchant/billing/gateways/wirecard.rb +5 -4
- data/lib/active_merchant/billing/gateways/worldpay.rb +85 -20
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +27 -8
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/connection.rb +48 -12
- data/lib/active_merchant/net_http_ssl_connection.rb +9 -0
- data/lib/active_merchant/network_connection_retries.rb +6 -4
- data/lib/active_merchant/posts_data.rb +11 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -5
- data/lib/certs/cacert.pem +85 -0
- data/lib/support/ssl_version.rb +87 -0
- metadata +25 -9
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.79.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 6.x
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '4.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 6.x
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: i18n
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/active_merchant/billing/cvv_result.rb
|
162
162
|
- lib/active_merchant/billing/gateway.rb
|
163
163
|
- lib/active_merchant/billing/gateways.rb
|
164
|
+
- lib/active_merchant/billing/gateways/adyen.rb
|
164
165
|
- lib/active_merchant/billing/gateways/allied_wallet.rb
|
165
166
|
- lib/active_merchant/billing/gateways/authorize_net.rb
|
166
167
|
- lib/active_merchant/billing/gateways/authorize_net_arb.rb
|
@@ -170,7 +171,6 @@ files:
|
|
170
171
|
- lib/active_merchant/billing/gateways/bank_frick.rb
|
171
172
|
- lib/active_merchant/billing/gateways/banwire.rb
|
172
173
|
- lib/active_merchant/billing/gateways/barclaycard_smartpay.rb
|
173
|
-
- lib/active_merchant/billing/gateways/barclays_epdq.rb
|
174
174
|
- lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb
|
175
175
|
- lib/active_merchant/billing/gateways/be2bill.rb
|
176
176
|
- lib/active_merchant/billing/gateways/beanstream.rb
|
@@ -187,9 +187,11 @@ files:
|
|
187
187
|
- lib/active_merchant/billing/gateways/braintree_orange.rb
|
188
188
|
- lib/active_merchant/billing/gateways/bridge_pay.rb
|
189
189
|
- lib/active_merchant/billing/gateways/cams.rb
|
190
|
+
- lib/active_merchant/billing/gateways/card_connect.rb
|
190
191
|
- lib/active_merchant/billing/gateways/card_save.rb
|
191
192
|
- lib/active_merchant/billing/gateways/card_stream.rb
|
192
193
|
- lib/active_merchant/billing/gateways/cardknox.rb
|
194
|
+
- lib/active_merchant/billing/gateways/cardprocess.rb
|
193
195
|
- lib/active_merchant/billing/gateways/cashnet.rb
|
194
196
|
- lib/active_merchant/billing/gateways/cc5.rb
|
195
197
|
- lib/active_merchant/billing/gateways/cecabank.rb
|
@@ -202,9 +204,12 @@ files:
|
|
202
204
|
- lib/active_merchant/billing/gateways/conekta.rb
|
203
205
|
- lib/active_merchant/billing/gateways/creditcall.rb
|
204
206
|
- lib/active_merchant/billing/gateways/credorax.rb
|
207
|
+
- lib/active_merchant/billing/gateways/culqi.rb
|
205
208
|
- lib/active_merchant/billing/gateways/cyber_source.rb
|
206
209
|
- lib/active_merchant/billing/gateways/data_cash.rb
|
207
210
|
- lib/active_merchant/billing/gateways/dibs.rb
|
211
|
+
- lib/active_merchant/billing/gateways/digitzs.rb
|
212
|
+
- lib/active_merchant/billing/gateways/ebanx.rb
|
208
213
|
- lib/active_merchant/billing/gateways/efsnet.rb
|
209
214
|
- lib/active_merchant/billing/gateways/elavon.rb
|
210
215
|
- lib/active_merchant/billing/gateways/element.rb
|
@@ -240,13 +245,17 @@ files:
|
|
240
245
|
- lib/active_merchant/billing/gateways/ipp.rb
|
241
246
|
- lib/active_merchant/billing/gateways/iridium.rb
|
242
247
|
- lib/active_merchant/billing/gateways/itransact.rb
|
248
|
+
- lib/active_merchant/billing/gateways/iveri.rb
|
243
249
|
- lib/active_merchant/billing/gateways/jetpay.rb
|
250
|
+
- lib/active_merchant/billing/gateways/jetpay_v2.rb
|
244
251
|
- lib/active_merchant/billing/gateways/komoju.rb
|
252
|
+
- lib/active_merchant/billing/gateways/kushki.rb
|
245
253
|
- lib/active_merchant/billing/gateways/latitude19.rb
|
246
254
|
- lib/active_merchant/billing/gateways/linkpoint.rb
|
247
255
|
- lib/active_merchant/billing/gateways/litle.rb
|
248
256
|
- lib/active_merchant/billing/gateways/mastercard.rb
|
249
257
|
- lib/active_merchant/billing/gateways/maxipago.rb
|
258
|
+
- lib/active_merchant/billing/gateways/mercado_pago.rb
|
250
259
|
- lib/active_merchant/billing/gateways/merchant_e_solutions.rb
|
251
260
|
- lib/active_merchant/billing/gateways/merchant_one.rb
|
252
261
|
- lib/active_merchant/billing/gateways/merchant_partners.rb
|
@@ -264,6 +273,7 @@ files:
|
|
264
273
|
- lib/active_merchant/billing/gateways/moneris.rb
|
265
274
|
- lib/active_merchant/billing/gateways/moneris_us.rb
|
266
275
|
- lib/active_merchant/billing/gateways/money_movers.rb
|
276
|
+
- lib/active_merchant/billing/gateways/mundipagg.rb
|
267
277
|
- lib/active_merchant/billing/gateways/nab_transact.rb
|
268
278
|
- lib/active_merchant/billing/gateways/ncr_secure_pay.rb
|
269
279
|
- lib/active_merchant/billing/gateways/net_registry.rb
|
@@ -300,6 +310,7 @@ files:
|
|
300
310
|
- lib/active_merchant/billing/gateways/payflow_express_uk.rb
|
301
311
|
- lib/active_merchant/billing/gateways/payflow_uk.rb
|
302
312
|
- lib/active_merchant/billing/gateways/payment_express.rb
|
313
|
+
- lib/active_merchant/billing/gateways/paymentez.rb
|
303
314
|
- lib/active_merchant/billing/gateways/paymill.rb
|
304
315
|
- lib/active_merchant/billing/gateways/paypal.rb
|
305
316
|
- lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb
|
@@ -316,6 +327,7 @@ files:
|
|
316
327
|
- lib/active_merchant/billing/gateways/payway.rb
|
317
328
|
- lib/active_merchant/billing/gateways/pin.rb
|
318
329
|
- lib/active_merchant/billing/gateways/plugnpay.rb
|
330
|
+
- lib/active_merchant/billing/gateways/pro_pay.rb
|
319
331
|
- lib/active_merchant/billing/gateways/psigate.rb
|
320
332
|
- lib/active_merchant/billing/gateways/psl_card.rb
|
321
333
|
- lib/active_merchant/billing/gateways/qbms.rb
|
@@ -329,6 +341,7 @@ files:
|
|
329
341
|
- lib/active_merchant/billing/gateways/realex.rb
|
330
342
|
- lib/active_merchant/billing/gateways/redsys.rb
|
331
343
|
- lib/active_merchant/billing/gateways/s5.rb
|
344
|
+
- lib/active_merchant/billing/gateways/safe_charge.rb
|
332
345
|
- lib/active_merchant/billing/gateways/sage.rb
|
333
346
|
- lib/active_merchant/billing/gateways/sage_pay.rb
|
334
347
|
- lib/active_merchant/billing/gateways/sallie_mae.rb
|
@@ -350,6 +363,7 @@ files:
|
|
350
363
|
- lib/active_merchant/billing/gateways/transact_pro.rb
|
351
364
|
- lib/active_merchant/billing/gateways/transax.rb
|
352
365
|
- lib/active_merchant/billing/gateways/transnational.rb
|
366
|
+
- lib/active_merchant/billing/gateways/trexle.rb
|
353
367
|
- lib/active_merchant/billing/gateways/trust_commerce.rb
|
354
368
|
- lib/active_merchant/billing/gateways/usa_epay.rb
|
355
369
|
- lib/active_merchant/billing/gateways/usa_epay_advanced.rb
|
@@ -374,6 +388,7 @@ files:
|
|
374
388
|
- lib/active_merchant/country.rb
|
375
389
|
- lib/active_merchant/empty.rb
|
376
390
|
- lib/active_merchant/errors.rb
|
391
|
+
- lib/active_merchant/net_http_ssl_connection.rb
|
377
392
|
- lib/active_merchant/network_connection_retries.rb
|
378
393
|
- lib/active_merchant/post_data.rb
|
379
394
|
- lib/active_merchant/posts_data.rb
|
@@ -383,6 +398,7 @@ files:
|
|
383
398
|
- lib/support/gateway_support.rb
|
384
399
|
- lib/support/outbound_hosts.rb
|
385
400
|
- lib/support/ssl_verify.rb
|
401
|
+
- lib/support/ssl_version.rb
|
386
402
|
homepage: http://activemerchant.org/
|
387
403
|
licenses:
|
388
404
|
- MIT
|
@@ -395,7 +411,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
395
411
|
requirements:
|
396
412
|
- - ">="
|
397
413
|
- !ruby/object:Gem::Version
|
398
|
-
version: '2'
|
414
|
+
version: '2.1'
|
399
415
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
400
416
|
requirements:
|
401
417
|
- - ">="
|
@@ -403,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
403
419
|
version: '0'
|
404
420
|
requirements: []
|
405
421
|
rubyforge_project: activemerchant
|
406
|
-
rubygems_version: 2.
|
422
|
+
rubygems_version: 2.6.14
|
407
423
|
signing_key:
|
408
424
|
specification_version: 4
|
409
425
|
summary: Framework and tools for dealing with credit card transactions.
|
@@ -1,314 +0,0 @@
|
|
1
|
-
module ActiveMerchant #:nodoc:
|
2
|
-
module Billing #:nodoc:
|
3
|
-
class BarclaysEpdqGateway < Gateway
|
4
|
-
self.test_url = 'https://secure2.mde.epdq.co.uk:11500'
|
5
|
-
self.live_url = 'https://secure2.epdq.co.uk:11500'
|
6
|
-
|
7
|
-
self.supported_countries = ['GB']
|
8
|
-
self.default_currency = 'GBP'
|
9
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :maestro, :switch ]
|
10
|
-
self.money_format = :cents
|
11
|
-
self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-mpi/'
|
12
|
-
self.display_name = 'Barclays ePDQ MPI'
|
13
|
-
|
14
|
-
def initialize(options = {})
|
15
|
-
requires!(options, :login, :password, :client_id)
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def authorize(money, creditcard, options = {})
|
20
|
-
document = Document.new(self, @options) do
|
21
|
-
add_order_form(options[:order_id]) do
|
22
|
-
add_consumer(options) do
|
23
|
-
add_creditcard(creditcard)
|
24
|
-
end
|
25
|
-
add_transaction(:PreAuth, money)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
commit(document)
|
30
|
-
end
|
31
|
-
|
32
|
-
def purchase(money, creditcard, options = {})
|
33
|
-
# disable fraud checks if this is a repeat order:
|
34
|
-
if options[:payment_number] && (options[:payment_number] > 1)
|
35
|
-
no_fraud = true
|
36
|
-
else
|
37
|
-
no_fraud = options[:no_fraud]
|
38
|
-
end
|
39
|
-
document = Document.new(self, @options, :no_fraud => no_fraud) do
|
40
|
-
add_order_form(options[:order_id], options[:group_id]) do
|
41
|
-
add_consumer(options) do
|
42
|
-
add_creditcard(creditcard)
|
43
|
-
end
|
44
|
-
add_transaction(:Auth, money, options)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
commit(document)
|
48
|
-
end
|
49
|
-
|
50
|
-
# authorization is your unique order ID, not the authorization
|
51
|
-
# code returned by ePDQ
|
52
|
-
def capture(money, authorization, options = {})
|
53
|
-
document = Document.new(self, @options) do
|
54
|
-
add_order_form(authorization) do
|
55
|
-
add_transaction(:PostAuth, money)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
commit(document)
|
60
|
-
end
|
61
|
-
|
62
|
-
# authorization is your unique order ID, not the authorization
|
63
|
-
# code returned by ePDQ
|
64
|
-
def credit(money, creditcard_or_authorization, options = {})
|
65
|
-
if creditcard_or_authorization.is_a?(String)
|
66
|
-
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
67
|
-
refund(money, creditcard_or_authorization, options)
|
68
|
-
else
|
69
|
-
credit_new_order(money, creditcard_or_authorization, options)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def refund(money, authorization, options = {})
|
74
|
-
credit_existing_order(money, authorization, options)
|
75
|
-
end
|
76
|
-
|
77
|
-
def void(authorization, options = {})
|
78
|
-
document = Document.new(self, @options) do
|
79
|
-
add_order_form(authorization) do
|
80
|
-
add_transaction(:Void)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
commit(document)
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
def credit_new_order(money, creditcard, options)
|
89
|
-
document = Document.new(self, @options) do
|
90
|
-
add_order_form do
|
91
|
-
add_consumer(options) do
|
92
|
-
add_creditcard(creditcard)
|
93
|
-
end
|
94
|
-
add_transaction(:Credit, money)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
commit(document)
|
99
|
-
end
|
100
|
-
|
101
|
-
def credit_existing_order(money, authorization, options)
|
102
|
-
order_id, _ = authorization.split(":")
|
103
|
-
document = Document.new(self, @options) do
|
104
|
-
add_order_form(order_id) do
|
105
|
-
add_transaction(:Credit, money)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
commit(document)
|
110
|
-
end
|
111
|
-
|
112
|
-
def parse(body)
|
113
|
-
parser = Parser.new(body)
|
114
|
-
response = parser.parse
|
115
|
-
Response.new(response[:success], response[:message], response,
|
116
|
-
:test => test?,
|
117
|
-
:authorization => response[:authorization],
|
118
|
-
:avs_result => response[:avsresponse],
|
119
|
-
:cvv_result => response[:cvv_result],
|
120
|
-
:order_id => response[:order_id],
|
121
|
-
:raw_response => response[:raw_response]
|
122
|
-
)
|
123
|
-
end
|
124
|
-
|
125
|
-
def commit(document)
|
126
|
-
url = (test? ? self.test_url : self.live_url)
|
127
|
-
data = ssl_post(url, document.to_xml)
|
128
|
-
parse(data)
|
129
|
-
end
|
130
|
-
|
131
|
-
class Parser
|
132
|
-
def initialize(response)
|
133
|
-
@response = response
|
134
|
-
end
|
135
|
-
|
136
|
-
def parse
|
137
|
-
require 'iconv' unless String.method_defined?(:encode)
|
138
|
-
if String.method_defined?(:encode)
|
139
|
-
doc = REXML::Document.new(@response.encode("UTF-8", "ISO-8859-1"))
|
140
|
-
else
|
141
|
-
ic = Iconv.new('UTF-8', 'ISO-8859-1')
|
142
|
-
doc = REXML::Document.new(ic.iconv(@response))
|
143
|
-
end
|
144
|
-
|
145
|
-
auth_type = find(doc, "//Transaction/Type").to_s
|
146
|
-
|
147
|
-
message = find(doc, "//Message/Text")
|
148
|
-
if message.blank?
|
149
|
-
message = find(doc, "//Transaction/CardProcResp/CcReturnMsg")
|
150
|
-
end
|
151
|
-
|
152
|
-
case auth_type
|
153
|
-
when 'Credit', 'Void'
|
154
|
-
success = find(doc, "//CcReturnMsg") == "Approved."
|
155
|
-
else
|
156
|
-
success = find(doc, "//Transaction/AuthCode").present?
|
157
|
-
end
|
158
|
-
|
159
|
-
{
|
160
|
-
:success => success,
|
161
|
-
:message => message,
|
162
|
-
:transaction_id => find(doc, "//Transaction/Id"),
|
163
|
-
:avs_result => find(doc, "//Transaction/AvsRespCode"),
|
164
|
-
:cvv_result => find(doc, "//Transaction/Cvv2Resp"),
|
165
|
-
:authorization => find(doc, "//OrderFormDoc/Id"),
|
166
|
-
:raw_response => @response
|
167
|
-
}
|
168
|
-
end
|
169
|
-
|
170
|
-
def find(doc, xpath)
|
171
|
-
REXML::XPath.first(doc, xpath).try(:text)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
class Document
|
176
|
-
attr_reader :type, :xml
|
177
|
-
|
178
|
-
PAYMENT_INTERVALS = {
|
179
|
-
:days => 'D',
|
180
|
-
:months => 'M'
|
181
|
-
}
|
182
|
-
|
183
|
-
EPDQ_CARD_TYPES = {
|
184
|
-
:visa => 1,
|
185
|
-
:master => 2,
|
186
|
-
:switch => 9,
|
187
|
-
:maestro => 10,
|
188
|
-
}
|
189
|
-
|
190
|
-
def initialize(gateway, options = {}, document_options = {}, &block)
|
191
|
-
@gateway = gateway
|
192
|
-
@options = options
|
193
|
-
@document_options = document_options
|
194
|
-
@xml = Builder::XmlMarkup.new(:indent => 2)
|
195
|
-
build(&block)
|
196
|
-
end
|
197
|
-
|
198
|
-
def to_xml
|
199
|
-
@xml.target!
|
200
|
-
end
|
201
|
-
|
202
|
-
def build(&block)
|
203
|
-
xml.instruct!(:xml, :version => '1.0')
|
204
|
-
xml.EngineDocList do
|
205
|
-
xml.DocVersion "1.0"
|
206
|
-
xml.EngineDoc do
|
207
|
-
xml.ContentType "OrderFormDoc"
|
208
|
-
xml.User do
|
209
|
-
xml.Name(@options[:login])
|
210
|
-
xml.Password(@options[:password])
|
211
|
-
xml.ClientId({ :DataType => "S32" }, @options[:client_id])
|
212
|
-
end
|
213
|
-
xml.Instructions do
|
214
|
-
if @document_options[:no_fraud]
|
215
|
-
xml.Pipeline "PaymentNoFraud"
|
216
|
-
else
|
217
|
-
xml.Pipeline "Payment"
|
218
|
-
end
|
219
|
-
end
|
220
|
-
instance_eval(&block)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def add_order_form(order_id=nil, group_id=nil, &block)
|
226
|
-
xml.OrderFormDoc do
|
227
|
-
xml.Mode 'P'
|
228
|
-
xml.Id(order_id) if order_id
|
229
|
-
xml.GroupId(group_id) if group_id
|
230
|
-
instance_eval(&block)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
def add_consumer(options=nil, &block)
|
235
|
-
xml.Consumer do
|
236
|
-
if options
|
237
|
-
xml.Email(options[:email]) if options[:email]
|
238
|
-
billing_address = options[:billing_address] || options[:address]
|
239
|
-
if billing_address
|
240
|
-
xml.BillTo do
|
241
|
-
xml.Location do
|
242
|
-
xml.Address do
|
243
|
-
xml.Street1 billing_address[:address1]
|
244
|
-
xml.Street2 billing_address[:address2]
|
245
|
-
xml.City billing_address[:city]
|
246
|
-
xml.StateProv billing_address[:state]
|
247
|
-
xml.PostalCode billing_address[:zip]
|
248
|
-
xml.Country billing_address[:country_code]
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
instance_eval(&block)
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
def add_creditcard(creditcard)
|
259
|
-
xml.PaymentMech do
|
260
|
-
xml.CreditCard do
|
261
|
-
xml.Type({ :DataType => 'S32' }, EPDQ_CARD_TYPES[creditcard.brand.to_sym])
|
262
|
-
xml.Number creditcard.number
|
263
|
-
xml.Expires({ :DataType => 'ExpirationDate', :Locale => 826 }, format_expiry_date(creditcard))
|
264
|
-
if creditcard.verification_value.present?
|
265
|
-
xml.Cvv2Indicator 1
|
266
|
-
xml.Cvv2Val creditcard.verification_value
|
267
|
-
else
|
268
|
-
xml.Cvv2Indicator 5
|
269
|
-
end
|
270
|
-
xml.IssueNum(creditcard.issue_number) if creditcard.issue_number.present?
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
def add_transaction(auth_type, amount = nil, options = {})
|
276
|
-
@auth_type = auth_type
|
277
|
-
xml.Transaction do
|
278
|
-
xml.Type @auth_type.to_s
|
279
|
-
if options[:payment_number] && options[:payment_number] > 1
|
280
|
-
xml.CardholderPresentCode({ :DataType => 'S32' }, 8)
|
281
|
-
else
|
282
|
-
xml.CardholderPresentCode({ :DataType => 'S32' }, 7)
|
283
|
-
end
|
284
|
-
if options[:payment_number]
|
285
|
-
xml.PaymentNumber({ :DataType => 'S32' }, options[:payment_number])
|
286
|
-
end
|
287
|
-
if options[:total_payments]
|
288
|
-
xml.TotalNumberPayments({ :DataType => 'S32' }, options[:total_payments])
|
289
|
-
end
|
290
|
-
if amount
|
291
|
-
xml.CurrentTotals do
|
292
|
-
xml.Totals do
|
293
|
-
xml.Total({ :DataType => 'Money', :Currency => 826 }, amount)
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
# date must be formatted MM/YY
|
301
|
-
def format_expiry_date(creditcard)
|
302
|
-
month_str = "%02d" % creditcard.month
|
303
|
-
if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
|
304
|
-
year_str = "%02d" % match[1].to_i
|
305
|
-
else
|
306
|
-
year_str = "%02d" % creditcard.year
|
307
|
-
end
|
308
|
-
"#{month_str}/#{year_str}"
|
309
|
-
end
|
310
|
-
end
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|