activemerchant 1.86.0 → 1.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +22 -0
  3. data/lib/active_merchant/billing/avs_result.rb +0 -1
  4. data/lib/active_merchant/billing/check.rb +1 -1
  5. data/lib/active_merchant/billing/compatibility.rb +3 -3
  6. data/lib/active_merchant/billing/credit_card.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card_formatting.rb +3 -3
  8. data/lib/active_merchant/billing/credit_card_methods.rb +6 -4
  9. data/lib/active_merchant/billing/gateway.rb +9 -9
  10. data/lib/active_merchant/billing/gateways/adyen.rb +48 -7
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +1 -1
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +8 -8
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +15 -15
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/balanced.rb +11 -11
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  19. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -2
  20. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/blue_pay.rb +5 -5
  22. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
  23. data/lib/active_merchant/billing/gateways/bogus.rb +3 -3
  24. data/lib/active_merchant/billing/gateways/borgun.rb +5 -6
  25. data/lib/active_merchant/billing/gateways/braintree_blue.rb +18 -12
  26. data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +9 -9
  29. data/lib/active_merchant/billing/gateways/cardknox.rb +4 -4
  30. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/cashnet.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
  33. data/lib/active_merchant/billing/gateways/cenpos.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/clearhaus.rb +12 -12
  36. data/lib/active_merchant/billing/gateways/commercegate.rb +3 -3
  37. data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
  38. data/lib/active_merchant/billing/gateways/credorax.rb +13 -3
  39. data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
  40. data/lib/active_merchant/billing/gateways/culqi.rb +1 -1
  41. data/lib/active_merchant/billing/gateways/cyber_source.rb +8 -8
  42. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -2
  43. data/lib/active_merchant/billing/gateways/dibs.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  45. data/lib/active_merchant/billing/gateways/ebanx.rb +1 -1
  46. data/lib/active_merchant/billing/gateways/efsnet.rb +4 -4
  47. data/lib/active_merchant/billing/gateways/elavon.rb +3 -3
  48. data/lib/active_merchant/billing/gateways/element.rb +4 -4
  49. data/lib/active_merchant/billing/gateways/epay.rb +1 -1
  50. data/lib/active_merchant/billing/gateways/eway.rb +2 -2
  51. data/lib/active_merchant/billing/gateways/eway_managed.rb +5 -5
  52. data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -1
  53. data/lib/active_merchant/billing/gateways/exact.rb +1 -1
  54. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  55. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  56. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
  58. data/lib/active_merchant/billing/gateways/forte.rb +11 -7
  59. data/lib/active_merchant/billing/gateways/garanti.rb +5 -5
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +2 -3
  61. data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
  62. data/lib/active_merchant/billing/gateways/hps.rb +3 -3
  63. data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
  64. data/lib/active_merchant/billing/gateways/iridium.rb +14 -14
  65. data/lib/active_merchant/billing/gateways/itransact.rb +4 -4
  66. data/lib/active_merchant/billing/gateways/iveri.rb +3 -3
  67. data/lib/active_merchant/billing/gateways/jetpay.rb +2 -2
  68. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -2
  69. data/lib/active_merchant/billing/gateways/latitude19.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
  71. data/lib/active_merchant/billing/gateways/litle.rb +2 -2
  72. data/lib/active_merchant/billing/gateways/maxipago.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -13
  74. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +3 -3
  75. data/lib/active_merchant/billing/gateways/merchant_one.rb +4 -4
  76. data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +3 -3
  78. data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
  79. data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
  80. data/lib/active_merchant/billing/gateways/micropayment.rb +1 -1
  81. data/lib/active_merchant/billing/gateways/migs.rb +4 -6
  82. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -2
  83. data/lib/active_merchant/billing/gateways/moneris.rb +85 -56
  84. data/lib/active_merchant/billing/gateways/moneris_us.rb +9 -9
  85. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  86. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/nab_transact.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  90. data/lib/active_merchant/billing/gateways/netbanx.rb +36 -36
  91. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  92. data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
  93. data/lib/active_merchant/billing/gateways/nmi.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
  95. data/lib/active_merchant/billing/gateways/omise.rb +6 -6
  96. data/lib/active_merchant/billing/gateways/opp.rb +1 -1
  97. data/lib/active_merchant/billing/gateways/optimal_payment.rb +5 -0
  98. data/lib/active_merchant/billing/gateways/orbital.rb +9 -7
  99. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +6 -6
  100. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -5
  103. data/lib/active_merchant/billing/gateways/pay_hub.rb +2 -2
  104. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -2
  105. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  106. data/lib/active_merchant/billing/gateways/pay_secure.rb +3 -3
  107. data/lib/active_merchant/billing/gateways/paybox_direct.rb +8 -8
  108. data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
  109. data/lib/active_merchant/billing/gateways/payex.rb +8 -8
  110. data/lib/active_merchant/billing/gateways/payflow.rb +13 -13
  111. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +4 -4
  112. data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/payment_express.rb +10 -10
  114. data/lib/active_merchant/billing/gateways/paymentez.rb +3 -0
  115. data/lib/active_merchant/billing/gateways/paymill.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
  118. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  119. data/lib/active_merchant/billing/gateways/payu_latam.rb +1 -1
  120. data/lib/active_merchant/billing/gateways/payway.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -2
  122. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  124. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
  125. data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
  126. data/lib/active_merchant/billing/gateways/quantum.rb +7 -7
  127. data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -6
  128. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -1
  129. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
  130. data/lib/active_merchant/billing/gateways/realex.rb +33 -13
  131. data/lib/active_merchant/billing/gateways/redsys.rb +2 -2
  132. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -2
  133. data/lib/active_merchant/billing/gateways/sage.rb +6 -6
  134. data/lib/active_merchant/billing/gateways/sage_pay.rb +7 -7
  135. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
  137. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/skip_jack.rb +5 -6
  140. data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -7
  141. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/stripe.rb +5 -5
  143. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
  144. data/lib/active_merchant/billing/gateways/telr.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +2 -2
  146. data/lib/active_merchant/billing/gateways/transact_pro.rb +5 -5
  147. data/lib/active_merchant/billing/gateways/transax.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/trust_commerce.rb +7 -7
  149. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +17 -16
  150. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +2 -2
  151. data/lib/active_merchant/billing/gateways/vanco.rb +2 -2
  152. data/lib/active_merchant/billing/gateways/verifi.rb +1 -1
  153. data/lib/active_merchant/billing/gateways/viaklix.rb +4 -4
  154. data/lib/active_merchant/billing/gateways/visanet_peru.rb +4 -4
  155. data/lib/active_merchant/billing/gateways/wirecard.rb +2 -2
  156. data/lib/active_merchant/billing/gateways/worldpay.rb +24 -13
  157. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +2 -2
  158. data/lib/active_merchant/billing/response.rb +7 -7
  159. data/lib/active_merchant/country.rb +4 -4
  160. data/lib/active_merchant/network_connection_retries.rb +7 -9
  161. data/lib/active_merchant/version.rb +1 -1
  162. data/lib/support/gateway_support.rb +3 -3
  163. data/lib/support/ssl_verify.rb +1 -1
  164. metadata +3 -3
