activemerchant 1.110.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +82 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +1 -1
  5. data/lib/active_merchant/billing/compatibility.rb +3 -3
  6. data/lib/active_merchant/billing/credit_card.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +6 -6
  8. data/lib/active_merchant/billing/gateway.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/adyen.rb +30 -15
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -17
  12. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  13. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -2
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  18. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  20. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  22. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  23. data/lib/active_merchant/billing/gateways/blue_snap.rb +83 -23
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  26. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  27. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/braintree_blue.rb +14 -17
  29. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  31. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
  35. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  37. data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
  38. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/checkout_v2.rb +17 -20
  40. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  41. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  43. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/credorax.rb +15 -9
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -37
  48. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  50. data/lib/active_merchant/billing/gateways/decidir.rb +10 -9
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  55. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  56. data/lib/active_merchant/billing/gateways/element.rb +12 -8
  57. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  58. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  59. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  60. data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
  64. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  65. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  67. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  68. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  70. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  72. data/lib/active_merchant/billing/gateways/global_collect.rb +15 -10
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  75. data/lib/active_merchant/billing/gateways/hps.rb +16 -13
  76. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  77. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  78. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  79. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  80. data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
  81. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  82. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  83. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  86. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  87. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  88. data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
  89. data/lib/active_merchant/billing/gateways/litle.rb +12 -12
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  92. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  95. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  96. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  97. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  98. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  99. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  100. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  101. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  102. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  104. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  105. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  106. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  107. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  108. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  109. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  110. data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
  111. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  112. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  113. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  114. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  115. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  116. data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
  117. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/orbital.rb +66 -64
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  122. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  125. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  126. data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
  127. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  130. data/lib/active_merchant/billing/gateways/payeezy.rb +12 -12
  131. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  132. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  133. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  136. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  138. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  140. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  141. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  142. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  143. data/lib/active_merchant/billing/gateways/payu_latam.rb +21 -11
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  146. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  147. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  148. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  149. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  150. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  152. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  154. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  155. data/lib/active_merchant/billing/gateways/realex.rb +2 -1
  156. data/lib/active_merchant/billing/gateways/redsys.rb +7 -7
  157. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  158. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  159. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  160. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  161. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  164. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  167. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  169. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  170. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  171. data/lib/active_merchant/billing/gateways/stripe.rb +11 -11
  172. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  173. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  174. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  175. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  176. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  177. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  178. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  179. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  181. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  182. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  183. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  184. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  186. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  188. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  190. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  191. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  192. data/lib/active_merchant/billing/response.rb +1 -1
  193. data/lib/active_merchant/country.rb +1 -1
  194. data/lib/active_merchant/network_connection_retries.rb +2 -2
  195. data/lib/active_merchant/post_data.rb +1 -1
  196. data/lib/active_merchant/posts_data.rb +1 -1
  197. data/lib/active_merchant/version.rb +1 -1
  198. data/lib/support/ssl_verify.rb +2 -2
  199. data/lib/support/ssl_version.rb +2 -2
  200. metadata +16 -2
@@ -67,12 +67,12 @@ module ActiveMerchant #:nodoc:
67
67
  '894' => STANDARD_ERROR_CODE[:processing_error]
68
68
  }
69
69
 
70
- def initialize(options={})
70
+ def initialize(options = {})
71
71
  requires!(options, :username, :password)
72
72
  super
73
73
  end
74
74
 
75
- def purchase(money, payment, options={})
75
+ def purchase(money, payment, options = {})
76
76
  post = {}
77
77
  add_invoice(post, money, options)
78
78
 
@@ -86,7 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
  commit('sale', post)
87
87
  end
88
88
 
89
- def authorize(money, payment, options={})
89
+ def authorize(money, payment, options = {})
90
90
  post = {}
91
91
  add_invoice(post, money, options)
92
92
  add_payment(post, payment)
@@ -95,7 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
  commit('auth', post)
96
96
  end
97
97
 
98
- def capture(money, authorization, options={})
98
+ def capture(money, authorization, options = {})
99
99
  post = {}
100
100
  add_reference(post, authorization)
101
101
  add_invoice(post, money, options)
@@ -103,20 +103,20 @@ module ActiveMerchant #:nodoc:
103
103
  commit('capture', post)
104
104
  end
105
105
 
106
- def refund(money, authorization, options={})
106
+ def refund(money, authorization, options = {})
107
107
  post = {}
108
108
  add_reference(post, authorization)
109
109
  add_invoice(post, money, options)
110
110
  commit('refund', post)
