activemerchant 1.83.0 → 1.84.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +19 -0
  3. data/lib/active_merchant/billing/base.rb +1 -1
  4. data/lib/active_merchant/billing/check.rb +3 -2
  5. data/lib/active_merchant/billing/compatibility.rb +2 -4
  6. data/lib/active_merchant/billing/credit_card.rb +6 -39
  7. data/lib/active_merchant/billing/credit_card_formatting.rb +0 -1
  8. data/lib/active_merchant/billing/credit_card_methods.rb +67 -44
  9. data/lib/active_merchant/billing/gateway.rb +1 -8
  10. data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +0 -1
  13. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/balanced.rb +9 -9
  15. data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
  16. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -1
  17. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -0
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +0 -1
  19. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -7
  20. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -6
  21. data/lib/active_merchant/billing/gateways/bridge_pay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/card_connect.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/card_stream.rb +9 -18
  25. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -9
  26. data/lib/active_merchant/billing/gateways/cc5.rb +0 -1
  27. data/lib/active_merchant/billing/gateways/cecabank.rb +0 -1
  28. data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/checkout_v2.rb +6 -6
  30. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/commercegate.rb +0 -1
  32. data/lib/active_merchant/billing/gateways/conekta.rb +6 -8
  33. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -2
  34. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/culqi.rb +8 -10
  36. data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -2
  37. data/lib/active_merchant/billing/gateways/data_cash.rb +16 -29
  38. data/lib/active_merchant/billing/gateways/dibs.rb +1 -7
  39. data/lib/active_merchant/billing/gateways/digitzs.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/efsnet.rb +0 -4
  41. data/lib/active_merchant/billing/gateways/element.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/epay.rb +8 -9
  43. data/lib/active_merchant/billing/gateways/eway.rb +1 -0
  44. data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
  45. data/lib/active_merchant/billing/gateways/exact.rb +0 -2
  46. data/lib/active_merchant/billing/gateways/ezic.rb +0 -1
  47. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -11
  48. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/first_giving.rb +3 -3
  50. data/lib/active_merchant/billing/gateways/first_pay.rb +5 -0
  51. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
  52. data/lib/active_merchant/billing/gateways/garanti.rb +4 -5
  53. data/lib/active_merchant/billing/gateways/global_collect.rb +6 -7
  54. data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
  55. data/lib/active_merchant/billing/gateways/inspire.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
  58. data/lib/active_merchant/billing/gateways/iveri.rb +1 -1
  59. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/kushki.rb +7 -9
  61. data/lib/active_merchant/billing/gateways/latitude19.rb +29 -34
  62. data/lib/active_merchant/billing/gateways/linkpoint.rb +1 -3
  63. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/mastercard.rb +1 -2
  65. data/lib/active_merchant/billing/gateways/mercado_pago.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +0 -1
  67. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/merchant_ware.rb +3 -3
  69. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +3 -3
  70. data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/micropayment.rb +0 -2
  72. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -0
  73. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +4 -3
  74. data/lib/active_merchant/billing/gateways/moneris.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -2
  76. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/mundipagg.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -0
  80. data/lib/active_merchant/billing/gateways/nmi.rb +1 -2
  81. data/lib/active_merchant/billing/gateways/ogone.rb +9 -10
  82. data/lib/active_merchant/billing/gateways/openpay.rb +7 -8
  83. data/lib/active_merchant/billing/gateways/opp.rb +110 -112
  84. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -4
  85. data/lib/active_merchant/billing/gateways/orbital.rb +1 -2
  86. data/lib/active_merchant/billing/gateways/pagarme.rb +3 -5
  87. data/lib/active_merchant/billing/gateways/pay_conex.rb +0 -1
  88. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +10 -12
  89. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -1
  91. data/lib/active_merchant/billing/gateways/payeezy.rb +15 -4
  92. data/lib/active_merchant/billing/gateways/payex.rb +5 -6
  93. data/lib/active_merchant/billing/gateways/payflow.rb +0 -4
  94. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -2
  95. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +1 -1
  96. data/lib/active_merchant/billing/gateways/payflow_express.rb +54 -55
  97. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/payment_express.rb +0 -6
  99. data/lib/active_merchant/billing/gateways/paymill.rb +0 -2
  100. data/lib/active_merchant/billing/gateways/paypal.rb +0 -8
  101. data/lib/active_merchant/billing/gateways/payscout.rb +0 -1
  102. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/payu_latam.rb +37 -32
  104. data/lib/active_merchant/billing/gateways/pin.rb +2 -2
  105. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -0
  106. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -10
  107. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  108. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +0 -3
  109. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -7
  110. data/lib/active_merchant/billing/gateways/realex.rb +6 -8
  111. data/lib/active_merchant/billing/gateways/redsys.rb +1 -0
  112. data/lib/active_merchant/billing/gateways/s5.rb +0 -1
  113. data/lib/active_merchant/billing/gateways/safe_charge.rb +4 -4
  114. data/lib/active_merchant/billing/gateways/sage.rb +16 -13
  115. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -9
  116. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  117. data/lib/active_merchant/billing/gateways/securion_pay.rb +3 -6
  118. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -4
  120. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +5 -5
  121. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -2
  122. data/lib/active_merchant/billing/gateways/stripe.rb +60 -15
  123. data/lib/active_merchant/billing/gateways/telr.rb +5 -6
  124. data/lib/active_merchant/billing/gateways/tns.rb +1 -1
  125. data/lib/active_merchant/billing/gateways/trans_first.rb +0 -1
  126. data/lib/active_merchant/billing/gateways/trexle.rb +6 -5
  127. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -0
  128. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +2 -2
  129. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -1
  130. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -0
  132. data/lib/active_merchant/billing/gateways/visanet_peru.rb +28 -32
  133. data/lib/active_merchant/billing/gateways/wepay.rb +0 -1
  134. data/lib/active_merchant/billing/gateways/wirecard.rb +2 -1
  135. data/lib/active_merchant/billing/gateways/worldpay.rb +1 -4
  136. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +5 -8
  137. data/lib/active_merchant/connection.rb +0 -2
  138. data/lib/active_merchant/country.rb +1 -0
  139. data/lib/active_merchant/net_http_ssl_connection.rb +1 -1
  140. data/lib/active_merchant/network_connection_retries.rb +1 -0
  141. data/lib/active_merchant/post_data.rb +1 -0
  142. data/lib/active_merchant/posts_data.rb +0 -2
  143. data/lib/active_merchant/version.rb +1 -1
  144. data/lib/support/gateway_support.rb +3 -4
  145. data/lib/support/ssl_verify.rb +0 -1
  146. metadata +2 -2
