activemerchant 1.100.0 → 1.101.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +10 -0
  3. data/lib/active_merchant/billing/check.rb +2 -6
  4. data/lib/active_merchant/billing/credit_card.rb +1 -3
  5. data/lib/active_merchant/billing/gateway.rb +4 -7
  6. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -9
  7. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +1 -3
  8. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +4 -12
  9. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -3
  10. data/lib/active_merchant/billing/gateways/balanced.rb +12 -11
  11. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -6
  12. data/lib/active_merchant/billing/gateways/blue_snap.rb +1 -3
  13. data/lib/active_merchant/billing/gateways/braintree_blue.rb +7 -21
  14. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -3
  15. data/lib/active_merchant/billing/gateways/checkout.rb +1 -3
  16. data/lib/active_merchant/billing/gateways/checkout_v2.rb +1 -3
  17. data/lib/active_merchant/billing/gateways/clearhaus.rb +9 -12
  18. data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/culqi.rb +6 -5
  20. data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -0
  21. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -3
  22. data/lib/active_merchant/billing/gateways/decidir.rb +1 -3
  23. data/lib/active_merchant/billing/gateways/ebanx.rb +1 -3
  24. data/lib/active_merchant/billing/gateways/elavon.rb +2 -6
  25. data/lib/active_merchant/billing/gateways/element.rb +1 -3
  26. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -5
  27. data/lib/active_merchant/billing/gateways/fat_zebra.rb +7 -6
  28. data/lib/active_merchant/billing/gateways/forte.rb +2 -6
  29. data/lib/active_merchant/billing/gateways/garanti.rb +1 -3
  30. data/lib/active_merchant/billing/gateways/global_collect.rb +1 -3
  31. data/lib/active_merchant/billing/gateways/hdfc.rb +1 -3
  32. data/lib/active_merchant/billing/gateways/hps.rb +6 -5
  33. data/lib/active_merchant/billing/gateways/inspire.rb +2 -6
  34. data/lib/active_merchant/billing/gateways/instapay.rb +1 -3
  35. data/lib/active_merchant/billing/gateways/iridium.rb +1 -3
  36. data/lib/active_merchant/billing/gateways/iveri.rb +7 -8
  37. data/lib/active_merchant/billing/gateways/jetpay.rb +3 -9
  38. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -6
  39. data/lib/active_merchant/billing/gateways/kushki.rb +7 -8
  40. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +6 -5
  41. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -3
  42. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -3
  43. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +1 -3
  44. data/lib/active_merchant/billing/gateways/mercury.rb +2 -6
  45. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -12
  46. data/lib/active_merchant/billing/gateways/migs.rb +1 -3
  47. data/lib/active_merchant/billing/gateways/moneris.rb +1 -3
  48. data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -3
  49. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -3
  50. data/lib/active_merchant/billing/gateways/netbanx.rb +24 -9
  51. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -3
  52. data/lib/active_merchant/billing/gateways/network_merchants.rb +1 -3
  53. data/lib/active_merchant/billing/gateways/opp.rb +12 -13
  54. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -3
  55. data/lib/active_merchant/billing/gateways/orbital.rb +8 -11
  56. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -3
  57. data/lib/active_merchant/billing/gateways/pagarme.rb +4 -12
  58. data/lib/active_merchant/billing/gateways/pago_facil.rb +1 -3
  59. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -3
  60. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -3
  61. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +6 -5
  62. data/lib/active_merchant/billing/gateways/payflow.rb +2 -6
  63. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -3
  64. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -3
  65. data/lib/active_merchant/billing/gateways/paymill.rb +1 -3
  66. data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -3
  67. data/lib/active_merchant/billing/gateways/quickbooks.rb +104 -31
  68. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +2 -6
  69. data/lib/active_merchant/billing/gateways/realex.rb +1 -3
  70. data/lib/active_merchant/billing/gateways/redsys.rb +17 -27
  71. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -3
  72. data/lib/active_merchant/billing/gateways/sage_pay.rb +1 -3
  73. data/lib/active_merchant/billing/gateways/secure_net.rb +2 -6
  74. data/lib/active_merchant/billing/gateways/secure_pay.rb +4 -12
  75. data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -6
  76. data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -6
  77. data/lib/active_merchant/billing/gateways/stripe.rb +3 -9
  78. data/lib/active_merchant/billing/gateways/telr.rb +2 -6
  79. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +6 -5
  80. data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -3
  81. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -3
  82. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +4 -12
  83. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -9
  84. data/lib/active_merchant/billing/gateways/viaklix.rb +2 -6
  85. data/lib/active_merchant/billing/gateways/wepay.rb +2 -6
  86. data/lib/active_merchant/billing/gateways/wirecard.rb +2 -6
  87. data/lib/active_merchant/billing/gateways/worldpay.rb +5 -15
  88. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +2 -6
  89. data/lib/active_merchant/version.rb +1 -1
  90. data/lib/support/ssl_verify.rb +1 -3
  91. metadata +2 -2