111
111
  end
112
112
 
113
- def void(authorization, options={})
113
+ def void(authorization, options = {})
114
114
  post = {}
115
115
  add_reference(post, authorization)
116
116
  commit('void', post)
117
117
  end
118
118
 
119
- def verify(credit_card, options={})
119
+ def verify(credit_card, options = {})
120
120
  post = {}
121
121
  add_invoice(post, 0, options)
122
122
  add_payment(post, credit_card)
@@ -138,7 +138,7 @@ module ActiveMerchant #:nodoc:
138
138
 
139
139
  private
140
140
 
141
- def add_address(post, creditcard, options={})
141
+ def add_address(post, creditcard, options = {})
142
142
  post[:firstname] = creditcard.first_name
143
143
  post[:lastname] = creditcard.last_name
144
144
 
@@ -233,7 +233,7 @@ module ActiveMerchant #:nodoc:
233
233
  post[:items] = options[:items].map do |item|
234
234
  updated = {}
235
235
  item.each_pair do |k, v|
236
- updated.merge!(k.to_s.gsub(/_/, '') => v)
236
+ updated.merge!(k.to_s.delete('_') => v)
237
237
  end
238
238
  updated
239
239
  end
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
  self.homepage_url = 'http://www.cardsave.net/'
12
12
  self.display_name = 'CardSave'
13
13
 
14
- def initialize(options={})
14
+ def initialize(options = {})
15
15
  super
16
16
  @test_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
17
17
  @live_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
@@ -203,7 +203,7 @@ module ActiveMerchant #:nodoc:
203
203
  commit('CANCEL', post)
204
204
  end
205
205
 
206
- def verify(creditcard, options={})
206
+ def verify(creditcard, options = {})
207
207
  MultiResponse.run(:use_first_response) do |r|
208
208
  r.process { authorize(100, creditcard, options) }
209
209
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -282,7 +282,7 @@ module ActiveMerchant #:nodoc:
282
282
  add_pair(post, :threeDSRequired, options[:threeds_required] || @threeds_required ? 'Y' : 'N')
283
283
  end
284
284
 
285
- def add_remote_address(post, options={})
285
+ def add_remote_address(post, options = {})
286
286
  add_pair(post, :remoteAddress, options[:ip] || '1.1.1.1')
287
287
  end
288
288
 
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
27
27
  }
28
28
  }
29
29
 
30
- def initialize(options={})
30
+ def initialize(options = {})
31
31
  requires!(options, :api_key)
32
32
  super
33
33
  end
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
37
37
  # - check
38
38
  # - cardknox token, which is returned in the the authorization string "ref_num;token;command"
39
39
 
40
- def purchase(amount, source, options={})
40
+ def purchase(amount, source, options = {})
41
41
  post = {}
42
42
  add_amount(post, amount, options)
43
43
  add_invoice(post, options)
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  commit(:purchase, source_type(source), post)
49
49
  end
50
50
 
51
- def authorize(amount, source, options={})
51
+ def authorize(amount, source, options = {})
52
52
  post = {}
53
53
  add_amount(post, amount)
54
54
  add_invoice(post, options)
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
  commit(:capture, source_type(authorization), post)
67
67
  end
68
68
 
69
- def refund(amount, authorization, options={})
69
+ def refund(amount, authorization, options = {})
70
70
  post = {}
71
71
  add_reference(post, authorization)
72
72
  add_amount(post, amount)
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  commit(:void, source_type(authorization), post)
80
80
  end
81
81
 
82
- def verify(credit_card, options={})
82
+ def verify(credit_card, options = {})
83
83
  MultiResponse.run(:use_first_response) do |r|
84
84
  r.process { authorize(100, credit_card, options) }
85
85
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -276,7 +276,7 @@ module ActiveMerchant #:nodoc:
276
276
  amount: fields['xAuthAmount'],
277
277
  masked_card_num: fields['xMaskedCardNumber'],
278
278
  masked_account_number: fields['MaskedAccountNumber']
279
- }.delete_if { |k, v| v.nil? }
279
+ }.delete_if { |_k, v| v.nil? }
280
280
  end
281
281
 
282
282
  def commit(action, source_type, parameters)
@@ -312,7 +312,7 @@ module ActiveMerchant #:nodoc:
312
312
  Version: '4.5.4',
313
313
  SoftwareName: 'Active Merchant',
314
314
  SoftwareVersion: ActiveMerchant::VERSION.to_s,
315
- Command: command,
315
+ Command: command
316
316
  }
317
317
 