@@ -27,14 +27,13 @@ module ActiveMerchant #:nodoc:
27
27
  post = {}
28
28
  add_amount(post, amount)
29
29
  add_invoice(post, amount, options)
30
- if (payment_method.respond_to?(:number))
30
+ if payment_method.respond_to?(:number)
31
31
  add_payment_method(post, payment_method, options)
32
32
  commit(:authorize, post)
33
33
  else
34
34
  add_ticket_id(post, payment_method)
35
35
  commit(:authorize_ticket, post)
36
36
  end
37
-
38
37
  end
39
38
 
40
39
  def capture(amount, authorization, options={})
@@ -110,15 +109,10 @@ module ActiveMerchant #:nodoc:
110
109
  post[:cvc] = payment_method.verification_value if payment_method.verification_value
111
110
  post[:expYear] = format(payment_method.year, :two_digits)
112
111
  post[:expMonth] = payment_method.month
113
-
114
- post[:startMonth] = payment_method.start_month if payment_method.start_month
115
- post[:startYear] = payment_method.start_year if payment_method.start_year
116
- post[:issueNumber] = payment_method.issue_number if payment_method.issue_number
117
112
  post[:clientIp] = options[:ip] || '127.0.0.1'
118
113
  post[:test] = true if test?
119
114
  end
120
115
 
121
-
122
116
  def add_reference(post, authorization)
123
117
  post[:transactionId] = authorization
124
118
  end
@@ -163,7 +163,7 @@ module ActiveMerchant #:nodoc:
163
163
  post[:data][:attributes] = {
164
164
  merchantId: options[:merchant_id],
165
165
  name: payment.name,
166
- externalId: "#{SecureRandom.hex(16)}"
166
+ externalId: SecureRandom.hex(16)
167
167
  }
168
168
 
169
169
  post
@@ -2,7 +2,6 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  class EfsnetGateway < Gateway
7
6
  self.supported_countries = ['US']
