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
@@ -160,10 +160,10 @@ module ActiveMerchant
160
160
  end
161
161
 
162
162
  def authorization_from(response)
163
- if response["token"]
164
- response["token"].to_s
163
+ if response['token']
164
+ response['token'].to_s
165
165
  else
166
- response["id"].to_s
166
+ response['id'].to_s
167
167
  end
168
168
  end
169
169
 
@@ -231,13 +231,13 @@ module ActiveMerchant
231
231
  end
232
232
 
233
233
  def message_from(success, response)
234
- success ? 'OK' : (response['message'] || invalid_operation_message(response) || "Unknown error - please contact QuickPay")
234
+ success ? 'OK' : (response['message'] || invalid_operation_message(response) || 'Unknown error - please contact QuickPay')
235
235
  end
236
236
 
237
237
  def invalid_operation_code?(response)
238
238
  if response['operations']
239
239
  operation = response['operations'].last
240
- operation && operation['qp_status_code'] != "20000"
240
+ operation && operation['qp_status_code'] != '20000'
241
241
  end
242
242
  end
243
243
 
@@ -267,11 +267,11 @@ module ActiveMerchant
267
267
  def headers
268
268
  auth = Base64.strict_encode64(":#{@options[:api_key]}")
269
269
  {
270
- "Authorization" => "Basic " + auth,
271
- "User-Agent" => "Quickpay-v#{API_VERSION} ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
272
- "Accept" => "application/json",
273
- "Accept-Version" => "v#{API_VERSION}",
274
- "Content-Type" => "application/json"
270
+ 'Authorization' => 'Basic ' + auth,
271
+ 'User-Agent' => "Quickpay-v#{API_VERSION} ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
272
+ 'Accept' => 'application/json',
273
+ 'Accept-Version' => "v#{API_VERSION}",
274
+ 'Content-Type' => 'application/json'
275
275
  }
276
276
  end
277
277
 
@@ -286,7 +286,7 @@ module ActiveMerchant
286
286
  def json_error(raw_response)
287
287
  msg = 'Invalid response received from the Quickpay API.'
288
288
  msg += " (The raw response returned by the API was #{raw_response.inspect})"
289
- { "message" => msg }
289
+ { 'message' => msg }
290
290
  end
291
291
 
292
292
  def synchronized_path(path)
@@ -136,7 +136,7 @@ module ActiveMerchant #:nodoc:
136
136
  end
137
137
 
138
138
  def add_description(post, options)
139
- post[:description] = options[:description] || "Description"
139
+ post[:description] = options[:description] || 'Description'
140
140
  end
141
141
 
142
142
  def add_testmode(post)
@@ -196,7 +196,7 @@ module ActiveMerchant #:nodoc:
196
196
  params[:apikey] = @options[:apikey] if @options[:apikey]
197
197
  params[:md5check] = generate_check_hash(action, params)
198
198
 
199
- params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
199
+ params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
200
200
  end
201
201
 
202
202
  def generate_check_hash(action, params)
@@ -219,7 +219,7 @@ module ActiveMerchant #:nodoc:
219
219
 
220
220
  # Limited to 20 digits max
221
221
  def format_order_number(number)
222
- number.to_s.gsub(/[^\w]/, '').rjust(4, "0")[0...20]
222
+ number.to_s.gsub(/[^\w]/, '').rjust(4, '0')[0...20]
223
223
  end
224
224
  end
225
225
  end
@@ -1,14 +1,14 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class QvalentGateway < Gateway
4
- self.display_name = "Qvalent"
5
- self.homepage_url = "https://www.qvalent.com/"
4
+ self.display_name = 'Qvalent'
5
+ self.homepage_url = 'https://www.qvalent.com/'
6
6
 
7
- self.test_url = "https://ccapi.client.support.qvalent.com/post/CreditCardAPIReceiver"
8
- self.live_url = "https://ccapi.client.qvalent.com/post/CreditCardAPIReceiver"
7
+ self.test_url = 'https://ccapi.client.support.qvalent.com/post/CreditCardAPIReceiver'
8
+ self.live_url = 'https://ccapi.client.qvalent.com/post/CreditCardAPIReceiver'
9
9
 
10
- self.supported_countries = ["AU"]
11
- self.default_currency = "AUD"
10
+ self.supported_countries = ['AU']
11
+ self.default_currency = 'AUD'
12
12
  self.money_format = :cents
