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
@@ -141,7 +141,7 @@ module ActiveMerchant #:nodoc:
141
141
  def initialize(options = {})
142
142
  requires!(options, :login, :shared_secret)
143
143
  @threeds_required = false
144
- if (options[:threeDSRequired])
144
+ if options[:threeDSRequired]
145
145
  ActiveMerchant.deprecated(THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE)
146
146
  @threeds_required = options[:threeDSRequired]
147
147
  end
@@ -278,7 +278,7 @@ module ActiveMerchant #:nodoc:
278
278
  end
279
279
 
280
280
  def add_threeds_required(post, options)
281
- add_pair(post, :threeDSRequired, (options[:threeds_required] || @threeds_required) ? 'Y' : 'N')
281
+ add_pair(post, :threeDSRequired, options[:threeds_required] || @threeds_required ? 'Y' : 'N')
282
282
  end
283
283
 
284
284
  def add_remote_address(post, options={})
@@ -334,13 +334,13 @@ module ActiveMerchant #:nodoc:
334
334
  street_match = AVS_STREET_MATCH[response[:avscv2ResponseCode].to_s[2, 1]]
335
335
 
336
336
  code = if postal_match == 'Y' && street_match == 'Y'
337
- 'M'
338
- elsif postal_match == 'Y'
339
- 'P'
340
- elsif street_match == 'Y'
341
- 'A'
342
- else
343
- 'I'
337
+ 'M'
338
+ elsif postal_match == 'Y'
339
+ 'P'
340
+ elsif street_match == 'Y'
341
+ 'A'
342
+ else
343
+ 'I'
344
344
  end
345
345
 
346
346
  AVSResult.new({
@@ -3,7 +3,7 @@ module ActiveMerchant #:nodoc:
3
3
  class CardknoxGateway < Gateway
4
4
  self.live_url = 'https://x1.cardknox.com/gateway'
5
5
 
6
- self.supported_countries = ['US','CA','GB']
6
+ self.supported_countries = ['US', 'CA', 'GB']
7
7
  self.default_currency = 'USD'
8
8
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
9
9
 
@@ -255,7 +255,7 @@ module ActiveMerchant #:nodoc:
255
255
  def parse(body)
256
256
  fields = {}
257
257
  for line in body.split('&')
258
- key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
258
+ key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
259
259
  fields[key] = CGI.unescape(value.to_s)
260
260
  end
261
261
 
@@ -276,7 +276,7 @@ module ActiveMerchant #:nodoc:
276
276
  amount: fields['xAuthAmount'],
277
277
  masked_card_num: fields['xMaskedCardNumber'],
278
278
  masked_account_number: fields['MaskedAccountNumber']
279
- }.delete_if{|k, v| v.nil?}
279
+ }.delete_if { |k, v| v.nil? }
280
280
  end
281
281
 
282
282
  def commit(action, source_type, parameters)
@@ -320,7 +320,7 @@ module ActiveMerchant #:nodoc:
320
320
  initial_parameters[:Hash] = "s/#{seed}/#{hash}/n" unless @options[:pin].blank?
321
321
  parameters = initial_parameters.merge(parameters)
322
322
 