8
7
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
@@ -143,7 +142,6 @@ module ActiveMerchant #:nodoc:
143
142
  post[:expiration_year] = sprintf('%.4i', creditcard.year)[-2..-1]
144
143
  end
145
144
 
146
-
147
145
  def commit(action, parameters)
148
146
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))
149
147
 
@@ -169,9 +167,7 @@ module ActiveMerchant #:nodoc:
169
167
  xml = REXML::Document.new(xml)
170
168
 
171
169
  xml.elements.each('//Reply//TransactionReply/*') do |node|
172
-
173
170
  response[node.name.underscore.to_sym] = normalize(node.text)
174
-
175
171
  end unless xml.root.nil?
176
172
 
177
173
  response
@@ -251,7 +251,7 @@ module ActiveMerchant #:nodoc:
251
251
  end
252
252
 
253
253
  root.each do |node|
254
- if (node.elements.empty?)
254
+ if node.elements.empty?
255
255
  response[node.name.downcase] = node.text
256
256
  else
257
257
  node_name = node.name.downcase
@@ -120,7 +120,6 @@ module ActiveMerchant #:nodoc:
120
120
  gsub(%r((&?cvc=)\d*(&?)), '\1[FILTERED]\2')
121
121
  end
122
122
 
123
-
124
123
  private
125
124
 
126
125
  def add_amount(post, money, options)
@@ -164,16 +163,16 @@ module ActiveMerchant #:nodoc:
164
163
 
165
164
  if action == :authorize
166
165
  Response.new response['accept'].to_i == 1,
167
- response['errortext'],
168
- response,
169
- :test => test?,
170
- :authorization => response['tid']
166
+ response['errortext'],
167
+ response,
168
+ :test => test?,
169
+ :authorization => response['tid']
171
170
  else
172
171
  Response.new response['result'] == 'true',
173
- messages(response['epay'], response['pbs']),
174
- response,
175
- :test => test?,
176
- :authorization => params[:transaction]
172
+ messages(response['epay'], response['pbs']),
173
+ response,
174
+ :test => test?,
175
+ :authorization => params[:transaction]
177
176
  end
178
177
  end
179
178
 
@@ -64,6 +64,7 @@ module ActiveMerchant #:nodoc:
64
64
  end
65
65
 
66
66
  private
67
+
67
68
  def requires_address!(options)
68
69
  raise ArgumentError.new('Missing eWay required parameters: address or billing_address') unless (options.has_key?(:address) or options.has_key?(:billing_address))
69
70
  end
@@ -136,7 +136,6 @@ module ActiveMerchant #:nodoc:
136
136
  post[:invoiceDescription] = options[:description]
137
137
  end
138
138
 
139
-
140
139
  # add credit card details to be stored by eway. NOTE eway requires "title" field
141
140
  def add_creditcard(post, creditcard)
142
141
  post[:CCNumber] = creditcard.number
@@ -253,9 +252,9 @@ module ActiveMerchant #:nodoc:
253
252
  end
254
253
  end
255
254
  xml.tag! 'soap12:Body' do |x|
256
- x.tag! "#{action}", {'xmlns' => 'https://www.eway.com.au/gateway/managedpayment'} do |y|
255
+ x.tag! action, {'xmlns' => 'https://www.eway.com.au/gateway/managedpayment'} do |y|
257
256
  post.each do |key, value|
258
- y.tag! "#{key}", "#{value}"
257
+ y.tag! key, value
259
258
  end
260
259
  end
261
260
  end
@@ -13,7 +13,6 @@ module ActiveMerchant #:nodoc:
13
13
  :capture => '32',
14
14
  :credit => '34' }
15
15
 
16
-
17
16
  ENVELOPE_NAMESPACES = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
18
17
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
19
18
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
@@ -169,7 +168,6 @@ module ActiveMerchant #:nodoc:
169
168
  :avs_result => { :code => response[:avs] },
170
169
  :cvv_result => response[:cvv2]
171
170
  )
172
-
173
171
  rescue ResponseError => e
174
172
  case e.response.code
175
173
  when '401'
@@ -191,6 +191,5 @@ module ActiveMerchant
191
191
  }
192
192
  end
193
193
  end
194
-
195
194
  end
196
195
  end
@@ -172,17 +172,15 @@ module ActiveMerchant #:nodoc:
172
172
  end
173
173
 
174
174
  def parse(response)
