activemerchant 1.103.0 → 1.104.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +41 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +8 -8
  5. data/lib/active_merchant/billing/compatibility.rb +2 -1
  6. data/lib/active_merchant/billing/credit_card.rb +3 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
  8. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  9. data/lib/active_merchant/billing/gateway.rb +3 -0
  10. data/lib/active_merchant/billing/gateways/adyen.rb +32 -9
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +10 -9
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -0
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -0
  16. data/lib/active_merchant/billing/gateways/balanced.rb +18 -15
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +4 -0
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -1
  19. data/lib/active_merchant/billing/gateways/blue_pay.rb +6 -5
  20. data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -3
  21. data/lib/active_merchant/billing/gateways/borgun.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/bpoint.rb +0 -2
  23. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
  24. data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -4
  25. data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/card_connect.rb +2 -1
  27. data/lib/active_merchant/billing/gateways/card_save.rb +2 -3
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +6 -6
  29. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -0
  30. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
  31. data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -0
  33. data/lib/active_merchant/billing/gateways/cenpos.rb +4 -3
  34. data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -0
  35. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  36. data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -2
  37. data/lib/active_merchant/billing/gateways/conekta.rb +5 -3
  38. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -0
  39. data/lib/active_merchant/billing/gateways/credorax.rb +17 -10
  40. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -0
  41. data/lib/active_merchant/billing/gateways/cyber_source.rb +38 -0
  42. data/lib/active_merchant/billing/gateways/d_local.rb +6 -0
  43. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/decidir.rb +18 -2
  45. data/lib/active_merchant/billing/gateways/digitzs.rb +3 -0
  46. data/lib/active_merchant/billing/gateways/ebanx.rb +13 -2
  47. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -2
  48. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/eway.rb +2 -1
  50. data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -0
  52. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  53. data/lib/active_merchant/billing/gateways/fat_zebra.rb +2 -1
  54. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -1
  55. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +1 -0
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
  58. data/lib/active_merchant/billing/gateways/forte.rb +1 -0
  59. data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -0
  61. data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
  62. data/lib/active_merchant/billing/gateways/hdfc.rb +1 -0
  63. data/lib/active_merchant/billing/gateways/hps.rb +9 -7
  64. data/lib/active_merchant/billing/gateways/iats_payments.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/itransact.rb +3 -2
  67. data/lib/active_merchant/billing/gateways/iveri.rb +1 -0
  68. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -1
  71. data/lib/active_merchant/billing/gateways/litle.rb +3 -0
  72. data/lib/active_merchant/billing/gateways/mastercard.rb +1 -0
  73. data/lib/active_merchant/billing/gateways/mercado_pago.rb +45 -0
  74. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/merchant_partners.rb +3 -3
  76. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -1
  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 +0 -1
  81. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/moneris.rb +36 -8
  83. data/lib/active_merchant/billing/gateways/moneris_us.rb +2 -0
  84. data/lib/active_merchant/billing/gateways/mundipagg.rb +6 -1
  85. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  86. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/netbanx.rb +3 -1
  88. data/lib/active_merchant/billing/gateways/netbilling.rb +3 -3
  89. data/lib/active_merchant/billing/gateways/netpay.rb +1 -0
  90. data/lib/active_merchant/billing/gateways/nmi.rb +5 -6
  91. data/lib/active_merchant/billing/gateways/ogone.rb +4 -2
  92. data/lib/active_merchant/billing/gateways/omise.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/openpay.rb +3 -1
  94. data/lib/active_merchant/billing/gateways/opp.rb +1 -0
  95. data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -5
  96. data/lib/active_merchant/billing/gateways/orbital.rb +17 -13
  97. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -0
  100. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -0
  103. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -0
  104. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  105. data/lib/active_merchant/billing/gateways/paybox_direct.rb +4 -2
  106. data/lib/active_merchant/billing/gateways/payeezy.rb +2 -0
  107. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
  108. data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
  109. data/lib/active_merchant/billing/gateways/paymentez.rb +4 -0
  110. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  111. data/lib/active_merchant/billing/gateways/paystation.rb +1 -3
  112. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -0
  114. data/lib/active_merchant/billing/gateways/payway.rb +3 -2
  115. data/lib/active_merchant/billing/gateways/pin.rb +1 -0
  116. data/lib/active_merchant/billing/gateways/plugnpay.rb +4 -4
  117. data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -0
  118. data/lib/active_merchant/billing/gateways/psigate.rb +2 -1
  119. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
  120. data/lib/active_merchant/billing/gateways/qbms.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/quantum.rb +0 -1
  122. data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -0
  123. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  124. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +5 -5
  125. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -0
  126. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -0
  127. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -0
  128. data/lib/active_merchant/billing/gateways/realex.rb +3 -1
  129. data/lib/active_merchant/billing/gateways/redsys.rb +3 -2
  130. data/lib/active_merchant/billing/gateways/s5.rb +1 -0
  131. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -0
  132. data/lib/active_merchant/billing/gateways/sage.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
  134. data/lib/active_merchant/billing/gateways/secure_net.rb +2 -4
  135. data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
  137. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -0
  139. data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -5
  140. data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
  141. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +0 -1
  142. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -0
  143. data/lib/active_merchant/billing/gateways/stripe.rb +7 -0
  144. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -4
  145. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/telr.rb +3 -0
  147. data/lib/active_merchant/billing/gateways/tns.rb +0 -1
  148. data/lib/active_merchant/billing/gateways/trans_first.rb +1 -0
  149. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +4 -2
  150. data/lib/active_merchant/billing/gateways/transax.rb +0 -1
  151. data/lib/active_merchant/billing/gateways/trexle.rb +3 -0
  152. data/lib/active_merchant/billing/gateways/usa_epay.rb +0 -1
  153. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +15 -16
  154. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +5 -0
  155. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -0
  157. data/lib/active_merchant/billing/gateways/wepay.rb +7 -6
  158. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -3
  159. data/lib/active_merchant/billing/gateways/world_net.rb +1 -0
  160. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -0
  161. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +0 -1
  162. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  163. data/lib/active_merchant/billing/response.rb +1 -1
  164. data/lib/active_merchant/connection.rb +2 -0
  165. data/lib/active_merchant/country.rb +1 -0
  166. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  167. data/lib/active_merchant/post_data.rb +1 -0
  168. data/lib/active_merchant/version.rb +1 -1
  169. data/lib/support/ssl_verify.rb +0 -2
  170. data/lib/support/ssl_version.rb +0 -1
  171. metadata +2 -2