318
318
  seed = SecureRandom.hex(32).upcase
@@ -320,7 +320,7 @@ module ActiveMerchant #:nodoc:
320
320
  initial_parameters[:Hash] = "s/#{seed}/#{hash}/n" unless @options[:pin].blank?
321
321
  parameters = initial_parameters.merge(parameters)
322
322
 
323
- parameters.reject { |k, v| v.blank? }.collect { |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
323
+ parameters.reject { |_k, v| v.blank? }.collect { |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
324
324
  end
325
325
  end
326
326
  end
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
26
26
  # * <tt>:user_id</tt> -- The CardProcess user ID
27
27
  # * <tt>:password</tt> -- The CardProcess password
28
28
  # * <tt>:entity_id</tt> -- The CardProcess channel or entity ID for any transactions
29
- def initialize(options={})
29
+ def initialize(options = {})
30
30
  requires!(options, :user_id, :password, :entity_id)
31
31
  super
32
32
  # This variable exists purely to allow remote tests to force error codes;
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  CECA_UI_LESS_REFUND_PAGE = 'anulacion_xml'
22
22
  CECA_ACTION_REFUND = 'anulaciones/anularParcial' # use partial refund's URL to avoid time frame limitations and decision logic on client side
23
23
  CECA_ACTION_PURCHASE = 'tpv/compra'
24
- CECA_CURRENCIES_DICTIONARY = {'EUR' => 978, 'USD' => 840, 'GBP' => 826}
24
+ CECA_CURRENCIES_DICTIONARY = { 'EUR' => 978, 'USD' => 840, 'GBP' => 826 }
25
25
 
26
26
  # Creates a new CecabankGateway
27
27
  #
@@ -57,14 +57,14 @@ module ActiveMerchant #:nodoc:
57
57
  def purchase(money, creditcard, options = {})
58
58
  requires!(options, :order_id)
59
59
 
60
- post = {'Descripcion' => options[:description],
60
+ post = { 'Descripcion' => options[:description],
61
61
  'Num_operacion' => options[:order_id],
62
62
  'Idioma' => CECA_UI_LESS_LANGUAGE,
63
63
  'Pago_soportado' => CECA_MODE,
64
64
  'URL_OK' => CECA_NOTIFICATIONS_URL,
65
65
  'URL_NOK' => CECA_NOTIFICATIONS_URL,
66
66
  'Importe' => amount(money),
67
- 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)]}
67
+ 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
68
68
 
69
69
  add_creditcard(post, creditcard)
70
70
 
@@ -84,12 +84,12 @@ module ActiveMerchant #:nodoc:
84
84
  def refund(money, identification, options = {})
85
85
  reference, order_id = split_authorization(identification)
86
86
 
87
- post = {'Referencia' => reference,
87
+ post = { 'Referencia' => reference,
88
88
  'Num_operacion' => order_id,
89
89
  'Idioma' => CECA_UI_LESS_LANGUAGE_REFUND,
90
90
  'Pagina' => CECA_UI_LESS_REFUND_PAGE,
91
91
  'Importe' => amount(money),
92
- 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)]}
92
+ 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[options[:currency] || currency(money)] }
93
93
 
94
94
  commit(CECA_ACTION_REFUND, post)
95
95
  end
@@ -13,12 +13,12 @@ module ActiveMerchant #:nodoc:
13
13
  self.money_format = :dollars
14
14
  self.supported_cardtypes = %i[visa master american_express discover]
15
15
 
16
- def initialize(options={})
16
+ def initialize(options = {})
17
17
  requires!(options, :merchant_id, :password, :user_id)
18
18
  super
19
19
  end
20
20
 
21
- def purchase(amount, payment_method, options={})
21
+ def purchase(amount, payment_method, options = {})
22
22
  post = {}
23
23
  add_invoice(post, amount, options)
24
24
  add_payment_method(post, payment_method)
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
27
27
  commit('Sale', post)
28
28
  end
29
29
 
30
- def authorize(amount, payment_method, options={})
30
+ def authorize(amount, payment_method, options = {})
31
31
  post = {}
32
32
  add_invoice(post, amount, options)
33
33
  add_payment_method(post, payment_method)
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
  commit('Auth', post)
37
37
  end
38
38
 
39
- def capture(amount, authorization, options={})
39
+ def capture(amount, authorization, options = {})
40
40
  post = {}
41
41
  add_invoice(post, amount, options)
42
42
  add_reference(post, authorization)
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  commit('SpecialForce', post)
46
46
  end
47
47
 