@@ -234,7 +234,7 @@ module ActiveMerchant #:nodoc:
234
234
  def parse(body)
235
235
  fields = {}
236
236
  for line in body.split('&')
237
- key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
237
+ key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
238
238
  fields[key] = CGI.unescape(value.to_s)
239
239
  end
240
240
 
@@ -253,7 +253,7 @@ module ActiveMerchant #:nodoc:
253
253
  :error_code => fields['UMerrorcode'],
254
254
  :acs_url => fields['UMacsurl'],
255
255
  :payload => fields['UMpayload']
256
- }.delete_if{|k, v| v.nil?}
256
+ }.delete_if { |k, v| v.nil? }
257
257
  end
258
258
 
259
259
  def commit(action, parameters)
@@ -82,8 +82,8 @@ module ActiveMerchant
82
82
  response[:error_message] = error['ErrorDescription']
83
83
  response[:error_codes] = error['ErrorCode']
84
84
  elsif error.kind_of?(Array)
85
- error_str = error.map { |e| e['ErrorDescription']}.join('. ')
86
- error_codes = error.map { |e| e['ErrorCode']}.join(', ')
85
+ error_str = error.map { |e| e['ErrorDescription'] }.join('. ')
86
+ error_codes = error.map { |e| e['ErrorCode'] }.join(', ')
87
87
  response[:error_message] = "#{error_str}."
