activemerchant 1.28.0 → 1.29.1

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.
Files changed (117) hide show
  1. data/CHANGELOG +41 -0
  2. data/CONTRIBUTORS +12 -0
  3. data/README.md +6 -0
  4. data/lib/active_merchant/billing/gateway.rb +2 -1
  5. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  6. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  7. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  8. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  9. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  10. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  11. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  12. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  13. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  14. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  15. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  16. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  17. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  18. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  19. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  20. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  21. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  22. data/lib/active_merchant/billing/gateways/eway_rapid.rb +300 -0
  23. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  24. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  25. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  26. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  27. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  28. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  29. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  30. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  31. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  32. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  33. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  34. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  35. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  36. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  37. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  38. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  39. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  40. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  41. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  42. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  43. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  44. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  45. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  46. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  47. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  48. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  50. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  51. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  54. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  55. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  56. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  57. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  58. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  59. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  62. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  63. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  64. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  65. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  66. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  67. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  68. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  69. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  70. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  71. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  72. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  75. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  76. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  77. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  78. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  79. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  80. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  81. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  82. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  83. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  84. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  85. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  86. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  87. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  88. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  89. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  90. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  91. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  92. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  93. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  94. data/lib/active_merchant/billing/gateways.rb +6 -7
  95. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  99. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  102. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  103. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
  104. data/lib/active_merchant/billing/integrations/notification.rb +4 -0
  105. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  110. data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
  111. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
  112. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
  113. data/lib/active_merchant/billing/response.rb +17 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. data.tar.gz.sig +0 -0
  116. metadata +46 -27
  117. metadata.gz.sig +0 -0
@@ -8,9 +8,9 @@ module ActiveMerchant
8
8
  # usable:
9
9
  # American Express, ATM, Carte Blanche, Diners Club, Discover,
10
10
  # EnRoute, GE Capital, JCB, Laser, Maestro, Mastercard, Solo,
11
- # Switch, Visa, Visa Delta, VISA Electron, Visa Purchasing
11
+ # Switch, Visa, Visa Delta, VISA Electron, Visa Purchasing
12
12
  #
13
- # Note continuous authority is only supported for :visa, :master and :american_express card types
13
+ # Note continuous authority is only supported for :visa, :master and :american_express card types
14
14
  self.supported_cardtypes = [ :visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro, :switch, :solo, :laser ]
15
15
 
16
16
  self.homepage_url = 'http://www.datacash.com/'
@@ -37,24 +37,23 @@ module ActiveMerchant
37
37
  DATACASH_SUCCESS = '1'
38
38
 
39
39
  # Creates a new DataCashGateway
40
- #
40
+ #
41
41
  # The gateway requires that a valid login and password be passed
42
42
  # in the +options+ hash.
43
- #
43
+ #
44
44
  # ==== Options
45
45
  #
46
46
  # * <tt>:login</tt> -- The Datacash account login.
47
47
  # * <tt>:password</tt> -- The Datacash account password.
48
48
  # * <tt>:test => +true+ or +false+</tt> -- Use the test or live Datacash url.
49
- #
49
+ #
50
50
  def initialize(options = {})
51
51
  requires!(options, :login, :password)
52
- @options = options
53
52
  super
54
53
  end
55
54
 
56
55
  # Perform a purchase, which is essentially an authorization and capture in a single operation.
57
- #
56
+ #
58
57
  # ==== Parameters
59
58
  # * <tt>money</tt> The amount to be authorized as an Integer value in cents.
60
59
  # * <tt>authorization_or_credit_card</tt>:: The continuous authority reference or CreditCard details for the transaction.
@@ -62,8 +61,8 @@ module ActiveMerchant
62
61
  # * <tt>:order_id</tt> A unique reference for this order (corresponds to merchantreference in datacash documentation)
63
62
  # * <tt>:set_up_continuous_authority</tt>
64
63
  # Set to true to set up a recurring historic transaction account be set up.
65
- # Only supported for :visa, :master and :american_express card types
66
- # See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
64
+ # Only supported for :visa, :master and :american_express card types
65
+ # See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
67
66
  # * <tt>:address</tt>:: billing address for card
68
67
  #
69
68
  # The continuous authority reference will be available in response#params['ca_referece'] if you have requested one
@@ -79,7 +78,7 @@ module ActiveMerchant
79
78
  commit(request)
80
79
  end
81
80
 
82
- # Performs an authorization, which reserves the funds on the customer's credit card, but does not
81
+ # Performs an authorization, which reserves the funds on the customer's credit card, but does not
83
82
  # charge the card.
