activemerchant 1.28.0 → 1.29.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +3 -3
- data/CHANGELOG +36 -0
- data/CONTRIBUTORS +8 -0
- data/README.md +5 -0
- data/lib/active_merchant/billing/gateway.rb +2 -1
- data/lib/active_merchant/billing/gateways.rb +6 -7
- 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/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.rb +25 -21
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- 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.rb +15 -16
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
- 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/integrations/a1agregator.rb +26 -0
- 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/liqpay.rb +30 -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/moneybookers/helper.rb +17 -1
- data/lib/active_merchant/billing/integrations/notification.rb +4 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -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/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 +19 -4
- data/lib/active_merchant/version.rb +1 -1
- metadata +45 -27
- metadata.gz.sig +0 -0
@@ -10,7 +10,6 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
|
11
11
|
def initialize(options = {})
|
12
12
|
requires!(options, :login)
|
13
|
-
@options = options
|
14
13
|
super
|
15
14
|
end
|
16
15
|
|
@@ -46,7 +45,7 @@ module ActiveMerchant #:nodoc:
|
|
46
45
|
|
47
46
|
def add_address(post, creditcard, options)
|
48
47
|
post[:address] = options[:billing_address][:address1]
|
49
|
-
post[:post_code] = options[:billing_address][:
|
48
|
+
post[:post_code] = options[:billing_address][:zip]
|
50
49
|
end
|
51
50
|
|
52
51
|
def add_creditcard(post, creditcard)
|
@@ -10,13 +10,12 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
self.money_format = :cents
|
11
11
|
self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-mpi/'
|
12
12
|
self.display_name = 'Barclays ePDQ'
|
13
|
-
|
13
|
+
|
14
14
|
def initialize(options = {})
|
15
15
|
requires!(options, :login, :password, :client_id)
|
16
|
-
@options = options
|
17
16
|
super
|
18
|
-
end
|
19
|
-
|
17
|
+
end
|
18
|
+
|
20
19
|
def authorize(money, creditcard, options = {})
|
21
20
|
document = Document.new(self, @options) do
|
22
21
|
add_order_form(options[:order_id]) do
|
@@ -29,7 +28,7 @@ module ActiveMerchant #:nodoc:
|
|
29
28
|
|
30
29
|
commit(document)
|
31
30
|
end
|
32
|
-
|
31
|
+
|
33
32
|
def purchase(money, creditcard, options = {})
|
34
33
|
# disable fraud checks if this is a repeat order:
|
35
34
|
if options[:payment_number] && (options[:payment_number] > 1)
|
@@ -46,9 +45,9 @@ module ActiveMerchant #:nodoc:
|
|
46
45
|
end
|
47
46
|
end
|
48
47
|
commit(document)
|
49
|
-
end
|
50
|
-
|
51
|
-
# authorization is your unique order ID, not the authorization
|
48
|
+
end
|
49
|
+
|
50
|
+
# authorization is your unique order ID, not the authorization
|
52
51
|
# code returned by ePDQ
|
53
52
|
def capture(money, authorization, options = {})
|
54
53
|
document = Document.new(self, @options) do
|
@@ -60,7 +59,7 @@ module ActiveMerchant #:nodoc:
|
|
60
59
|
commit(document)
|
61
60
|
end
|
62
61
|
|
63
|
-
# authorization is your unique order ID, not the authorization
|
62
|
+
# authorization is your unique order ID, not the authorization
|
64
63
|
# code returned by ePDQ
|
65
64
|
def credit(money, creditcard_or_authorization, options = {})
|
66
65
|
if creditcard_or_authorization.is_a?(String)
|
@@ -85,7 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
85
84
|
commit(document)
|
86
85
|
end
|
87
86
|
|
88
|
-
private
|
87
|
+
private
|
89
88
|
def credit_new_order(money, creditcard, options)
|
90
89
|
document = Document.new(self, @options) do
|
91
90
|
add_order_form do
|
@@ -106,10 +105,10 @@ module ActiveMerchant #:nodoc:
|
|
106
105
|
add_transaction(:Credit, money)
|
107
106
|
end
|
108
107
|
end
|
109
|
-
|
108
|
+
|
110
109
|
commit(document)
|
111
110
|
end
|
112
|
-
|
111
|
+
|
113
112
|
def parse(body)
|
114
113
|
parser = Parser.new(body)
|
115
114
|
response = parser.parse
|
@@ -121,8 +120,8 @@ module ActiveMerchant #:nodoc:
|
|
121
120
|
:order_id => response[:order_id],
|
122
121
|
:raw_response => response[:raw_response]
|
123
122
|
)
|
124
|
-
end
|
125
|
-
|
123
|
+
end
|
124
|
+
|
126
125
|
def commit(document)
|
127
126
|
url = (test? ? self.test_url : self.live_url)
|
128
127
|
data = ssl_post(url, document.to_xml)
|
@@ -150,7 +149,7 @@ module ActiveMerchant #:nodoc:
|
|
150
149
|
success = find(doc, "//Transaction/AuthCode").present?
|
151
150
|
end
|
152
151
|
|
153
|
-
{
|
152
|
+
{
|
154
153
|
:success => success,
|
155
154
|
:message => message,
|
156
155
|
:transaction_id => find(doc, "//Transaction/Id"),
|
@@ -169,7 +168,7 @@ module ActiveMerchant #:nodoc:
|
|
169
168
|
class Document
|
170
169
|
attr_reader :type, :xml
|
171
170
|
|
172
|
-
PAYMENT_INTERVALS = {
|
171
|
+
PAYMENT_INTERVALS = {
|
173
172
|
:days => 'D',
|
174
173
|
:months => 'M'
|
175
174
|
}
|
@@ -180,7 +179,7 @@ module ActiveMerchant #:nodoc:
|
|
180
179
|
:switch => 9,
|
181
180
|
:maestro => 10,
|
182
181
|
}
|
183
|
-
|
182
|
+
|
184
183
|
def initialize(gateway, options = {}, document_options = {}, &block)
|
185
184
|
@gateway = gateway
|
186
185
|
@options = options
|
@@ -206,7 +205,7 @@ module ActiveMerchant #:nodoc:
|
|
206
205
|
end
|
207
206
|
xml.Instructions do
|
208
207
|
if @document_options[:no_fraud]
|
209
|
-
xml.Pipeline "PaymentNoFraud"
|
208
|
+
xml.Pipeline "PaymentNoFraud"
|
210
209
|
else
|
211
210
|
xml.Pipeline "Payment"
|
212
211
|
end
|
@@ -294,9 +293,9 @@ module ActiveMerchant #:nodoc:
|
|
294
293
|
# date must be formatted MM/YY
|
295
294
|
def format_expiry_date(creditcard)
|
296
295
|
month_str = "%02d" % creditcard.month
|
297
|
-
if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
|
296
|
+
if match = creditcard.year.to_s.match(/^\d{2}(\d{2})$/)
|
298
297
|
year_str = "%02d" % match[1].to_i
|
299
|
-
else
|
298
|
+
else
|
300
299
|
year_str = "%02d" % creditcard.year
|
301
300
|
end
|
302
301
|
"#{month_str}/#{year_str}"
|
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
|
|
37
37
|
'5' => 'I',
|
38
38
|
'9' => 'I'
|
39
39
|
}
|
40
|
-
|
40
|
+
|
41
41
|
PERIODS = {
|
42
42
|
:days => 'D',
|
43
43
|
:weeks => 'W',
|
@@ -75,28 +75,27 @@ module ActiveMerchant #:nodoc:
|
|
75
75
|
# The name of the gateway
|
76
76
|
base.display_name = 'Beanstream.com'
|
77
77
|
end
|
78
|
-
|
79
|
-
# Only <tt>:login</tt> is required by default,
|
80
|
-
# which is the merchant's merchant ID. If you'd like to perform void,
|
78
|
+
|
79
|
+
# Only <tt>:login</tt> is required by default,
|
80
|
+
# which is the merchant's merchant ID. If you'd like to perform void,
|
81
81
|
# capture or refund transactions then you'll also need to add a username
|
82
82
|
# and password to your account under administration -> account settings ->
|
83
83
|
# order settings -> Use username/password validation
|
84
84
|
def initialize(options = {})
|
85
85
|
requires!(options, :login)
|
86
|
-
@options = options
|
87
86
|
super
|
88
87
|
end
|
89
|
-
|
88
|
+
|
90
89
|
def capture(money, authorization, options = {})
|
91
90
|
reference, amount, type = split_auth(authorization)
|
92
|
-
|
91
|
+
|
93
92
|
post = {}
|
94
93
|
add_amount(post, money)
|
95
94
|
add_reference(post, reference)
|
96
95
|
add_transaction_type(post, :capture)
|
97
96
|
commit(post)
|
98
97
|
end
|
99
|
-
|
98
|
+
|
100
99
|
def refund(money, source, options = {})
|
101
100
|
post = {}
|
102
101
|
reference, amount, type = split_auth(source)
|
@@ -110,7 +109,7 @@ module ActiveMerchant #:nodoc:
|
|
110
109
|
deprecated Gateway::CREDIT_DEPRECATION_MESSAGE
|
111
110
|
refund(money, source, options)
|
112
111
|
end
|
113
|
-
|
112
|
+
|
114
113
|
private
|
115
114
|
def purchase_action(source)
|
116
115
|
if source.is_a?(Check)
|
@@ -119,38 +118,38 @@ module ActiveMerchant #:nodoc:
|
|
119
118
|
:purchase
|
120
119
|
end
|
121
120
|
end
|
122
|
-
|
121
|
+
|
123
122
|
def void_action(original_transaction_type)
|
124
123
|
(original_transaction_type == TRANSACTIONS[:refund]) ? :void_refund : :void_purchase
|
125
124
|
end
|
126
|
-
|
125
|
+
|
127
126
|
def refund_action(type)
|
128
127
|
(type == TRANSACTIONS[:check_purchase]) ? :check_refund : :refund
|
129
128
|
end
|
130
|
-
|
129
|
+
|
131
130
|
def secure_profile_action(type)
|
132
131
|
PROFILE_OPERATIONS[type] || PROFILE_OPERATIONS[:new]
|
133
132
|
end
|
134
|
-
|
133
|
+
|
135
134
|
def split_auth(string)
|
136
135
|
string.split(";")
|
137
136
|
end
|
138
|
-
|
137
|
+
|
139
138
|
def add_amount(post, money)
|
140
139
|
post[:trnAmount] = amount(money)
|
141
140
|
end
|
142
|
-
|
141
|
+
|
143
142
|
def add_original_amount(post, amount)
|
144
143
|
post[:trnAmount] = amount
|
145
144
|
end
|
146
145
|
|
147
|
-
def add_reference(post, reference)
|
146
|
+
def add_reference(post, reference)
|
148
147
|
post[:adjId] = reference
|
149
148
|
end
|
150
|
-
|
149
|
+
|
151
150
|
def add_address(post, options)
|
152
151
|
prepare_address_for_non_american_countries(options)
|
153
|
-
|
152
|
+
|
154
153
|
if billing_address = options[:billing_address] || options[:address]
|
155
154
|
post[:ordName] = billing_address[:name]
|
156
155
|
post[:ordEmailAddress] = options[:email]
|
@@ -195,7 +194,7 @@ module ActiveMerchant #:nodoc:
|
|
195
194
|
post[:ordTax2Price] = amount(options[:tax2])
|
196
195
|
post[:ref1] = options[:custom]
|
197
196
|
end
|
198
|
-
|
197
|
+
|
199
198
|
def add_credit_card(post, credit_card)
|
200
199
|
if credit_card
|
201
200
|
post[:trnCardOwner] = credit_card.name
|
@@ -205,31 +204,31 @@ module ActiveMerchant #:nodoc:
|
|
205
204
|
post[:trnCardCvd] = credit_card.verification_value
|
206
205
|
end
|
207
206
|
end
|
208
|
-
|
207
|
+
|
209
208
|
def add_check(post, check)
|
210
209
|
# The institution number of the consumer’s financial institution. Required for Canadian dollar EFT transactions.
|
211
210
|
post[:institutionNumber] = check.institution_number
|
212
|
-
|
211
|
+
|
213
212
|
# The bank transit number of the consumer’s bank account. Required for Canadian dollar EFT transactions.
|
214
213
|
post[:transitNumber] = check.transit_number
|
215
|
-
|
214
|
+
|
216
215
|
# The routing number of the consumer’s bank account. Required for US dollar EFT transactions.
|
217
216
|
post[:routingNumber] = check.routing_number
|
218
|
-
|
217
|
+
|
219
218
|
# The account number of the consumer’s bank account. Required for both Canadian and US dollar EFT transactions.
|
220
219
|
post[:accountNumber] = check.account_number
|
221
220
|
end
|
222
|
-
|
221
|
+
|
223
222
|
def add_secure_profile_variables(post, options = {})
|
224
223
|
post[:serviceVersion] = SP_SERVICE_VERSION
|
225
224
|
post[:responseFormat] = 'QS'
|
226
225
|
post[:cardValidation] = (options[:cardValidation].to_i == 1) || '0'
|
227
|
-
|
226
|
+
|
228
227
|
post[:operationType] = options[:operationType] || options[:operation] || secure_profile_action(:new)
|
229
228
|
post[:customerCode] = options[:billing_id] || options[:vault_id] || false
|
230
229
|
post[:status] = options[:status]
|
231
230
|
end
|
232
|
-
|
231
|
+
|
233
232
|
def add_recurring_amount(post, money)
|
234
233
|
post[:amount] = amount(money)
|
235
234
|
end
|
@@ -293,14 +292,14 @@ module ActiveMerchant #:nodoc:
|
|
293
292
|
results[key.to_sym] = val.nil? ? nil : CGI.unescape(val)
|
294
293
|
end
|
295
294
|
end
|
296
|
-
|
295
|
+
|
297
296
|
# Clean up the message text if there is any
|
298
297
|
if results[:messageText]
|
299
298
|
results[:messageText].gsub!(/<LI>/, "")
|
300
299
|
results[:messageText].gsub!(/(\.)?<br>/, ". ")
|
301
300
|
results[:messageText].strip!
|
302
301
|
end
|
303
|
-
|
302
|
+
|
304
303
|
results
|
305
304
|
end
|
306
305
|
|
@@ -314,7 +313,7 @@ module ActiveMerchant #:nodoc:
|
|
314
313
|
def commit(params, use_profile_api = false)
|
315
314
|
post(post_data(params,use_profile_api),use_profile_api)
|
316
315
|
end
|
317
|
-
|
316
|
+
|
318
317
|
def recurring_commit(params)
|
319
318
|
recurring_post(post_data(params, false))
|
320
319
|
end
|
@@ -329,7 +328,7 @@ module ActiveMerchant #:nodoc:
|
|
329
328
|
:avs_result => { :code => (AVS_CODES.include? response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
|
330
329
|
)
|
331
330
|
end
|
332
|
-
|
331
|
+
|
333
332
|
def recurring_post(data)
|
334
333
|
response = recurring_parse(ssl_post(RECURRING_URL, data))
|
335
334
|
build_response(recurring_success?(response), recurring_message_from(response), response)
|
@@ -350,7 +349,7 @@ module ActiveMerchant #:nodoc:
|
|
350
349
|
def success?(response)
|
351
350
|
response[:responseType] == 'R' || response[:trnApproved] == '1' || response[:responseCode] == '1'
|
352
351
|
end
|
353
|
-
|
352
|
+
|
354
353
|
def recurring_success?(response)
|
355
354
|
response[:code] == '1'
|
356
355
|
end
|
@@ -362,24 +361,24 @@ module ActiveMerchant #:nodoc:
|
|
362
361
|
card_brand(source) == "check" ? add_check(post, source) : add_credit_card(post, source)
|
363
362
|
end
|
364
363
|
end
|
365
|
-
|
364
|
+
|
366
365
|
def add_transaction_type(post, action)
|
367
366
|
post[:trnType] = TRANSACTIONS[action]
|
368
367
|
end
|
369
|
-
|
368
|
+
|
370
369
|
def post_data(params, use_profile_api)
|
371
370
|
params[:requestType] = 'BACKEND'
|
372
371
|
if use_profile_api
|
373
|
-
params[:merchantId] = @options[:login]
|
372
|
+
params[:merchantId] = @options[:login]
|
374
373
|
params[:passCode] = @options[:secure_profile_api_key]
|
375
374
|
else
|
376
375
|
params[:username] = @options[:user] if @options[:user]
|
377
376
|
params[:password] = @options[:password] if @options[:password]
|
378
|
-
params[:merchant_id] = @options[:login]
|
377
|
+
params[:merchant_id] = @options[:login]
|
379
378
|
end
|
380
379
|
params[:vbvEnabled] = '0'
|
381
380
|
params[:scEnabled] = '0'
|
382
|
-
|
381
|
+
|
383
382
|
params.reject{|k, v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
384
383
|
end
|
385
384
|
|
@@ -7,9 +7,9 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
|
8
8
|
self.live_url = 'https://secure.bluepay.com/interfaces/bp20post'
|
9
9
|
self.rebilling_url = 'https://secure.bluepay.com/interfaces/bp20rebadmin'
|
10
|
-
|
10
|
+
|
11
11
|
self.ignore_http_status = true
|
12
|
-
|
12
|
+
|
13
13
|
RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT = 0, 2, 3
|
14
14
|
AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE = 5, 6, 38
|
15
15
|
|
@@ -35,10 +35,9 @@ module ActiveMerchant #:nodoc:
|
|
35
35
|
#
|
36
36
|
# * <tt>:account_id</tt> -- The BluePay gateway Account ID (REQUIRED)
|
37
37
|
# * <tt>:secret_key</tt> -- The BluePay gateway Secret Key (REQUIRED)
|
38
|
-
# * <tt>:test</tt> -- set to true for TEST mode or false for LIVE mode
|
38
|
+
# * <tt>:test</tt> -- set to true for TEST mode or false for LIVE mode
|
39
39
|
def initialize(options = {})
|
40
40
|
requires!(options, :login, :password)
|
41
|
-
@options = options
|
42
41
|
super
|
43
42
|
end
|
44
43
|
|
@@ -54,30 +53,30 @@ module ActiveMerchant #:nodoc:
|
|
54
53
|
# or a token. The token is called the Master ID. This is a unique transaction ID returned from a previous transaction. This token associates all the stored information for a previous transaction.
|
55
54
|
# * <tt>options</tt> -- A hash of optional parameters.
|
56
55
|
def authorize(money, payment_object, options = {})
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
post = {}
|
57
|
+
post[:MASTER_ID] = ''
|
58
|
+
if payment_object != nil && payment_object.class() != String
|
59
|
+
payment_object.class() == ActiveMerchant::Billing::Check ?
|
61
60
|
add_check(post, payment_object) :
|
62
61
|
add_creditcard(post, payment_object)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
else
|
63
|
+
post[:MASTER_ID] = payment_object
|
64
|
+
end
|
65
|
+
add_invoice(post, options)
|
67
66
|
add_address(post, options)
|
68
67
|
add_customer_data(post, options)
|
69
|
-
|
68
|
+
if options[:rebill] != nil
|
70
69
|
post[:DO_REBILL] = '1'
|
71
70
|
post[:REB_AMOUNT] = amount(options[:rebill_amount])
|
72
71
|
post[:REB_FIRST_DATE] = options[:rebill_start_date]
|
73
72
|
post[:REB_EXPR] = options[:rebill_expression]
|
74
73
|
post[:REB_CYCLES] = options[:rebill_cycles]
|
75
74
|
end
|
76
|
-
|
75
|
+
post[:TRANS_TYPE] = 'AUTH'
|
77
76
|
commit('AUTH_ONLY', money, post)
|
78
77
|
end
|
79
78
|
|
80
|
-
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
79
|
+
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
81
80
|
# This is referred to a SALE transaction in BluePay
|
82
81
|
#
|
83
82
|
# ==== Parameters
|
@@ -89,26 +88,26 @@ module ActiveMerchant #:nodoc:
|
|
89
88
|
# or a token. The token is called the Master ID. This is a unique transaction ID returned from a previous transaction. This token associates all the stored information for a previous transaction.
|
90
89
|
# * <tt>options</tt> -- A hash of optional parameters.,
|
91
90
|
def purchase(money, payment_object, options = {})
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
91
|
+
post = {}
|
92
|
+
post[:MASTER_ID] = ''
|
93
|
+
if payment_object != nil && payment_object.class() != String
|
94
|
+
payment_object.class() == ActiveMerchant::Billing::Check ?
|
95
|
+
add_check(post, payment_object) :
|
96
|
+
add_creditcard(post, payment_object)
|
97
|
+
else
|
98
|
+
post[:MASTER_ID] = payment_object
|
99
|
+
end
|
100
|
+
add_invoice(post, options)
|
102
101
|
add_address(post, options)
|
103
102
|
add_customer_data(post, options)
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
if options[:rebill] != nil
|
104
|
+
post[:DO_REBILL] = '1'
|
105
|
+
post[:REB_AMOUNT] = amount(options[:rebill_amount])
|
107
106
|
post[:REB_FIRST_DATE] = options[:rebill_start_date]
|
108
107
|
post[:REB_EXPR] = options[:rebill_expression]
|
109
108
|
post[:REB_CYCLES] = options[:rebill_cycles]
|
110
109
|
end
|
111
|
-
|
110
|
+
post[:TRANS_TYPE] = 'SALE'
|
112
111
|
commit('AUTH_CAPTURE', money, post)
|
113
112
|
end
|
114
113
|
|
@@ -120,11 +119,11 @@ module ActiveMerchant #:nodoc:
|
|
120
119
|
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
121
120
|
# * <tt>identification</tt> -- The Master ID, or token, returned from the previous authorize transaction.
|
122
121
|
def capture(money, identification, options = {})
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
post = {}
|
123
|
+
add_address(post, options)
|
124
|
+
add_customer_data(post, options)
|
126
125
|
post[:MASTER_ID] = identification
|
127
|
-
|
126
|
+
post[:TRANS_TYPE] = 'CAPTURE'
|
128
127
|
commit('PRIOR_AUTH_CAPTURE', money, post)
|
129
128
|
end
|
130
129
|
|
@@ -135,9 +134,9 @@ module ActiveMerchant #:nodoc:
|
|
135
134
|
#
|
136
135
|
# * <tt>identification</tt> - The Master ID, or token, returned from a previous authorize transaction.
|
137
136
|
def void(identification, options = {})
|
138
|
-
|
137
|
+
post = {}
|
139
138
|
post[:MASTER_ID] = identification
|
140
|
-
|
139
|
+
post[:TRANS_TYPE] = 'VOID'
|
141
140
|
commit('VOID', nil, post)
|
142
141
|
end
|
143
142
|
|
@@ -156,20 +155,20 @@ module ActiveMerchant #:nodoc:
|
|
156
155
|
# If the payment_object is either a CreditCard or Check object, then the transaction type will be an unmatched credit placing funds in the specified account. This is referred to a CREDIT transaction in BluePay.
|
157
156
|
# * <tt>options</tt> -- A hash of parameters.
|
158
157
|
def refund(money, payment_object, options = {})
|
159
|
-
|
160
|
-
|
158
|
+
post = {}
|
159
|
+
post[:PAYMENT_ACCOUNT] = ''
|
161
160
|
if payment_object != nil && payment_object.class() != String
|
162
161
|
payment_object.class() == ActiveMerchant::Billing::Check ?
|
163
162
|
add_check(post, payment_object) :
|
164
163
|
add_creditcard(post, payment_object)
|
165
|
-
|
164
|
+
post[:TRANS_TYPE] = 'CREDIT'
|
166
165
|
else
|
167
166
|
post[:MASTER_ID] = payment_object
|
168
|
-
|
167
|
+
post[:TRANS_TYPE] = 'REFUND'
|
169
168
|
end
|
170
169
|
|
171
170
|
options[:first_name] ? post[:NAME1] = options[:first_name] : post[:NAME1] = ''
|
172
|
-
post[:NAME2] = options[:last_name] if options[:last_name]
|
171
|
+
post[:NAME2] = options[:last_name] if options[:last_name]
|
173
172
|
post[:ZIP] = options[:zip] if options[:zip]
|
174
173
|
add_invoice(post, options)
|
175
174
|
add_address(post, options)
|
@@ -195,7 +194,7 @@ module ActiveMerchant #:nodoc:
|
|
195
194
|
|
196
195
|
# ==== Options
|
197
196
|
#
|
198
|
-
# * <tt>:rebill_start_date</tt> is a string that tells the gateway when to start the rebill. (REQUIRED)
|
197
|
+
# * <tt>:rebill_start_date</tt> is a string that tells the gateway when to start the rebill. (REQUIRED)
|
199
198
|
# Has two valid formats:
|
200
199
|
# "YYYY-MM-DD HH:MM:SS" Hours, minutes, and seconds are optional.
|
201
200
|
# "XX UNITS" Relative date as explained below. Marked from the time of the
|
@@ -206,16 +205,16 @@ module ActiveMerchant #:nodoc:
|
|
206
205
|
# * <tt>rebill_cycles</tt>: Number of times to rebill. Don't send or set to nil for infinite rebillings (or
|
207
206
|
# until canceled).
|
208
207
|
# * <tt>rebill_amount</tt>: Amount to rebill. Defaults to amount of transaction for rebillings.
|
209
|
-
#
|
208
|
+
#
|
210
209
|
# For example, to charge the customer $19.95 now and then charge $39.95 in 60 days every 3 months for 5 times, the options hash would be as follows:
|
211
210
|
# :rebill_start_date => '60 DAYS',
|
212
211
|
# :rebill_expression => '3 MONTHS',
|
213
212
|
# :rebill_cycles => '5',
|
214
|
-
# :rebill_amount => '39.95'
|
213
|
+
# :rebill_amount => '39.95'
|
215
214
|
# A money object of 1995 cents would be passed into the 'money' parameter.
|
216
215
|
def recurring(money, payment_object, options = {})
|
217
216
|
requires!(options, :rebill_start_date, :rebill_expression)
|
218
|
-
|
217
|
+
options[:rebill] = '1'
|
219
218
|
money == nil ? authorize(money, payment_object, options) :
|
220
219
|
purchase(money, payment_object, options)
|
221
220
|
end
|
@@ -228,7 +227,7 @@ module ActiveMerchant #:nodoc:
|
|
228
227
|
#
|
229
228
|
# * <tt>rebill_id</tt> -- A string containing the rebill_id of the recurring billing that is already active (REQUIRED)
|
230
229
|
def status_recurring(rebill_id)
|
231
|
-
|
230
|
+
post = {}
|
232
231
|
requires!(rebill_id)
|
233
232
|
post[:REBILL_ID] = rebill_id
|
234
233
|
post[:TRANS_TYPE] = 'GET'
|
@@ -241,7 +240,7 @@ module ActiveMerchant #:nodoc:
|
|
241
240
|
#
|
242
241
|
# ==== Options
|
243
242
|
#
|
244
|
-
# * <tt>:rebill_id</tt> -- The 12 digit rebill ID used to update a particular rebilling cycle. (REQUIRED)
|
243
|
+
# * <tt>:rebill_id</tt> -- The 12 digit rebill ID used to update a particular rebilling cycle. (REQUIRED)
|
245
244
|
# * <tt>:rebill_amount</tt> -- A string containing the new rebilling amount.
|
246
245
|
# * <tt>:rebill_next_date</tt> -- A string containing the new rebilling next date.
|
247
246
|
# * <tt>:rebill_expression</tt> -- A string containing the new rebilling expression.
|
@@ -249,16 +248,16 @@ module ActiveMerchant #:nodoc:
|
|
249
248
|
# * <tt>:rebill_next_amount</tt> -- A string containing the next rebilling amount to charge the customer. This ONLY affects the next scheduled charge; all other rebillings will continue at the regular (rebill_amount) amount.
|
250
249
|
# Take a look above at the recurring_payment method for similar examples on how to use.
|
251
250
|
def update_recurring(options = {})
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
251
|
+
post = {}
|
252
|
+
requires!(options, :rebill_id)
|
253
|
+
post[:REBILL_ID] = options[:rebill_id]
|
254
|
+
post[:TRANS_TYPE] = 'SET'
|
256
255
|
post[:REB_AMOUNT] = amount(options[:rebill_amount]) if !options[:rebill_amount].nil?
|
257
256
|
post[:NEXT_DATE] = options[:rebill_next_date] if !options[:rebill_next_date].nil?
|
258
257
|
post[:REB_EXPR] = options[:rebill_expression] if !options[:rebill_expression].nil?
|
259
|
-
post[:REB_CYCLES]
|
260
|
-
|
261
|
-
|
258
|
+
post[:REB_CYCLES] = options[:rebill_cycles] if !options[:rebill_cycles].nil?
|
259
|
+
post[:NEXT_AMOUNT] = options[:rebill_next_amount] if !options[:rebill_next_amount].nil?
|
260
|
+
commit('rebill', 'nil', post)
|
262
261
|
end
|
263
262
|
|
264
263
|
# Cancel a recurring payment.
|
@@ -269,93 +268,91 @@ module ActiveMerchant #:nodoc:
|
|
269
268
|
#
|
270
269
|
# * <tt>rebill_id</tt> -- A string containing the rebill_id of the recurring billing that you wish to cancel/stop (REQUIRED)
|
271
270
|
def cancel_recurring(rebill_id)
|
272
|
-
|
271
|
+
post = {}
|
273
272
|
requires!(rebill_id)
|
274
273
|
post[:REBILL_ID] = rebill_id
|
275
274
|
post[:TRANS_TYPE] = 'SET'
|
276
|
-
|
275
|
+
post[:STATUS] = 'stopped'
|
277
276
|
commit('rebill', 'nil', post)
|
278
277
|
end
|
279
278
|
|
280
279
|
private
|
281
|
-
|
280
|
+
|
282
281
|
def commit(action, money, fields)
|
283
282
|
fields[:AMOUNT] = amount(money) unless (fields[:TRANS_TYPE] == 'VOID' or action == 'rebill')
|
284
|
-
|
285
|
-
|
283
|
+
test? == true || @options[:test] == true ? fields[:MODE] = 'TEST' : fields[:MODE] = 'LIVE'
|
284
|
+
action == 'rebill' ? begin url = rebilling_url; fields[:TAMPER_PROOF_SEAL] = calc_rebill_tps(fields) end : begin url = live_url; fields[:TAMPER_PROOF_SEAL] = calc_tps(amount(money), fields) end
|
286
285
|
fields[:ACCOUNT_ID] = @options[:login]
|
287
286
|
data = ssl_post url, post_data(action, fields)
|
288
287
|
response = parse(data)
|
289
288
|
message = message_from(response)
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
response.has_key?('CVV2') ? cvv2 = response['CVV2'] : cvv2 = ''
|
301
|
-
response[CARD_CODE_RESPONSE_CODE] != '' ? cvv2 = response[CARD_CODE_RESPONSE_CODE] : cvv2 = ''
|
289
|
+
test_mode = test? || fields[:MODE] == 'TEST'
|
290
|
+
if (response.has_key?('TRANS_ID'))
|
291
|
+
response_id = response['TRANS_ID'].to_s()
|
292
|
+
elsif (response.has_key?('rebill_id'))
|
293
|
+
response_id = response['rebill_id'][0]
|
294
|
+
else
|
295
|
+
response_id = response[TRANSACTION_ID]
|
296
|
+
end
|
297
|
+
avs = (response[AVS_RESULT_CODE] != '' ? response[AVS_RESULT_CODE] : '')
|
298
|
+
cvv2 = (!response[CARD_CODE_RESPONSE_CODE].empty? ? response[CARD_CODE_RESPONSE_CODE] : '')
|
302
299
|
Response.new(success?(response), message, response,
|
303
300
|
:test => test_mode,
|
304
301
|
:authorization => response_id,
|
305
|
-
|
302
|
+
:fraud_review => fraud_review?(response),
|
306
303
|
:avs_result => { :code => avs },
|
307
304
|
:cvv_result => cvv2
|
308
305
|
)
|
309
306
|
end
|
310
307
|
|
311
308
|
def success?(response)
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
309
|
+
if (response['STATUS'] == '1' || message_from(response) =~ /approved/ || response.has_key?('rebill_id') || response[RESPONSE_REASON_TEXT] =~ /approved/)
|
310
|
+
return true
|
311
|
+
else
|
312
|
+
return false
|
313
|
+
end
|
317
314
|
end
|
318
315
|
|
319
316
|
def fraud_review?(response)
|
320
|
-
|
317
|
+
response['STATUS'] == 'E' || response['STATUS'] == '0' || response[RESPONSE_REASON_TEXT] =~ /being reviewed/
|
321
318
|
end
|
322
319
|
|
323
320
|
def get_rebill_id(response)
|
324
|
-
|
321
|
+
response['REBID'] if response_has.key?('REBID')
|
325
322
|
end
|
326
|
-
|
323
|
+
|
327
324
|
def parse(body)
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
325
|
+
fields = CGI::parse(body)
|
326
|
+
if fields.has_key?('MESSAGE') or fields.has_key?('rebill_id')
|
327
|
+
if fields.has_key?('MESSAGE')
|
328
|
+
fields['MESSAGE'][0] == "Missing ACCOUNT_ID" ? message = "The merchant login ID or password is invalid" : message = fields['MESSAGE']
|
329
|
+
fields['MESSAGE'][0] =~ /Approved/ ? message = "This transaction has been approved" : message = fields['MESSAGE'] if message == fields['MESSAGE']
|
330
|
+
fields['MESSAGE'][0] =~ /Expired/ ? message = "The credit card has expired" : message = fields['MESSAGE'] if message == fields['MESSAGE']
|
331
|
+
fields.delete('MESSAGE')
|
332
|
+
end
|
333
|
+
fields.has_key?('STATUS') ? begin status = fields['STATUS']; fields.delete('STATUS') end : status = ''
|
334
|
+
fields.has_key?('AVS') ? begin avs = fields['AVS']; fields.delete('AVS') end : avs = ''
|
335
|
+
fields.has_key?('CVV2') ? begin cvv2 = fields['CVV2']; fields.delete('CVV2') end : cvv2 = ''
|
336
|
+
fields.has_key?('MASTER_ID') ? begin trans_id = fields['MASTER_ID']; fields.delete('MASTER_ID') end : trans_id = ''
|
337
|
+
fields[:avs_result_code] = avs
|
338
|
+
fields[:card_code] = cvv2
|
339
|
+
fields[:response_code] = status
|
340
|
+
fields[:response_reason_code] = ''
|
341
|
+
fields[:response_reason_text] = message
|
342
|
+
fields[:transaction_id] = trans_id
|
343
|
+
return fields
|
344
|
+
end
|
345
|
+
# parse response if using other old API
|
346
|
+
hash = Hash.new
|
350
347
|
fields = fields.first[0].split(",")
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
348
|
+
fields.each_index do |x|
|
349
|
+
hash[x] = fields[x].tr('$','')
|
350
|
+
end
|
351
|
+
hash
|
355
352
|
end
|
356
353
|
|
357
354
|
def add_invoice(post, options)
|
358
|
-
|
355
|
+
post[:ORDER_ID] = options[:order_id] if options.has_key? :order_id
|
359
356
|
post[:INVOICE_ID] = options[:invoice] if options.has_key? :invoice
|
360
357
|
post[:invoice_num] = options[:order_id] if options.has_key? :order_id
|
361
358
|
post[:MEMO] = options[:description] if options.has_key? :description
|
@@ -363,9 +360,9 @@ module ActiveMerchant #:nodoc:
|
|
363
360
|
end
|
364
361
|
|
365
362
|
def add_creditcard(post, creditcard)
|
366
|
-
|
363
|
+
post[:PAYMENT_TYPE] = 'CREDIT'
|
367
364
|
post[:PAYMENT_ACCOUNT] = creditcard.number
|
368
|
-
post[:CARD_CVV2] = creditcard.verification_value if
|
365
|
+
post[:CARD_CVV2] = creditcard.verification_value if
|
369
366
|
creditcard.verification_value?
|
370
367
|
post[:CARD_EXPIRE] = expdate(creditcard)
|
371
368
|
post[:NAME1] = creditcard.first_name
|
@@ -373,34 +370,34 @@ module ActiveMerchant #:nodoc:
|
|
373
370
|
end
|
374
371
|
|
375
372
|
def add_check(post, check)
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
373
|
+
post[:PAYMENT_TYPE] = 'ACH'
|
374
|
+
post[:PAYMENT_ACCOUNT] = check.account_type + ":" + check.routing_number + ":" + check.account_number
|
375
|
+
post[:NAME1] = check.first_name
|
376
|
+
post[:NAME2] = check.last_name
|
380
377
|
end
|
381
378
|
|
382
379
|
def add_customer_data(post, options)
|
383
380
|
post[:EMAIL] = options[:email] if options.has_key? :email
|
384
|
-
|
381
|
+
post[:CUSTOM_ID] = options[:customer] if options.has_key? :customer
|
385
382
|
end
|
386
383
|
|
387
384
|
def add_duplicate_window(post)
|
388
385
|
unless duplicate_window.nil?
|
389
386
|
post[:duplicate_window] = duplicate_window
|
390
|
-
|
387
|
+
post[:DUPLICATE_OVERRIDE] = duplicate_window
|
391
388
|
end
|
392
389
|
end
|
393
390
|
|
394
391
|
def add_address(post, options)
|
395
|
-
|
396
|
-
|
397
|
-
|
392
|
+
if address = options[:billing_address] || options[:address]
|
393
|
+
post[:NAME1] = address[:first_name]
|
394
|
+
post[:NAME2] = address[:last_name]
|
398
395
|
post[:ADDR1] = address[:address1]
|
399
|
-
|
396
|
+
post[:ADDR2] = address[:address2]
|
400
397
|
post[:COMPANY_NAME] = address[:company]
|
401
398
|
post[:PHONE] = address[:phone]
|
402
399
|
post[:CITY] = address[:city]
|
403
|
-
|
400
|
+
post[:STATE] = address[:state].blank? ? 'n/a' : address[:state]
|
404
401
|
post[:ZIP] = address[:zip]
|
405
402
|
post[:COUNTRY] = address[:country]
|
406
403
|
end
|
@@ -408,13 +405,13 @@ module ActiveMerchant #:nodoc:
|
|
408
405
|
post[:NAME1] = address[:first_name]
|
409
406
|
post[:NAME2] = address[:last_name]
|
410
407
|
post[:ADDR1] = address[:address1]
|
411
|
-
|
408
|
+
post[:ADDR1] = address[:address1]
|
412
409
|
post[:COMPANY_NAME] = address[:company]
|
413
410
|
post[:PHONE] = address[:phone]
|
414
411
|
post[:ZIP] = address[:zip]
|
415
412
|
post[:CITY] = address[:city]
|
416
413
|
post[:COUNTRY] = address[:country]
|
417
|
-
post[:STATE] = address[:state].blank? ? 'n/a' : address[:state]
|
414
|
+
post[:STATE] = address[:state].blank? ? 'n/a' : address[:state]
|
418
415
|
end
|
419
416
|
end
|
420
417
|
|
@@ -428,8 +425,8 @@ module ActiveMerchant #:nodoc:
|
|
428
425
|
post[:delim_data] = "TRUE"
|
429
426
|
post[:delim_char] = ","
|
430
427
|
post[:encap_char] = "$"
|
431
|
-
|
432
|
-
|
428
|
+
post[:card_num] = '4111111111111111'
|
429
|
+
post[:exp_date] = '1212'
|
433
430
|
post[:solution_ID] = application_id if application_id.present? && application_id != "ActiveMerchant"
|
434
431
|
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
435
432
|
request
|
@@ -441,15 +438,15 @@ module ActiveMerchant #:nodoc:
|
|
441
438
|
if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
442
439
|
return AVSResult.messages[ results[:avs_result_code] ]
|
443
440
|
end
|
444
|
-
|
441
|
+
return (results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
|
442
|
+
end
|
443
|
+
if results.has_key?(:response_reason_text)
|
444
|
+
return results[:response_reason_text].to_s()
|
445
|
+
end
|
446
|
+
if !results.has_key?('STATUS')
|
447
|
+
return results[RESPONSE_REASON_TEXT] ? results[RESPONSE_REASON_TEXT].chomp('.') : ''
|
445
448
|
end
|
446
|
-
|
447
|
-
return results[:response_reason_text].to_s()
|
448
|
-
end
|
449
|
-
if !results.has_key?('STATUS')
|
450
|
-
return results[RESPONSE_REASON_TEXT] ? results[RESPONSE_REASON_TEXT].chomp('.') : ''
|
451
|
-
end
|
452
|
-
end
|
449
|
+
end
|
453
450
|
|
454
451
|
def expdate(creditcard)
|
455
452
|
year = sprintf("%.4i", creditcard.year)
|
@@ -459,21 +456,20 @@ module ActiveMerchant #:nodoc:
|
|
459
456
|
end
|
460
457
|
|
461
458
|
def calc_tps(amount, post)
|
462
|
-
|
463
|
-
digest = Digest::MD5.hexdigest(@options[:password] +
|
464
|
-
@options[:login] + post[:TRANS_TYPE] +
|
465
|
-
amount.to_s() + post[:MASTER_ID].to_s() +
|
459
|
+
post[:NAME1] = '' if post[:NAME1].nil?
|
460
|
+
digest = Digest::MD5.hexdigest(@options[:password] +
|
461
|
+
@options[:login] + post[:TRANS_TYPE] +
|
462
|
+
amount.to_s() + post[:MASTER_ID].to_s() +
|
466
463
|
post[:NAME1].to_s() + post[:PAYMENT_ACCOUNT].to_s())
|
467
|
-
|
464
|
+
return digest
|
468
465
|
end
|
469
466
|
|
470
|
-
|
471
467
|
def calc_rebill_tps(post)
|
472
|
-
digest = Digest::MD5.hexdigest(@options[:password] +
|
468
|
+
digest = Digest::MD5.hexdigest(@options[:password] +
|
473
469
|
@options[:login] + post[:TRANS_TYPE] + post[:REBILL_ID][0].to_s())
|
474
470
|
return digest
|
475
471
|
end
|
476
|
-
|
472
|
+
|
477
473
|
def handle_response(response)
|
478
474
|
if ignore_http_status then
|
479
475
|
return response.body
|
@@ -486,7 +482,6 @@ module ActiveMerchant #:nodoc:
|
|
486
482
|
end
|
487
483
|
end
|
488
484
|
end
|
489
|
-
|
490
485
|
end
|
491
486
|
end
|
492
487
|
end
|