48
- def void(authorization, options={})
48
+ def void(authorization, options = {})
49
49
  post = {}
50
50
  add_void_required_elements(post)
51
51
  add_reference(post, authorization)
@@ -56,7 +56,7 @@ module ActiveMerchant #:nodoc:
56
56
  commit('Void', post)
57
57
  end
58
58
 
59
- def refund(amount, authorization, options={})
59
+ def refund(amount, authorization, options = {})
60
60
  post = {}
61
61
  add_invoice(post, amount, options)
62
62
  add_reference(post, authorization)
@@ -65,7 +65,7 @@ module ActiveMerchant #:nodoc:
65
65
  commit('SpecialReturn', post)
66
66
  end
67
67
 
68
- def credit(amount, payment_method, options={})
68
+ def credit(amount, payment_method, options = {})
69
69
  post = {}
70
70
  add_invoice(post, amount, options)
71
71
  add_payment_method(post, payment_method)
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  commit('Credit', post)
74
74
  end
75
75
 
76
- def verify(credit_card, options={})
76
+ def verify(credit_card, options = {})
77
77
  MultiResponse.run(:use_first_response) do |r|
78
78
  r.process { authorize(100, credit_card, options) }
79
79
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -198,7 +198,7 @@ module ActiveMerchant #:nodoc:
198
198
  end
199
199
 
200
200
  def envelope(body)
201
- <<~EOS
201
+ <<~XML
202
202
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:acr="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.Common" xmlns:acr1="http://schemas.datacontract.org/2004/07/Acriter.ABI.CenPOS.EPayment.VirtualTerminal.v6.Common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
203
203
  <soapenv:Header/>
204
204
  <soapenv:Body>
@@ -209,7 +209,7 @@ module ActiveMerchant #:nodoc:
209
209
  </tem:ProcessCreditCard>
210
210
  </soapenv:Body>
211
211
  </soapenv:Envelope>
212
- EOS
212
+ XML
213
213
  end
214
214
 
215
215
  def parse(xml)
@@ -250,7 +250,7 @@ module ActiveMerchant #:nodoc:
250
250
  '257' => STANDARD_ERROR_CODE[:invalid_cvc],
251
251
  '333' => STANDARD_ERROR_CODE[:expired_card],
252
252
  '1' => STANDARD_ERROR_CODE[:card_declined],
253
- '99' => STANDARD_ERROR_CODE[:processing_error],
253
+ '99' => STANDARD_ERROR_CODE[:processing_error]
254
254
  }
255
255
 
256
256
  def authorization_from(request, response)
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  end
84
84
  end
85
85
 
86
- def verify(credit_card, options={})
86
+ def verify(credit_card, options = {})
87
87
  MultiResponse.run(:use_first_response) do |r|
88
88
  r.process { authorize(100, credit_card, options) }
89
89
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -159,7 +159,7 @@ module ActiveMerchant #:nodoc:
159
159
  xml.trackid(trackid) if trackid
160
160
  end
161
161
 
162
- def commit(action, amount=nil, options={}, &builder)
162
+ def commit(action, amount = nil, options = {}, &builder)
163
163
  response = parse_xml(ssl_post(live_url, build_xml(action, &builder)))