84
83
  #
85
84
  # ==== Parameters
@@ -90,8 +89,8 @@ module ActiveMerchant
90
89
  # * <tt>:order_id</tt> A unique reference for this order (corresponds to merchantreference in datacash documentation)
91
90
  # * <tt>:set_up_continuous_authority</tt>::
92
91
  # Set to true to set up a recurring historic transaction account be set up.
93
- # Only supported for :visa, :master and :american_express card types
94
- # See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
92
+ # Only supported for :visa, :master and :american_express card types
93
+ # See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
95
94
  # * <tt>:address</tt>:: billing address for card
96
95
  #
97
96
  # The continuous authority reference will be available in response#params['ca_referece'] if you have requested one
@@ -108,20 +107,20 @@ module ActiveMerchant
108
107
  end
109
108
 
110
109
  # Captures the funds from an authorized transaction.
111
- #
110
+ #
112
111
  # ==== Parameters
113
112
  #
114
113
  # * <tt>money</tt> -- The amount to be captured as anInteger value in cents.
115
- # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
114
+ # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
116
115
  def capture(money, authorization, options = {})
117
116
  commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))
118
- end
117
+ end
119
118
 
120
119
  # Void a previous transaction
121
- #
120
+ #
122
121
  # ==== Parameters
123
122
  #
124
- # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
123
+ # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
125
124
  def void(authorization, options = {})
126
125
  request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)
127
126
 
@@ -129,7 +128,7 @@ module ActiveMerchant
129
128
  end
130
129
 
131
130
  # Refund to a card
132
- #
131
+ #
133
132
  # ==== Parameters
134
133
  #
135
134
  # * <tt>money</tt> The amount to be refunded as an Integer value in cents. Set to nil for a full refund on existing transaction.
@@ -151,14 +150,9 @@ module ActiveMerchant
151
150
  commit(build_transaction_refund_request(money, reference))
152
151
  end
153
152
 
154
- # Is the gateway running in test mode?
155
- def test?
156
- @options[:test] || super
157
- end
158
-
159
- private
153
+ private
160
154
  # Create the xml document for a 'cancel' or 'fulfill' transaction.
161
- #
155
+ #
162
156
  # Final XML should look like:
163
157
  # <Request>
164
158
  # <Authentication>
@@ -176,14 +170,14 @@ module ActiveMerchant
176
170
  # </HistoricTxn>
177
171
  # </Transaction>
178
172
  # </Request>
179
- #
173
+ #
180
174
  # Parameters:
181
175
  # * <tt>type</tt> must be FULFILL_TYPE or CANCEL_TYPE
182
176
  # * <tt>money</tt> - optional - Integer value in cents
183
177
  # * <tt>authorization</tt> - the Datacash authorization from a previous succesful authorize transaction
184
178
  # * <tt>options</tt>
185
179
  # * <tt>order_id</tt> - A unique reference for the transaction
186
- #
180
+ #
187
181
  # Returns:
188
182
  # -Builder xml document
189
183
  #
@@ -194,14 +188,14 @@ module ActiveMerchant
194
188
  xml.instruct!
195
189
  xml.tag! :Request do
196
190
  add_authentication(xml)
197
-
191
+
198
192
  xml.tag! :Transaction do
199
193
  xml.tag! :HistoricTxn do
200
194
  xml.tag! :reference, reference
201
195
  xml.tag! :authcode, auth_code
202
196
  xml.tag! :method, type
203
197
  end
204
-
198
+
205
199
  if money
206
200
  xml.tag! :TxnDetails do
207
201
  xml.tag! :merchantreference, format_reference_number(options[:order_id])
@@ -214,9 +208,9 @@ module ActiveMerchant
214
208
  end
215
209
 
216
210
  # Create the xml document for an 'auth' or 'pre' transaction with a credit card
217
- #
211
+ #
218
212
  # Final XML should look like:
219
- #
213
+ #
220
214
  # <Request>
221
215
  # <Authentication>
222
216
  # <client>99000000</client>
@@ -261,7 +255,7 @@ module ActiveMerchant
261
255
  # </CardTxn>
262
256
  # </Transaction>
263
257
  # </Request>
264
- #
258
+ #
265
259
  # Parameters:
266
260
  # -type must be 'auth' or 'pre'
267
261
  # -money - A money object with the price and currency
@@ -270,7 +264,7 @@ module ActiveMerchant
270
264
  # :order_id is the merchant reference number
