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.
- data/CHANGELOG +41 -0
- data/CONTRIBUTORS +12 -0
- data/README.md +6 -0
- data/lib/active_merchant/billing/gateway.rb +2 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
- data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
- data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
- data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
- data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
- data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
- data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
- data/lib/active_merchant/billing/gateways/epay.rb +0 -1
- data/lib/active_merchant/billing/gateways/eway.rb +88 -93
- data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +300 -0
- data/lib/active_merchant/billing/gateways/exact.rb +45 -54
- data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
- data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
- data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
- data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
- data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
- data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
- data/lib/active_merchant/billing/gateways/litle.rb +1 -5
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
- data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
- data/lib/active_merchant/billing/gateways/migs.rb +5 -3
- data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
- data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
- data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
- data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
- data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
- data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
- data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
- data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
- data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
- data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
- data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
- data/lib/active_merchant/billing/gateways/payway.rb +2 -9
- data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
- data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
- data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
- data/lib/active_merchant/billing/gateways/realex.rb +6 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
- data/lib/active_merchant/billing/gateways/sage.rb +15 -16
- data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
- data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
- data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
- data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
- data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
- data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
- data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
- data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
- data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
- data/lib/active_merchant/billing/gateways.rb +6 -7
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
- data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
- data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
- data/lib/active_merchant/billing/integrations/notification.rb +4 -0
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
- data/lib/active_merchant/billing/response.rb +17 -4
- data/lib/active_merchant/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +46 -27
- metadata.gz.sig +0 -0
|
@@ -5,21 +5,21 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
module Billing #:nodoc:
|
|
6
6
|
class SkipJackGateway < Gateway
|
|
7
7
|
API_VERSION = '?.?'
|
|
8
|
-
|
|
9
|
-
self.live_url = "https://www.skipjackic.com"
|
|
8
|
+
|
|
9
|
+
self.live_url = "https://www.skipjackic.com"
|
|
10
10
|
self.test_url = "https://developer.skipjackic.com"
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
BASIC_PATH = "/scripts/evolvcc.dll"
|
|
13
13
|
ADVANCED_PATH = "/evolvcc/evolvcc.aspx"
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
ACTIONS = {
|
|
16
16
|
:authorization => 'AuthorizeAPI',
|
|
17
17
|
:change_status => 'SJAPI_TransactionChangeStatusRequest',
|
|
18
18
|
:get_status => 'SJAPI_TransactionStatusRequest'
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
SUCCESS_MESSAGE = 'The transaction was successful.'
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
MONETARY_CHANGE_STATUSES = ['SETTLE', 'AUTHORIZE', 'AUTHORIZE ADDITIONAL', 'CREDIT', 'SPLITSETTLE']
|
|
24
24
|
|
|
25
25
|
CARD_CODE_ERRORS = %w( N S "" )
|
|
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
|
|
|
87
87
|
'4' => 'Pending Manual Settlement',
|
|
88
88
|
'5' => 'Pending Recurring'
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
RETURN_CODE_MESSAGES = {
|
|
92
92
|
'-1' => 'Data was not by received intact by Skipjack Transaction Network.',
|
|
93
93
|
'0' => 'Communication Failure. Error in Request and Response at IP level.',
|
|
@@ -161,17 +161,17 @@ module ActiveMerchant #:nodoc:
|
|
|
161
161
|
'-116' => 'POS Check Invalid Lane Number POS Check lane or cash register number is invalid. Use a valid lane or cash register number that has been configured in the Skipjack Merchant Account.',
|
|
162
162
|
'-117' => 'POS Check Invalid Cashier Number'
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
self.supported_countries = ['US', 'CA']
|
|
166
166
|
self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover, :diners_club]
|
|
167
167
|
self.homepage_url = 'http://www.skipjack.com/'
|
|
168
168
|
self.display_name = 'SkipJack'
|
|
169
169
|
|
|
170
170
|
# Creates a new SkipJackGateway
|
|
171
|
-
#
|
|
171
|
+
#
|
|
172
172
|
# The gateway requires that a valid login and password be passed
|
|
173
173
|
# in the +options+ hash.
|
|
174
|
-
#
|
|
174
|
+
#
|
|
175
175
|
# ==== Options
|
|
176
176
|
#
|
|
177
177
|
# * <tt>:login</tt> -- The SkipJack Merchant Serial Number.
|
|
@@ -181,14 +181,9 @@ module ActiveMerchant #:nodoc:
|
|
|
181
181
|
# See the SkipJack Integration Guide for details. (default: +false+)
|
|
182
182
|
def initialize(options = {})
|
|
183
183
|
requires!(options, :login, :password)
|
|
184
|
-
@options = options
|
|
185
184
|
super
|
|
186
185
|
end
|
|
187
|
-
|
|
188
|
-
def test?
|
|
189
|
-
@options[:test] || super
|
|
190
|
-
end
|
|
191
|
-
|
|
186
|
+
|
|
192
187
|
def authorize(money, creditcard, options = {})
|
|
193
188
|
requires!(options, :order_id, :email)
|
|
194
189
|
post = {}
|
|
@@ -210,13 +205,13 @@ module ActiveMerchant #:nodoc:
|
|
|
210
205
|
end
|
|
211
206
|
|
|
212
207
|
# Captures the funds from an authorized transaction.
|
|
213
|
-
#
|
|
208
|
+
#
|
|
214
209
|
# ==== Parameters
|
|
215
210
|
#
|
|
216
211
|
# * <tt>money</tt> -- The amount to be capture as an Integer in cents.
|
|
217
212
|
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
|
|
218
213
|
# * <tt>options</tt> -- A hash of optional parameters.
|
|
219
|
-
#
|
|
214
|
+
#
|
|
220
215
|
# ==== Options
|
|
221
216
|
#
|
|
222
217
|
# * <tt>:force_settlement</tt> -- Force the settlement to occur as soon as possible. This option is not supported by other gateways. See the SkipJack API reference for more details
|
|
@@ -252,24 +247,24 @@ module ActiveMerchant #:nodoc:
|
|
|
252
247
|
def status(order_id)
|
|
253
248
|
commit(:get_status, nil, :szOrderNumber => order_id)
|
|
254
249
|
end
|
|
255
|
-
|
|
250
|
+
|
|
256
251
|
private
|
|
257
|
-
|
|
252
|
+
|
|
258
253
|
def advanced?
|
|
259
254
|
@options[:advanced]
|
|
260
255
|
end
|
|
261
|
-
|
|
256
|
+
|
|
262
257
|
def add_forced_settlement(post, options)
|
|
263
258
|
post[:szForceSettlement] = options[:force_settlment] ? 1 : 0
|
|
264
259
|
end
|
|
265
|
-
|
|
260
|
+
|
|
266
261
|
def add_status_action(post, action)
|
|
267
262
|
post[:szDesiredStatus] = action
|
|
268
263
|
end
|
|
269
|
-
|
|
264
|
+
|
|
270
265
|
def commit(action, money, parameters)
|
|
271
266
|
response = parse( ssl_post( url_for(action), post_data(action, money, parameters) ), action )
|
|
272
|
-
|
|
267
|
+
|
|
273
268
|
# Pass along the original transaction id in the case an update transaction
|
|
274
269
|
Response.new(response[:success], message_from(response, action), response,
|
|
275
270
|
:test => test?,
|
|
@@ -278,13 +273,13 @@ module ActiveMerchant #:nodoc:
|
|
|
278
273
|
:cvv_result => response[:szCVV2ResponseCode]
|
|
279
274
|
)
|
|
280
275
|
end
|
|
281
|
-
|
|
276
|
+
|
|
282
277
|
def url_for(action)
|
|
283
278
|
result = test? ? self.test_url : self.live_url
|
|
284
279
|
result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH
|
|
285
280
|
result += "?#{ACTIONS[action]}"
|
|
286
281
|
end
|
|
287
|
-
|
|
282
|
+
|
|
288
283
|
def add_credentials(params, action)
|
|
289
284
|
if action == :authorization
|
|
290
285
|
params[:SerialNumber] = @options[:login]
|
|
@@ -294,7 +289,7 @@ module ActiveMerchant #:nodoc:
|
|
|
294
289
|
params[:szDeveloperSerialNumber] = @options[:password]
|
|
295
290
|
end
|
|
296
291
|
end
|
|
297
|
-
|
|
292
|
+
|
|
298
293
|
def add_amount(params, action, money)
|
|
299
294
|
if action == :authorization
|
|
300
295
|
params[:TransactionAmount] = amount(money)
|
|
@@ -313,7 +308,7 @@ module ActiveMerchant #:nodoc:
|
|
|
313
308
|
parse_status_response(body, [ :SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID ])
|
|
314
309
|
end
|
|
315
310
|
end
|
|
316
|
-
|
|
311
|
+
|
|
317
312
|
def split_lines(body)
|
|
318
313
|
body.split(/[\r\n]+/)
|
|
319
314
|
end
|
|
@@ -321,13 +316,13 @@ module ActiveMerchant #:nodoc:
|
|
|
321
316
|
def split_line(line)
|
|
322
317
|
line.split(/","/).collect { |key| key.sub(/"*([^"]*)"*/, '\1').strip; }
|
|
323
318
|
end
|
|
324
|
-
|
|
319
|
+
|
|
325
320
|
def authorize_response_map(body)
|
|
326
321
|
lines = split_lines(body)
|
|
327
322
|
keys, values = split_line(lines[0]), split_line(lines[1])
|
|
328
323
|
Hash[*(keys.zip(values).flatten)].symbolize_keys
|
|
329
324
|
end
|
|
330
|
-
|
|
325
|
+
|
|
331
326
|
def parse_authorization_response(body)
|
|
332
327
|
result = authorize_response_map(body)
|
|
333
328
|
result[:success] = (result[:szIsApproved] == '1')
|
|
@@ -374,7 +369,7 @@ module ActiveMerchant #:nodoc:
|
|
|
374
369
|
post[:CustomerCode] = options[:customer].to_s.slice(0, 17)
|
|
375
370
|
post[:InvoiceNumber] = options[:invoice]
|
|
376
371
|
post[:OrderDescription] = options[:description]
|
|
377
|
-
|
|
372
|
+
|
|
378
373
|
if order_items = options[:items]
|
|
379
374
|
post[:OrderString] = order_items.collect { |item| "#{item[:sku]}~#{item[:description].tr('~','-')}~#{item[:declared_value]}~#{item[:quantity]}~#{item[:taxable]}~~~~~~~~#{item[:tax_rate]}~||"}.join
|
|
380
375
|
else
|
|
@@ -405,7 +400,7 @@ module ActiveMerchant #:nodoc:
|
|
|
405
400
|
post[:Phone] = address[:phone]
|
|
406
401
|
post[:Fax] = address[:fax]
|
|
407
402
|
end
|
|
408
|
-
|
|
403
|
+
|
|
409
404
|
if address = options[:shipping_address]
|
|
410
405
|
post[:ShipToName] = address[:name]
|
|
411
406
|
post[:ShipToStreetAddress] = address[:address1]
|
|
@@ -417,7 +412,7 @@ module ActiveMerchant #:nodoc:
|
|
|
417
412
|
post[:ShipToPhone] = address[:phone]
|
|
418
413
|
post[:ShipToFax] = address[:fax]
|
|
419
414
|
end
|
|
420
|
-
|
|
415
|
+
|
|
421
416
|
# The phone number for the shipping address is required
|
|
422
417
|
# Use the billing address phone number if a shipping address
|
|
423
418
|
# phone number wasn't provided
|
|
@@ -449,7 +444,7 @@ module ActiveMerchant #:nodoc:
|
|
|
449
444
|
def message_from_status(response)
|
|
450
445
|
response[:success] ? SUCCESS_MESSAGE : response[:szErrorMessage]
|
|
451
446
|
end
|
|
452
|
-
|
|
447
|
+
|
|
453
448
|
def sanitize_order_id(value)
|
|
454
449
|
value.to_s.gsub(/[^\w.]/, '')
|
|
455
450
|
end
|
|
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'check.rb')
|
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
|
4
4
|
module Billing #:nodoc:
|
|
5
5
|
class SmartPs < Gateway #:nodoc:
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
##
|
|
8
8
|
# This is the base gateway for processors who use the smartPS processing system
|
|
9
9
|
|
|
@@ -11,13 +11,12 @@ module ActiveMerchant #:nodoc:
|
|
|
11
11
|
|
|
12
12
|
def initialize(options = {})
|
|
13
13
|
requires!(options, :login, :password)
|
|
14
|
-
@options = options
|
|
15
14
|
super
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Pass :store => true in the options to store the
|
|
19
|
-
# payment info at the gateway and get a generated
|
|
20
|
-
# customer_vault_id in the response.
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Pass :store => true in the options to store the
|
|
18
|
+
# payment info at the gateway and get a generated
|
|
19
|
+
# customer_vault_id in the response.
|
|
21
20
|
# Pass :store => some_number_or_string to specify the
|
|
22
21
|
# customer_vault_id the gateway should use (make sure it's
|
|
23
22
|
# unique).
|
|
@@ -33,7 +32,7 @@ module ActiveMerchant #:nodoc:
|
|
|
33
32
|
add_processor(post, options)
|
|
34
33
|
commit('auth', money, post)
|
|
35
34
|
end
|
|
36
|
-
|
|
35
|
+
|
|
37
36
|
def purchase(money, payment_source, options = {})
|
|
38
37
|
post = {}
|
|
39
38
|
add_invoice(post, options)
|
|
@@ -43,26 +42,26 @@ module ActiveMerchant #:nodoc:
|
|
|
43
42
|
add_customer_data(post, options)
|
|
44
43
|
add_currency(post, money, options)
|
|
45
44
|
add_taxes(post, options)
|
|
46
|
-
add_processor(post, options)
|
|
45
|
+
add_processor(post, options)
|
|
47
46
|
commit('sale', money, post)
|
|
48
|
-
end
|
|
49
|
-
|
|
47
|
+
end
|
|
48
|
+
|
|
50
49
|
def capture(money, authorization, options = {})
|
|
51
50
|
post ={}
|
|
52
51
|
post[:transactionid] = authorization
|
|
53
52
|
commit('capture', money, post)
|
|
54
53
|
end
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
def void(authorization, options = {})
|
|
57
56
|
post ={}
|
|
58
57
|
post[:transactionid] = authorization
|
|
59
58
|
commit('void', nil, post)
|
|
60
59
|
end
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
def credit(money, payment_source, options = {})
|
|
63
62
|
post = {}
|
|
64
63
|
add_invoice(post, options)
|
|
65
|
-
add_payment_source(post, payment_source, options)
|
|
64
|
+
add_payment_source(post, payment_source, options)
|
|
66
65
|
add_address(post, options[:billing_address] || options[:address])
|
|
67
66
|
add_customer_data(post, options)
|
|
68
67
|
add_sku(post,options)
|
|
@@ -70,14 +69,14 @@ module ActiveMerchant #:nodoc:
|
|
|
70
69
|
add_processor(post, options)
|
|
71
70
|
commit('credit', money, post)
|
|
72
71
|
end
|
|
73
|
-
|
|
72
|
+
|
|
74
73
|
def refund(money, auth, options = {})
|
|
75
74
|
post = {}
|
|
76
75
|
add_transaction(post, auth)
|
|
77
76
|
commit('refund', money, post)
|
|
78
77
|
end
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
|
|
79
|
+
|
|
81
80
|
# Update the values (such as CC expiration) stored at
|
|
82
81
|
# the gateway. The CC number must be supplied in the
|
|
83
82
|
# CreditCard object.
|
|
@@ -85,13 +84,13 @@ module ActiveMerchant #:nodoc:
|
|
|
85
84
|
post = {}
|
|
86
85
|
post[:customer_vault] = "update_customer"
|
|
87
86
|
add_customer_vault_id(post, vault_id)
|
|
88
|
-
add_creditcard(post, creditcard, options)
|
|
87
|
+
add_creditcard(post, creditcard, options)
|
|
89
88
|
add_address(post, options[:billing_address] || options[:address])
|
|
90
89
|
add_customer_data(post, options)
|
|
91
|
-
|
|
90
|
+
|
|
92
91
|
commit(nil, nil, post)
|
|
93
92
|
end
|
|
94
|
-
|
|
93
|
+
|
|
95
94
|
# Amend an existing transaction
|
|
96
95
|
def amend(auth, options = {})
|
|
97
96
|
post = {}
|
|
@@ -99,15 +98,15 @@ module ActiveMerchant #:nodoc:
|
|
|
99
98
|
add_transaction(post, auth)
|
|
100
99
|
commit('update', nil, post)
|
|
101
100
|
end
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
|
|
102
|
+
|
|
104
103
|
def delete(vault_id)
|
|
105
104
|
post = {}
|
|
106
105
|
post[:customer_vault] = "delete_customer"
|
|
107
|
-
add_customer_vault_id(post, vault_id)
|
|
106
|
+
add_customer_vault_id(post, vault_id)
|
|
108
107
|
commit(nil, nil, post)
|
|
109
108
|
end
|
|
110
|
-
|
|
109
|
+
|
|
111
110
|
# To match the other stored-value gateways, like TrustCommerce,
|
|
112
111
|
# store and unstore need to be defined
|
|
113
112
|
def store(payment_source, options = {})
|
|
@@ -118,10 +117,10 @@ module ActiveMerchant #:nodoc:
|
|
|
118
117
|
add_customer_data(post, options)
|
|
119
118
|
commit(nil, nil, post)
|
|
120
119
|
end
|
|
121
|
-
|
|
120
|
+
|
|
122
121
|
alias_method :unstore, :delete
|
|
123
122
|
|
|
124
|
-
private
|
|
123
|
+
private
|
|
125
124
|
def add_customer_data(post, options)
|
|
126
125
|
if options.has_key? :email
|
|
127
126
|
post[:email] = options[:email]
|
|
@@ -129,23 +128,23 @@ module ActiveMerchant #:nodoc:
|
|
|
129
128
|
|
|
130
129
|
if options.has_key? :ip
|
|
131
130
|
post[:ipaddress] = options[:ip]
|
|
132
|
-
end
|
|
131
|
+
end
|
|
133
132
|
end
|
|
134
133
|
|
|
135
|
-
def add_address(post, address,prefix="")
|
|
136
|
-
prefix +="_" unless prefix.blank?
|
|
134
|
+
def add_address(post, address,prefix="")
|
|
135
|
+
prefix +="_" unless prefix.blank?
|
|
137
136
|
unless address.blank? or address.values.blank?
|
|
138
137
|
post[prefix+"address1"] = address[:address1].to_s
|
|
139
138
|
post[prefix+"address2"] = address[:address2].to_s unless address[:address2].blank?
|
|
140
139
|
post[prefix+"company"] = address[:company].to_s
|
|
141
140
|
post[prefix+"phone"] = address[:phone].to_s
|
|
142
|
-
post[prefix+"zip"] = address[:zip].to_s
|
|
141
|
+
post[prefix+"zip"] = address[:zip].to_s
|
|
143
142
|
post[prefix+"city"] = address[:city].to_s
|
|
144
143
|
post[prefix+"country"] = address[:country].to_s
|
|
145
144
|
post[prefix+"state"] = address[:state].blank? ? 'n/a' : address[:state]
|
|
146
|
-
end
|
|
145
|
+
end
|
|
147
146
|
end
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
def add_currency(post, money, options)
|
|
150
149
|
post[:currency] = options[:currency] || currency(money)
|
|
151
150
|
end
|
|
@@ -157,11 +156,11 @@ module ActiveMerchant #:nodoc:
|
|
|
157
156
|
def add_processor(post, options)
|
|
158
157
|
post[:processor] = options[:processor] unless options[:processor].nil?
|
|
159
158
|
end
|
|
160
|
-
|
|
159
|
+
|
|
161
160
|
def add_invoice(post, options)
|
|
162
161
|
post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
|
|
163
162
|
end
|
|
164
|
-
|
|
163
|
+
|
|
165
164
|
def add_payment_source(params, source, options={})
|
|
166
165
|
case determine_funding_source(source)
|
|
167
166
|
when :vault then add_customer_vault_id(params, source)
|
|
@@ -169,13 +168,13 @@ module ActiveMerchant #:nodoc:
|
|
|
169
168
|
when :check then add_check(params, source, options)
|
|
170
169
|
end
|
|
171
170
|
end
|
|
172
|
-
|
|
171
|
+
|
|
173
172
|
def add_customer_vault_id(params, vault_id)
|
|
174
173
|
params[:customer_vault_id] = vault_id
|
|
175
174
|
end
|
|
176
|
-
|
|
175
|
+
|
|
177
176
|
def add_creditcard(post, creditcard, options)
|
|
178
|
-
if options[:store]
|
|
177
|
+
if options[:store]
|
|
179
178
|
post[:customer_vault] = "add_customer"
|
|
180
179
|
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
|
181
180
|
end
|
|
@@ -183,15 +182,15 @@ module ActiveMerchant #:nodoc:
|
|
|
183
182
|
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
|
184
183
|
post[:ccexp] = expdate(creditcard)
|
|
185
184
|
post[:firstname] = creditcard.first_name
|
|
186
|
-
post[:lastname] = creditcard.last_name
|
|
185
|
+
post[:lastname] = creditcard.last_name
|
|
187
186
|
end
|
|
188
|
-
|
|
187
|
+
|
|
189
188
|
def add_check(post, check, options)
|
|
190
|
-
if options[:store]
|
|
189
|
+
if options[:store]
|
|
191
190
|
post[:customer_vault] = "add_customer"
|
|
192
191
|
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
|
193
192
|
end
|
|
194
|
-
|
|
193
|
+
|
|
195
194
|
post[:payment] = 'check' # Set transaction to ACH
|
|
196
195
|
post[:checkname] = check.name # The name on the customer's Checking Account
|
|
197
196
|
post[:checkaba] = check.routing_number # The customer's bank routing number
|
|
@@ -199,44 +198,44 @@ module ActiveMerchant #:nodoc:
|
|
|
199
198
|
post[:account_holder_type] = check.account_holder_type # The customer's type of ACH account
|
|
200
199
|
post[:account_type] = check.account_type # The customer's type of ACH account
|
|
201
200
|
end
|
|
202
|
-
|
|
201
|
+
|
|
203
202
|
def add_sku(post,options)
|
|
204
203
|
post["product_sku_#"] = options[:sku] || options["product_sku_#"]
|
|
205
204
|
end
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
def add_transaction(post, auth)
|
|
208
207
|
post[:transactionid] = auth
|
|
209
208
|
end
|
|
210
|
-
|
|
209
|
+
|
|
211
210
|
def parse(body)
|
|
212
211
|
results = {}
|
|
213
212
|
body.split(/&/).each do |pair|
|
|
214
213
|
key,val = pair.split(/=/)
|
|
215
214
|
results[key] = val
|
|
216
215
|
end
|
|
217
|
-
|
|
216
|
+
|
|
218
217
|
results
|
|
219
|
-
end
|
|
220
|
-
|
|
218
|
+
end
|
|
219
|
+
|
|
221
220
|
def commit(action, money, parameters)
|
|
222
221
|
parameters[:amount] = amount(money) if money
|
|
223
222
|
response = parse( ssl_post(self.live_url, post_data(action,parameters)) )
|
|
224
|
-
Response.new(response["response"] == "1", message_from(response), response,
|
|
223
|
+
Response.new(response["response"] == "1", message_from(response), response,
|
|
225
224
|
:authorization => response["transactionid"],
|
|
226
225
|
:test => test?,
|
|
227
226
|
:cvv_result => response["cvvresponse"],
|
|
228
227
|
:avs_result => { :code => response["avsresponse"] }
|
|
229
228
|
)
|
|
230
|
-
|
|
229
|
+
|
|
231
230
|
end
|
|
232
|
-
|
|
231
|
+
|
|
233
232
|
def expdate(creditcard)
|
|
234
233
|
year = sprintf("%.04i", creditcard.year.to_i)
|
|
235
234
|
month = sprintf("%.02i", creditcard.month.to_i)
|
|
236
235
|
|
|
237
236
|
"#{month}#{year[-2..-1]}"
|
|
238
237
|
end
|
|
239
|
-
|
|
238
|
+
|
|
240
239
|
|
|
241
240
|
def message_from(response)
|
|
242
241
|
case response["responsetext"]
|
|
@@ -248,7 +247,7 @@ module ActiveMerchant #:nodoc:
|
|
|
248
247
|
response["responsetext"]
|
|
249
248
|
end
|
|
250
249
|
end
|
|
251
|
-
|
|
250
|
+
|
|
252
251
|
def post_data(action, parameters = {})
|
|
253
252
|
post = {}
|
|
254
253
|
post[:username] = @options[:login]
|
|
@@ -256,18 +255,18 @@ module ActiveMerchant #:nodoc:
|
|
|
256
255
|
post[:type] = action if action
|
|
257
256
|
|
|
258
257
|
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
|
|
259
|
-
request
|
|
258
|
+
request
|
|
260
259
|
end
|
|
261
|
-
|
|
260
|
+
|
|
262
261
|
def determine_funding_source(source)
|
|
263
|
-
case
|
|
262
|
+
case
|
|
264
263
|
when source.is_a?(String) then :vault
|
|
265
264
|
when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
|
|
266
265
|
when card_brand(source) == 'check' then :check
|
|
267
266
|
else raise ArgumentError, "Unsupported funding source provided"
|
|
268
267
|
end
|
|
269
268
|
end
|
|
270
|
-
end
|
|
269
|
+
end
|
|
271
270
|
end
|
|
272
271
|
end
|
|
273
272
|
|
|
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
|
|
|
21
21
|
'unchecked' => 'P'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
self.supported_countries = ['US']
|
|
24
|
+
self.supported_countries = ['US', 'CA']
|
|
25
25
|
self.default_currency = 'USD'
|
|
26
26
|
self.money_format = :cents
|
|
27
27
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
|
|
@@ -48,6 +48,7 @@ module ActiveMerchant #:nodoc:
|
|
|
48
48
|
add_amount(post, money, options)
|
|
49
49
|
add_creditcard(post, creditcard, options)
|
|
50
50
|
add_customer(post, options)
|
|
51
|
+
add_customer_data(post,options)
|
|
51
52
|
post[:description] = options[:description] || options[:email]
|
|
52
53
|
add_flags(post, options)
|
|
53
54
|
|
|
@@ -105,8 +106,11 @@ module ActiveMerchant #:nodoc:
|
|
|
105
106
|
end
|
|
106
107
|
|
|
107
108
|
def add_customer_data(post, options)
|
|
108
|
-
|
|
109
|
-
post
|
|
109
|
+
metadata_options = [:description,:browser_ip,:user_agent,:referrer]
|
|
110
|
+
post.update(options.slice(*metadata_options))
|
|
111
|
+
|
|
112
|
+
post[:external_id] = options[:order_id]
|
|
113
|
+
post[:payment_user_agent] = "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
|
|
110
114
|
end
|
|
111
115
|
|
|
112
116
|
def add_address(post, options)
|
|
@@ -117,6 +121,7 @@ module ActiveMerchant #:nodoc:
|
|
|
117
121
|
post[:card][:address_country] = address[:country] if address[:country]
|
|
118
122
|
post[:card][:address_zip] = address[:zip] if address[:zip]
|
|
119
123
|
post[:card][:address_state] = address[:state] if address[:state]
|
|
124
|
+
post[:card][:address_city] = address[:city] if address[:city]
|
|
120
125
|
end
|
|
121
126
|
end
|
|
122
127
|
|
|
@@ -7,36 +7,35 @@ module ActiveMerchant #:nodoc:
|
|
|
7
7
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
8
8
|
self.homepage_url = 'http://www.transfirst.com/'
|
|
9
9
|
self.display_name = 'TransFirst'
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
UNUSED_FIELDS = %w(ECIValue UserId CAVVData TrackData POSInd EComInd MerchZIP MerchCustPNum MCC InstallmentNum InstallmentOf POSEntryMode POSConditionCode AuthCharInd CardCertData)
|
|
12
12
|
|
|
13
13
|
DECLINED = 'The transaction was declined'
|
|
14
14
|
|
|
15
15
|
def initialize(options = {})
|
|
16
16
|
requires!(options, :login, :password)
|
|
17
|
-
@options = options
|
|
18
17
|
super
|
|
19
|
-
end
|
|
20
|
-
|
|
18
|
+
end
|
|
19
|
+
|
|
21
20
|
def purchase(money, credit_card, options = {})
|
|
22
21
|
post = {}
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
add_amount(post, money)
|
|
25
24
|
add_invoice(post, options)
|
|
26
|
-
add_credit_card(post, credit_card)
|
|
27
|
-
add_address(post, options)
|
|
28
|
-
|
|
25
|
+
add_credit_card(post, credit_card)
|
|
26
|
+
add_address(post, options)
|
|
27
|
+
|
|
29
28
|
commit(post)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
33
32
|
def add_amount(post, money)
|
|
34
33
|
add_pair(post, :Amount, amount(money), :required => true)
|
|
35
34
|
end
|
|
36
|
-
|
|
35
|
+
|
|
37
36
|
def add_address(post, options)
|
|
38
37
|
address = options[:billing_address] || options[:address]
|
|
39
|
-
|
|
38
|
+
|
|
40
39
|
if address
|
|
41
40
|
add_pair(post, :Address, address[:address1])
|
|
42
41
|
add_pair(post, :ZipCode, address[:zip])
|
|
@@ -50,34 +49,34 @@ module ActiveMerchant #:nodoc:
|
|
|
50
49
|
add_pair(post, :PaymentDesc, options[:description], :required => true)
|
|
51
50
|
add_pair(post, :TaxIndicator, 0)
|
|
52
51
|
end
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
def add_credit_card(post, credit_card)
|
|
55
54
|
add_pair(post, :CardHolderName, credit_card.name, :required => true)
|
|
56
55
|
add_pair(post, :CardNumber, credit_card.number, :required => true)
|
|
57
|
-
|
|
56
|
+
|
|
58
57
|
add_pair(post, :Expiration, expdate(credit_card), :required => true)
|
|
59
58
|
add_pair(post, :CVV2, credit_card.verification_value)
|
|
60
59
|
end
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
def add_unused_fields(post)
|
|
63
62
|
UNUSED_FIELDS.each do |f|
|
|
64
63
|
post[f] = ""
|
|
65
64
|
end
|
|
66
65
|
end
|
|
67
|
-
|
|
66
|
+
|
|
68
67
|
def expdate(credit_card)
|
|
69
68
|
year = format(credit_card.year, :two_digits)
|
|
70
69
|
month = format(credit_card.month, :two_digits)
|
|
71
70
|
|
|
72
71
|
"#{month}#{year}"
|
|
73
72
|
end
|
|
74
|
-
|
|
73
|
+
|
|
75
74
|
def parse(data)
|
|
76
75
|
response = {}
|
|
77
|
-
|
|
76
|
+
|
|
78
77
|
xml = REXML::Document.new(data)
|
|
79
78
|
root = REXML::XPath.first(xml, "//CCSaleDebitResponse")
|
|
80
|
-
|
|
79
|
+
|
|
81
80
|
if root.nil?
|
|
82
81
|
response[:message] = data.to_s.strip
|
|
83
82
|
else
|
|
@@ -85,21 +84,21 @@ module ActiveMerchant #:nodoc:
|
|
|
85
84
|
response[node.name.underscore.to_sym] = node.text
|
|
86
85
|
end
|
|
87
86
|
end
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
response
|
|
90
89
|
end
|
|
91
|
-
|
|
92
|
-
def commit(params)
|
|
90
|
+
|
|
91
|
+
def commit(params)
|
|
93
92
|
response = parse( ssl_post(self.live_url, post_data(params)) )
|
|
94
93
|
|
|
95
|
-
Response.new(response[:status] == "Authorized", message_from(response), response,
|
|
96
|
-
:test => test?,
|
|
94
|
+
Response.new(response[:status] == "Authorized", message_from(response), response,
|
|
95
|
+
:test => test?,
|
|
97
96
|
:authorization => response[:trans_id],
|
|
98
97
|
:avs_result => { :code => response[:avs_code] },
|
|
99
98
|
:cvv_result => response[:cvv2_code]
|
|
100
99
|
)
|
|
101
100
|
end
|
|
102
|
-
|
|
101
|
+
|
|
103
102
|
def message_from(response)
|
|
104
103
|
case response[:message]
|
|
105
104
|
when 'Call Voice Center'
|
|
@@ -108,16 +107,16 @@ module ActiveMerchant #:nodoc:
|
|
|
108
107
|
response[:message]
|
|
109
108
|
end
|
|
110
109
|
end
|
|
111
|
-
|
|
110
|
+
|
|
112
111
|
def post_data(params = {})
|
|
113
112
|
add_unused_fields(params)
|
|
114
113
|
params[:MerchantID] = @options[:login]
|
|
115
114
|
params[:RegKey] = @options[:password]
|
|
116
|
-
|
|
115
|
+
|
|
117
116
|
request = params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
|
118
117
|
request
|
|
119
118
|
end
|
|
120
|
-
|
|
119
|
+
|
|
121
120
|
def add_pair(post, key, value, options = {})
|
|
122
121
|
post[key] = value if !value.blank? || options[:required]
|
|
123
122
|
end
|