164
164
  Response.new(
165
165
  (response[:responsecode] == '0'),
@@ -19,25 +19,16 @@ module ActiveMerchant #:nodoc:
19
19
  end
20
20
 
21
21
  def purchase(amount, payment_method, options = {})
22
- multi = MultiResponse.run do |r|
23
- r.process { authorize(amount, payment_method, options) }
24
- r.process { capture(amount, r.authorization, options) }
25
- end
26
-
27
- merged_params = multi.responses.map(&:params).reduce({}, :merge)
28
- succeeded = success_from(merged_params)
22
+ post = {}
23
+ build_auth_or_purchase(post, amount, payment_method, options)
29
24
 
30
- response(:purchase, succeeded, merged_params)
25
+ commit(:purchase, post)
31
26
  end
32
27
 
33
28
  def authorize(amount, payment_method, options = {})
34
29
  post = {}
35
30
  post[:capture] = false
36
- add_invoice(post, amount, options)
37
- add_payment_method(post, payment_method, options)
38
- add_customer_data(post, options)
39
- add_transaction_data(post, options)
40
- add_3ds(post, options)
31
+ build_auth_or_purchase(post, amount, payment_method, options)
41
32
 
42
33
  commit(:authorize, post)
43
34
  end
@@ -64,13 +55,10 @@ module ActiveMerchant #:nodoc:
64
55
  end
65
56
 
66
57
  def verify(credit_card, options = {})
67
- MultiResponse.run(:use_first_response) do |r|
68
- r.process { authorize(100, credit_card, options) }
69
- r.process(:ignore_result) { void(r.authorization, options) }
70
- end
58
+ authorize(0, credit_card, options)
71
59
  end
72
60
 
73
- def verify_payment(authorization, option={})
61
+ def verify_payment(authorization, option = {})
74
62
  commit(:verify_payment, authorization)
75
63
  end
76
64
 
@@ -87,6 +75,14 @@ module ActiveMerchant #:nodoc:
87
75
 
88
76
  private
89
77
 
78
+ def build_auth_or_purchase(post, amount, payment_method, options)
79
+ add_invoice(post, amount, options)
80
+ add_payment_method(post, payment_method, options)
81
+ add_customer_data(post, options)
82
+ add_transaction_data(post, options)
83
+ add_3ds(post, options)
84
+ end
85
+
90
86
  def add_invoice(post, money, options)
91
87
  post[:amount] = localized_amount(money, options[:currency])
92
88
  post[:reference] = options[:order_id]
@@ -155,6 +151,7 @@ module ActiveMerchant #:nodoc:
155
151
  post[:'3ds'][:cryptogram] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
156
152
  post[:'3ds'][:version] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
157
153
  post[:'3ds'][:xid] = options[:three_d_secure][:ds_transaction_id] || options[:three_d_secure][:xid]
154
+ post[:'3ds'][:attempt_n3d] = options[:attempt_n3d] if options[:attempt_n3d]
158
155
  end
159
156
  end
160
157
 
@@ -194,12 +191,12 @@ module ActiveMerchant #:nodoc:
194
191
  def headers
195
192
  {
196
193
  'Authorization' => @options[:secret_key],
197
- 'Content-Type' => 'application/json;charset=UTF-8',
194
+ 'Content-Type' => 'application/json;charset=UTF-8'
198
195
  }
199
196
  end
200
197
 
201
198
  def url(_post, action, authorization)
202
- if action == :authorize
199
+ if %i[authorize purchase].include?(action)
203
200
  "#{base_url}/payments"
204
201
  elsif action == :capture
205
202
  "#{base_url}/payments/#{authorization}/captures"
@@ -36,20 +36,20 @@ module ActiveMerchant #:nodoc:
36
36
  50000 => 'Clearhaus error'
37
37
  }
38
38
 
39
- def initialize(options={})
39
+ def initialize(options = {})
40
40
  requires!(options, :api_key)
41
41
  options[:private_key] = options[:private_key].strip if options[:private_key]
42
42
  super
43
43
  end
44
44
 
45
- def purchase(amount, payment, options={})
45
+ def purchase(amount, payment, options = {})
46
46
  MultiResponse.run(:use_first_response) do |r|
47
47
  r.process { authorize(amount, payment, options) }
48
48
  r.process { capture(amount, r.authorization, options) }
49
49
  end
50
50
  end
51
51
 
52
- def authorize(amount, payment, options={})
52
+ def authorize(amount, payment, options = {})
53
53
  post = {}
54
54
  add_invoice(post, amount, options)
55
55
 
@@ -69,14 +69,14 @@ module ActiveMerchant #:nodoc:
69
69
  commit(action, post)
70
70
  end
71
71
 
72
- def capture(amount, authorization, options={})
72
+ def capture(amount, authorization, options = {})
73
73
  post = {}
74
74
  add_invoice(post, amount, options)
75
75
 
76
76
  commit("/authorizations/#{authorization}/captures", post)
77
77
  end
78
78
 
79
- def refund(amount, authorization, options={})
79
+ def refund(amount, authorization, options = {})
80
80
  post = {}
81
81
  add_amount(post, amount, options)
82
82
 
@@ -87,14 +87,14 @@ module ActiveMerchant #:nodoc:
87
87
  commit("/authorizations/#{authorization}/voids", options)
88
88
  end
89
89
 
90
- def verify(credit_card, options={})
90
+ def verify(credit_card, options = {})
91
91
  MultiResponse.run(:use_first_response) do |r|
92
92
  r.process { authorize(0, credit_card, options) }
93
93
  r.process(:ignore_result) { void(r.authorization, options) }
94
94
  end
95
95
  end
96
96
 
97
- def store(credit_card, options={})
97
+ def store(credit_card, options = {})
98
98
  post = {}
99
99
  add_payment(post, credit_card)
100
100