13
13
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners]
14
14
 
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
26
26
  add_customer_data(post, options)
27
27
  add_soft_descriptors(post, options)
28
28
 
29
- commit("capture", post)
29
+ commit('capture', post)
30
30
  end
31
31
 
32
32
  def authorize(amount, payment_method, options={})
@@ -38,7 +38,7 @@ module ActiveMerchant #:nodoc:
38
38
  add_customer_data(post, options)
39
39
  add_soft_descriptors(post, options)
40
40
 
41
- commit("preauth", post)
41
+ commit('preauth', post)
42
42
  end
43
43
 
44
44
  def capture(amount, authorization, options={})
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  add_customer_data(post, options)
49
49
  add_soft_descriptors(post, options)
50
50
 
51
- commit("captureWithoutAuth", post)
51
+ commit('captureWithoutAuth', post)
52
52
  end
53
53
 
54
54
  def refund(amount, authorization, options={})
@@ -58,7 +58,7 @@ module ActiveMerchant #:nodoc:
58
58
  add_customer_data(post, options)
59
59
  add_soft_descriptors(post, options)
60
60
 
61
- commit("refund", post)
61
+ commit('refund', post)
62
62
  end
63
63
 
64
64
  # Credit requires the merchant account to be enabled for "Adhoc Refunds"
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  add_customer_data(post, options)
71
71
  add_soft_descriptors(post, options)
72
72
 
73
- commit("refund", post)
73
+ commit('refund', post)
74
74
  end
75
75
 
76
76
  def void(authorization, options={})
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  add_customer_data(post, options)
80
80
  add_soft_descriptors(post, options)
81
81
 
82
- commit("reversal", post)
82
+ commit('reversal', post)
83
83
  end
84
84
 
85
85
  def store(payment_method, options = {})
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
87
87
  add_payment_method(post, payment_method)
88
88
  add_card_reference(post)
89
89
 
90
- commit("registerAccount", post)
90
+ commit('registerAccount', post)
91
91
  end
92
92
 
93
93
  def supports_scrubbing?
@@ -104,70 +104,70 @@ module ActiveMerchant #:nodoc:
104
104
  private
105
105
 
106
106
  CURRENCY_CODES = Hash.new{|h,k| raise ArgumentError.new("Unsupported currency: #{k}")}
107
- CURRENCY_CODES["AUD"] = "AUD"
108
- CURRENCY_CODES["INR"] = "INR"
107
+ CURRENCY_CODES['AUD'] = 'AUD'
108
+ CURRENCY_CODES['INR'] = 'INR'
109
109
 
110
110
  def add_soft_descriptors(post, options)
111
- post["customer.merchantName"] = options[:customer_merchant_name] if options[:customer_merchant_name]
112
- post["customer.merchantStreetAddress"] = options[:customer_merchant_street_address] if options[:customer_merchant_street_address]
113
- post["customer.merchantLocation"] = options[:customer_merchant_location] if options[:customer_merchant_location]
114
- post["customer.merchantState"] = options[:customer_merchant_state] if options[:customer_merchant_state]
115
- post["customer.merchantCountry"] = options[:customer_merchant_country] if options[:customer_merchant_country]
116
- post["customer.merchantPostCode"] = options[:customer_merchant_post_code] if options[:customer_merchant_post_code]
117
- post["customer.subMerchantId"] = options[:customer_sub_merchant_id] if options[:customer_sub_merchant_id]
111
+ post['customer.merchantName'] = options[:customer_merchant_name] if options[:customer_merchant_name]
112
+ post['customer.merchantStreetAddress'] = options[:customer_merchant_street_address] if options[:customer_merchant_street_address]
113
+ post['customer.merchantLocation'] = options[:customer_merchant_location] if options[:customer_merchant_location]
114
+ post['customer.merchantState'] = options[:customer_merchant_state] if options[:customer_merchant_state]
115
+ post['customer.merchantCountry'] = options[:customer_merchant_country] if options[:customer_merchant_country]
116
+ post['customer.merchantPostCode'] = options[:customer_merchant_post_code] if options[:customer_merchant_post_code]
117
+ post['customer.subMerchantId'] = options[:customer_sub_merchant_id] if options[:customer_sub_merchant_id]
118
118
  end
119
119
 