@@ -249,6 +249,7 @@ module ActiveMerchant #:nodoc:
249
249
  def hashify_xml!(xml, response)
250
250
  xml = REXML::Document.new(xml)
251
251
  return if xml.root.nil?
252
+
252
253
  xml.elements.each('//receipt/*') do |node|
253
254
  response[node.name.underscore.to_sym] = normalize(node.text)
254
255
  end
@@ -316,6 +317,7 @@ module ActiveMerchant #:nodoc:
316
317
 
317
318
  def message_from(message)
318
319
  return 'Unspecified error' if message.blank?
320
+
319
321
  message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
320
322
  end
321
323
 
@@ -198,6 +198,7 @@ module ActiveMerchant #:nodoc:
198
198
 
199
199
  def voucher?(payment)
200
200
  return false if payment.is_a?(String)
201
+
201
202
  %w[sodexo vr].include? card_brand(payment)
202
203
  end
203
204
 
@@ -301,6 +302,7 @@ module ActiveMerchant #:nodoc:
301
302
 
302
303
  def authorization_from(response, action)
303
304
  return "#{response['customer']['id']}|#{response['id']}" if action == 'store'
305
+
304
306
  response['id']
305
307
  end
306
308
 
@@ -313,7 +315,10 @@ module ActiveMerchant #:nodoc:
313
315
  end