88
88
  response[:error_codes] = error_codes
89
89
  end
@@ -192,7 +192,7 @@ module ActiveMerchant #:nodoc:
192
192
  def commit(trx_type, money, post)
193
193
  post[:amount] = amount(money)
194
194
 
195
- response = parse( ssl_post(self.live_url, post_data(trx_type, post)) )
195
+ response = parse(ssl_post(self.live_url, post_data(trx_type, post)))
196
196
 
197
197
  Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
198
198
  :test => test?,
@@ -73,12 +73,12 @@ module ActiveMerchant #:nodoc:
73
73
  form[:customer_code] = options[:customer].to_s.slice(0, 10) unless options[:customer].blank?
74
74
  end
75
75
 
76
- def add_invoice(form,options)
76
+ def add_invoice(form, options)
77
77
  form[:invoice_number] = (options[:order_id] || options[:invoice]).to_s.slice(0, 10)
78
78
  form[:description] = options[:description].to_s.slice(0, 255)
79
79
  end
80
80
 
81
- def add_address(form,options)
81
+ def add_address(form, options)
82
82
  billing_address = options[:billing_address] || options[:address]
83
83
 
84
84
  if billing_address
@@ -138,7 +138,7 @@ module ActiveMerchant #:nodoc:
138
138
  parameters[:amount] = amount(money)
139
139
  parameters[:transaction_type] = self.actions[action]
140
140
 
141
- response = parse( ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)) )
141
+ response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)))
142
142
 