120
120
  def add_invoice(post, money, options)
121
- post["order.amount"] = amount(money)
122
- post["card.currency"] = CURRENCY_CODES[options[:currency] || currency(money)]
123
- post["order.ECI"] = options[:eci] ? options[:eci] : "SSL"
121
+ post['order.amount'] = amount(money)
122
+ post['card.currency'] = CURRENCY_CODES[options[:currency] || currency(money)]
123
+ post['order.ECI'] = options[:eci] || 'SSL'
124
124
  end
125
125
 
126
126
  def add_payment_method(post, payment_method)
127
- post["card.cardHolderName"] = payment_method.name
128
- post["card.PAN"] = payment_method.number
129
- post["card.expiryYear"] = format(payment_method.year, :two_digits)
130
- post["card.expiryMonth"] = format(payment_method.month, :two_digits)
127
+ post['card.cardHolderName'] = payment_method.name
128
+ post['card.PAN'] = payment_method.number
129
+ post['card.expiryYear'] = format(payment_method.year, :two_digits)
130
+ post['card.expiryMonth'] = format(payment_method.month, :two_digits)
131
131
  end
132
132
 
133
133
  def add_verification_value(post, payment_method)
134
- post["card.CVN"] = payment_method.verification_value
134
+ post['card.CVN'] = payment_method.verification_value
135
135
  end
136
136
 
137
137
  def add_card_reference(post)
138
- post["customer.customerReferenceNumber"] = options[:order_id]
138
+ post['customer.customerReferenceNumber'] = options[:order_id]
139
139
  end
140
140
 
141
141
  def add_reference(post, authorization, options)
142
- post["customer.originalOrderNumber"] = authorization
142
+ post['customer.originalOrderNumber'] = authorization
143
143
  add_order_number(post, options)
144
144
  end
145
145
 
146
146
  def add_order_number(post, options)
147
- post["customer.orderNumber"] = options[:order_id] || SecureRandom.uuid
147
+ post['customer.orderNumber'] = options[:order_id] || SecureRandom.uuid
148
148
  end
149
149
 
150
150
  def add_customer_data(post, options)
151
- post["order.ipAddress"] = options[:ip] || "127.0.0.1"
152
- post["order.xid"] = options[:xid] if options[:xid]
153
- post["order.cavv"] = options[:cavv] if options[:cavv]
151
+ post['order.ipAddress'] = options[:ip] || '127.0.0.1'
152
+ post['order.xid'] = options[:xid] if options[:xid]
153
+ post['order.cavv'] = options[:cavv] if options[:cavv]
154
154
  end
155
155
 
156
156
  def commit(action, post)
157
- post["customer.username"] = @options[:username]
158
- post["customer.password"] = @options[:password]
159
- post["customer.merchant"] = @options[:merchant]
160
- post["order.type"] = action
157
+ post['customer.username'] = @options[:username]
158
+ post['customer.password'] = @options[:password]
159
+ post['customer.merchant'] = @options[:merchant]
160
+ post['order.type'] = action
161
161
 
162
162
  data = build_request(post)
163
163
  raw = parse(ssl_post(url(action), data, headers))
164
164
 
165
- succeeded = success_from(raw["response.responseCode"])
165
+ succeeded = success_from(raw['response.responseCode'])
166
166
  Response.new(
167
167
  succeeded,
168
168
  message_from(succeeded, raw),
169
169
  raw,
170
- authorization: raw["response.orderNumber"] || raw["response.customerReferenceNumber"],
170
+ authorization: raw['response.orderNumber'] || raw['response.customerReferenceNumber'],
171
171
  error_code: error_code_from(succeeded, raw),
172
172
  test: test?
173
173
  )
@@ -175,12 +175,12 @@ module ActiveMerchant #:nodoc:
175
175
 
176
176
  def headers
177
177
  {
178
- "Content-Type" => "application/x-www-form-urlencoded"
178
+ 'Content-Type' => 'application/x-www-form-urlencoded'
179
179
  }
180
180
  end
181
181
 
182
182
  def build_request(post)
183
- post.to_query + "&message.end"
183
+ post.to_query + '&message.end'
184
184
  end
185
185
 
186
186
  def url(action)
@@ -211,25 +211,25 @@ module ActiveMerchant #:nodoc:
211
211
 
212
212
  def message_from(succeeded, response)
213
213
  if succeeded