175
- begin
176
- JSON.parse(response)
177
- rescue JSON::ParserError
178
- msg = 'Invalid JSON response received from Fat Zebra. Please contact support@fatzebra.com.au if you continue to receive this message.'
179
- msg += " (The raw response returned by the API was #{response.inspect})"
180
- {
181
- 'successful' => false,
182
- 'response' => {},
183
- 'errors' => [msg]
184
- }
185
- end
175
+ JSON.parse(response)
176
+ rescue JSON::ParserError
177
+ msg = 'Invalid JSON response received from Fat Zebra. Please contact support@fatzebra.com.au if you continue to receive this message.'
178
+ msg += " (The raw response returned by the API was #{response.inspect})"
179
+ {
180
+ 'successful' => false,
181
+ 'response' => {},
182
+ 'errors' => [msg]
183
+ }
186
184
  end
187
185
 
188
186
  def get_url(uri)
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
  end
135
135
 
136
136
  def test?
137
- (@options[:login].eql?('demo')) && (@options[:password].eql?('password'))
137
+ @options[:login].eql?('demo') && @options[:password].eql?('password')
138
138
  end
139
139
 
140
140
  def message_from(response)
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  (response['friendlyErrorMessage'] || response['verboseErrorMessage'] || response['acknowledgement']),
108
108
  response,
109
109
  authorization: response['transactionId'],
110
- test: test?,
110
+ test: test?
111
111
  )
112
112
  end
113
113
 
@@ -133,8 +133,8 @@ module ActiveMerchant #:nodoc:
133
133
  def headers
134
134
  {
135
135
  'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
136
- 'JG_APPLICATIONKEY' => "#{@options[:application_key]}",
137
- 'JG_SECURITYTOKEN' => "#{@options[:security_token]}"
136
+ 'JG_APPLICATIONKEY' => @options[:application_key].to_s,
137
+ 'JG_SECURITYTOKEN' => @options[:security_token].to_s
138
138
  }
139
139
  end
140
140
  end
@@ -134,6 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
  message_from(response),
135
135
  response,
136
136
  authorization: authorization_from(response),
137
+ error_code: error_code_from(response),
137
138
  test: test?
138
139
  )
139
140
  end
@@ -151,6 +152,10 @@ module ActiveMerchant #:nodoc:
151
152
  msg.downcase.capitalize if msg
152
153
  end
153
154
 
155
+ def error_code_from(response)
156
+ response['error']
157
+ end
158
+
154
159
  def authorization_from(response)
155
160
  response['reference_number'] || response['reference_number1']
156
161
  end
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
  self.display_name = 'FirstData Global Gateway e4'
44
44
 
45
45
  STANDARD_ERROR_CODE_MAPPING = {
46
- # Bank error codes: https://firstdata.zendesk.com/entries/471297-First-Data-Global-Gateway-e4-Bank-Response-Codes
46
+ # Bank error codes: https://firstdata.zendesk.com/entries/471297-First-Data-Global-Gateway-e4-Bank-Response-Codes
47
47
  '201' => STANDARD_ERROR_CODE[:incorrect_number],
48
48
  '531' => STANDARD_ERROR_CODE[:invalid_cvc],
49
49
  '503' => STANDARD_ERROR_CODE[:invalid_cvc],
@@ -55,7 +55,7 @@ module ActiveMerchant #:nodoc:
55
55
  '401' => STANDARD_ERROR_CODE[:call_issuer],
56
56
  '402' => STANDARD_ERROR_CODE[:call_issuer],
57
57
  '501' => STANDARD_ERROR_CODE[:pickup_card],
58
- # Ecommerce error codes -- https://firstdata.zendesk.com/entries/451980-ecommerce-response-codes-etg-codes
58
+ # Ecommerce error codes -- https://firstdata.zendesk.com/entries/451980-ecommerce-response-codes-etg-codes
59
59
  '22' => STANDARD_ERROR_CODE[:invalid_number],
60
60
  '25' => STANDARD_ERROR_CODE[:invalid_expiry_date],
61
61
  '31' => STANDARD_ERROR_CODE[:incorrect_cvc],
@@ -30,7 +30,6 @@ module ActiveMerchant #:nodoc:
30
30
  'JPY' => 392
31
31
  }
32
32
 
33
-
34
33
  def initialize(options = {})