@@ -175,9 +175,7 @@ module ActiveMerchant #:nodoc:
175
175
  end
176
176
 
177
177
  def add_card_or_token(post, payment)
178
- if payment.is_a?(String)
179
- payment, brand = payment.split('|')
180
- end
178
+ payment, brand = payment.split('|') if payment.is_a?(String)
181
179
  post[:payment][:payment_type_code] = payment.is_a?(String) ? brand : CARD_BRAND[payment.brand.to_sym]
182
180
  post[:payment][:creditcard] = payment_details(payment)
183
181
  end
@@ -98,9 +98,7 @@ module ActiveMerchant #:nodoc:
98
98
  end
99
99
 
100
100
  def credit(money, creditcard, options = {})
101
- if creditcard.is_a?(String)
102
- raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.'
103
- end
101
+ raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if creditcard.is_a?(String)
104
102
 
105
103
  form = {}
106
104
  add_invoice(form, options)
@@ -174,9 +172,7 @@ module ActiveMerchant #:nodoc:
174
172
  form[:card_number] = creditcard.number
175
173
  form[:exp_date] = expdate(creditcard)
176
174
 
177
- if creditcard.verification_value?
178
- add_verification_value(form, creditcard)
179
- end
175
+ add_verification_value(form, creditcard) if creditcard.verification_value?
180
176
 
181
177
  form[:first_name] = truncate(creditcard.first_name, 20)
182
178
  form[:last_name] = truncate(creditcard.last_name, 30)
@@ -246,9 +246,7 @@ module ActiveMerchant #:nodoc:
246
246
  doc.remove_namespaces!
247
247
  root = doc.root.xpath('//response/*')
248
248
 
249
- if root.empty?
250
- root = doc.root.xpath('//Response/*')
251
- end
249
+ root = doc.root.xpath('//Response/*') if root.empty?
252
250
 
253
251
  root.each do |node|
254
252
  if node.elements.empty?
@@ -214,11 +214,12 @@ module ActiveMerchant #:nodoc:
214
214
  end
215
215
 
216
216
  def commit(action, post)
217
- raw = begin
218
- ssl_post(test? ? self.test_url : self.live_url, soap_request(post, action), 'Content-Type' => 'application/soap+xml; charset=utf-8')
219
- rescue ResponseError => e
220
- e.response.body
221
- end
217
+ raw =
218
+ begin
219
+ ssl_post(test? ? self.test_url : self.live_url, soap_request(post, action), 'Content-Type' => 'application/soap+xml; charset=utf-8')
220
+ rescue ResponseError => e
221
+ e.response.body
222
+ end
222
223
  response = parse(raw)
223
224
 