214
- "Succeeded"
214
+ 'Succeeded'
215
215
  else
216
- response["response.text"] || "Unable to read error message"
216
+ response['response.text'] || 'Unable to read error message'
217
217
  end
218
218
  end
219
219
 
220
220
  STANDARD_ERROR_CODE_MAPPING = {
221
- "14" => STANDARD_ERROR_CODE[:invalid_number],
222
- "QQ" => STANDARD_ERROR_CODE[:invalid_cvc],
223
- "33" => STANDARD_ERROR_CODE[:expired_card],
224
- "NT" => STANDARD_ERROR_CODE[:incorrect_address],
225
- "12" => STANDARD_ERROR_CODE[:card_declined],
226
- "06" => STANDARD_ERROR_CODE[:processing_error],
227
- "01" => STANDARD_ERROR_CODE[:call_issuer],
228
- "04" => STANDARD_ERROR_CODE[:pickup_card],
221
+ '14' => STANDARD_ERROR_CODE[:invalid_number],
222
+ 'QQ' => STANDARD_ERROR_CODE[:invalid_cvc],
223
+ '33' => STANDARD_ERROR_CODE[:expired_card],
224
+ 'NT' => STANDARD_ERROR_CODE[:incorrect_address],
225
+ '12' => STANDARD_ERROR_CODE[:card_declined],
226
+ '06' => STANDARD_ERROR_CODE[:processing_error],
227
+ '01' => STANDARD_ERROR_CODE[:call_issuer],
228
+ '04' => STANDARD_ERROR_CODE[:pickup_card],
229
229
  }
230
230
 
231
231
  def error_code_from(succeeded, response)
232
- succeeded ? nil : STANDARD_ERROR_CODE_MAPPING[response["response.responseCode"]]
232
+ succeeded ? nil : STANDARD_ERROR_CODE_MAPPING[response['response.responseCode']]
233
233
  end
234
234
  end
235
235
  end
@@ -39,9 +39,9 @@ module ActiveMerchant
39
39
  self.homepage_url = 'http://www.realexpayments.com/'
40
40
  self.display_name = 'Realex'
41
41
 
42
- SUCCESS, DECLINED = "Successful", "Declined"
43
- BANK_ERROR = REALEX_ERROR = "Gateway is in maintenance. Please try again later."
44
- ERROR = CLIENT_DEACTIVATED = "Gateway Error"
42
+ SUCCESS, DECLINED = 'Successful', 'Declined'
43
+ BANK_ERROR = REALEX_ERROR = 'Gateway is in maintenance. Please try again later.'
44
+ ERROR = CLIENT_DEACTIVATED = 'Gateway Error'
45
45
 
46
46
  def initialize(options = {})
47
47
  requires!(options, :login, :password)
@@ -64,7 +64,7 @@ module ActiveMerchant
64
64
  end
65
65
 
66
66
  def capture(money, authorization, options = {})
67
- request = build_capture_request(authorization, options)
67
+ request = build_capture_request(money, authorization, options)
68
68
  commit(request)
69
69
  end
70
70
 
@@ -98,7 +98,7 @@ module ActiveMerchant
98
98
  response = parse(ssl_post(self.live_url, request))
99
99
 
100
100
  Response.new(
101
- (response[:result] == "00"),
101
+ (response[:result] == '00'),
102
102
  message_from(response),
103
103
  response,
104
104
  :test => (response[:message] =~ %r{\[ test system \]}),
@@ -147,14 +147,15 @@ module ActiveMerchant
147
147
  xml.target!
148
148
  end
149
149
 
150
- def build_capture_request(authorization, options)
150
+ def build_capture_request(money, authorization, options)
151
151
  timestamp = new_timestamp
152
152
  xml = Builder::XmlMarkup.new :indent => 2
153
153
  xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'settle' do
154
154
  add_merchant_details(xml, options)
155
+ add_amount(xml, money, options)
155
156
  add_transaction_identifiers(xml, authorization, options)
156
157
  add_comments(xml, options)
157
- add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), nil, nil, nil)
158
+ add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), amount(money), (options[:currency] || currency(money)), nil)
158
159
  end
159
160
  xml.target!
160
161
  end
@@ -266,7 +267,7 @@ module ActiveMerchant
266
267
 
267
268
  def format_address_code(address)