314
316
 
315
317
  def error_code_from(response)
316
- STANDARD_ERROR_CODE[:processing_error] unless success_from(response)
318
+ return if success_from(response)
319
+ return response['last_transaction']['acquirer_return_code'] if response['last_transaction']
320
+
321
+ STANDARD_ERROR_CODE[:processing_error]
317
322
  end
318
323
  end
319
324
  end
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  :trigger => 8
40
40
  }
41
41
 
42
- SUCCESS_CODES = [ '00', '08', '11', '16', '77' ]
42
+ SUCCESS_CODES = ['00', '08', '11', '16', '77']
43
43
 
44
44
  def initialize(options = {})
45
45
  requires!(options, :login, :password)
@@ -84,6 +84,7 @@ module ActiveMerchant #:nodoc:
84
84
 
85
85
  def scrub(transcript)
86
86
  return '' if transcript.blank?
87
+
87
88
  transcript.
88
89
  gsub(%r((<cardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
89
90
  gsub(%r((<cvv>)[^<]+(<))i, '\1[FILTERED]\2').
@@ -295,7 +296,6 @@ module ActiveMerchant #:nodoc:
295
296
  def request_timeout
296
297
  @options[:request_timeout] || 60
297
298
  end
298
-
299
299
  end
300
300
  end
301
301
  end
@@ -24,7 +24,7 @@ module ActiveMerchant
24
24
  class NetRegistryGateway < Gateway
25
25
  self.live_url = self.test_url = 'https://paygate.ssllock.net/external2.pl'
26
26
 
27
- FILTERED_PARAMS = [ 'card_no', 'card_expiry', 'receipt_array' ]
27
+ FILTERED_PARAMS = ['card_no', 'card_expiry', 'receipt_array']
28
28
 
29
29
  self.supported_countries = ['AU']
30
30
 
@@ -168,6 +168,7 @@ module ActiveMerchant #:nodoc:
168
168
 
169
169
  def map_address(address)
170
170
  return {} if address.nil?
171
+
171
172
  country = Country.find(address[:country]) if address[:country]
172
173
  mapped = {
173
174
  :street => address[:address1],
@@ -203,7 +204,8 @@ module ActiveMerchant #:nodoc:
203
204
  begin
204
205
  parse(ssl_request(method, get_url(uri), params, headers))
205
206
  rescue ResponseError => e
206
- return Response.new(false, 'Invalid Login') if(e.response.code == '401')
207
+ return Response.new(false, 'Invalid Login') if e.response.code == '401'
208
+
207
209
  parse(e.response.body)
208
210
  end
209
211
 
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
23
23
  :quasi => 'Q'
24
24
  }
25
25
 
26
- SUCCESS_CODES = [ '1', 'T' ]
26
+ SUCCESS_CODES = ['1', 'T']
27
27
  SUCCESS_MESSAGE = 'The transaction was approved'
28
28
  FAILURE_MESSAGE = 'The transaction failed'
29
29
  TEST_LOGIN = '104901072025'
@@ -200,7 +200,8 @@ module ActiveMerchant #:nodoc:
200
200
  :cvv_result => response[:cvv2_code]
201
201
  )
202
202
  rescue ActiveMerchant::ResponseError => e
203
- raise unless(e.response.code =~ /^[67]\d\d$/)
203
+ raise unless e.response.code =~ /^[67]\d\d$/
204
+
204
205
  return Response.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
205
206
  end
206
207
 
@@ -224,7 +225,6 @@ module ActiveMerchant #:nodoc:
224
225
 
225
226
  parameters.reject { |k, v| v.blank? }.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
226
227
  end
227
-
228
228
  end
229
229
  end
230
230
  end
@@ -215,6 +215,7 @@ module ActiveMerchant #:nodoc:
215
215
 
216
216
  def currency_code(currency)
217
217
  return currency if currency =~ /^\d+$/
218
+
218
219
  CURRENCY_CODES[currency]
219
220
  end
220
221
  end
@@ -153,14 +153,14 @@ module ActiveMerchant #:nodoc:
153
153
  end
154
154
 
155
155
  def add_payment_method(post, payment_method, options)
156
- if(payment_method.is_a?(String))
156
+ if payment_method.is_a?(String)
157
157
  customer_vault_id, _ = split_authorization(payment_method)
158
158
  post[:customer_vault_id] = customer_vault_id
159
159
  elsif payment_method.is_a?(NetworkTokenizationCreditCard)
160
160
  post[:ccnumber] = payment_method.number
161
161
  post[:ccexp] = exp_date(payment_method)
162
162
  post[:token_cryptogram] = payment_method.payment_cryptogram
163
- elsif(card_brand(payment_method) == 'check')
163
+ elsif card_brand(payment_method) == 'check'
164
164
  post[:payment] = 'check'
165
165
  post[:firstname] = payment_method.first_name
166
166
  post[:lastname] = payment_method.last_name
@@ -213,7 +213,7 @@ module ActiveMerchant #:nodoc:
213
213
  post[:ipaddress] = options[:ip]
214
214
  post[:customer_id] = options[:customer_id] || options[:customer]
215
215
 
216
- if(billing_address = options[:billing_address] || options[:address])
216
+ if (billing_address = options[:billing_address] || options[:address])
217
217
  post[:company] = billing_address[:company]
218
218
  post[:address1] = billing_address[:address1]
219
219
  post[:address2] = billing_address[:address2]
@@ -224,7 +224,7 @@ module ActiveMerchant #:nodoc:
224
224
  post[:phone] = billing_address[:phone]
225
225
  end
226
226
 
227
- if(shipping_address = options[:shipping_address])
227
+ if (shipping_address = options[:shipping_address])
228
228
  post[:shipping_company] = shipping_address[:company]
229
229
  post[:shipping_address1] = shipping_address[:address1]
230
230
  post[:shipping_address2] = shipping_address[:address2]
@@ -284,7 +284,7 @@ module ActiveMerchant #:nodoc:
284
284
 
285
285
  def authorization_from(response, payment_type, action)
286
286
  authorization = (action == 'add_customer' ? response[:customer_vault_id] : response[:transactionid])
287
- [ authorization, payment_type ].join('#')
287
+ [authorization, payment_type].join('#')
288
288
  end
289
289
 
290
290
  def split_authorization(authorization)
@@ -318,7 +318,6 @@ module ActiveMerchant #:nodoc:
318
318
  response[:responsetext]
319
319
  end
320
320
  end
321
-
322
321
  end
323
322
  end
324
323
  end
@@ -213,7 +213,7 @@ module ActiveMerchant #:nodoc:
213
213
 
214
214
  # Store a credit card by creating an Ogone Alias
215
215
  def store(payment_source, options = {})
216
- options[:alias_operation] = 'BYPSP' unless(options.has_key?(:billing_id) || options.has_key?(:store))
216
+ options[:alias_operation] = 'BYPSP' unless options.has_key?(:billing_id) || options.has_key?(:store)
217
217
  response = authorize(@options[:store_amount] || 1, payment_source, options)
218
218
  void(response.authorization) if response.success?
219
219
  response
@@ -239,6 +239,7 @@ module ActiveMerchant #:nodoc:
239
239
 
240
240
  def reference_transaction?(identifier)
241
241
  return false unless identifier.is_a?(String)
242
+
242
243
  _, action = identifier.split(';')
243
244
  !action.nil?
244
245
  end
@@ -322,6 +323,7 @@ module ActiveMerchant #:nodoc:
322
323
 
323
324
  def add_address(post, creditcard, options)
324
325
  return unless options[:billing_address]
326
+
325
327
  add_pair post, 'Owneraddress', options[:billing_address][:address1]
326
328
  add_pair post, 'OwnerZip', options[:billing_address][:zip]
327
329
  add_pair post, 'ownertown', options[:billing_address][:city]
@@ -408,7 +410,7 @@ module ActiveMerchant #:nodoc:
408
410
 
409
411
  def add_signature(parameters)
410
412
  if @options[:signature].blank?
411
- ActiveMerchant.deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE) unless(@options[:signature_encryptor] == 'none')
413
+ ActiveMerchant.deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE) unless @options[:signature_encryptor] == 'none'
412
414
  return