224
225
  EwayResponse.new(response[:success], response[:message], response,
@@ -145,12 +145,13 @@ module ActiveMerchant #:nodoc:
145
145
  end
146
146
 
147
147
  def commit(method, uri, parameters=nil)
148
- response = begin
149
- parse(ssl_request(method, get_url(uri), parameters.to_json, headers))
150
- rescue ResponseError => e
151
- return Response.new(false, 'Invalid Login') if(e.response.code == '401')
152
- parse(e.response.body)
153
- end
148
+ response =
149
+ begin
150
+ parse(ssl_request(method, get_url(uri), parameters.to_json, headers))
151
+ rescue ResponseError => e
152
+ return Response.new(false, 'Invalid Login') if(e.response.code == '401')
153
+ parse(e.response.body)
154
+ end
154
155
 
155
156
  success = success_from(response)
156
157
  Response.new(
@@ -130,13 +130,9 @@ module ActiveMerchant #:nodoc:
130
130
  post[:billing_address][:physical_address][:locality] = address[:city] if address[:city]
131
131
  end
132
132
 
133
- if empty?(post[:billing_address][:first_name]) && payment.first_name
134
- post[:billing_address][:first_name] = payment.first_name
135
- end
133
+ post[:billing_address][:first_name] = payment.first_name if empty?(post[:billing_address][:first_name]) && payment.first_name
136
134
 
137
- if empty?(post[:billing_address][:last_name]) && payment.last_name
138
- post[:billing_address][:last_name] = payment.last_name
139
- end
135
+ post[:billing_address][:last_name] = payment.last_name if empty?(post[:billing_address][:last_name]) && payment.last_name
140
136
  end
141
137
 
142
138
  def add_shipping_address(post, options)
@@ -137,9 +137,7 @@ module ActiveMerchant #:nodoc:
137
137
  xml.tag! 'OrderID', format_order_id(options[:order_id])
138
138
  xml.tag! 'GroupID'
139
139
 
140
- if block_given?
141
- yield xml
142
- end
140
+ yield xml if block_given?
143
141
  end
144
142
  end
145
143
 
@@ -228,9 +228,7 @@ module ActiveMerchant #:nodoc:
228
228
  raw_response = ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization))
229
229
  response = parse(raw_response)
230
230
  rescue ResponseError => e
231
- if e.response.code.to_i >= 400
232
- response = parse(e.response.body)
233
- end
231
+ response = parse(e.response.body) if e.response.code.to_i >= 400
234
232
  rescue JSON::ParserError
235
233
  response = json_error(raw_response)
236
234
  end
@@ -196,9 +196,7 @@ EOA
196
196
 
197
197
  def escape(string, max_length=250)
198
198
  return '' unless string
199
- if max_length
200
- string = string[0...max_length]
201
- end
199
+ string = string[0...max_length] if max_length
202
200
  string.gsub(/[^A-Za-z0-9 \-_@\.\n]/, '')
203
201
  end
204
202
  end
@@ -274,11 +274,12 @@ module ActiveMerchant #:nodoc:
274
274
  def commit(action, &request)
275
275
  data = build_request(action, &request)
276
276
 
277
- response = begin
278
- parse(ssl_post((test? ? test_url : live_url), data, 'Content-Type' => 'text/xml'))
279
- rescue ResponseError => e
280
- parse(e.response.body)
281
- end
277
+ response =
278
+ begin
279
+ parse(ssl_post((test? ? test_url : live_url), data, 'Content-Type' => 'text/xml'))
280
+ rescue ResponseError => e
281
+ parse(e.response.body)
282
+ end
282
283
 