271
265
  # :billing_address is the billing address for the cc
272
266
  # :address is the delivery address
273
- #
267
+ #
274
268
  # Returns:
275
269
  # -xml: Builder document containing the markup
276
270
  #
@@ -279,7 +273,7 @@ module ActiveMerchant
279
273
  xml.instruct!
280
274
  xml.tag! :Request do
281
275
  add_authentication(xml)
282
-
276
+
283
277
  xml.tag! :Transaction do
284
278
  if options[:set_up_continuous_authority]
285
279
  xml.tag! :ContAuthTxn, :type => 'setup'
@@ -299,35 +293,35 @@ module ActiveMerchant
299
293
 
300
294
  # Create the xml document for an 'auth' or 'pre' transaction with
301
295
  # continuous authorization
302
- #
296
+ #
303
297
  # Final XML should look like:
304
- #
305
- # <Request>
306
- # <Transaction>
307
- # <ContAuthTxn type="historic" />
308
- # <TxnDetails>
309
- # <merchantreference>3851231</merchantreference>
310
- # <capturemethod>cont_auth</capturemethod>
311
- # <amount currency="GBP">18.50</amount>
312
- # </TxnDetails>
313
- # <HistoricTxn>
314
- # <reference>4500200040925092</reference>
315
- # <method>auth</method>
316
- # </HistoricTxn>
317
- # </Transaction>
318
- # <Authentication>
319
- # <client>99000001</client>
320
- # <password>mypasswd</password>
321
- # </Authentication>
298
+ #
299
+ # <Request>
300
+ # <Transaction>
301
+ # <ContAuthTxn type="historic" />
302
+ # <TxnDetails>
303
+ # <merchantreference>3851231</merchantreference>
304
+ # <capturemethod>cont_auth</capturemethod>
305
+ # <amount currency="GBP">18.50</amount>
306
+ # </TxnDetails>
307
+ # <HistoricTxn>
308
+ # <reference>4500200040925092</reference>
309
+ # <method>auth</method>
310
+ # </HistoricTxn>
311
+ # </Transaction>
312
+ # <Authentication>
313
+ # <client>99000001</client>
314
+ # <password>mypasswd</password>
315
+ # </Authentication>
322
316
  # </Request>
323
- #
317
+ #
324
318
  # Parameters:
325
319
  # -type must be 'auth' or 'pre'
326
320
  # -money - A money object with the price and currency
327
321
  # -authorization - The authorization containing a continuous authority reference previously set up on a credit card
328
322
  # -options:
329
323
  # :order_id is the merchant reference number
330
- #
324
+ #
331
325
  # Returns:
332
326
  # -xml: Builder document containing the markup
333
327
  #
@@ -356,25 +350,25 @@ module ActiveMerchant
356
350
  end
357
351
 
358
352
  # Create the xml document for a full or partial refund transaction with
359
- #
353
+ #
360
354
  # Final XML should look like:
361
355
  #
362
- # <Request>
363
- # <Authentication>
364
- # <client>99000001</client>
365
- # <password>*******</password>
366
- # </Authentication>
367
- # <Transaction>
368
- # <HistoricTxn>
369
- # <method>txn_refund</method>
370
- # <reference>12345678</reference>
371
- # </HistoricTxn>
372
- # <TxnDetails>
373
- # <amount>10.00</amount>
374
- # </TxnDetails>
356
+ # <Request>
357
+ # <Authentication>
358
+ # <client>99000001</client>
359
+ # <password>*******</password>
360
+ # </Authentication>
361
+ # <Transaction>
362
+ # <HistoricTxn>
363
+ # <method>txn_refund</method>
364
+ # <reference>12345678</reference>
365
+ # </HistoricTxn>
366
+ # <TxnDetails>
367
+ # <amount>10.00</amount>
368
+ # </TxnDetails>
375
369
  # </Transaction>
376
- # </Request>
377
- #
370
+ # </Request>
371
+ #
378
372
  def build_transaction_refund_request(money, reference)
379
373
  xml = Builder::XmlMarkup.new :indent => 2
380
374
  xml.instruct!
@@ -396,27 +390,27 @@ module ActiveMerchant
396
390
  end
397
391
 
398
392
  # Create the xml document for a full or partial refund with
399
- #
393
+ #
400
394
  # Final XML should look like:
401
395
  #