143
143
  Response.new(response['result'] == APPROVED, message_from(response), response,
144
144
  :test => @options[:test] || test?,
@@ -165,7 +165,7 @@ module ActiveMerchant #:nodoc:
165
165
  # Parse the response message
166
166
  def parse(msg)
167
167
  resp = {}
168
- msg.split(self.delimiter).collect{|li|
168
+ msg.split(self.delimiter).collect { |li|
169
169
  key, value = li.split('=')
170
170
  resp[key.strip.gsub(/^ssl_/, '')] = value.to_s.strip
171
171
  }
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
 
83
83
  private
84
84
 
85
- CURRENCY_CODES = Hash.new{|h,k| raise ArgumentError.new("Unsupported currency: #{k}")}
85
+ CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
86
86
  CURRENCY_CODES['USD'] = 840
87
87
  CURRENCY_CODES['PEN'] = 604
88
88
 
@@ -166,9 +166,9 @@ module ActiveMerchant #:nodoc:
166
166
  end
167
167
 
168
168
  def url(action, params, options={})
169
- if (action == 'authorize')
169
+ if action == 'authorize'
170
170
  "#{base_url}/#{@options[:merchant_id]}"
171
- elsif (action == 'refund')
171
+ elsif action == 'refund'
172
172
  "#{base_url}/#{@options[:merchant_id]}/#{action}/#{options[:transaction_id]}"
173
173
  else
174
174
  "#{base_url}/#{@options[:merchant_id]}/#{action}/#{params[:purchaseNumber]}"
@@ -176,7 +176,7 @@ module ActiveMerchant #:nodoc:
176
176
  end
177
177
 
178
178
  def method(action)
179
- (%w(authorize refund).include? action) ? :post : :put
179
+ %w(authorize refund).include?(action) ? :post : :put
180
180
  end
181
181
 
182
182
  def authorization_from(params, response, options)
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
140
140
  private
141
141
 
142
142
  def clean_description(description)
143
- description.to_s.slice(0,32).encode('US-ASCII', invalid: :replace, undef: :replace, replace: '?')
143
+ description.to_s.slice(0, 32).encode('US-ASCII', invalid: :replace, undef: :replace, replace: '?')
144
144
  end
145
145
 
146
146
  def prepare_options_hash(options)
@@ -343,7 +343,7 @@ module ActiveMerchant #:nodoc:
343
343
  end
344
344
 
345
345
  status.elements.to_a.each do |node|
346
- if (node.elements.size == 0)
346
+ if node.elements.size == 0
347
347
  response[node.name.to_sym] = (node.text || '').strip
348
348
  else
349
349
  node.elements.each do |childnode|
@@ -30,8 +30,8 @@ module ActiveMerchant #:nodoc:
30
30
 
31
31
  def purchase(money, payment_method, options = {})
32
32
  MultiResponse.run do |r|
33
- r.process{authorize(money, payment_method, options)}
34
- r.process{capture(money, r.authorization, options.merge(:authorization_validated => true))}
33
+ r.process { authorize(money, payment_method, options) }
34
+ r.process { capture(money, r.authorization, options.merge(:authorization_validated => true)) }
35
35
  end
36
36
  end
37
37
 
@@ -42,19 +42,19 @@ module ActiveMerchant #:nodoc:
42
42
 
43
43
  def capture(money, authorization, options = {})
44
44
  MultiResponse.run do |r|
45
- r.process{inquire_request(authorization, options, 'AUTHORISED')} unless options[:authorization_validated]
45
+ r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
46
46
  if r.params
47
47
  authorization_currency = r.params['amount_currency_code']
48
48
  options = options.merge(:currency => authorization_currency) if authorization_currency.present?
49
49
  end
50
- r.process{capture_request(money, authorization, options)}
50
+ r.process { capture_request(money, authorization, options) }
51
51
  end
52
52
  end
53
53
 
54
54
  def void(authorization, options = {})
55
55
  MultiResponse.run do |r|
56
- r.process{inquire_request(authorization, options, 'AUTHORISED')} unless options[:authorization_validated]
57
- r.process{cancel_request(authorization, options)}
56
+ r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
57
+ r.process { cancel_request(authorization, options) }
58
58
  end
59
59
  end
60
60
 
@@ -67,7 +67,7 @@ module ActiveMerchant #:nodoc:
67
67
  return response if response.success?
68
68
  return response unless options[:force_full_refund_if_unsettled]
69
69
 
70
- void(authorization, options ) if response.params['last_event'] == 'AUTHORISED'
70
+ void(authorization, options) if response.params['last_event'] == 'AUTHORISED'
71
71
  end
72
72
 
73
73
  # Credits only function on a Merchant ID/login/profile flagged for Payouts
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
175
175
  end
176
176
 
177
177
  def order_tag_attributes(options)
178
- { 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject{|_,v| !v}
178
+ { 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v }
179
179
  end
180
180
 
181
181
  def build_capture_request(money, authorization, options)
@@ -212,7 +212,7 @@ module ActiveMerchant #:nodoc:
212
212
  }
213
213
 
214
214
  if options[:debit_credit_indicator]
215
- amount_hash.merge!('debitCreditIndicator' => options[:debit_credit_indicator])
215
+ amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator]
216
216
  end
217
217
 
218
218
  xml.tag! 'amount', amount_hash
@@ -248,10 +248,21 @@ module ActiveMerchant #:nodoc:
248
248
  xml.tag! 'session', 'shopperIPAddress' => options[:ip] if options[:ip]
249
249
  xml.tag! 'session', 'id' => options[:session_id] if options[:session_id]
250
250
  end
251
+ add_stored_credential_options(xml, options) if options[:stored_credential_usage]
251
252
  end
252
253
  end
253
254
  end
254
255
 
256
+ def add_stored_credential_options(xml, options={})
257
+ if options[:stored_credential_initiated_reason]
258
+ xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage], 'merchantInitiatedReason' => options[:stored_credential_initiated_reason] do
259
+ xml.tag! 'schemeTransactionIdentifier', options[:stored_credential_transaction_id] if options[:stored_credential_transaction_id]
260
+ end
261
+ else
262
+ xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage]
263
+ end
264
+ end
265
+
255
266
  def add_email(xml, options)
256
267
  return unless options[:execute_threed] || options[:email]
257
268
  xml.tag! 'shopper' do