35
34
  requires!(options, :login, :password, :terminal_id, :merchant_id)
36
35
  super
@@ -223,10 +222,10 @@ module ActiveMerchant #:nodoc:
223
222
  success = success?(response)
224
223
 
225
224
  Response.new(success,
226
- success ? 'Approved' : "Declined (Reason: #{response[:reason_code]} - #{response[:error_msg]} - #{response[:sys_err_msg]})",
227
- response,
228
- :test => test?,
229
- :authorization => response[:order_id])
225
+ success ? 'Approved' : "Declined (Reason: #{response[:reason_code]} - #{response[:error_msg]} - #{response[:sys_err_msg]})",
226
+ response,
227
+ :test => test?,
228
+ :authorization => response[:order_id])
230
229
  end
231
230
 
232
231
  def parse(body)
@@ -239,14 +239,13 @@ module ActiveMerchant #:nodoc:
239
239
 
240
240
  succeeded = success_from(response)
241
241
  Response.new(
242
- succeeded,
243
- message_from(succeeded, response),
244
- response,
245
- authorization: authorization_from(succeeded, response),
246
- error_code: error_code_from(succeeded, response),
247
- test: test?
242
+ succeeded,
243
+ message_from(succeeded, response),
244
+ response,
245
+ authorization: authorization_from(succeeded, response),
246
+ error_code: error_code_from(succeeded, response),
247
+ test: test?
248
248
  )
249
-
250
249
  end
251
250
 
252
251
  def headers(action, post, authorization = nil)
@@ -165,7 +165,7 @@ module ActiveMerchant #:nodoc:
165
165
 
166
166
  def commit(action, parameters)
167
167
  response = parse(ssl_post(url(action), post_data(action, parameters),
168
- { 'Content-Type' => 'application/soap+xml; charset=utf-8'}))
168
+ { 'Content-Type' => 'application/soap+xml; charset=utf-8'}))
169
169
 
170
170
  Response.new(
171
171
  success_from(response),
@@ -99,6 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
  alias_method :unstore, :delete
100
100
 
101
101
  private
102
+
102
103
  def add_customer_data(post, options)
103
104
  if options.has_key? :email
104
105
  post[:email] = options[:email]
@@ -181,7 +182,6 @@ module ActiveMerchant #:nodoc:
181
182
  :cvv_result => response['cvvresponse'],
182
183
  :avs_result => { :code => response['avsresponse'] }
183
184
  )
184
-
185
185
  end
186
186
 
187
187
  def message_from(response)
@@ -208,7 +208,7 @@ module ActiveMerchant #:nodoc:
208
208
  def determine_funding_source(source)
209
209
  case
210
210
  when source.is_a?(String) then :vault
211
- when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
211
+ when CreditCard.card_companies.include?(card_brand(source)) then :credit_card
212
212
  when card_brand(source) == 'check' then :check
213
213
  else raise ArgumentError, 'Unsupported funding source provided'
214
214
  end
@@ -130,7 +130,7 @@ module ActiveMerchant #:nodoc:
130
130
  response,
131
131
  authorization: authorization_from(response),
132
132
  error_code: error_code_from(response),
133
- test: test?,
133
+ test: test?
134
134
  )
135
135
  end
136
136
 
@@ -15,7 +15,7 @@ module ActiveMerchant #:nodoc:
15
15
  self.money_format = :cents
16
16
 
17
17
  # The card types supported by the payment gateway
18
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :maestro, :jcb, :solo, :diners_club]
18
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :maestro, :jcb, :diners_club]
19
19
 
20
20
  # The homepage URL of the gateway
21
21
  self.homepage_url = 'http://www.iridiumcorp.co.uk/'
@@ -377,8 +377,8 @@ module ActiveMerchant #:nodoc:
377
377
  def commit(request, options)
378
378
  requires!(options, :action)
379
379
  response = parse(ssl_post(test? ? self.test_url : self.live_url, request,
380
- {'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
381
- 'Content-Type' => 'text/xml; charset=utf-8' }))
380
+ {'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
381
+ 'Content-Type' => 'text/xml; charset=utf-8' }))
382
382
 
383
383
  success = response[:transaction_result][:status_code] == '0'
384
384
  message = response[:transaction_result][:message]
@@ -187,7 +187,7 @@ module ActiveMerchant #:nodoc:
187
187
  vxml = Nokogiri::XML(body).remove_namespaces!.xpath('//Envelope/Body/ExecuteResponse/ExecuteResult').inner_text