402
- # <Request>
403
- # <Authentication>
404
- # <client>99000001</client>
405
- # <password>*****</password>
406
- # </Authentication>
407
- # <Transaction>
408
- # <CardTxn>
409
- # <Card>
410
- # <pan>633300*********1</pan>
411
- # <expirydate>04/06</expirydate>
412
- # <startdate>01/04</startdate>
413
- # </Card>
414
- # <method>refund</method>
415
- # </CardTxn>
416
- # <TxnDetails>
417
- # <merchantreference>1000001</merchantreference>
418
- # <amount currency="GBP">95.99</amount>
419
- # </TxnDetails>
396
+ # <Request>
397
+ # <Authentication>
398
+ # <client>99000001</client>
399
+ # <password>*****</password>
400
+ # </Authentication>
401
+ # <Transaction>
402
+ # <CardTxn>
403
+ # <Card>
404
+ # <pan>633300*********1</pan>
405
+ # <expirydate>04/06</expirydate>
406
+ # <startdate>01/04</startdate>
407
+ # </Card>
408
+ # <method>refund</method>
409
+ # </CardTxn>
410
+ # <TxnDetails>
411
+ # <merchantreference>1000001</merchantreference>
412
+ # <amount currency="GBP">95.99</amount>
413
+ # </TxnDetails>
420
414
  # </Transaction>
421
415
  # </Request>
422
416
  def build_refund_request(money, credit_card, options)
@@ -440,13 +434,13 @@ module ActiveMerchant
440
434
 
441
435
 
442
436
  # Adds the authentication element to the passed builder xml doc
443
- #
437
+ #
444
438
  # Parameters:
445
439
  # -xml: Builder document that is being built up
446
- #
440
+ #
447
441
  # Returns:
448
442
  # -none: The results is stored in the passed xml document
449
- #
443
+ #
450
444
  def add_authentication(xml)
451
445
  xml.tag! :Authentication do
452
446
  xml.tag! :client, @options[:login]
@@ -455,17 +449,17 @@ module ActiveMerchant
455
449
  end
456
450
 
457
451
  # Add credit_card detals to the passed XML Builder doc
458
- #
452
+ #
459
453
  # Parameters:
460
454
  # -xml: Builder document that is being built up
461
455
  # -credit_card: ActiveMerchant::Billing::CreditCard object
462
456
  # -billing_address: Hash containing all of the billing address details
463
- #
457
+ #
464
458
  # Returns:
465
459
  # -none: The results is stored in the passed xml document
466
- #
460
+ #
467
461
  def add_credit_card(xml, credit_card, address)
468
-
462
+
469
463
  xml.tag! :Card do
470
464
 
471
465
  # DataCash calls the CC number 'pan'
@@ -474,7 +468,7 @@ module ActiveMerchant
474
468
 
475
469
  # optional values - for Solo etc
476
470
  if [ 'switch', 'solo' ].include?(card_brand(credit_card).to_s)
477
-
471
+
478
472
  xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?
479
473
 
480
474
  if !credit_card.start_month.blank? && !credit_card.start_year.blank?
@@ -492,14 +486,14 @@ module ActiveMerchant
492
486
  xml.tag! :postcode, address[:zip] unless address[:zip].blank?
493
487
  end
494
488
 
495
- # The ExtendedPolicy defines what to do when the passed data
489
+ # The ExtendedPolicy defines what to do when the passed data
496
490
  # matches, or not...
497
- #
491
+ #
498
492
  # All of the following elements MUST be present for the
499
493
  # xml to be valid (or can drop the ExtendedPolicy and use
500
494
  # a predefined one
501
495
  xml.tag! :ExtendedPolicy do
502
- xml.tag! :cv2_policy,
496
+ xml.tag! :cv2_policy,
503
497
  :notprovided => POLICY_REJECT,
504
498
  :notchecked => POLICY_REJECT,
505
499
  :matched => POLICY_ACCEPT,
@@ -511,7 +505,7 @@ module ActiveMerchant
511
505
  :matched => POLICY_ACCEPT,
512
506
  :notmatched => POLICY_REJECT,
513
507
  :partialmatch => POLICY_ACCEPT
514
- xml.tag! :address_policy,
508
+ xml.tag! :address_policy,
515
509
  :notprovided => POLICY_ACCEPT,
516
510
  :notchecked => POLICY_ACCEPT,
517
511
  :matched => POLICY_ACCEPT,
@@ -523,15 +517,15 @@ module ActiveMerchant
523
517
  end
524
518
 
525
519
  # Send the passed data to DataCash for processing
526
- #
520
+ #
527
521
  # Parameters:
528
522
  # -request: The XML data that is to be sent to Datacash
529
- #
523
+ #
530
524
  # Returns:
531
525
  # - ActiveMerchant::Billing::Response object
532
- #
526
+ #
533
527
  def commit(request)
534
- response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
528
+ response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
535
529
 
536
530
  Response.new(response[:status] == DATACASH_SUCCESS, response[:reason], response,
537
531
  :test => test?,
@@ -540,11 +534,11 @@ module ActiveMerchant
540
534
  end
541
535
 
542
536
  # Returns a date string in the format Datacash expects
543
- #
537
+ #
544
538
  # Parameters:
545
539
  # -month: integer, the month
546
540
  # -year: integer, the year
547
- #
541
+ #
548
542
  # Returns:
549
543
  # -String: date in MM/YY format
550
544
  #
@@ -556,10 +550,10 @@ module ActiveMerchant
556
550
  #
557
551
  # Parameters:
558
552
  # -body: The XML returned from Datacash
559
- #
553
+ #
560
554
  # Returns:
561
555
  # -a hash with all of the values returned in the Datacash XML response
562
- #
556
+ #
563
557
  def parse(body)
564
558
 
565
559
  response = {}
@@ -571,14 +565,14 @@ module ActiveMerchant
571
565
  end
572
566
 
573
567
  response
574
- end
568
+ end
575
569
 
576
570
  # Parse an xml element
577
571
  #
578
572
  # Parameters:
579
573
  # -response: The hash that the values are being returned in
580
574
  # -node: The node that is currently being read
581
- #
575
+ #
582
576
  # Returns:
583
577
  # - none (results are stored in the passed hash)
584
578
  def parse_element(response, node)
@@ -8,22 +8,17 @@ module ActiveMerchant #:nodoc:
8
8
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
9
9
  self.homepage_url = 'http://www.concordefsnet.com/'
10
10
  self.display_name = 'Efsnet'
11
-
11
+
12
12
  self.test_url = 'https://testefsnet.concordebiz.com/efsnet.dll'
13
13
  self.live_url = 'https://efsnet.concordebiz.com/efsnet.dll'
14
-
14
+
15
15
  # login is your Store ID
16
16
  # password is your Store Key
17
17
  def initialize(options = {})
18
18
  requires!(options, :login, :password)
19
- @options = options
20
- super
21
- end
22
-
23
- def test?
24
- @options[:test] || super
19
+ super
25
20
  end
26
-
21
+
27
22
  def authorize(money, creditcard, options = {})
28
23
  request = build_credit_card_request(money, creditcard, options)
29
24
  commit(:credit_card_authorize, request)
@@ -33,7 +28,7 @@ module ActiveMerchant #:nodoc:
33
28
  request = build_credit_card_request(money, creditcard, options)
34
29
  commit(:credit_card_charge, request)
35
30
  end
36
-
31
+
37
32
  def capture(money, identification, options = {})
38
33
  request = build_refund_or_settle_request(money, identification, options)
39
34
  commit(:credit_card_settle, request)
@@ -62,28 +57,28 @@ module ActiveMerchant #:nodoc:
62
57
  original_transaction_id, original_transaction_amount = identification.split(";")
63
58
  commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :transaction_id => original_transaction_id})
64
59
  end
65
-
60
+
66
61
  def voice_authorize(money, authorization_code, creditcard, options = {})
67
62
  options[:authorization_number] = authorization_code
68
63
  request = build_credit_card_request(money, creditcard, options)
69
64
  commit(:credit_card_voice_authorize, request)
70
65
  end
71
-
66
+
72
67
  def force(money, authorization_code, creditcard, options = {})
73
68
  options[:authorization_number] = authorization_code
74
69
  request = build_credit_card_request(money, creditcard, options)
75
70
  commit(:credit_card_capture, request)
76
71
  end
77
-
72
+
78
73
  def system_check
79
- commit(:system_check, {})
74
+ commit(:system_check, {})
80
75
  end
81
76
 
82
77
  private
83
78
 
84
79
  def build_refund_or_settle_request(money, identification, options = {})
85
80
  original_transaction_id, original_transaction_amount = identification.split(";")
86
-
81
+
87
82
  requires!(options, :order_id)
88
83
 
89
84
  post = {
@@ -94,7 +89,7 @@ module ActiveMerchant #:nodoc:
94
89
  :client_ip_address => options[:ip]
95
90
  }
96
91
  end
97
-
92
+
98
93
  def build_credit_card_request(money, creditcard, options = {})