413
415
  end
414
416
 
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
 
22
22
  # Country supported by Omise
23
23
  # * Thailand
24
- self.supported_countries = %w( TH JP )
24
+ self.supported_countries = %w(TH JP)
25
25
 
26
26
  # Credit cards supported by Omise
27
27
  # * VISA
@@ -318,7 +318,6 @@ module ActiveMerchant #:nodoc:
318
318
  post[:currency] = (options[:currency] || currency(money))
319
319
  post[:description] = options[:description] if options.key?(:description)
320
320
  end
321
-
322
321
  end
323
322
  end
324
323
  end
@@ -75,7 +75,7 @@ module ActiveMerchant #:nodoc:
75
75
  MultiResponse.run(:first) do |r|
76
76
  r.process { commit(:post, 'customers', post, options) }
77
77
 
78
- if(r.success? && !r.params['id'].blank?)
78
+ if r.success? && !r.params['id'].blank?
79
79
  customer_id = r.params['id']
80
80
  r.process { commit(:post, "customers/#{customer_id}/cards", card, options) }
81
81
  end
@@ -151,6 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
 
152
152
  def add_address(card, options)
153
153
  return unless card.kind_of?(Hash)
154
+
154
155
  if address = (options[:billing_address] || options[:address])
155
156
  card[:address] = {
156
157
  line1: address[:address1],
@@ -175,6 +176,7 @@ module ActiveMerchant #:nodoc:
175
176
 
176
177
  def parse(body)
177
178
  return {} unless body
179
+
178
180
  JSON.parse(body)
179
181
  end
180
182
 
@@ -258,6 +258,7 @@ module ActiveMerchant #:nodoc:
258
258
 
259
259
  def add_payment_method(post, payment, options)
260
260
  return if payment.is_a?(String)
261
+
261
262
  if options[:registrationId]
262
263
  post[:card] = {
263
264
  cvv: payment.verification_value,
@@ -19,12 +19,12 @@ module ActiveMerchant #:nodoc:
19
19
  self.display_name = 'Optimal Payments'
20
20
 
21
21
  def initialize(options = {})
22
- if(options[:login])
22
+ if options[:login]
23
23
  ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'store_id' and will be removed in a future version.")
24
24
  options[:store_id] = options[:login]
25
25
  end
26
26
 
27
- if(options[:account])
27
+ if options[:account]
28
28
  ActiveMerchant.deprecated("The 'account' option is deprecated in favor of 'account_number' and will be removed in a future version.")
29
29
  options[:account_number] = options[:account]
30
30
  end
@@ -158,13 +158,13 @@ module ActiveMerchant #:nodoc:
158
158
  %w(confirmationNumber authCode
159
159
  decision code description
160
160
  actionCode avsResponse cvdResponse
161
- txnTime duplicateFound
162
- ).each do |tag|
161
+ txnTime duplicateFound).each do |tag|
163
162
  node = REXML::XPath.first(response, "//#{tag}")
164
163
  hsh[tag] = node.text if node
165
164
  end
166
165
  REXML::XPath.each(response, '//detail') do |detail|
167
166
  next unless detail.is_a?(REXML::Element)
167
+
168
168
  tag = detail.elements['tag'].text
169
169
  value = detail.elements['value'].text
170
170
  hsh[tag] = value
@@ -323,7 +323,6 @@ module ActiveMerchant #:nodoc:
323
323
  'discover' => 'DI',
324
324
  'diners_club' => 'DC', }[key]
