activemerchant 1.79.2 → 1.80.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 (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -0
  3. data/README.md +10 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/check.rb +4 -4
  6. data/lib/active_merchant/billing/compatibility.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card.rb +21 -21
  8. data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
  9. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  10. data/lib/active_merchant/billing/gateway.rb +13 -13
  11. data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
  12. data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
  13. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
  14. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  16. data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
  17. data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  22. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
  27. data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
  28. data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
  29. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
  32. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
  34. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  35. data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
  36. data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
  37. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  38. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
  41. data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
  42. data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
  43. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  44. data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
  45. data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
  46. data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
  47. data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
  48. data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
  49. data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
  50. data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
  51. data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
  52. data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
  57. data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
  58. data/lib/active_merchant/billing/gateways/element.rb +35 -35
  59. data/lib/active_merchant/billing/gateways/epay.rb +4 -4
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +65 -65
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
  64. data/lib/active_merchant/billing/gateways/exact.rb +12 -12
  65. data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -16
  74. data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
  78. data/lib/active_merchant/billing/gateways/hps.rb +28 -28
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
  80. data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
  81. data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
  83. data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
  84. data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
  87. data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
  88. data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
  93. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
  95. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
  96. data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
  97. data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
  98. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
  99. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
  100. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
  102. data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
  104. data/lib/active_merchant/billing/gateways/migs.rb +11 -9
  105. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
  107. data/lib/active_merchant/billing/gateways/monei.rb +5 -5
  108. data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
  109. data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
  110. data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
  111. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
  113. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
  118. data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
  119. data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
  120. data/lib/active_merchant/billing/gateways/omise.rb +3 -3
  121. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  122. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
  125. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
  128. data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
  129. data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
  130. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
  131. data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
  132. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  133. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
  134. data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
  135. data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
  136. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/payex.rb +4 -4
  138. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  139. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
  140. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
  142. data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
  143. data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
  144. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
  148. data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
  149. data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
  150. data/lib/active_merchant/billing/gateways/payway.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/pin.rb +7 -7
  152. data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
  153. data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
  154. data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
  155. data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
  156. data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
  157. data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
  158. data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
  159. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
  163. data/lib/active_merchant/billing/gateways/realex.rb +16 -15
  164. data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
  165. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
  167. data/lib/active_merchant/billing/gateways/sage.rb +20 -20
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
  176. data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
  177. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
  178. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
  181. data/lib/active_merchant/billing/gateways/telr.rb +26 -26
  182. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
  183. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
  184. data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
  185. data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
  188. data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
  192. data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
  195. data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
  196. data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
  198. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  199. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
  200. data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
  201. data/lib/active_merchant/billing/model.rb +2 -2
  202. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  203. data/lib/active_merchant/billing/rails.rb +1 -1
  204. data/lib/active_merchant/connection.rb +10 -8
  205. data/lib/active_merchant/country.rb +1 -1
  206. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  207. data/lib/active_merchant/network_connection_retries.rb +12 -12
  208. data/lib/active_merchant/post_data.rb +1 -1
  209. data/lib/active_merchant/posts_data.rb +1 -1
  210. data/lib/active_merchant/version.rb +1 -1
  211. data/lib/certs/cacert.pem +37 -0
  212. data/lib/support/gateway_support.rb +2 -2
  213. data/lib/support/ssl_verify.rb +5 -5
  214. data/lib/support/ssl_version.rb +7 -7
  215. metadata +3 -7
  216. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  217. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  218. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  219. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
@@ -112,7 +112,7 @@ module ActiveMerchant #:nodoc:
112
112
  private
113
113
 
114
114
  def split_authorization(authorization)
115
- authorization.split(";")
115
+ authorization.split(';')
116
116
  end
117
117
 
118
118
  def add_reference(post, reference)
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
 
135
135
  def source_type_from(authorization)
136
136
  _, _, source_type = split_authorization(authorization)
137
- (source_type || "credit_card").to_sym
137
+ (source_type || 'credit_card').to_sym
138
138
  end
139
139
 
140
140
  def add_source(post, source)
@@ -294,10 +294,10 @@ module ActiveMerchant #:nodoc:
294
294
  end
295
295
 
296
296
  def message_from(response)
297
- if response[:status] == "Approved"
298
- "Success"
297
+ if response[:status] == 'Approved'
298
+ 'Success'
299
299
  elsif response[:error].blank?
300
- "Unspecified error"
300
+ 'Unspecified error'
301
301
  else
302
302
  response[:error]
303
303
  end
@@ -310,7 +310,7 @@ module ActiveMerchant #:nodoc:
310
310
  def post_data(command, parameters = {})
311
311
  initial_parameters = {
312
312
  Key: @options[:api_key],
313
- Version: "4.5.4",
313
+ Version: '4.5.4',
314
314
  SoftwareName: 'Active Merchant',
315
315
  SoftwareVersion: "#{ActiveMerchant::VERSION}",
316
316
  Command: command,
@@ -321,7 +321,7 @@ module ActiveMerchant #:nodoc:
321
321
  initial_parameters[:Hash] = "s/#{seed}/#{hash}/n" unless @options[:pin].blank?
322
322
  parameters = initial_parameters.merge(parameters)
323
323
 
324
- parameters.reject{|k, v| v.blank?}.collect{ |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join("&")
324
+ parameters.reject{|k, v| v.blank?}.collect{ |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
325
325
  end
326
326
  end
327
327
  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)
@@ -3,13 +3,13 @@ module ActiveMerchant #:nodoc:
3
3
  class CashnetGateway < Gateway
4
4
  include Empty
5
5
 
6
- self.live_url = "https://commerce.cashnet.com/"
7
- self.test_url = "https://train.cashnet.com/"
6
+ self.live_url = 'https://commerce.cashnet.com/'
7
+ self.test_url = 'https://train.cashnet.com/'
8
8
 
9
- self.supported_countries = ["US"]
9
+ self.supported_countries = ['US']
10
10
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
11
- self.homepage_url = "http://www.higherone.com/"
12
- self.display_name = "Cashnet"
11
+ self.homepage_url = 'http://www.higherone.com/'
12
+ self.display_name = 'Cashnet'
13
13
  self.money_format = :dollars
14
14
  self.max_retries = 0
15
15
 
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  :password,
35
35
  :merchant_gateway_name
36
36
  )
37
- options[:default_item_code] ||= "FEE"
37
+ options[:default_item_code] ||= 'FEE'
38
38
  super
39
39
  end
40
40
 
@@ -92,9 +92,9 @@ module ActiveMerchant #:nodoc:
92
92
  post[:merchant] = @options[:merchant]
93
93
  post[:operator] = @options[:operator]
94
94
  post[:password] = @options[:password]
95
- post[:station] = (@options[:station] || "WEB")
95
+ post[:station] = (@options[:station] || 'WEB')
96
96
  post[:custcode] = (@options[:custcode] || "ActiveMerchant/#{ActiveMerchant::VERSION}")
97
- post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
97
+ post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
98
98
  end
99
99
 
100
100
  def add_creditcard(post, creditcard)
@@ -142,14 +142,14 @@ module ActiveMerchant #:nodoc:
142
142
  def handle_response(response)
143
143
  if (200...300).include?(response.code.to_i)
144
144
  return response.body
145
- elsif 302 == response.code.to_i
145
+ elsif response.code.to_i == 302
146
146
  return ssl_get(URI.parse(response['location']))
147
147
  end
148
148
  raise ResponseError.new(response)
149
149
  end
150
150
 
151
151
  def unparsable_response(raw_response)
152
- message = "Unparsable response received from Cashnet. Please contact Cashnet if you continue to receive this message."
152
+ message = 'Unparsable response received from Cashnet. Please contact Cashnet if you continue to receive this message.'
153
153
  message += " (The raw response returned by the API was #{raw_response.inspect})"
154
154
  return Response.new(false, message)
155
155
  end
@@ -148,7 +148,7 @@ module ActiveMerchant #:nodoc:
148
148
  end
149
149
 
150
150
  def commit(request)
151
- raw_response = ssl_post((test? ? self.test_url : self.live_url), "DATA=" + request)
151
+ raw_response = ssl_post((test? ? self.test_url : self.live_url), 'DATA=' + request)
152
152
 
153
153
  response = parse(raw_response)
154
154
 
@@ -182,7 +182,7 @@ module ActiveMerchant #:nodoc:
182
182
  end
183
183
 
184
184
  def success?(response)
185
- (response[:response] == "Approved")
185
+ (response[:response] == 'Approved')
186
186
  end
187
187
 
188
188
  def normalize(text)
@@ -190,10 +190,8 @@ module ActiveMerchant #:nodoc:
190
190
 
191
191
  if ActiveSupport::Inflector.method(:transliterate).arity == -2
192
192
  ActiveSupport::Inflector.transliterate(text,'')
193
- elsif RUBY_VERSION >= '1.9'
194
- text.gsub(/[^\x00-\x7F]+/, '')
195
193
  else
196
- ActiveSupport::Inflector.transliterate(text).to_s
194
+ text.gsub(/[^\x00-\x7F]+/, '')
197
195
  end
198
196
  end
199
197
  end
@@ -123,7 +123,7 @@ module ActiveMerchant #:nodoc:
123
123
 
124
124
  root = REXML::Document.new(body).root
125
125
 
126
- response[:success] = (root.attributes['valor'] == "OK")
126
+ response[:success] = (root.attributes['valor'] == 'OK')
127
127
  response[:date] = root.attributes['fecha']
128
128
  response[:operation_number] = root.attributes['numeroOperacion']
129
129
  response[:message] = root.attributes['valor']
@@ -142,7 +142,7 @@ module ActiveMerchant #:nodoc:
142
142
  response[:error_code] = root.elements['ERROR/codigo'].text
143
143
  response[:error_message] = root.elements['ERROR/descripcion'].text
144
144
  else
145
- if("000" == root.elements['OPERACION'].attributes['numeroOperacion'])
145
+ if root.elements['OPERACION'].attributes['numeroOperacion'] == '000'
146
146
  if(root.elements['OPERACION/numeroAutorizacion'])
147
147
  response[:authorization] = root.elements['OPERACION/numeroAutorizacion'].text
148
148
  end
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
 
156
156
  rescue REXML::ParseException => e
157
157
  response[:success] = false
158
- response[:message] = "Unable to parse the response."
158
+ response[:message] = 'Unable to parse the response.'
159
159
  response[:error_message] = e.message
160
160
  response
161
161
  end
@@ -195,15 +195,15 @@ module ActiveMerchant #:nodoc:
195
195
  else
196
196
  "#{key}=#{CGI.escape(value.to_s)}"
197
197
  end
198
- end.compact.join("&")
198
+ end.compact.join('&')
199
199
  end
200
200
 
201
201
  def build_authorization(response)
202
- [response[:reference], response[:authorization]].join("|")
202
+ [response[:reference], response[:authorization]].join('|')
203
203
  end
204
204
 
205
205
  def split_authorization(authorization)
206
- authorization.split("|")
206
+ authorization.split('|')
207
207
  end
208
208
 
209
209
  def generate_signature(action, parameters)
@@ -1,15 +1,15 @@
1
- require "nokogiri"
1
+ require 'nokogiri'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class CenposGateway < Gateway
6
- self.display_name = "CenPOS"
7
- self.homepage_url = "https://www.cenpos.com/"
6
+ self.display_name = 'CenPOS'
7
+ self.homepage_url = 'https://www.cenpos.com/'
8
8
 
9
- self.live_url = "https://ww3.cenpos.net/6/transact.asmx"
9
+ self.live_url = 'https://ww3.cenpos.net/6/transact.asmx'
10
10
 
11
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)
12
- self.default_currency = "USD"
12
+ self.default_currency = 'USD'
13
13
  self.money_format = :dollars
14
14
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
15
15
 
@@ -24,7 +24,7 @@ module ActiveMerchant #:nodoc:
24
24
  add_payment_method(post, payment_method)
25
25
  add_customer_data(post, options)
26
26
 
27
- commit("Sale", post)
27
+ commit('Sale', post)
28
28
  end
29
29
 
30
30
  def authorize(amount, payment_method, options={})
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
  add_payment_method(post, payment_method)
34
34
  add_customer_data(post, options)
35
35
 
36
- commit("Auth", post)
36
+ commit('Auth', post)
37
37
  end
38
38
 
39
39
  def capture(amount, authorization, options={})
@@ -42,7 +42,7 @@ module ActiveMerchant #:nodoc:
42
42
  add_reference(post, authorization)
43
43
  add_customer_data(post, options)
44
44
 
45
- commit("SpecialForce", post)
45
+ commit('SpecialForce', post)
46
46
  end
47
47
 
48
48
  def void(authorization, options={})
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
  add_tax(post, options)
54
54
  add_order_id(post, options)
55
55
 
56
- commit("Void", post)
56
+ commit('Void', post)
57
57
  end
58
58
 
59
59
  def refund(amount, authorization, options={})
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
62
62
  add_reference(post, authorization)
63
63
  add_customer_data(post, options)
64
64
 
65
- commit("SpecialReturn", post)
65
+ commit('SpecialReturn', post)
66
66
  end
67
67
 
68
68
  def credit(amount, payment_method, options={})
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  add_invoice(post, amount, options)
71
71
  add_payment_method(post, payment_method)
72
72
 
73
- commit("Credit", post)
73
+ commit('Credit', post)
74
74
  end
75
75
 
76
76
  def verify(credit_card, options={})
@@ -156,9 +156,9 @@ module ActiveMerchant #:nodoc:
156
156
  xml = ssl_post(self.live_url, data, headers)
157
157
  raw = parse(xml)
158
158
  rescue ActiveMerchant::ResponseError => e
159
- if(e.response.code == "500" && e.response.body.start_with?("<s:Envelope"))
159
+ if(e.response.code == '500' && e.response.body.start_with?('<s:Envelope'))
160
160
  raw = {
161
- message: "See transcript for detailed error description."
161
+ message: 'See transcript for detailed error description.'
162
162
  }
163
163
  else
164
164
  raise
@@ -180,17 +180,17 @@ module ActiveMerchant #:nodoc:
180
180
 
181
181
  def headers
182
182
  {
183
- "Accept-Encoding" => "identity",
184
- "Content-Type" => "text/xml;charset=UTF-8",
185
- "SOAPAction" => "http://tempuri.org/Transactional/ProcessCreditCard"
183
+ 'Accept-Encoding' => 'identity',
184
+ 'Content-Type' => 'text/xml;charset=UTF-8',
185
+ 'SOAPAction' => 'http://tempuri.org/Transactional/ProcessCreditCard'
186
186
  }
187
187
  end
188
188
 
189
189
  def build_request(post)
190
190
  xml = Builder::XmlMarkup.new :indent => 8
191
- xml.tag!("acr:MerchantId", post.delete(:MerchantId))
192
- xml.tag!("acr:Password", post.delete(:Password))
193
- xml.tag!("acr:UserId", post.delete(:UserId))
191
+ xml.tag!('acr:MerchantId', post.delete(:MerchantId))
192
+ xml.tag!('acr:Password', post.delete(:Password))
193
+ xml.tag!('acr:UserId', post.delete(:UserId))
194
194
  post.sort.each do |field, value|
195
195
  xml.tag!("acr1:#{field}", value)
196
196
  end
@@ -217,7 +217,7 @@ module ActiveMerchant #:nodoc:
217
217
 
218
218
  doc = Nokogiri::XML(xml)
219
219
  doc.remove_namespaces!
220
- body = doc.xpath("//ProcessCreditCardResult")
220
+ body = doc.xpath('//ProcessCreditCardResult')
221
221
  body.children.each do |node|
222
222
  if (node.elements.size == 0)
223
223
  response[node.name.underscore.to_sym] = node.text
@@ -233,32 +233,32 @@ module ActiveMerchant #:nodoc:
233
233
  end
234
234
 
235
235
  def success_from(response)
236
- response == "0"
236
+ response == '0'
237
237
  end
238
238
 
239
239
  def message_from(succeeded, response)
240
240
  if succeeded
241
- "Succeeded"
241
+ 'Succeeded'
242
242
  else
243
- response[:message] || "Unable to read error message"
243
+ response[:message] || 'Unable to read error message'
244
244
  end
245
245
  end
246
246
 
247
247
  STANDARD_ERROR_CODE_MAPPING = {
248
- "211" => STANDARD_ERROR_CODE[:invalid_number],
249
- "252" => STANDARD_ERROR_CODE[:invalid_expiry_date],
250
- "257" => STANDARD_ERROR_CODE[:invalid_cvc],
251
- "333" => STANDARD_ERROR_CODE[:expired_card],
252
- "1" => STANDARD_ERROR_CODE[:card_declined],
253
- "99" => STANDARD_ERROR_CODE[:processing_error],
248
+ '211' => STANDARD_ERROR_CODE[:invalid_number],
249
+ '252' => STANDARD_ERROR_CODE[:invalid_expiry_date],
250
+ '257' => STANDARD_ERROR_CODE[:invalid_cvc],
251
+ '333' => STANDARD_ERROR_CODE[:expired_card],
252
+ '1' => STANDARD_ERROR_CODE[:card_declined],
253
+ '99' => STANDARD_ERROR_CODE[:processing_error],
254
254
  }
255
255
 
256
256
  def authorization_from(request, response)
257
- [ response[:reference_number], request[:CardLastFourDigits], request[:Amount] ].join("|")
257
+ [ response[:reference_number], request[:CardLastFourDigits], request[:Amount] ].join('|')
258
258
  end
259
259
 
260
260
  def split_authorization(authorization)
261
- reference_number, last_four_digits, original_amount = authorization.split("|")
261
+ reference_number, last_four_digits, original_amount = authorization.split('|')
262
262
  [reference_number, last_four_digits, original_amount]
263
263
  end
264
264
 
@@ -275,14 +275,14 @@ module ActiveMerchant #:nodoc:
275
275
  end
276
276
 
277
277
  def cvv_result_code(xml)
278
- cvv = validation_result_element(xml, "CVV")
278
+ cvv = validation_result_element(xml, 'CVV')
279
279
  return nil unless cvv
280
280
  validation_result_matches?(*validation_result_element_text(cvv.parent)) ? 'M' : 'N'
281
281
  end
282
282
 
283
283
  def avs_result_code(xml)
284
- billing_address_elem = validation_result_element(xml, "Billing Address")
285
- zip_code_elem = validation_result_element(xml, "Zip Code")
284
+ billing_address_elem = validation_result_element(xml, 'Billing Address')
285
+ zip_code_elem = validation_result_element(xml, 'Zip Code')
286
286
 
287
287
  return nil unless billing_address_elem && zip_code_elem
288
288
 
@@ -312,10 +312,10 @@ module ActiveMerchant #:nodoc:
312
312
 
313
313
  def validation_result_element_text(element)
314
314
  result_text = element.elements.detect { |elem|
315
- elem.name == "Result"
315
+ elem.name == 'Result'
316
316
  }.children.detect { |elem| elem.text }.text
317
317
 
318
- result_text.split(";").collect(&:strip)
318
+ result_text.split(';').collect(&:strip)
319
319
  end
320
320
 
321
321
  def validation_result_matches?(present, match)
@@ -164,8 +164,8 @@ module ActiveMerchant #:nodoc:
164
164
  def commit(action, amount=nil, options={}, &builder)
165
165
  response = parse_xml(ssl_post(live_url, build_xml(action, &builder)))
166
166
  Response.new(
167
- (response[:responsecode] == "0"),
168
- (response[:result] || response[:error_text] || "Unknown Response"),
167
+ (response[:responsecode] == '0'),
168
+ (response[:result] || response[:error_text] || 'Unknown Response'),
169
169
  response,
170
170
  authorization: authorization_from(response, action, amount, options),
171
171
  test: test?
@@ -184,7 +184,7 @@ module ActiveMerchant #:nodoc:
184
184
  def parse_xml(xml)
185
185
  response = {}
186
186
 
187
- Nokogiri::XML(CGI.unescapeHTML(xml)).xpath("//response").children.each do |node|
187
+ Nokogiri::XML(CGI.unescapeHTML(xml)).xpath('//response').children.each do |node|
188
188
  if node.text?
189
189
  next
190
190
  elsif (node.elements.size == 0)
@@ -202,11 +202,11 @@ module ActiveMerchant #:nodoc:
202
202
 
203
203
  def authorization_from(response, action, amount, options)
204
204
  currency = options[:currency] || currency(amount)
205
- [response[:tranid], response[:trackid], action, amount, currency].join("|")
205
+ [response[:tranid], response[:trackid], action, amount, currency].join('|')
206
206
  end
207
207
 
208
208
  def split_authorization(authorization)
209
- transid, trackid, action, amount, currency = authorization.split("|")
209
+ transid, trackid, action, amount, currency = authorization.split('|')
210
210
  [transid, trackid, action, amount, currency]
211
211
  end
212
212
  end
@@ -1,13 +1,13 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class CheckoutV2Gateway < Gateway
4
- self.display_name = "Checkout.com V2 Gateway"
5
- self.homepage_url = "https://www.checkout.com/"
6
- self.live_url = "https://api2.checkout.com/v2"
7
- self.test_url = "https://sandbox.checkout.com/api2/v2"
4
+ self.display_name = 'Checkout.com V2 Gateway'
5
+ self.homepage_url = 'https://www.checkout.com/'
6
+ self.live_url = 'https://api2.checkout.com/v2'
7
+ self.test_url = 'https://sandbox.checkout.com/api2/v2'
8
8
 
9
9
  self.supported_countries = ['AD', 'AE', 'AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FO', 'FI', 'FR', 'GB', 'GI', 'GL', 'GR', 'HR', 'HU', 'IE', 'IS', 'IL', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SM', 'SK', 'SJ', 'TR', 'VA']
10
- self.default_currency = "USD"
10
+ self.default_currency = 'USD'
11
11
  self.money_format = :cents
12
12
  self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
13
13
 
@@ -30,7 +30,7 @@ module ActiveMerchant #:nodoc:
30
30
 
31
31
  def authorize(amount, payment_method, options={})
32
32
  post = {}
33
- post[:autoCapture] = "n"
33
+ post[:autoCapture] = 'n'
34
34
  add_invoice(post, amount, options)
35
35
  add_payment_method(post, payment_method)
36
36
  add_customer_data(post, options)
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
  end
100
100
 
101
101
  def add_customer_data(post, options)
102
- post[:email] = options[:email] || "unspecified@example.com"
102
+ post[:email] = options[:email] || 'unspecified@example.com'
103
103
  post[:customerIp] = options[:ip] if options[:ip]
104
104
  address = options[:billing_address]
105
105
  if(address && post[:card])
@@ -153,8 +153,8 @@ module ActiveMerchant #:nodoc:
153
153
 
154
154
  def headers
155
155
  {
156
- "Authorization" => @options[:secret_key],
157
- "Content-Type" => "application/json;charset=UTF-8"
156
+ 'Authorization' => @options[:secret_key],
157
+ 'Content-Type' => 'application/json;charset=UTF-8'
158
158
  }
159
159
  end
160
160
 
@@ -182,50 +182,50 @@ module ActiveMerchant #:nodoc:
182
182
  JSON.parse(body)
183
183
  rescue JSON::ParserError
184
184
  {
185
- "message" => "Invalid JSON response received from CheckoutV2Gateway. Please contact CheckoutV2Gateway if you continue to receive this message.",
186
- "raw_response" => scrub(body)
185
+ 'message' => 'Invalid JSON response received from CheckoutV2Gateway. Please contact CheckoutV2Gateway if you continue to receive this message.',
186
+ 'raw_response' => scrub(body)
187
187
  }
188
188
  end
189
189
 
190
190
  def success_from(response)
191
- (response["responseCode"] == "10000" && !response["responseMessage"].start_with?("40")) || response["responseCode"] == "10100"
191
+ (response['responseCode'] == '10000' && !response['responseMessage'].start_with?('40')) || response['responseCode'] == '10100'
192
192
  end
193
193
 
194
194
  def message_from(succeeded, response)
195
195
  if succeeded
196
- "Succeeded"
197
- elsif response["errors"]
198
- response["message"] + ": " + response["errors"].first
196
+ 'Succeeded'
197
+ elsif response['errors']
198
+ response['message'] + ': ' + response['errors'].first
199
199
  else
200
- response["responseMessage"] || response["message"] || "Unable to read error message"
200
+ response['responseMessage'] || response['message'] || 'Unable to read error message'
201
201
  end
202
202
  end
203
203
 
204
204
  STANDARD_ERROR_CODE_MAPPING = {
205
- "20014" => STANDARD_ERROR_CODE[:invalid_number],
206
- "20100" => STANDARD_ERROR_CODE[:invalid_expiry_date],
207
- "20054" => STANDARD_ERROR_CODE[:expired_card],
208
- "40104" => STANDARD_ERROR_CODE[:incorrect_cvc],
209
- "40108" => STANDARD_ERROR_CODE[:incorrect_zip],
210
- "40111" => STANDARD_ERROR_CODE[:incorrect_address],
211
- "20005" => STANDARD_ERROR_CODE[:card_declined],
212
- "20088" => STANDARD_ERROR_CODE[:processing_error],
213
- "20001" => STANDARD_ERROR_CODE[:call_issuer],
214
- "30004" => STANDARD_ERROR_CODE[:pickup_card]
205
+ '20014' => STANDARD_ERROR_CODE[:invalid_number],
206
+ '20100' => STANDARD_ERROR_CODE[:invalid_expiry_date],
207
+ '20054' => STANDARD_ERROR_CODE[:expired_card],
208
+ '40104' => STANDARD_ERROR_CODE[:incorrect_cvc],
209
+ '40108' => STANDARD_ERROR_CODE[:incorrect_zip],
210
+ '40111' => STANDARD_ERROR_CODE[:incorrect_address],
211
+ '20005' => STANDARD_ERROR_CODE[:card_declined],
212
+ '20088' => STANDARD_ERROR_CODE[:processing_error],
213
+ '20001' => STANDARD_ERROR_CODE[:call_issuer],
214
+ '30004' => STANDARD_ERROR_CODE[:pickup_card]
215
215
  }
216
216
 
217
217
  def authorization_from(raw)
218
- raw["id"]
218
+ raw['id']
219
219
  end
220
220
 
221
221
  def error_code_from(succeeded, response)
222
222
  return if succeeded
223
- if response["errorCode"] && response["errorMessageCodes"]
223
+ if response['errorCode'] && response['errorMessageCodes']
224
224
  "#{response["errorCode"]}: #{response["errorMessageCodes"].join(", ")}"
225
- elsif response["errorCode"]
226
- response["errorCode"]
225
+ elsif response['errorCode']
226
+ response['errorCode']
227
227
  else
228
- STANDARD_ERROR_CODE_MAPPING[response["responseCode"]]
228
+ STANDARD_ERROR_CODE_MAPPING[response['responseCode']]
229
229
  end
230
230
  end
231
231
  end