99
94
  requires!(options, :order_id)
100
95
 
@@ -103,17 +98,17 @@ module ActiveMerchant #:nodoc:
103
98
  :authorization_number => options[:authorization_number],
104
99
  :transaction_amount => amount(money),
105
100
  :client_ip_address => options[:ip]
106
-
101
+
107
102
  }
108
103
  add_creditcard(post,creditcard)
109
104
  add_address(post,options)
110
105
  post
111
106
  end
112
-
107
+
113
108
  def format_reference_number(number)
114
109
  number.to_s.slice(0,12)
115
110
  end
116
-
111
+
117
112
  def add_address(post,options)
118
113
  if address = options[:billing_address] || options[:address]
119
114
  if address[:address2]
@@ -123,7 +118,7 @@ module ActiveMerchant #:nodoc:
123
118
  end
124
119
  post[:billing_city] = address[:city].to_s
125
120
  post[:billing_state] = address[:state].blank? ? 'n/a' : address[:state]
126
- post[:billing_postal_code] = address[:zip].to_s
121
+ post[:billing_postal_code] = address[:zip].to_s
127
122
  post[:billing_country] = address[:country].to_s
128
123
  end
129
124
 
@@ -135,12 +130,12 @@ module ActiveMerchant #:nodoc:
135
130
  end
136
131
  post[:shipping_city] = address[:city].to_s
137
132
  post[:shipping_state] = address[:state].blank? ? 'n/a' : address[:state]
138
- post[:shipping_postal_code] = address[:zip].to_s
133
+ post[:shipping_postal_code] = address[:zip].to_s
139
134
  post[:shipping_country] = address[:country].to_s
140
135
  end
141
136
  end
142
137
 
143
- def add_creditcard(post, creditcard)
138
+ def add_creditcard(post, creditcard)
144
139
  post[:billing_name] = creditcard.name if creditcard.name
145
140
  post[:account_number] = creditcard.number
146
141
  post[:card_verification_value] = creditcard.verification_value if creditcard.verification_value?
@@ -148,8 +143,8 @@ module ActiveMerchant #:nodoc:
148
143
  post[:expiration_year] = sprintf("%.4i", creditcard.year)[-2..-1]
149
144
  end
150
145
 
151
-
152
- def commit(action, parameters)
146
+
147
+ def commit(action, parameters)
153
148
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))
154
149
 
155
150
  Response.new(success?(response), message_from(response[:result_message]), response,
@@ -159,19 +154,19 @@ module ActiveMerchant #:nodoc:
159
154
  :cvv_result => response[:cvv_response_code]
160
155
  )
161
156
  end
162
-
157
+
163
158
  def success?(response)
164
159
  response[:response_code] == '0'
165
160
  end
166
-
161
+
167
162
  def authorization_from(response, params)
168
163
  [ response[:transaction_id], params[:transaction_amount] ].compact.join(';')
169
164
  end
170
-
165
+
171
166
  def parse(xml)
172
167
  response = {}
173
168
 
174
- xml = REXML::Document.new(xml)
169
+ xml = REXML::Document.new(xml)
175
170
 
176
171
  xml.elements.each('//Reply//TransactionReply/*') do |node|
177
172
 
@@ -180,7 +175,7 @@ module ActiveMerchant #:nodoc:
180
175
  end unless xml.root.nil?
181
176
 
182
177
  response
183
- end
178
+ end
184
179
 
185
180
  def post_data(action, parameters = {})
186
181
  xml = REXML::Document.new("<?xml version='1.0' encoding='UTF-8'?>")
@@ -196,7 +191,7 @@ module ActiveMerchant #:nodoc:
196
191
 
197
192
  xml.to_s
198
193
  end
199
-
194
+
200
195
  def message_from(message)
201
196
  return 'Unspecified error' if message.blank?
202
197
  message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
@@ -210,9 +205,9 @@ module ActiveMerchant #:nodoc:
210
205
  when "" then nil
211
206
  when "null" then nil
212
207
  else field
213
- end
214
- end
215
-
208
+ end
209
+ end
210
+
216
211
  def actions
217
212
  ACTIONS
218
213
  end
@@ -229,7 +224,7 @@ module ActiveMerchant #:nodoc:
229
224
  :void_transaction => %w(ReferenceNumber TransactionID),
230
225
  :credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
231
226
  :system_check => %w(SystemCheck),
232
- }
227
+ }
233
228
  end
234
229
  end
235
230
  end