283
284
  ActiveMerchant::Billing::Response.new(
284
285
  successful?(response),
@@ -101,13 +101,9 @@ module ActiveMerchant #:nodoc:
101
101
  private
102
102
 
103
103
  def add_customer_data(post, options)
104
- if options.has_key? :email
105
- post[:email] = options[:email]
106
- end
104
+ post[:email] = options[:email] if options.has_key? :email
107
105
 
108
- if options.has_key? :ip
109
- post[:ipaddress] = options[:ip]
110
- end
106
+ post[:ipaddress] = options[:ip] if options.has_key? :ip
111
107
  end
112
108
 
113
109
  def add_address(post, creditcard, options)
@@ -150,9 +150,7 @@ module ActiveMerchant #:nodoc:
150
150
  def post_data(action, parameters = {})
151
151
  post = {}
152
152
  post[:acctid] = @options[:login]
153
- if(@options[:password])
154
- post[:merchantpin] = @options[:password]
155
- end
153
+ post[:merchantpin] = @options[:password] if @options[:password]
156
154
  post[:action] = action
157
155
  request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
158
156
  request
@@ -342,9 +342,7 @@ module ActiveMerchant #:nodoc:
342
342
  def add_customerdetails(xml, creditcard, address, options, shipTo = false)
343
343
  xml.tag! 'CustomerDetails' do
344
344
  if address
345
- unless address[:country].blank?
346
- country_code = Country.find(address[:country]).code(:numeric)
347
- end
345
+ country_code = Country.find(address[:country]).code(:numeric) unless address[:country].blank?
348
346
  xml.tag! 'BillingAddress' do
349
347
  xml.tag! 'Address1', address[:address1]
350
348
  xml.tag! 'Address2', address[:address2]
@@ -150,11 +150,12 @@ module ActiveMerchant #:nodoc:
150
150
  end
151
151
 
152
152
  def commit(post)
153
- raw_response = begin
154
- ssl_post(live_url, build_xml_envelope(post), headers(post))
155
- rescue ActiveMerchant::ResponseError => e
156
- e.response.body
157
- end
153
+ raw_response =
154
+ begin
155
+ ssl_post(live_url, build_xml_envelope(post), headers(post))
156
+ rescue ActiveMerchant::ResponseError => e
157
+ e.response.body
158
+ end
158
159
 
159
160
  parsed = parse(raw_response)
160
161
  succeeded = success_from(parsed)
@@ -234,9 +235,7 @@ module ActiveMerchant #:nodoc:
234
235
  end
235
236
 
236
237
  def error_code_from(response, succeeded)
237
- unless succeeded
238
- response['result_code']
239
- end
238
+ response['result_code'] unless succeeded
240
239
  end
241
240
 
242
241
  def underscore(camel_cased_word)
@@ -213,9 +213,7 @@ module ActiveMerchant #:nodoc:
213
213
  xml.tag! 'TerminalID', @options[:login]
214
214
  xml.tag! 'TransactionType', transaction_type
215
215
  xml.tag! 'TransactionID', transaction_id.nil? ? generate_unique_id.slice(0, 18) : transaction_id
216
- if options && options[:origin]
217
- xml.tag! 'Origin', options[:origin]
218
- end
216
+ xml.tag! 'Origin', options[:origin] if options && options[:origin]
219
217
 
220
218
  if block_given?
221
219
  yield xml
@@ -343,13 +341,9 @@ module ActiveMerchant #:nodoc:
343
341
  xml.tag! 'CardExpMonth', format_exp(credit_card.month)
344
342
  xml.tag! 'CardExpYear', format_exp(credit_card.year)
345
343
 
346
- if credit_card.first_name || credit_card.last_name
347
- xml.tag! 'CardName', [credit_card.first_name, credit_card.last_name].compact.join(' ')
348
- end
344
+ xml.tag! 'CardName', [credit_card.first_name, credit_card.last_name].compact.join(' ') if credit_card.first_name || credit_card.last_name
349
345
 
350
- unless credit_card.verification_value.nil? || (credit_card.verification_value.length == 0)
351
- xml.tag! 'CVV2', credit_card.verification_value
352
- end
346
+ xml.tag! 'CVV2', credit_card.verification_value unless credit_card.verification_value.nil? || (credit_card.verification_value.length == 0)
353
347
  end
354
348
 
355
349
  def add_addresses(xml, options)
@@ -368,13 +368,9 @@ module ActiveMerchant #:nodoc:
368
368
  xml.tag! 'CardExpMonth', format_exp(credit_card.month)
369
369
  xml.tag! 'CardExpYear', format_exp(credit_card.year)
370
370
 
371
- if credit_card.first_name || credit_card.last_name
372
- xml.tag! 'CardName', [credit_card.first_name, credit_card.last_name].compact.join(' ')
373
- end
371
+ xml.tag! 'CardName', [credit_card.first_name, credit_card.last_name].compact.join(' ') if credit_card.first_name || credit_card.last_name
374
372
 
375
- unless credit_card.verification_value.nil? || (credit_card.verification_value.length == 0)
376
- xml.tag! 'CVV2', credit_card.verification_value
377
- end
373
+ xml.tag! 'CVV2', credit_card.verification_value unless credit_card.verification_value.nil? || (credit_card.verification_value.length == 0)
378
374
  end
379
375
 
380
376
  def add_addresses(xml, options)
@@ -94,9 +94,7 @@ module ActiveMerchant #:nodoc:
94
94
  sum[:iva] = 0
95
95
  sum[:subtotalIva0] = 0
96
96
 
97
- if sum[:currency] != 'COP'
98
- sum[:ice] = 0
99
- end
97
+ sum[:ice] = 0 if sum[:currency] != 'COP'
100
98
  end
101
99
 
102
100
  def add_amount_by_country(sum, options)
@@ -137,11 +135,12 @@ module ActiveMerchant #:nodoc:
137
135
  }