325
325
  end
326
-
327
326
  end
328
327
  end
329
328
  end
@@ -243,7 +243,7 @@ module ActiveMerchant #:nodoc:
243
243
  end
244
244
 
245
245
  def void(authorization, options = {}, deprecated = {})
246
- if(!options.kind_of?(Hash))
246
+ if !options.kind_of?(Hash)
247
247
  ActiveMerchant.deprecated('Calling the void method with an amount parameter is deprecated and will be removed in a future version.')
248
248
  return void(options, deprecated.merge(:amount => authorization))
249
249
  end
@@ -383,7 +383,7 @@ module ActiveMerchant #:nodoc:
383
383
  end
384
384
 
385
385
  def add_address(xml, creditcard, options)
386
- if(address = (options[:billing_address] || options[:address]))
386
+ if (address = (options[:billing_address] || options[:address]))
387
387
  avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s) || empty?(address[:country])
388
388
 
389
389
  if avs_supported
@@ -421,7 +421,7 @@ module ActiveMerchant #:nodoc:
421
421
 
422
422
  # For Profile requests
423
423
  def add_customer_address(xml, options)
424
- if(address = (options[:billing_address] || options[:address]))
424
+ if (address = (options[:billing_address] || options[:address]))
425
425
  avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s)
426
426
 