323
- parameters.reject{|k, v| v.blank?}.collect{ |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
323
+ parameters.reject { |k, v| v.blank? }.collect { |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
324
324
  end
325
325
  end
326
326
  end
@@ -189,7 +189,7 @@ module ActiveMerchant #:nodoc:
189
189
  post[:authentication][:password] = @options[:password]
190
190
  post[:authentication][:entityId] = @options[:entity_id]
191
191
  post[:paymentType] = action
192
- dot_flatten_hash(post).map {|key, value| "#{key}=#{CGI.escape(value.to_s)}"}.join('&')
192
+ dot_flatten_hash(post).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
193
193
  end
194
194
 
195
195
  def error_code_from(response)
@@ -136,11 +136,11 @@ module ActiveMerchant #:nodoc:
136
136
  match = body.match(/<cngateway>(.*)<\/cngateway>/)
137
137
  return nil unless match
138
138
 
139
- Hash[CGI::parse(match[1]).map{|k,v| [k.to_sym,v.first]}]
139
+ Hash[CGI::parse(match[1]).map { |k, v| [k.to_sym, v.first] }]
140
140
  end
141
141
 
142
142
  def handle_response(response)
143
- if (200...300).include?(response.code.to_i)
143
+ if (200...300).cover?(response.code.to_i)
144
144
  return response.body
145
145
  elsif response.code.to_i == 302
146
146
  return ssl_get(URI.parse(response['location']))
@@ -174,7 +174,7 @@ module ActiveMerchant #:nodoc:
174
174
 
175
175
  def parse_element(response, node)
176
176
  if node.has_elements?
177
- node.elements.each{|element| parse_element(response, element) }
177
+ node.elements.each { |element| parse_element(response, element) }
178
178
  else
179
179
  response[node.name.underscore.to_sym] = node.text
180
180
  end
@@ -188,7 +188,7 @@ module ActiveMerchant #:nodoc:
188
188
  return unless text
189
189
 
190
190
  if ActiveSupport::Inflector.method(:transliterate).arity == -2
191
- ActiveSupport::Inflector.transliterate(text,'')
191
+ ActiveSupport::Inflector.transliterate(text, '')
192
192
  else
193
193
  text.gsub(/[^\x00-\x7F]+/, '')
194
194
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.live_url = 'https://ww3.cenpos.net/6/transact.asmx'
10
10
 
11
- self.supported_countries = %w(AD AI AG AR AU AT BS BB BE BZ BM BR BN BG CA HR CY CZ DK DM EE FI FR DE GR GD GY HK HU IS IN IL IT JP LV LI LT LU MY MT MX MC MS NL PA PL PT KN LC MF VC SM SG SK SI ZA ES SR SE CH TR GB US UY)
11
+ self.supported_countries = %w(AD AI AG AR AU AT BS BB BE BZ BM BR BN BG CA HR CY CZ DK DM EE FI FR DE GR GD GY HK HU IS IL IT JP LV LI LT LU MY MT MX MC MS NL PA PL PT KN LC MF VC SM SG SK SI ZA ES SR SE CH TR GB US UY)
12
12
  self.default_currency = 'USD'
13
13
  self.money_format = :dollars
14
14
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
@@ -219,7 +219,7 @@ module ActiveMerchant #:nodoc:
219
219
  doc.remove_namespaces!
220
220
  body = doc.xpath('//ProcessCreditCardResult')
221
221
  body.children.each do |node|
222
- if (node.elements.size == 0)
222
+ if node.elements.size == 0
223
223
  response[node.name.underscore.to_sym] = node.text
224
224
  else
225
225
  node.elements.each do |childnode|
@@ -187,7 +187,7 @@ module ActiveMerchant #:nodoc:
187
187
  Nokogiri::XML(CGI.unescapeHTML(xml)).xpath('//response').children.each do |node|
188
188
  if node.text?
189
189
  next
190
- elsif (node.elements.size == 0)
190
+ elsif node.elements.size == 0
191
191
  response[node.name.downcase.to_sym] = node.text
192
192
  else
193
193
  node.elements.each do |childnode|
@@ -54,16 +54,16 @@ module ActiveMerchant #:nodoc:
54
54
  add_invoice(post, amount, options)
55
55
 
56
56
  action = if payment.respond_to?(:number)
57
- add_payment(post, payment)
58
- '/authorizations'
59
- elsif payment.kind_of?(String)
60
- "/cards/#{payment}/authorizations"
61
- else
62
- raise ArgumentError.new("Unknown payment type #{payment.inspect}")
57
+ add_payment(post, payment)
58
+ '/authorizations'
59
+ elsif payment.kind_of?(String)
60
+ "/cards/#{payment}/authorizations"
61
+ else
62
+ raise ArgumentError.new("Unknown payment type #{payment.inspect}")
63
63
  end
64
64
 
65
65
  post[:recurring] = options[:recurring] if options[:recurring]
66
- post[:threed_secure] = {pares: options[:pares]} if options[:pares]
66
+ post[:card][:pares] = options[:pares] if options[:pares]
67
67
 
68
68
  commit(action, post)
69
69
  end
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
108
108
  transcript.
109
109
  gsub(%r((Authorization: Basic )[\w=]+), '\1[FILTERED]').
110
110
  gsub(%r((&?card(?:\[|%5B)csc(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]').
111
- gsub(%r((&?card(?:\[|%5B)number(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]')
111
+ gsub(%r((&?card(?:\[|%5B)pan(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]')
112
112
  end
113
113
 
114
114
  private
@@ -126,12 +126,12 @@ module ActiveMerchant #:nodoc:
126
126
 
127
127
  def add_payment(post, payment)
128
128
  card = {}
129
- card[:number] = payment.number
129
+ card[:pan] = payment.number
130
130
  card[:expire_month] = '%02d'% payment.month
131
131
  card[:expire_year] = payment.year
132
132
 
133
133
  if payment.verification_value?
134
- card[:csc] = payment.verification_value
134
+ card[:csc] = payment.verification_value
135
135
  end
136
136
 
137
137
  post[:card] = card if card.any?
@@ -139,8 +139,8 @@ module ActiveMerchant #:nodoc:
139
139
 
140
140
  def headers(api_key)
141
141
  {
142
- 'Authorization' => 'Basic ' + Base64.strict_encode64("#{api_key}:"),
143
- 'User-Agent' => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
142
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{api_key}:"),
143
+ 'User-Agent' => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
144
144
  }
145
145
  end
146
146
 
@@ -111,7 +111,7 @@ module ActiveMerchant #:nodoc:
111
111
  results = {}
112
112
 
113
113
  body.split(/\&/).each do |pair|
114
- key,val = pair.split(%r{=})
114
+ key, val = pair.split(%r{=})
115
115
  results[key] = CGI.unescape(val)
116
116
  end
117
117
 
@@ -126,8 +126,8 @@ module ActiveMerchant #:nodoc:
126
126
  if response['returnText'].present?
127
127
  response['returnText']
128
128
  else
129
- 'Invalid response received from the CommerceGate API. ' +
130
- 'Please contact CommerceGate support if you continue to receive this message. ' +
129
+ 'Invalid response received from the CommerceGate API. ' \
130
+ 'Please contact CommerceGate support if you continue to receive this message. ' \
131
131
  "(The raw response returned by the API was #{response.inspect})"
132
132
  end
133
133
  end
@@ -147,7 +147,7 @@ module ActiveMerchant #:nodoc:
147
147
  def add_transaction_details(xml, amount, authorization, type, options={})
148
148
  xml.TransactionDetails do
149
149
  xml.MessageType type
150
- xml.Amount(unit: 'Minor'){ xml.text(amount) } if amount
150
+ xml.Amount(unit: 'Minor') { xml.text(amount) } if amount
151
151
  xml.CardEaseReference authorization if authorization
152
152
  xml.VoidReason '01' if type == 'Void'
153
153
  end
@@ -157,7 +157,7 @@ module ActiveMerchant #:nodoc:
157
157
  xml.TerminalDetails do
158
158
  xml.TerminalID @options[:terminal_id]
159
159
  xml.TransactionKey @options[:transaction_key]
160
- xml.Software(version: 'SoftwareVersion'){ xml.text('SoftwareName') }
160
+ xml.Software(version: 'SoftwareVersion') { xml.text('SoftwareName') }
161
161
  end
162
162
  end
163
163
 
@@ -129,6 +129,7 @@ module ActiveMerchant #:nodoc:
129
129
  add_email(post, options)
130
130
  add_3d_secure(post, options)
131
131
  add_echo(post, options)
132
+ add_submerchant_id(post, options)
132
133
  add_transaction_type(post, options)
133
134
 
134
135
  commit(:purchase, post)
@@ -142,6 +143,7 @@ module ActiveMerchant #:nodoc:
142
143
  add_email(post, options)
143
144
  add_3d_secure(post, options)
144
145
  add_echo(post, options)
146
+ add_submerchant_id(post, options)
145
147
  add_transaction_type(post, options)
146
148
 
147
149
  commit(:authorize, post)
@@ -153,6 +155,7 @@ module ActiveMerchant #:nodoc:
153
155
  add_reference(post, authorization)
154
156
  add_customer_data(post, options)
155
157
  add_echo(post, options)
158
+ add_submerchant_id(post, options)
156
159
 
157
160
  commit(:capture, post)
158
161
  end
@@ -162,6 +165,7 @@ module ActiveMerchant #:nodoc:
162
165
  add_customer_data(post, options)
163
166
  reference_action = add_reference(post, authorization)
164
167
  add_echo(post, options)
168
+ add_submerchant_id(post, options)
165
169
  post[:a1] = generate_unique_id
166
170
 
167
171
  commit(:void, post, reference_action)
@@ -173,6 +177,7 @@ module ActiveMerchant #:nodoc:
173
177
  add_reference(post, authorization)
174
178
  add_customer_data(post, options)
175
179
  add_echo(post, options)
180
+ add_submerchant_id(post, options)
176
181
 
177
182
  commit(:refund, post)
178
183
  end
@@ -184,6 +189,7 @@ module ActiveMerchant #:nodoc:
184
189
  add_customer_data(post, options)
185
190
  add_email(post, options)
186
191
  add_echo(post, options)
192
+ add_submerchant_id(post, options)
187
193
  add_transaction_type(post, options)
188
194
 
189
195
  commit(:credit, post)
@@ -268,6 +274,10 @@ module ActiveMerchant #:nodoc:
268
274
  post[:d2] = options[:echo] unless options[:echo].blank?
269
275
  end
270
276
 
277
+ def add_submerchant_id(post, options)
278
+ post[:h3] = options[:submerchant_id] if options[:submerchant_id]
279
+ end
280
+
271
281
  def add_transaction_type(post, options)
272
282
  post[:a9] = options[:transaction_type] if options[:transaction_type]
273
283
  end
@@ -307,11 +317,11 @@ module ActiveMerchant #:nodoc:
307
317
  end
308
318
 
309
319
  def post_data(action, params, reference_action)
310
- params.keys.each { |key| params[key] = params[key].to_s}
320
+ params.keys.each { |key| params[key] = params[key].to_s }
311
321
  params[:M] = @options[:merchant_id]
312
322
  params[:O] = request_action(action, reference_action)
313
323
  params[:K] = sign_request(params)
314
- params.map {|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
324
+ params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
315
325
  end
316
326
 
317
327
  def request_action(action, reference_action)
@@ -327,7 +337,7 @@ module ActiveMerchant #:nodoc:
327
337
  end
328
338
 
329
339
  def parse(body)
330
- Hash[CGI::parse(body).map{|k,v| [k.upcase,v.first]}]
340
+ Hash[CGI::parse(body).map { |k, v| [k.upcase, v.first] }]
331
341
  end
332
342
 
333
343
  def success_from(response)
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
  post = {}
119
119
  add_terminal_number(post, options)
120
120
  add_operator_id(post, options)
121
- add_invoice(post,0, options)
121
+ add_invoice(post, 0, options)
122
122
  add_payment(post, credit_card)
123
123
  add_address(post, credit_card, options)
124
124
  add_customer_data(post, options)
@@ -159,7 +159,7 @@ module ActiveMerchant #:nodoc:
159
159
  end
160
160
 
161
161
  def add_money(post, money)
162
- post[:Amount] = money.to_s.rjust(11,'0')
162
+ post[:Amount] = money.to_s.rjust(11, '0')
163
163
  end
164
164
 
165
165
  def add_operator_id(post, options)
@@ -179,7 +179,7 @@ module ActiveMerchant #:nodoc:
179
179
 
180
180
  def add_invoice(post, money, options)
181
181
  post[:CurrencyCode] = options[:currency] || (currency(money) if money)
182
- post[:InvoiceNumber] = options[:order_id].rjust(12,'0')
182
+ post[:InvoiceNumber] = options[:order_id].rjust(12, '0')
183
183
  post[:InputType] = 'I'
184
184
  post[:LanguageCode] = 'E'
185
185
  end
@@ -189,7 +189,7 @@ module ActiveMerchant #:nodoc:
189
189
  post[:Token] = split_authorization(payment)[3].strip
190
190
  else
191
191
  post[:CardType] = CARD_BRAND[payment.brand] || ' '
192
- post[:CardNumber] = payment.number.rjust(40,' ')
192
+ post[:CardNumber] = payment.number.rjust(40, ' ')
193
193
  post[:ExpirationDate] = expdate(payment)
194
194
  post[:Cvv2Cvc2Number] = payment.verification_value
195
195
  end
@@ -224,7 +224,7 @@ module ActiveMerchant #:nodoc:
224
224
  commit_raw(action, parameters)
225
225
  else
226
226
  MultiResponse.run(true) do |r|
227
- r.process { commit_raw(action, parameters)}
227
+ r.process { commit_raw(action, parameters) }
228
228
  r.process {
229
229
  split_auth = split_authorization(r.authorization)
230
230
  auth = (action.include?('recur')? split_auth[4] : split_auth[0])
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
254
254
  parameters[:CompanyNumber] = @options[:company_number]
255
255
  parameters[:MerchantNumber] = @options[:merchant_number]
256
256
  parameters = parameters.collect do |key, value|
257
- "#{key}=#{value}" unless (value.nil? || value.empty?)
257
+ "#{key}=#{value}" unless value.nil? || value.empty?
258
258
  end.join('&')
259
259
  payload = Base64.strict_encode64(parameters)
260
260
  "auth-api-key=#{@options[:api_key]}&payload=#{payload}".strip
@@ -235,7 +235,7 @@ module ActiveMerchant #:nodoc:
235
235
  end
236
236
 
237
237
  def post_data(action, params)
238
- params.map {|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
238
+ params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
239
239
  end
240
240
 
241
241
  def url
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
27
27
  XSD_VERSION = '1.121'
28
28
 
29
29
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro]
30
- self.supported_countries = %w(US BR CA CN DK FI FR DE JP MX NO SE GB SG LB)
30
+ self.supported_countries = %w(US BR CA CN DK FI FR DE IN JP MX NO SE GB SG LB)
31
31
 
32
32
  self.default_currency = 'USD'
33
33
  self.currencies_without_fractions = %w(JPY)
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
 
114
114
  def authorize(money, creditcard_or_reference, options = {})
115
115
  setup_address_hash(options)
116
- commit(build_auth_request(money, creditcard_or_reference, options), :authorize, money, options )
116
+ commit(build_auth_request(money, creditcard_or_reference, options), :authorize, money, options)
117
117
  end
118
118
 
119
119
  def capture(money, authorization, options = {})
@@ -209,7 +209,7 @@ module ActiveMerchant #:nodoc:
209
209
  # Determines if a card can be used for Pinless Debit Card transactions
210
210
  def validate_pinless_debit_card(creditcard, options = {})
211
211
  requires!(options, :order_id)
212
- commit(build_validate_pinless_debit_request(creditcard,options), :validate_pinless_debit_card, nil, options)
212
+ commit(build_validate_pinless_debit_request(creditcard, options), :validate_pinless_debit_card, nil, options)
213
213
  end
214
214
 
215
215
  def supports_scrubbing?
@@ -392,7 +392,7 @@ module ActiveMerchant #:nodoc:
392
392
  xml.target!
393
393
  end
394
394
 
395
- def build_validate_pinless_debit_request(creditcard,options)
395
+ def build_validate_pinless_debit_request(creditcard, options)
396
396
  xml = Builder::XmlMarkup.new :indent => 2
397
397
  add_creditcard(xml, creditcard)
398
398
  add_validate_pinless_debit_service(xml)
@@ -410,7 +410,7 @@ module ActiveMerchant #:nodoc:
410
410
  end
411
411
  end
412
412
 
413
- def extract_option prioritized_options, option_name
413
+ def extract_option(prioritized_options, option_name)
414
414
  options_matching_key = prioritized_options.detect do |options|
415
415
  options.has_key? option_name
416
416
  end
@@ -432,7 +432,7 @@ module ActiveMerchant #:nodoc:
432
432
  def add_merchant_data(xml, options)
433
433
  xml.tag! 'merchantID', @options[:login]
434
434
  xml.tag! 'merchantReferenceCode', options[:order_id] || generate_unique_id
435
- xml.tag! 'clientLibrary','Ruby Active Merchant'
435
+ xml.tag! 'clientLibrary', 'Ruby Active Merchant'
436
436
  xml.tag! 'clientLibraryVersion', VERSION
437
437
  xml.tag! 'clientEnvironment', RUBY_PLATFORM
438
438
  end
@@ -469,7 +469,7 @@ module ActiveMerchant #:nodoc:
469
469
  xml.tag! 'accountNumber', creditcard.number
470
470
  xml.tag! 'expirationMonth', format(creditcard.month, :two_digits)
471
471
  xml.tag! 'expirationYear', format(creditcard.year, :four_digits)
472
- xml.tag!('cvNumber', creditcard.verification_value) unless (@options[:ignore_cvv] || creditcard.verification_value.blank? )
472
+ xml.tag!('cvNumber', creditcard.verification_value) unless @options[:ignore_cvv] || creditcard.verification_value.blank?
473
473
  xml.tag! 'cardType', @@credit_card_codes[card_brand(creditcard).to_sym]
474
474
  end
475
475
  end
@@ -755,7 +755,7 @@ module ActiveMerchant #:nodoc:
755
755
 
756
756
  def parse_element(reply, node)
757
757
  if node.has_elements?
758
- node.elements.each{|e| parse_element(reply, e) }
758
+ node.elements.each { |e| parse_element(reply, e) }
759
759
  else
760
760
  if node.parent.name =~ /item/
761
761
  parent = node.parent.name