268
269
  code = [address[:zip].to_s, address[:address1].to_s + address[:address2].to_s]
269
- code.collect{|e| e.gsub(/\D/, "")}.reject{|e| e.empty?}.join("|")
270
+ code.collect{|e| e.gsub(/\D/, '')}.reject{|e| e.empty?}.join('|')
270
271
  end
271
272
 
272
273
  def new_timestamp
@@ -274,8 +275,8 @@ module ActiveMerchant
274
275
  end
275
276
 
276
277
  def add_signed_digest(xml, *values)
277
- string = Digest::SHA1.hexdigest(values.join("."))
278
- xml.tag! 'sha1hash', Digest::SHA1.hexdigest([string, @options[:password]].join("."))
278
+ string = Digest::SHA1.hexdigest(values.join('.'))
279
+ xml.tag! 'sha1hash', Digest::SHA1.hexdigest([string, @options[:password]].join('.'))
279
280
  end
280
281
 
281
282
  def auto_settle_flag(action)
@@ -289,11 +290,11 @@ module ActiveMerchant
289
290
  def message_from(response)
290
291
  message = nil
291
292
  case response[:result]
292
- when "00"
293
+ when '00'
293
294
  message = SUCCESS
294
- when "101"
295
+ when '101'
295
296
  message = response[:message]
296
- when "102", "103"
297
+ when '102', '103'
297
298
  message = DECLINED
298
299
  when /^2[0-9][0-9]/
299
300
  message = BANK_ERROR
@@ -301,9 +302,9 @@ module ActiveMerchant
301
302
  message = REALEX_ERROR
302
303
  when /^5[0-9][0-9]/
303
304
  message = response[:message]
304
- when "600", "601", "603"
305
+ when '600', '601', '603'
305
306
  message = ERROR
306
- when "666"
307
+ when '666'
307
308
  message = CLIENT_DEACTIVATED
308
309
  else
309
310
  message = DECLINED
@@ -35,8 +35,8 @@ module ActiveMerchant #:nodoc:
35
35
  #
36
36
  #
37
37
  class RedsysGateway < Gateway
38
- self.live_url = "https://sis.sermepa.es/sis/operaciones"
39
- self.test_url = "https://sis-t.redsys.es:25443/sis/operaciones"
38
+ self.live_url = 'https://sis.sermepa.es/sis/operaciones'
39
+ self.test_url = 'https://sis-t.redsys.es:25443/sis/operaciones'
40
40
 
41
41
  self.supported_countries = ['ES']
42
42
  self.default_currency = 'EUR'
@@ -44,46 +44,46 @@ module ActiveMerchant #:nodoc:
44
44
 
45
45
  # Not all card types may be activated by the bank!
46
46
  self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club]
47
- self.homepage_url = "http://www.redsys.es/"
48
- self.display_name = "Redsys"
47
+ self.homepage_url = 'http://www.redsys.es/'
48
+ self.display_name = 'Redsys'
49
49
 
50
50
  CURRENCY_CODES = {
51
- "AED" => '784',
52
- "ARS" => '32',
53
- "AUD" => '36',
54
- "BRL" => '986',
55
- "BOB" => '68',
56
- "CAD" => '124',
57
- "CHF" => '756',
58
- "CLP" => '152',
59
- "CNY" => '156',
60
- "COP" => '170',
61
- "CRC" => '188',
62
- "CZK" => '203',
63
- "DKK" => '208',
64
- "DOP" => '214',
65
- "EUR" => '978',
66
- "GBP" => '826',
67
- "GTQ" => '320',
68
- "HUF" => '348',
69
- "IDR" => '360',
70
- "INR" => '356',
71
- "JPY" => '392',
72
- "KRW" => '410',
73
- "MYR" => '458',
74
- "MXN" => '484',
75
- "NOK" => '578',
76
- "NZD" => '554',
77
- "PEN" => '604',
78
- "PLN" => '985',
79
- "RUB" => '643',
80
- "SAR" => '682',
81
- "SEK" => '752',
82
- "SGD" => '702',
83
- "THB" => '764',
84
- "TWD" => '901',
85
- "USD" => '840',
86
- "UYU" => '858'
51
+ 'AED' => '784',
52
+ 'ARS' => '32',
53
+ 'AUD' => '36',
54
+ 'BRL' => '986',
55
+ 'BOB' => '68',
56
+ 'CAD' => '124',
57
+ 'CHF' => '756',
58
+ 'CLP' => '152',
59
+ 'CNY' => '156',
60
+ 'COP' => '170',
61
+ 'CRC' => '188',
62
+ 'CZK' => '203',
63
+ 'DKK' => '208',
64
+ 'DOP' => '214',
65
+ 'EUR' => '978',
66
+ 'GBP' => '826',
67
+ 'GTQ' => '320',
68
+ 'HUF' => '348',
69
+ 'IDR' => '360',
70
+ 'INR' => '356',
71
+ 'JPY' => '392',
72
+ 'KRW' => '410',
73
+ 'MYR' => '458',
74
+ 'MXN' => '484',
75
+ 'NOK' => '578',
76
+ 'NZD' => '554',
77
+ 'PEN' => '604',
78
+ 'PLN' => '985',
79
+ 'RUB' => '643',
80
+ 'SAR' => '682',
81
+ 'SEK' => '752',
82
+ 'SGD' => '702',
83
+ 'THB' => '764',
84
+ 'TWD' => '901',
85
+ 'USD' => '840',
86
+ 'UYU' => '858'
87
87
  }