427
427
  xml.tag! :CustomerAddress1, byte_limit(format_address_field(address[:address1]), 30)
@@ -455,7 +455,7 @@ module ActiveMerchant #:nodoc:
455
455
  # - http://download.chasepaymentech.com/docs/orbital/orbital_gateway_xml_specification.pdf
456
456
  unless creditcard.nil?
457
457
  if creditcard.verification_value?
458
- xml.tag! :CardSecValInd, '1' if %w( visa discover ).include?(creditcard.brand)
458
+ xml.tag! :CardSecValInd, '1' if %w(visa discover).include?(creditcard.brand)
459
459
  xml.tag! :CardSecVal, creditcard.verification_value
460
460
  end
461
461
  end
@@ -550,6 +550,7 @@ module ActiveMerchant #:nodoc:
550
550
 
551
551
  def add_stored_credentials(xml, parameters)
552
552
  return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)
553
+
553
554
  if msg_type = get_msg_type(parameters)
554
555
  xml.tag! :MITMsgType, msg_type
555
556
  end
@@ -565,6 +566,7 @@ module ActiveMerchant #:nodoc:
565
566
  return parameters[:mit_msg_type] if parameters[:mit_msg_type]
566
567
  return 'CSTO' if parameters[:stored_credential][:initial_transaction]
567
568
  return unless parameters[:stored_credential][:initiator] && parameters[:stored_credential][:reason_type]
569
+
568
570
  initiator =
569
571
  case parameters[:stored_credential][:initiator]
570
572
  when 'customer' then 'C'
@@ -726,6 +728,7 @@ module ActiveMerchant #:nodoc:
726
728
  def set_recurring_ind(xml, parameters)
727
729
  if parameters[:recurring_ind]
728
730
  raise 'RecurringInd must be set to either "RF" or "RS"' unless %w(RF RS).include?(parameters[:recurring_ind])
731
+
729
732
  xml.tag! :RecurringInd, parameters[:recurring_ind]
730
733
  end
731
734
  end
@@ -830,7 +833,8 @@ module ActiveMerchant #:nodoc:
830
833
  limited_value = ''
831
834
 
832
835
  value.to_s.each_char do |c|
833
- break if((limited_value.bytesize + c.bytesize) > byte_length)
836
+ break if (limited_value.bytesize + c.bytesize) > byte_length
837
+
834
838
  limited_value << c