188
188
  doc = Nokogiri::XML(vxml)
189
189
  doc.xpath('*').each do |node|
190
- if (node.elements.empty?)
190
+ if node.elements.empty?
191
191
  parsed[underscore(node.name)] = node.text
192
192
  else
193
193
  node.elements.each do |childnode|
@@ -3,7 +3,7 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class KomojuGateway < Gateway
6
- self.test_url = 'https://sandbox.komoju.com/api/v1'
6
+ self.test_url = 'https://komoju.com/api/v1'
7
7
  self.live_url = 'https://komoju.com/api/v1'
8
8
  self.supported_countries = ['JP']
9
9
  self.default_currency = 'JPY'
@@ -186,15 +186,13 @@ module ActiveMerchant #:nodoc:
186
186
  end
187
187
 
188
188
  def parse(body)
189
- begin
190
- JSON.parse(body)
191
- rescue JSON::ParserError
192
- message = 'Invalid JSON response received from KushkiGateway. Please contact KushkiGateway if you continue to receive this message.'
193
- message += " (The raw response returned by the API was #{body.inspect})"
194
- {
195
- 'message' => message
196
- }
197
- end
189
+ JSON.parse(body)
190
+ rescue JSON::ParserError
191
+ message = 'Invalid JSON response received from KushkiGateway. Please contact KushkiGateway if you continue to receive this message.'
192
+ message += " (The raw response returned by the API was #{body.inspect})"
193
+ {
194
+ 'message' => message
195
+ }
198
196
  end
199
197
 
200
198
  def success_from(response)
@@ -147,7 +147,6 @@ module ActiveMerchant #:nodoc:
147
147
  gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
148
148
  end
149
149
 
150
-
151
150
  private
152
151
 
153
152
  def add_request_id(post)
@@ -302,27 +301,25 @@ module ActiveMerchant #:nodoc:
302
301
  end
303
302
 
304
303
  def commit(endpoint, post)
305
- begin
306
- raw_response = ssl_post(url() + endpoint, post_data(post), headers)
307
- response = parse(raw_response)
308
- rescue ResponseError => e
309
- raw_response = e.response.body
310
- response_error(raw_response)
311
- rescue JSON::ParserError
312
- unparsable_response(raw_response)
313
- else
314
- success = success_from(response)
315
- Response.new(
316
- success,
317
- message_from(response),
318
- response,
319
- authorization: success ? authorization_from(response, post[:method]) : nil,
320
- avs_result: success ? avs_from(response) : nil,
321
- cvv_result: success ? cvv_from(response) : nil,
322
- error_code: success ? nil : error_from(response),
323
- test: test?
324
- )
325
- end
304
+ raw_response = ssl_post(url() + endpoint, post_data(post), headers)
305
+ response = parse(raw_response)
306
+ rescue ResponseError => e
307
+ raw_response = e.response.body
308
+ response_error(raw_response)
309
+ rescue JSON::ParserError
310
+ unparsable_response(raw_response)
311
+ else
312
+ success = success_from(response)
313
+ Response.new(
314
+ success,
315
+ message_from(response),
316
+ response,
317
+ authorization: success ? authorization_from(response, post[:method]) : nil,
318
+ avs_result: success ? avs_from(response) : nil,
319
+ cvv_result: success ? cvv_from(response) : nil,
320
+ error_code: success ? nil : error_from(response),
321
+ test: test?
322
+ )
326
323
  end
327
324
 
328
325
  def headers
@@ -392,18 +389,16 @@ module ActiveMerchant #:nodoc:
392
389
  end
393
390
 
394
391
  def response_error(raw_response)
395
- begin
396
- response = parse(raw_response)
397
- rescue JSON::ParserError
398
- unparsable_response(raw_response)
399
- else
400
- return Response.new(
401
- false,
402
- message_from(response),
403
- response,
404
- :test => test?
405
- )
406
- end
392
+ response = parse(raw_response)
393
+ rescue JSON::ParserError
394
+ unparsable_response(raw_response)
395
+ else
396
+ return Response.new(
397
+ false,
398
+ message_from(response),
399
+ response,
400
+ :test => test?
401
+ )
407
402
  end
408
403
 
409
404
  def unparsable_response(raw_response)