138
136
 
139
137
  def commit(action, params)
140
- response = begin
141
- parse(ssl_invoke(action, params))
142
- rescue ResponseError => e
143
- parse(e.response.body)
144
- end
138
+ response =
139
+ begin
140
+ parse(ssl_invoke(action, params))
141
+ rescue ResponseError => e
142
+ parse(e.response.body)
143
+ end
145
144
 
146
145
  success = success_from(response)
147
146
 
@@ -158,11 +158,12 @@ module ActiveMerchant #:nodoc:
158
158
  url = test? ? self.test_url : self.live_url
159
159
  parameters[:transaction_amount] = amount(money) if money unless action == 'V'
160
160
 
161
- response = begin
162
- parse(ssl_post(url, post_data(action, parameters)))
163
- rescue ActiveMerchant::ResponseError => e
164
- { 'error_code' => '404', 'auth_response_text' => e.to_s }
165
- end
161
+ response =
162
+ begin
163
+ parse(ssl_post(url, post_data(action, parameters)))
164
+ rescue ActiveMerchant::ResponseError => e
165
+ { 'error_code' => '404', 'auth_response_text' => e.to_s }
166
+ end
166
167
 
167
168
  Response.new(response['error_code'] == '000', message_from(response), response,
168
169
  :authorization => response['transaction_id'],
@@ -91,9 +91,7 @@ module ActiveMerchant #:nodoc:
91
91
  ret = ''
92
92
  for key in parameters.keys
93
93
  ret += "#{key}=#{CGI.escape(parameters[key].to_s)}"
94
- if key != parameters.keys.last
95
- ret += '&'
96
- end
94
+ ret += '&' if key != parameters.keys.last
97
95
  end
98
96
  ret.to_s
99
97
  end
@@ -308,9 +308,7 @@ module ActiveMerchant #:nodoc:
308
308
  end
309
309
 
310
310
  def authorization_from(response)
311
- if response[:success]
312
- [ response['ReferenceID'], response['OrderNumber'] ].join(';')
313
- end
311
+ [ response['ReferenceID'], response['OrderNumber'] ].join(';') if response[:success]
314
312
  end
315
313
  end
316
314
  end
@@ -181,9 +181,7 @@ module ActiveMerchant #:nodoc:
181
181
  def add_auth(action, post)
182
182
  post['merchantUUID'] = @options[:merchant_uuid]
183
183
  post['apiKey'] = @options[:api_key]
184
- unless token?(post)
185
- post['method'] = action
186
- end
184
+ post['method'] = action unless token?(post)
187
185
  end
188
186
 
189
187
  def url_for(action, post)
@@ -103,9 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  xml.tag! 'Transaction' do
104
104
  xml.tag! 'TranType', 'Credit'
105
105
  xml.tag! 'TranCode', action
106
- if options[:allow_partial_auth] && ['PreAuth', 'Sale'].include?(action)
107
- xml.tag! 'PartialAuth', 'Allow'
108
- end
106
+ xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && ['PreAuth', 'Sale'].include?(action)
109
107
  add_invoice(xml, options[:order_id], nil, options)
110
108
  add_reference(xml, 'RecordNumberRequested')
111
109
  add_customer_data(xml, options)
@@ -126,9 +124,7 @@ module ActiveMerchant #:nodoc:
126
124
  xml.tag! 'TStream' do
127
125
  xml.tag! 'Transaction' do
128
126
  xml.tag! 'TranType', 'Credit'
129
- if options[:allow_partial_auth] && (action == 'PreAuthCapture')
130
- xml.tag! 'PartialAuth', 'Allow'
131
- end
127
+ xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && (action == 'PreAuthCapture')
132
128
  xml.tag! 'TranCode', (@use_tokenization ? (action + 'ByRecordNo') : action)
133
129
  add_invoice(xml, invoice_no, ref_no, options)
134
130
  add_reference(xml, record_no)
@@ -242,21 +242,15 @@ module ActiveMerchant #:nodoc:
242
242
  post[:email_customer] = false
243
243
  end
244
244
 
245
- if options.has_key? :customer
246
- post[:cust_id] = options[:customer]
247
- end
245
+ post[:cust_id] = options[:customer] if options.has_key? :customer
248
246
 
249
- if options.has_key? :ip
250
- post[:customer_ip] = options[:ip]
251
- end
247
+ post[:customer_ip] = options[:ip] if options.has_key? :ip
252
248
  end
253
249
 
254
250
  # x_duplicate_window won't be sent by default, because sending it changes the response.
255
251
  # "If this field is present in the request with or without a value, an enhanced duplicate transaction response will be sent."
256
252
  def add_duplicate_window(post)
257
- unless duplicate_window.nil?
258
- post[:duplicate_window] = duplicate_window
259
- end
253
+ post[:duplicate_window] = duplicate_window unless duplicate_window.nil?
260
254
  end
261
255
 
262
256
  def add_address(post, options)
@@ -286,9 +280,7 @@ module ActiveMerchant #:nodoc:
286
280
  def message_from(results)
287
281
  if results[:response_code] == DECLINED
288
282
  return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
289
- if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
290
- return AVSResult.messages[results[:avs_result_code]]
291
- end
283
+ return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
292
284
  end
293
285
 
294
286
  (results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
@@ -195,9 +195,7 @@ module ActiveMerchant #:nodoc:
195
195
  response_hash = parse(data)
196
196
 
197
197
  expected_secure_hash = calculate_secure_hash(response_hash, @options[:secure_hash])
198
- unless response_hash[:SecureHash] == expected_secure_hash
199
- raise SecurityError, 'Secure Hash mismatch, response may be tampered with'
200
- end
198
+ raise SecurityError, 'Secure Hash mismatch, response may be tampered with' unless response_hash[:SecureHash] == expected_secure_hash
201
199
 
202
200
  response_object(response_hash)
203
201
  end
@@ -287,9 +287,7 @@ module ActiveMerchant #:nodoc:
287
287
 
288
288
  # Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
289
289
  def authorization_from(response = {})
290
- if response[:trans_id] && response[:receipt_id]
291
- "#{response[:trans_id]};#{response[:receipt_id]}"
292
- end
290
+ "#{response[:trans_id]};#{response[:receipt_id]}" if response[:trans_id] && response[:receipt_id]
293
291
  end
294
292
 
295
293
  # Tests for a successful response from Moneris' servers
@@ -230,9 +230,7 @@ module ActiveMerchant #:nodoc:
230
230
 
231
231
  # Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
232
232
  def authorization_from(response = {})
233
- if response[:trans_id] && response[:receipt_id]
234
- "#{response[:trans_id]};#{response[:receipt_id]}"
235
- end
233
+ "#{response[:trans_id]};#{response[:receipt_id]}" if response[:trans_id] && response[:receipt_id]
236
234
  end
237
235
 
238
236
  # Tests for a successful response from Moneris' servers