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,11 +5,11 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
# This gateway accepts the following arguments:
|
|
6
6
|
# :login => your PayJunction username
|
|
7
7
|
# :password => your PayJunction pass
|
|
8
|
-
#
|
|
8
|
+
#
|
|
9
9
|
# Example use:
|
|
10
10
|
#
|
|
11
11
|
# gateway = ActiveMerchant::Billing::Base.gateway(:pay_junction).new(
|
|
12
|
-
# :login => "my_account",
|
|
12
|
+
# :login => "my_account",
|
|
13
13
|
# :password => "my_pass"
|
|
14
14
|
# )
|
|
15
15
|
#
|
|
@@ -51,14 +51,14 @@ module ActiveMerchant #:nodoc:
|
|
|
51
51
|
# Test Transactions
|
|
52
52
|
#
|
|
53
53
|
# See the source for initialize() for test account information. Note that
|
|
54
|
-
# PayJunction does not allow test transactions on your account, so if the
|
|
54
|
+
# PayJunction does not allow test transactions on your account, so if the
|
|
55
55
|
# gateway is running in :test mode your transaction will be run against
|
|
56
56
|
# PayJunction's global test account and will not show up in your account.
|
|
57
57
|
#
|
|
58
|
-
# Transactions ran on this account go through a test processor, so there is no
|
|
59
|
-
# need to void or otherwise cancel transactions. However, for further safety,
|
|
60
|
-
# please use the special card numbers 4433221111223344 or 4444333322221111 and
|
|
61
|
-
# keep transaction amounts below $4.00 when testing.
|
|
58
|
+
# Transactions ran on this account go through a test processor, so there is no
|
|
59
|
+
# need to void or otherwise cancel transactions. However, for further safety,
|
|
60
|
+
# please use the special card numbers 4433221111223344 or 4444333322221111 and
|
|
61
|
+
# keep transaction amounts below $4.00 when testing.
|
|
62
62
|
#
|
|
63
63
|
# Also note, transactions ran for an amount between $0.00 and $1.99 will likely
|
|
64
64
|
# result in denial. To demonstrate approvals, use amounts between $2.00 and $4.00.
|
|
@@ -67,12 +67,12 @@ module ActiveMerchant #:nodoc:
|
|
|
67
67
|
# PayJunction Web Login with username 'pj-cm-01' and password 'pj-cm-01p'
|
|
68
68
|
#
|
|
69
69
|
# Usage Details
|
|
70
|
-
#
|
|
70
|
+
#
|
|
71
71
|
# Below is a map of values accepted by PayJunction and how you should submit
|
|
72
72
|
# each to ActiveMerchant
|
|
73
73
|
#
|
|
74
74
|
# PayJunction Field ActiveMerchant Use
|
|
75
|
-
#
|
|
75
|
+
#
|
|
76
76
|
# dc_logon provide as :login value to gateway instantation
|
|
77
77
|
# dc_password provide as :password value to gateway instantiation
|
|
78
78
|
#
|
|
@@ -106,12 +106,12 @@ module ActiveMerchant #:nodoc:
|
|
|
106
106
|
|
|
107
107
|
TEST_LOGIN = 'pj-ql-01'
|
|
108
108
|
TEST_PASSWORD = 'pj-ql-01p'
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
SUCCESS_CODES = ["00", "85"]
|
|
111
111
|
SUCCESS_MESSAGE = 'The transaction was approved.'
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
FAILURE_MESSAGE = 'The transaction was declined.'
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
DECLINE_CODES = {
|
|
116
116
|
"AE" => 'Address verification failed because address did not match.',
|
|
117
117
|
'ZE' => 'Address verification failed because zip did not match.',
|
|
@@ -143,13 +143,13 @@ module ActiveMerchant #:nodoc:
|
|
|
143
143
|
'15' => 'Declined because there is no such issuer.',
|
|
144
144
|
'96' => 'Declined because of a system error.',
|
|
145
145
|
'N7' => 'Declined because of a CVV2/CVC2 mismatch.',
|
|
146
|
-
'M4' => 'Declined.',
|
|
146
|
+
'M4' => 'Declined.',
|
|
147
147
|
"FE" => "There was a format error with your Trinity Gateway Service (API) request.",
|
|
148
148
|
"LE" => "Could not log you in (problem with dc_logon and/or dc_password).",
|
|
149
149
|
'NL' => 'Aborted because of a system error, please try again later. ',
|
|
150
150
|
'AB' => 'Aborted because of an upstream system error, please try again later.'
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
154
154
|
self.supported_countries = ['US']
|
|
155
155
|
self.homepage_url = 'http://www.payjunction.com/'
|
|
@@ -157,31 +157,30 @@ module ActiveMerchant #:nodoc:
|
|
|
157
157
|
|
|
158
158
|
def initialize(options = {})
|
|
159
159
|
requires!(options, :login, :password)
|
|
160
|
-
@options = options
|
|
161
160
|
super
|
|
162
161
|
end
|
|
163
|
-
|
|
162
|
+
|
|
164
163
|
# The first half of the preauth(authorize)/postauth(capture) model.
|
|
165
164
|
# Checks to make sure funds are available for a transaction, and returns a
|
|
166
165
|
# transaction_id that can be used later to postauthorize (capture) the funds.
|
|
167
166
|
def authorize(money, payment_source, options = {})
|
|
168
167
|
parameters = {
|
|
169
168
|
:transaction_amount => amount(money),
|
|
170
|
-
}
|
|
171
|
-
|
|
169
|
+
}
|
|
170
|
+
|
|
172
171
|
add_payment_source(parameters, payment_source)
|
|
173
172
|
add_address(parameters, options)
|
|
174
173
|
add_optional_fields(parameters, options)
|
|
175
174
|
commit('AUTHORIZATION', parameters)
|
|
176
175
|
end
|
|
177
|
-
|
|
176
|
+
|
|
178
177
|
# A simple sale, capturing funds immediately.
|
|
179
178
|
# Execute authorization and capture in a single step.
|
|
180
|
-
def purchase(money, payment_source, options = {})
|
|
179
|
+
def purchase(money, payment_source, options = {})
|
|
181
180
|
parameters = {
|
|
182
181
|
:transaction_amount => amount(money),
|
|
183
|
-
}
|
|
184
|
-
|
|
182
|
+
}
|
|
183
|
+
|
|
185
184
|
add_payment_source(parameters, payment_source)
|
|
186
185
|
add_address(parameters, options)
|
|
187
186
|
add_optional_fields(parameters, options)
|
|
@@ -195,14 +194,14 @@ module ActiveMerchant #:nodoc:
|
|
|
195
194
|
:transaction_id => authorization,
|
|
196
195
|
:posture => 'capture'
|
|
197
196
|
}
|
|
198
|
-
|
|
199
|
-
add_optional_fields(parameters, options)
|
|
197
|
+
|
|
198
|
+
add_optional_fields(parameters, options)
|
|
200
199
|
commit('update', parameters)
|
|
201
200
|
end
|
|
202
|
-
|
|
201
|
+
|
|
203
202
|
# Return money to a card that was previously billed.
|
|
204
203
|
# _authorization_ should be the transaction id of the transaction we are returning.
|
|
205
|
-
def refund(money, authorization, options = {})
|
|
204
|
+
def refund(money, authorization, options = {})
|
|
206
205
|
parameters = {
|
|
207
206
|
:transaction_amount => amount(money),
|
|
208
207
|
:transaction_id => authorization
|
|
@@ -228,7 +227,7 @@ module ActiveMerchant #:nodoc:
|
|
|
228
227
|
commit('update', parameters)
|
|
229
228
|
end
|
|
230
229
|
|
|
231
|
-
# Set up a sale that will be made on a regular basis for the same amount
|
|
230
|
+
# Set up a sale that will be made on a regular basis for the same amount
|
|
232
231
|
# (ex. $20 a month for 12 months)
|
|
233
232
|
#
|
|
234
233
|
# The parameter :periodicity should be specified as either :monthly, :weekly, or :daily
|
|
@@ -236,12 +235,12 @@ module ActiveMerchant #:nodoc:
|
|
|
236
235
|
#
|
|
237
236
|
# gateway.recurring('2000', creditcard, :periodicity => :monthly, :payments => 12)
|
|
238
237
|
#
|
|
239
|
-
# The optional parameter :starting_at takes a date or time argument or a string in
|
|
240
|
-
# YYYYMMDD format and can be used to specify when the first charge will be made.
|
|
241
|
-
# If omitted the first charge will be immediate.
|
|
242
|
-
def recurring(money, payment_source, options = {})
|
|
238
|
+
# The optional parameter :starting_at takes a date or time argument or a string in
|
|
239
|
+
# YYYYMMDD format and can be used to specify when the first charge will be made.
|
|
240
|
+
# If omitted the first charge will be immediate.
|
|
241
|
+
def recurring(money, payment_source, options = {})
|
|
243
242
|
requires!(options, [:periodicity, :monthly, :weekly, :daily], :payments)
|
|
244
|
-
|
|
243
|
+
|
|
245
244
|
periodic_type = case options[:periodicity]
|
|
246
245
|
when :monthly
|
|
247
246
|
'month'
|
|
@@ -250,7 +249,7 @@ module ActiveMerchant #:nodoc:
|
|
|
250
249
|
when :daily
|
|
251
250
|
'day'
|
|
252
251
|
end
|
|
253
|
-
|
|
252
|
+
|
|
254
253
|
if options[:starting_at].nil?
|
|
255
254
|
start_date = Time.now.strftime('%Y-%m-%d')
|
|
256
255
|
elsif options[:starting_at].is_a?(String)
|
|
@@ -259,7 +258,7 @@ module ActiveMerchant #:nodoc:
|
|
|
259
258
|
else
|
|
260
259
|
start_date = options[:starting_at].strftime('%Y-%m-%d')
|
|
261
260
|
end
|
|
262
|
-
|
|
261
|
+
|
|
263
262
|
parameters = {
|
|
264
263
|
:transaction_amount => amount(money),
|
|
265
264
|
:schedule_periodic_type => periodic_type,
|
|
@@ -268,23 +267,23 @@ module ActiveMerchant #:nodoc:
|
|
|
268
267
|
:schedule_periodic_number => 1,
|
|
269
268
|
:schedule_start => start_date
|
|
270
269
|
}
|
|
271
|
-
|
|
270
|
+
|
|
272
271
|
add_payment_source(parameters, payment_source)
|
|
273
272
|
add_optional_fields(parameters, options)
|
|
274
|
-
add_address(parameters, options)
|
|
273
|
+
add_address(parameters, options)
|
|
275
274
|
commit('AUTHORIZATION_CAPTURE', parameters)
|
|
276
275
|
end
|
|
277
|
-
|
|
276
|
+
|
|
278
277
|
def test?
|
|
279
|
-
test_login? ||
|
|
278
|
+
(test_login? || super)
|
|
280
279
|
end
|
|
281
280
|
|
|
282
281
|
private
|
|
283
|
-
|
|
282
|
+
|
|
284
283
|
def test_login?
|
|
285
284
|
@options[:login] == TEST_LOGIN && @options[:password] == TEST_PASSWORD
|
|
286
285
|
end
|
|
287
|
-
|
|
286
|
+
|
|
288
287
|
# add fields depending on payment source selected (cc or transaction id)
|
|
289
288
|
def add_payment_source(params, source)
|
|
290
289
|
if source.is_a?(String)
|
|
@@ -293,54 +292,54 @@ module ActiveMerchant #:nodoc:
|
|
|
293
292
|
add_creditcard(params, source)
|
|
294
293
|
end
|
|
295
294
|
end
|
|
296
|
-
|
|
295
|
+
|
|
297
296
|
# add fields for credit card
|
|
298
297
|
def add_creditcard(params, creditcard)
|
|
299
298
|
params[:name] = creditcard.name
|
|
300
299
|
params[:number] = creditcard.number
|
|
301
300
|
params[:expiration_month] = creditcard.month
|
|
302
|
-
params[:expiration_year] = creditcard.year
|
|
301
|
+
params[:expiration_year] = creditcard.year
|
|
303
302
|
params[:verification_number] = creditcard.verification_value if creditcard.verification_value?
|
|
304
303
|
end
|
|
305
|
-
|
|
304
|
+
|
|
306
305
|
# add field for "instant" transaction, using previous transaction id
|
|
307
306
|
def add_billing_id(params, billingid)
|
|
308
307
|
params[:transaction_id] = billingid
|
|
309
308
|
end
|
|
310
|
-
|
|
309
|
+
|
|
311
310
|
# add address fields if present
|
|
312
311
|
def add_address(params, options)
|
|
313
312
|
address = options[:billing_address] || options[:address]
|
|
314
|
-
|
|
315
|
-
if address
|
|
313
|
+
|
|
314
|
+
if address
|
|
316
315
|
params[:address] = address[:address1] unless address[:address1].blank?
|
|
317
316
|
params[:city] = address[:city] unless address[:city].blank?
|
|
318
317
|
params[:state] = address[:state] unless address[:state].blank?
|
|
319
318
|
params[:zipcode] = address[:zip] unless address[:zip].blank?
|
|
320
319
|
params[:country] = address[:country] unless address[:country].blank?
|
|
321
|
-
end
|
|
320
|
+
end
|
|
322
321
|
end
|
|
323
|
-
|
|
322
|
+
|
|
324
323
|
def add_optional_fields(params, options)
|
|
325
324
|
params[:notes] = options[:description] unless options[:description].blank?
|
|
326
325
|
params[:invoice] = options[:order_id].to_s.gsub(/[^-\/\w.,']/, '') unless options[:order_id].blank?
|
|
327
326
|
end
|
|
328
|
-
|
|
327
|
+
|
|
329
328
|
def commit(action, parameters)
|
|
330
329
|
url = test? ? self.test_url : self.live_url
|
|
331
330
|
|
|
332
331
|
response = parse( ssl_post(url, post_data(action, parameters)) )
|
|
333
|
-
|
|
334
|
-
Response.new(successful?(response), message_from(response), response,
|
|
335
|
-
:test => test?,
|
|
332
|
+
|
|
333
|
+
Response.new(successful?(response), message_from(response), response,
|
|
334
|
+
:test => test?,
|
|
336
335
|
:authorization => response[:transaction_id] || parameters[:transaction_id]
|
|
337
336
|
)
|
|
338
337
|
end
|
|
339
|
-
|
|
338
|
+
|
|
340
339
|
def successful?(response)
|
|
341
340
|
SUCCESS_CODES.include?(response[:response_code]) || response[:query_status] == true
|
|
342
341
|
end
|
|
343
|
-
|
|
342
|
+
|
|
344
343
|
def message_from(response)
|
|
345
344
|
if successful?(response)
|
|
346
345
|
SUCCESS_MESSAGE
|
|
@@ -348,7 +347,7 @@ module ActiveMerchant #:nodoc:
|
|
|
348
347
|
DECLINE_CODES[response[:response_code]] || FAILURE_MESSAGE
|
|
349
348
|
end
|
|
350
349
|
end
|
|
351
|
-
|
|
350
|
+
|
|
352
351
|
def post_data(action, params)
|
|
353
352
|
if test?
|
|
354
353
|
# test requests must use global test account
|
|
@@ -360,18 +359,18 @@ module ActiveMerchant #:nodoc:
|
|
|
360
359
|
end
|
|
361
360
|
params[:version] = API_VERSION
|
|
362
361
|
params[:transaction_type] = action
|
|
363
|
-
|
|
362
|
+
|
|
364
363
|
params.reject{|k,v| v.blank?}.collect{ |k, v| "dc_#{k.to_s}=#{CGI.escape(v.to_s)}" }.join("&")
|
|
365
364
|
end
|
|
366
|
-
|
|
365
|
+
|
|
367
366
|
def parse(body)
|
|
368
367
|
# PayJunction uses the Field Separator ASCII character to separate key/val
|
|
369
368
|
# pairs in the response. The <FS> character's octal value is 034.
|
|
370
369
|
#
|
|
371
370
|
# Sample response:
|
|
372
|
-
#
|
|
373
|
-
# transaction_id=44752<FS>response_code=M4<FS>response_message=Declined (INV TEST CARD).
|
|
374
|
-
|
|
371
|
+
#
|
|
372
|
+
# transaction_id=44752<FS>response_code=M4<FS>response_message=Declined (INV TEST CARD).
|
|
373
|
+
|
|
375
374
|
pairs = body.chomp.split("\034")
|
|
376
375
|
response = {}
|
|
377
376
|
pairs.each do |pair|
|
|
@@ -380,7 +379,7 @@ module ActiveMerchant #:nodoc:
|
|
|
380
379
|
end
|
|
381
380
|
response
|
|
382
381
|
end
|
|
383
|
-
|
|
382
|
+
|
|
384
383
|
# Make a ruby type out of the response string
|
|
385
384
|
def normalize(field)
|
|
386
385
|
case field
|
|
@@ -389,9 +388,9 @@ module ActiveMerchant #:nodoc:
|
|
|
389
388
|
when "" then nil
|
|
390
389
|
when "null" then nil
|
|
391
390
|
else field
|
|
392
|
-
end
|
|
391
|
+
end
|
|
393
392
|
end
|
|
394
|
-
|
|
393
|
+
|
|
395
394
|
end
|
|
396
395
|
end
|
|
397
396
|
end
|
|
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
|
|
|
2
2
|
module Billing #:nodoc:
|
|
3
3
|
class PaySecureGateway < Gateway
|
|
4
4
|
self.live_url = self.test_url = 'https://clearance.commsecure.com.au/cgi-bin/PSDirect'
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
self.money_format = :cents
|
|
7
7
|
|
|
8
8
|
# Currently Authorization and Capture is not implemented because
|
|
@@ -10,13 +10,13 @@ module ActiveMerchant #:nodoc:
|
|
|
10
10
|
TRANSACTIONS = {
|
|
11
11
|
:purchase => 'PURCHASE',
|
|
12
12
|
:authorization => 'AUTHORISE',
|
|
13
|
-
:capture => 'ADVICE',
|
|
13
|
+
:capture => 'ADVICE',
|
|
14
14
|
:credit => 'REFUND'
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
SUCCESS = 'Accepted'
|
|
18
18
|
SUCCESS_MESSAGE = 'The transaction was approved'
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
self.supported_countries = ['AU']
|
|
21
21
|
self.homepage_url = 'http://www.commsecure.com.au/paysecure.shtml'
|
|
22
22
|
self.display_name = 'PaySecure'
|
|
@@ -24,21 +24,20 @@ module ActiveMerchant #:nodoc:
|
|
|
24
24
|
|
|
25
25
|
def initialize(options = {})
|
|
26
26
|
requires!(options, :login, :password)
|
|
27
|
-
@options = options
|
|
28
27
|
super
|
|
29
|
-
end
|
|
28
|
+
end
|
|
30
29
|
|
|
31
30
|
def purchase(money, credit_card, options = {})
|
|
32
31
|
requires!(options, :order_id)
|
|
33
|
-
|
|
32
|
+
|
|
34
33
|
post = {}
|
|
35
34
|
add_amount(post, money)
|
|
36
35
|
add_invoice(post, options)
|
|
37
|
-
add_credit_card(post, credit_card)
|
|
38
|
-
|
|
36
|
+
add_credit_card(post, credit_card)
|
|
37
|
+
|
|
39
38
|
commit(:purchase, money, post)
|
|
40
|
-
end
|
|
41
|
-
|
|
39
|
+
end
|
|
40
|
+
|
|
42
41
|
private
|
|
43
42
|
# Used for capturing, which is currently not supported.
|
|
44
43
|
def add_reference(post, identification)
|
|
@@ -46,72 +45,72 @@ module ActiveMerchant #:nodoc:
|
|
|
46
45
|
post[:authnum] = auth
|
|
47
46
|
post[:transid] = trans_id
|
|
48
47
|
end
|
|
49
|
-
|
|
48
|
+
|
|
50
49
|
def add_amount(post, money)
|
|
51
50
|
post[:amount] = amount(money)
|
|
52
51
|
end
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
def add_invoice(post, options)
|
|
55
54
|
post[:merchant_transid] = options[:order_id].to_s.slice(0,21)
|
|
56
55
|
post[:memnum] = options[:invoice]
|
|
57
56
|
post[:custnum] = options[:customer]
|
|
58
57
|
post[:clientdata] = options[:description]
|
|
59
58
|
end
|
|
60
|
-
|
|
61
|
-
def add_credit_card(post, credit_card)
|
|
59
|
+
|
|
60
|
+
def add_credit_card(post, credit_card)
|
|
62
61
|
post[:cardnum] = credit_card.number
|
|
63
62
|
post[:cardname] = credit_card.name
|
|
64
63
|
post[:expiry] = expdate(credit_card)
|
|
65
64
|
post[:cvv2] = credit_card.verification_value
|
|
66
65
|
end
|
|
67
|
-
|
|
66
|
+
|
|
68
67
|
def expdate(credit_card)
|
|
69
68
|
year = sprintf("%.4i", credit_card.year)
|
|
70
69
|
month = sprintf("%.2i", credit_card.month)
|
|
71
70
|
|
|
72
71
|
"#{month}#{year[-2..-1]}"
|
|
73
72
|
end
|
|
74
|
-
|
|
73
|
+
|
|
75
74
|
def commit(action, money, parameters)
|
|
76
75
|
response = parse( ssl_post(self.live_url, post_data(action, parameters)) )
|
|
77
|
-
|
|
78
|
-
Response.new(successful?(response), message_from(response), response,
|
|
79
|
-
:test => test_response?(response),
|
|
76
|
+
|
|
77
|
+
Response.new(successful?(response), message_from(response), response,
|
|
78
|
+
:test => test_response?(response),
|
|
80
79
|
:authorization => authorization_from(response)
|
|
81
80
|
)
|
|
82
|
-
|
|
81
|
+
|
|
83
82
|
end
|
|
84
|
-
|
|
83
|
+
|
|
85
84
|
def successful?(response)
|
|
86
85
|
response[:status] == SUCCESS
|
|
87
86
|
end
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
def authorization_from(response)
|
|
90
89
|
[ response[:authnum], response[:transid] ].compact.join(";")
|
|
91
90
|
end
|
|
92
|
-
|
|
91
|
+
|
|
93
92
|
def test_response?(response)
|
|
94
93
|
!!(response[:transid] =~ /SimProxy/)
|
|
95
94
|
end
|
|
96
|
-
|
|
95
|
+
|
|
97
96
|
def message_from(response)
|
|
98
97
|
successful?(response) ? SUCCESS_MESSAGE : response[:errorstring]
|
|
99
98
|
end
|
|
100
|
-
|
|
99
|
+
|
|
101
100
|
def parse(body)
|
|
102
101
|
response = {}
|
|
103
|
-
body.to_s.each_line do |l|
|
|
102
|
+
body.to_s.each_line do |l|
|
|
104
103
|
key, value = l.split(":", 2)
|
|
105
104
|
response[key.to_s.downcase.to_sym] = value.strip
|
|
106
105
|
end
|
|
107
106
|
response
|
|
108
|
-
end
|
|
109
|
-
|
|
107
|
+
end
|
|
108
|
+
|
|
110
109
|
def post_data(action, parameters = {})
|
|
111
110
|
parameters[:request_type] = TRANSACTIONS[action]
|
|
112
111
|
parameters[:merchant_id] = @options[:login]
|
|
113
112
|
parameters[:password] = @options[:password]
|
|
114
|
-
|
|
113
|
+
|
|
115
114
|
parameters.reject{|k,v| v.blank?}.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join("&")
|
|
116
115
|
end
|
|
117
116
|
end
|
|
@@ -60,7 +60,6 @@ module ActiveMerchant #:nodoc:
|
|
|
60
60
|
|
|
61
61
|
def initialize(options = {})
|
|
62
62
|
requires!(options, :login, :password)
|
|
63
|
-
@options = options
|
|
64
63
|
super
|
|
65
64
|
end
|
|
66
65
|
|
|
@@ -109,10 +108,6 @@ module ActiveMerchant #:nodoc:
|
|
|
109
108
|
commit('refund', money, post)
|
|
110
109
|
end
|
|
111
110
|
|
|
112
|
-
def test?
|
|
113
|
-
@options[:test] || Base.gateway_mode == :test
|
|
114
|
-
end
|
|
115
|
-
|
|
116
111
|
private
|
|
117
112
|
|
|
118
113
|
def add_invoice(post, options)
|
|
@@ -3,20 +3,20 @@ module ActiveMerchant #:nodoc:
|
|
|
3
3
|
module PayflowCommonAPI
|
|
4
4
|
def self.included(base)
|
|
5
5
|
base.default_currency = 'USD'
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
base.class_attribute :partner
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
# Set the default partner to PayPal
|
|
10
10
|
base.partner = 'PayPal'
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
base.supported_countries = ['US', 'CA', 'SG', 'AU']
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
base.class_attribute :timeout
|
|
15
15
|
base.timeout = 60
|
|
16
16
|
|
|
17
17
|
base.test_url = 'https://pilot-payflowpro.paypal.com'
|
|
18
18
|
base.live_url = 'https://payflowpro.paypal.com'
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
# Enable safe retry of failed connections
|
|
21
21
|
# Payflow is safe to retry because retried transactions use the same
|
|
22
22
|
# X-VPS-Request-ID header. If a transaction is detected as a duplicate
|
|
@@ -25,9 +25,9 @@ module ActiveMerchant #:nodoc:
|
|
|
25
25
|
# hash.
|
|
26
26
|
base.retry_safe = true
|
|
27
27
|
end
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
XMLNS = 'http://www.paypal.com/XMLPay'
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
CARD_MAPPING = {
|
|
32
32
|
:visa => 'Visa',
|
|
33
33
|
:master => 'MasterCard',
|
|
@@ -38,45 +38,40 @@ module ActiveMerchant #:nodoc:
|
|
|
38
38
|
:switch => 'Switch',
|
|
39
39
|
:solo => 'Solo'
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
TRANSACTIONS = {
|
|
41
|
+
|
|
42
|
+
TRANSACTIONS = {
|
|
43
43
|
:purchase => "Sale",
|
|
44
44
|
:authorization => "Authorization",
|
|
45
45
|
:capture => "Capture",
|
|
46
46
|
:void => "Void",
|
|
47
|
-
:credit => "Credit"
|
|
47
|
+
:credit => "Credit"
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
CVV_CODE = {
|
|
51
51
|
'Match' => 'M',
|
|
52
52
|
'No Match' => 'N',
|
|
53
|
-
'Service Not Available' => 'U',
|
|
53
|
+
'Service Not Available' => 'U',
|
|
54
54
|
'Service not Requested' => 'P'
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
def initialize(options = {})
|
|
58
58
|
requires!(options, :login, :password)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@options[:partner] = partner if @options[:partner].blank?
|
|
59
|
+
|
|
60
|
+
options[:partner] = partner if options[:partner].blank?
|
|
62
61
|
super
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def test?
|
|
66
|
-
@options[:test] || super
|
|
67
62
|
end
|
|
68
|
-
|
|
63
|
+
|
|
69
64
|
def capture(money, authorization, options = {})
|
|
70
65
|
request = build_reference_request(:capture, money, authorization, options)
|
|
71
66
|
commit(request, options)
|
|
72
67
|
end
|
|
73
|
-
|
|
68
|
+
|
|
74
69
|
def void(authorization, options = {})
|
|
75
70
|
request = build_reference_request(:void, nil, authorization, options)
|
|
76
71
|
commit(request, options)
|
|
77
72
|
end
|
|
78
|
-
|
|
79
|
-
private
|
|
73
|
+
|
|
74
|
+
private
|
|
80
75
|
def build_request(body, options = {})
|
|
81
76
|
xml = Builder::XmlMarkup.new
|
|
82
77
|
xml.instruct!
|
|
@@ -104,12 +99,12 @@ module ActiveMerchant #:nodoc:
|
|
|
104
99
|
end
|
|
105
100
|
xml.target!
|
|
106
101
|
end
|
|
107
|
-
|
|
102
|
+
|
|
108
103
|
def build_reference_request(action, money, authorization, options)
|
|
109
104
|
xml = Builder::XmlMarkup.new
|
|
110
105
|
xml.tag! TRANSACTIONS[action] do
|
|
111
106
|
xml.tag! 'PNRef', authorization
|
|
112
|
-
|
|
107
|
+
|
|
113
108
|
unless money.nil?
|
|
114
109
|
xml.tag! 'Invoice' do
|
|
115
110
|
xml.tag!('TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money))
|
|
@@ -119,11 +114,11 @@ module ActiveMerchant #:nodoc:
|
|
|
119
114
|
end
|
|
120
115
|
end
|
|
121
116
|
end
|
|
122
|
-
|
|
117
|
+
|
|
123
118
|
xml.target!
|
|
124
119
|
end
|
|
125
120
|
|
|
126
|
-
def add_address(xml, tag, address, options)
|
|
121
|
+
def add_address(xml, tag, address, options)
|
|
127
122
|
return if address.nil?
|
|
128
123
|
xml.tag! tag do
|
|
129
124
|
xml.tag! 'Name', address[:name] unless address[:name].blank?
|
|
@@ -131,7 +126,7 @@ module ActiveMerchant #:nodoc:
|
|
|
131
126
|
xml.tag! 'Phone', address[:phone] unless address[:phone].blank?
|
|
132
127
|
xml.tag! 'CustCode', options[:customer] if !options[:customer].blank? && tag == 'BillTo'
|
|
133
128
|
xml.tag! 'PONum', options[:po_number] if !options[:po_number].blank? && tag == 'BillTo'
|
|
134
|
-
|
|
129
|
+
|
|
135
130
|
xml.tag! 'Address' do
|
|
136
131
|
xml.tag! 'Street', address[:address1] unless address[:address1].blank?
|
|
137
132
|
xml.tag! 'City', address[:city] unless address[:city].blank?
|
|
@@ -141,26 +136,26 @@ module ActiveMerchant #:nodoc:
|
|
|
141
136
|
end
|
|
142
137
|
end
|
|
143
138
|
end
|
|
144
|
-
|
|
139
|
+
|
|
145
140
|
def parse(data)
|
|
146
141
|
response = {}
|
|
147
142
|
xml = REXML::Document.new(data)
|
|
148
143
|
root = REXML::XPath.first(xml, "//ResponseData")
|
|
149
|
-
|
|
144
|
+
|
|
150
145
|
# REXML::XPath in Ruby 1.8.6 is now unable to match nodes based on their attributes
|
|
151
146
|
tx_result = REXML::XPath.first(root, "//TransactionResult")
|
|
152
|
-
|
|
147
|
+
|
|
153
148
|
if tx_result && tx_result.attributes['Duplicate'] == "true"
|
|
154
|
-
response[:duplicate] = true
|
|
149
|
+
response[:duplicate] = true
|
|
155
150
|
end
|
|
156
|
-
|
|
151
|
+
|
|
157
152
|
root.elements.to_a.each do |node|
|
|
158
153
|
parse_element(response, node)
|
|
159
154
|
end
|
|
160
155
|
|
|
161
156
|
response
|
|
162
157
|
end
|
|
163
|
-
|
|
158
|
+
|
|
164
159
|
def parse_element(response, node)
|
|
165
160
|
node_name = node.name.underscore.to_sym
|
|
166
161
|
case
|
|
@@ -182,7 +177,7 @@ module ActiveMerchant #:nodoc:
|
|
|
182
177
|
response[node_name] = node.text
|
|
183
178
|
end
|
|
184
179
|
end
|
|
185
|
-
|
|
180
|
+
|
|
186
181
|
def build_headers(content_length)
|
|
187
182
|
{
|
|
188
183
|
"Content-Type" => "text/xml",
|
|
@@ -193,11 +188,11 @@ module ActiveMerchant #:nodoc:
|
|
|
193
188
|
"X-VPS-Request-ID" => Utils.generate_unique_id
|
|
194
189
|
}
|
|
195
190
|
end
|
|
196
|
-
|
|
191
|
+
|
|
197
192
|
def commit(request_body, options = {})
|
|
198
193
|
request = build_request(request_body, options)
|
|
199
194
|
headers = build_headers(request.size)
|
|
200
|
-
|
|
195
|
+
|
|
201
196
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request, headers))
|
|
202
197
|
|
|
203
198
|
build_response(response[:result] == "0", response[:message], response,
|