@@ -326,7 +337,7 @@ module ActiveMerchant #:nodoc:
326
337
  end
327
338
  if node.has_elements?
328
339
  raw[node.name.underscore.to_sym] = true unless node.name.blank?
329
- node.elements.each{|e| parse_element(raw, e) }
340
+ node.elements.each { |e| parse_element(raw, e) }
330
341
  else
331
342
  raw[node.name.underscore.to_sym] = node.text unless node.text.nil?
332
343
  end
@@ -339,7 +350,7 @@ module ActiveMerchant #:nodoc:
339
350
  'Authorization' => encoded_credentials
340
351
  }
341
352
  if options[:cookie]
342
- headers.merge!('Set-Cookie' => options[:cookie]) if options[:cookie]
353
+ headers['Set-Cookie'] = options[:cookie] if options[:cookie]
343
354
  end
344
355
  headers
345
356
  end
@@ -407,12 +418,12 @@ module ActiveMerchant #:nodoc:
407
418
 
408
419
  def required_status_message(raw, success_criteria)
409
420
  if(!success_criteria.include?(raw[:last_event]))
410
- "A transaction status of #{success_criteria.collect{|c| "'#{c}'"}.join(" or ")} is required."
421
+ "A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required."
411
422
  end
412
423
  end
413
424
 
414
425
  def authorization_from(raw)
415
- pair = raw.detect{|k,v| k.to_s =~ /_order_code$/}
426
+ pair = raw.detect { |k, v| k.to_s =~ /_order_code$/ }
416
427
  (pair ? pair.last : nil)
417
428
  end
418
429
 
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
139
139
 
140
140
  raw_response = ssl_request(method, self.live_url + url, json, headers(options))
141
141
 
142
- if (raw_response != '')
142
+ if raw_response != ''
143
143
  response = parse(raw_response)
144
144
  if type == 'token'
145
145
  success = response.key?('token')
@@ -163,7 +163,7 @@ module ActiveMerchant #:nodoc:
163
163
  rescue ResponseError => e
164
164
  raw_response = e.response.body
165
165
  response = response_error(raw_response)
166
- rescue JSON::ParserError => e
166
+ rescue JSON::ParserError
167
167
  response = json_error(raw_response)
168
168
  end
169
169
 
@@ -27,15 +27,15 @@ module ActiveMerchant #:nodoc:
27
27
  @emv_authorization = options[:emv_authorization]
28
28
 
29
29
  @avs_result = if options[:avs_result].kind_of?(AVSResult)
30
- options[:avs_result].to_hash
31
- else
32
- AVSResult.new(options[:avs_result]).to_hash
30
+ options[:avs_result].to_hash
31
+ else
32
+ AVSResult.new(options[:avs_result]).to_hash
33
33
  end
34
34
 
35
35
  @cvv_result = if options[:cvv_result].kind_of?(CVVResult)
36
- options[:cvv_result].to_hash
37
- else
38
- CVVResult.new(options[:cvv_result]).to_hash
36
+ options[:cvv_result].to_hash
37
+ else
38
+ CVVResult.new(options[:cvv_result]).to_hash
39
39
  end
40
40
  end
41
41
  end
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
 
71
71
  def <<(response)
72
72
  if response.is_a?(MultiResponse)
73
- response.responses.each{|r| @responses << r}
73
+ response.responses.each { |r| @responses << r }
74
74
  else
75
75
  @responses << response
76
76
  end
@@ -39,11 +39,11 @@ module ActiveMerchant #:nodoc:
39
39
 
40
40
  def initialize(options = {})
41
41
  @name = options.delete(:name)
42
- @codes = options.collect{|k,v| CountryCode.new(v)}
42
+ @codes = options.collect { |k, v| CountryCode.new(v) }
43
43
  end
44
44
 
45
45
  def code(format)
46
- @codes.detect{|c| c.format == format}
46
+ @codes.detect { |c| c.format == format }
47
47
  end
48
48
 
49
49
  def ==(other)
@@ -324,9 +324,9 @@ module ActiveMerchant #:nodoc:
324
324
  when 2, 3
325
325
  upcase_name = name.upcase
326
326
  country_code = CountryCode.new(name)