88
88
 
89
89
  # The set of supported transactions for this gateway.
@@ -101,72 +101,72 @@ module ActiveMerchant #:nodoc:
101
101
  # a card has been rejected. Syntax or general request errors
102
102
  # are not covered here.
103
103
  RESPONSE_TEXTS = {
104
- 0 => "Transaction Approved",
105
- 400 => "Cancellation Accepted",
106
- 481 => "Cancellation Accepted",
107
- 500 => "Reconciliation Accepted",
108
- 900 => "Refund / Confirmation approved",
109
-
110
- 101 => "Card expired",
111
- 102 => "Card blocked temporarily or under susciption of fraud",
112
- 104 => "Transaction not permitted",
113
- 107 => "Contact the card issuer",
114
- 109 => "Invalid identification by merchant or POS terminal",
115
- 110 => "Invalid amount",
116
- 114 => "Card cannot be used to the requested transaction",
117
- 116 => "Insufficient credit",
118
- 118 => "Non-registered card",
119
- 125 => "Card not effective",
120
- 129 => "CVV2/CVC2 Error",
121
- 167 => "Contact the card issuer: suspected fraud",
122
- 180 => "Card out of service",
123
- 181 => "Card with credit or debit restrictions",
124
- 182 => "Card with credit or debit restrictions",
125
- 184 => "Authentication error",
126
- 190 => "Refusal with no specific reason",
127
- 191 => "Expiry date incorrect",
128
-
129
- 201 => "Card expired",
130
- 202 => "Card blocked temporarily or under suspicion of fraud",
131
- 204 => "Transaction not permitted",
132
- 207 => "Contact the card issuer",
133
- 208 => "Lost or stolen card",
134
- 209 => "Lost or stolen card",
135
- 280 => "CVV2/CVC2 Error",
136
- 290 => "Declined with no specific reason",
137
-
138
- 480 => "Original transaction not located, or time-out exceeded",
139
- 501 => "Original transaction not located, or time-out exceeded",
140
- 502 => "Original transaction not located, or time-out exceeded",
141
- 503 => "Original transaction not located, or time-out exceeded",
142
-
143
- 904 => "Merchant not registered at FUC",
144
- 909 => "System error",
145
- 912 => "Issuer not available",
146
- 913 => "Duplicate transmission",
147
- 916 => "Amount too low",
148
- 928 => "Time-out exceeded",
149
- 940 => "Transaction cancelled previously",
150
- 941 => "Authorization operation already cancelled",
151
- 942 => "Original authorization declined",
152
- 943 => "Different details from origin transaction",
153
- 944 => "Session error",
154
- 945 => "Duplicate transmission",
155
- 946 => "Cancellation of transaction while in progress",
156
- 947 => "Duplicate tranmission while in progress",
157
- 949 => "POS Inoperative",
158
- 950 => "Refund not possible",
159
- 9064 => "Card number incorrect",
160
- 9078 => "No payment method available",
161
- 9093 => "Non-existent card",
162
- 9218 => "Recursive transaction in bad gateway",
163
- 9253 => "Check-digit incorrect",
164
- 9256 => "Preauth not allowed for merchant",
165
- 9257 => "Preauth not allowed for card",
166
- 9261 => "Operating limit exceeded",
167
- 9912 => "Issuer not available",
168
- 9913 => "Confirmation error",
169
- 9914 => "KO Confirmation"
104
+ 0 => 'Transaction Approved',
105
+ 400 => 'Cancellation Accepted',
106
+ 481 => 'Cancellation Accepted',
107
+ 500 => 'Reconciliation Accepted',
108
+ 900 => 'Refund / Confirmation approved',
109
+
110
+ 101 => 'Card expired',
111
+ 102 => 'Card blocked temporarily or under susciption of fraud',
112
+ 104 => 'Transaction not permitted',
113
+ 107 => 'Contact the card issuer',
114
+ 109 => 'Invalid identification by merchant or POS terminal',
115
+ 110 => 'Invalid amount',
116
+ 114 => 'Card cannot be used to the requested transaction',
117
+ 116 => 'Insufficient credit',
118
+ 118 => 'Non-registered card',
119
+ 125 => 'Card not effective',
120
+ 129 => 'CVV2/CVC2 Error',
121
+ 167 => 'Contact the card issuer: suspected fraud',
122
+ 180 => 'Card out of service',
123
+ 181 => 'Card with credit or debit restrictions',
124
+ 182 => 'Card with credit or debit restrictions',
125
+ 184 => 'Authentication error',
126
+ 190 => 'Refusal with no specific reason',
127
+ 191 => 'Expiry date incorrect',
128
+
129
+ 201 => 'Card expired',
130
+ 202 => 'Card blocked temporarily or under suspicion of fraud',
131
+ 204 => 'Transaction not permitted',
132
+ 207 => 'Contact the card issuer',
133
+ 208 => 'Lost or stolen card',
134
+ 209 => 'Lost or stolen card',
135
+ 280 => 'CVV2/CVC2 Error',
136
+ 290 => 'Declined with no specific reason',
137
+
138
+ 480 => 'Original transaction not located, or time-out exceeded',
139
+ 501 => 'Original transaction not located, or time-out exceeded',
140
+ 502 => 'Original transaction not located, or time-out exceeded',
141
+ 503 => 'Original transaction not located, or time-out exceeded',
142
+
143
+ 904 => 'Merchant not registered at FUC',
144
+ 909 => 'System error',
145
+ 912 => 'Issuer not available',
146
+ 913 => 'Duplicate transmission',
147
+ 916 => 'Amount too low',
148
+ 928 => 'Time-out exceeded',
149
+ 940 => 'Transaction cancelled previously',
150
+ 941 => 'Authorization operation already cancelled',
151
+ 942 => 'Original authorization declined',
152
+ 943 => 'Different details from origin transaction',
153
+ 944 => 'Session error',
154
+ 945 => 'Duplicate transmission',
155
+ 946 => 'Cancellation of transaction while in progress',
156
+ 947 => 'Duplicate tranmission while in progress',
157
+ 949 => 'POS Inoperative',
158
+ 950 => 'Refund not possible',
159
+ 9064 => 'Card number incorrect',
160
+ 9078 => 'No payment method available',
161
+ 9093 => 'Non-existent card',
162
+ 9218 => 'Recursive transaction in bad gateway',
163
+ 9253 => 'Check-digit incorrect',
164
+ 9256 => 'Preauth not allowed for merchant',
165
+ 9257 => 'Preauth not allowed for card',
166
+ 9261 => 'Operating limit exceeded',
167
+ 9912 => 'Issuer not available',
168
+ 9913 => 'Confirmation error',
169
+ 9914 => 'KO Confirmation'
170
170
  }