835
839
  end
836
840
 
@@ -938,10 +942,10 @@ module ActiveMerchant #:nodoc:
938
942
 
939
943
  # Map vendor's AVS result code to a postal match code
940
944
  ORBITAL_POSTAL_MATCH_CODE = {
941
- 'Y' => %w( 9 A B C H JA JD M2 M3 M5 N5 N8 N9 X Z ),
942
- 'N' => %w( D E F G M8 ),
943
- 'X' => %w( 4 J R ),
944
- nil => %w( 1 2 3 5 6 7 8 JB JC M1 M4 M6 M7 N3 N4 N6 N7 UK )
945
+ 'Y' => %w(9 A B C H JA JD M2 M3 M5 N5 N8 N9 X Z),
946
+ 'N' => %w(D E F G M8),
947
+ 'X' => %w(4 J R),
948
+ nil => %w(1 2 3 5 6 7 8 JB JC M1 M4 M6 M7 N3 N4 N6 N7 UK)
945
949
  }.inject({}) do |map, (type, codes)|
946
950
  codes.each { |code| map[code] = type }
947
951
  map
@@ -949,10 +953,10 @@ module ActiveMerchant #:nodoc:
949
953
 
950
954
  # Map vendor's AVS result code to a street match code
951
955
  ORBITAL_STREET_MATCH_CODE = {
952
- 'Y' => %w( 9 B D F H JA JB M2 M4 M5 M6 M7 N3 N5 N7 N8 N9 X ),
953
- 'N' => %w( A C E G M8 Z ),
954
- 'X' => %w( 4 J R ),
955
- nil => %w( 1 2 3 5 6 7 8 JC JD M1 M3 N4 N6 UK )
956
+ 'Y' => %w(9 B D F H JA JB M2 M4 M5 M6 M7 N3 N5 N7 N8 N9 X),
957
+ 'N' => %w(A C E G M8 Z),
958
+ 'X' => %w(4 J R),
959
+ nil => %w(1 2 3 5 6 7 8 JC JD M1 M3 N4 N6 UK)
956
960
  }.inject({}) do |map, (type, codes)|
957
961
  codes.each { |code| map[code] = type }
958
962
  map
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
 
35
35
  [:merchant_email, :merchant_url].each do |attr|
36
36
  unless self.send(attr).blank?
37
- errors << [attr, 'is required to be 13 bytes or less'] if(self.send(attr).bytesize > 13)
37
+ errors << [attr, 'is required to be 13 bytes or less'] if self.send(attr).bytesize > 13
38
38
  end
39
39
  end
40
40
 
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class PacNetRavenGateway < Gateway
4
-
5
4
  AVS_ADDRESS_CODES = {
6
5
  'avs_address_unavailable' => 'X',
7
6
  'avs_address_not_checked' => 'X',
@@ -140,6 +139,7 @@ module ActiveMerchant #:nodoc:
140
139
 
141
140
  def endpoint(action)
142
141
  return 'void' if action == 'void'
142
+
143
143
  'submit'
144
144
  end
145
145
 
@@ -119,6 +119,7 @@ module ActiveMerchant #:nodoc:
119
119
 
120
120
  params.map do |key, value|
121
121
  next if value != false && value.blank?
122
+
122
123
  if value.is_a?(Hash)
123
124
  h = {}
124
125
  value.each do |k, v|
@@ -86,6 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
 
87
87
  def force_utf8(string)
88
88
  return nil unless string
89
+
89
90
  binary = string.encode('BINARY', invalid: :replace, undef: :replace, replace: '?') # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
90
91
  binary.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
91
92
  end
@@ -237,7 +238,6 @@ module ActiveMerchant #:nodoc:
237
238
  message += " (The raw response returned by the API was #{raw_response.inspect})"
238
239
  return Response.new(false, message)
239
240
  end
240
-
241
241
  end
242
242
  end
243
243
  end