327
- country = COUNTRIES.detect{|c| c[country_code.format] == upcase_name }
327
+ country = COUNTRIES.detect { |c| c[country_code.format] == upcase_name }
328
328
  else
329
- country = COUNTRIES.detect{|c| c[:name].upcase == name.upcase }
329
+ country = COUNTRIES.detect { |c| c[:name].casecmp(name).zero? }
330
330
  end
331
331
  raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
332
332
  Country.new(country.dup)
@@ -28,7 +28,7 @@ module ActiveMerchant
28
28
  rescue OpenSSL::X509::CertificateError => e
29
29
  NetworkConnectionRetries.log(options[:logger], :error, e.message, options[:tag])
30
30
  raise ActiveMerchant::ClientCertificateError, 'The remote server did not accept the provided SSL certificate'
31
- rescue Zlib::BufError => e
31
+ rescue Zlib::BufError
32
32
  raise ActiveMerchant::InvalidResponseError, 'The remote server replied with an invalid response'
33
33
  rescue *connection_errors.keys => e
34
34
  raise ActiveMerchant::ConnectionError.new(derived_error_message(connection_errors, e.class), e)
@@ -36,6 +36,12 @@ module ActiveMerchant
36
36
  end
37
37
  end
38
38
 
39
+ def self.log(logger, level, message, tag=nil)
40
+ tag ||= self.class.to_s
41
+ message = "[#{tag}] #{message}"
42
+ logger&.send(level, message)
43
+ end
44
+
39
45
  private
40
46
 
41
47
  def retry_network_exceptions(options = {})
@@ -62,14 +68,6 @@ module ActiveMerchant
62
68
  end
63
69
  end
64
70
 
65
- def self.log(logger, level, message, tag=nil)
66
- tag ||= self.class.to_s
67
- message = "[#{tag}] #{message}"
68
- logger&.send(level, message)
69
- end
70
-
71
- private
72
-
73
71
  def log_with_retry_details(logger, attempts, time, message, tag)
74
72
  NetworkConnectionRetries.log(logger, :info, 'connection_attempt=%d connection_request_time=%.4fs connection_msg="%s"' % [attempts, time, message], tag)
75
73
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.86.0'
2
+ VERSION = '1.87.0'
3
3
  end
@@ -14,7 +14,7 @@ class GatewaySupport #:nodoc:
14
14
  filename = File.basename(f, '.rb')
15
15
  gateway_name = filename + '_gateway'
16
16
  begin
17
- gateway_class = ('ActiveMerchant::Billing::' + gateway_name.camelize).constantize
17
+ ('ActiveMerchant::Billing::' + gateway_name.camelize).constantize
18
18
  rescue NameError
19
19
  puts 'Could not load gateway ' + gateway_name.camelize + ' from ' + f + '.'
20
20
  end
@@ -24,14 +24,14 @@ class GatewaySupport #:nodoc:
24
24
  end
25
25
 
26
26
  def each_gateway
27
- @gateways.each{|g| yield g }
27
+ @gateways.each { |g| yield g }
28
28
  end
29
29
 
30
30
  def features
31
31
  width = 15
32
32
 
33
33
  print 'Name'.center(width + 20)
34
- ACTIONS.each{|f| print f.to_s.capitalize.center(width) }
34
+ ACTIONS.each { |f| print f.to_s.capitalize.center(width) }
35
35
  puts
36
36
 
37
37
  each_gateway do |g|
@@ -23,7 +23,7 @@ class SSLVerify
23
23
  end
24
24
 
25
25
  uri = URI.parse(g.live_url)
26
- result,message = ssl_verify_peer?(uri)
26
+ result, message = ssl_verify_peer?(uri)
27
27
  case result
28
28
  when :success
29
29
  print '.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.86.0
4
+ version: 1.87.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-26 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
417
  version: '0'
418
418
  requirements: []
419
419
  rubyforge_project: activemerchant
420
- rubygems_version: 2.6.14
420
+ rubygems_version: 2.7.6
421
421
  signing_key:
422
422
  specification_version: 4
423
423
  summary: Framework and tools for dealing with credit card transactions.