171
171
 
172
172
  # Creates a new instance
@@ -184,7 +184,7 @@ module ActiveMerchant #:nodoc:
184
184
  def initialize(options = {})
185
185
  requires!(options, :login, :secret_key)
186
186
  options[:terminal] ||= 1
187
- options[:signature_algorithm] ||= "sha1"
187
+ options[:signature_algorithm] ||= 'sha1'
188
188
  super
189
189
  end
190
190
 
@@ -299,8 +299,8 @@ module ActiveMerchant #:nodoc:
299
299
  data[:credit_card_token] = card
300
300
  else
301
301
  name = [card.first_name, card.last_name].join(' ').slice(0, 60)
302
- year = sprintf("%.4i", card.year)
303
- month = sprintf("%.2i", card.month)
302
+ year = sprintf('%.4i', card.year)
303
+ month = sprintf('%.2i', card.month)
304
304
  data[:card] = {
305
305
  :name => name,
306
306
  :pan => card.number,
@@ -395,6 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
  xml.DS_MERCHANT_IDENTIFIER 'REQUIRED' if data[:store_in_vault]
396
396
  elsif data[:credit_card_token]
397
397
  xml.DS_MERCHANT_IDENTIFIER data[:credit_card_token]
398
+ xml.DS_MERCHANT_DIRECTPAYMENT 'true'
398
399
  end
399
400
  end
400
401
  end
@@ -402,12 +403,12 @@ module ActiveMerchant #:nodoc:
402
403
  def parse(data)
403
404
  params = {}
404
405
  success = false
405
- message = ""
406
+ message = ''
406
407
  options = @options.merge(:test => test?)
407
408
  xml = Nokogiri::XML(data)
408
- code = xml.xpath("//RETORNOXML/CODIGO").text
409
- if code == "0"
410
- op = xml.xpath("//RETORNOXML/OPERACION")
409
+ code = xml.xpath('//RETORNOXML/CODIGO').text
410
+ if code == '0'
411
+ op = xml.xpath('//RETORNOXML/OPERACION')
411
412
  op.children.each do |element|
412
413
  params[element.name.downcase.to_sym] = element.text
413
414
  end
@@ -417,7 +418,7 @@ module ActiveMerchant #:nodoc:
417
418
  options[:authorization] = build_authorization(params)
418
419
  success = is_success_response?(params[:ds_response])
419
420
  else
420
- message = "Response failed validation check"
421
+ message = 'Response failed validation check'
421
422
  end
422
423
  else
423
424
  # Some kind of programmer error with the request!
@@ -448,11 +449,11 @@ module ActiveMerchant #:nodoc:
448
449
  end
449
450
 
450
451
  def build_authorization(params)
451
- [params[:ds_order], params[:ds_amount], params[:ds_currency]].join("|")
452
+ [params[:ds_order], params[:ds_amount], params[:ds_currency]].join('|')
452
453
  end
453
454
 
454
455
  def split_authorization(authorization)
455
- order_id, amount, currency = authorization.split("|")
456
+ order_id, amount, currency = authorization.split('|')
456
457
  [order_id, amount.to_i, currency]
457
458
  end
458
459
 
@@ -469,7 +470,7 @@ module ActiveMerchant #:nodoc:
469
470
  def response_text(code)
470
471
  code = code.to_i
471
472
  code = 0 if code < 100
472
- RESPONSE_TEXTS[code] || "Unkown code, please check in manual"
473
+ RESPONSE_TEXTS[code] || 'Unkown code, please check in manual'
473
474
  end
474
475
 
475
476
  def is_success_response?(code)
@@ -481,12 +482,12 @@ module ActiveMerchant #:nodoc:
481
482
  if cleansed =~ /^\d{4}/
482
483
  cleansed[0..11]
483
484
  else
484
- "%04d%s" % [rand(0..9999), cleansed[0...8]]
485
+ '%04d%s' % [rand(0..9999), cleansed[0...8]]
485
486
  end
486
487
  end
487
488
 
488
489
  def sha256_authentication?
489
- @options[:signature_algorithm] == "sha256"
490
+ @options[:signature_algorithm] == 'sha256'
490
491
  end
491
492
 
492
493
  def sign_request(xml_request_string, order_id)
@@ -514,8 +515,14 @@ module ActiveMerchant #:nodoc:
514
515
  end
515
516
 
516
517
  def xml_signed_fields(data)
517
- data[:ds_amount] + data[:ds_order] + data[:ds_merchantcode] + data[:ds_currency] +
518
- data[:ds_response] + data[:ds_transactiontype] + data[:ds_securepayment]
518
+ xml_signed_fields = data[:ds_amount] + data[:ds_order] + data[:ds_merchantcode] +
519
+ data[:ds_currency] + data[:ds_response]
520
+
521
+ if data[:ds_cardnumber]
522
+ xml_signed_fields += data[:ds_cardnumber]
523
+ end
524
+
525
+ xml_signed_fields += data[:ds_transactiontype] + data[:ds_securepayment]
519
526
  end
520
527
 
521
528
  def get_key(order_id)