activemerchant 1.112.0 → 1.118.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +115 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/compatibility.rb +3 -3
  7. data/lib/active_merchant/billing/credit_card.rb +3 -1
  8. data/lib/active_merchant/billing/credit_card_methods.rb +58 -11
  9. data/lib/active_merchant/billing/gateway.rb +1 -1
  10. data/lib/active_merchant/billing/gateways/adyen.rb +26 -16
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -18
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -2
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  16. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  17. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  19. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +85 -23
  25. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  27. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  28. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +20 -17
  30. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  31. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  32. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
  36. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  38. data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
  39. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  40. data/lib/active_merchant/billing/gateways/checkout_v2.rb +18 -21
  41. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  42. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  45. data/lib/active_merchant/billing/gateways/credorax.rb +32 -15
  46. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  48. data/lib/active_merchant/billing/gateways/cyber_source.rb +61 -37
  49. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  50. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/decidir.rb +24 -9
  52. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  53. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  54. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  55. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  56. data/lib/active_merchant/billing/gateways/elavon.rb +279 -227
  57. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  58. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  59. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  60. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  61. data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
  62. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  63. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  64. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  66. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  68. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  69. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  70. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  71. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  72. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  73. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -10
  74. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  75. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  76. data/lib/active_merchant/billing/gateways/hps.rb +17 -14
  77. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  78. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  80. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  81. data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  83. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  88. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  89. data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
  90. data/lib/active_merchant/billing/gateways/litle.rb +28 -12
  91. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  92. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  93. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  94. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  96. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  97. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  98. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  99. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  100. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  101. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  102. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  103. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  104. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  105. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  106. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  107. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  108. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  109. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  110. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  111. data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
  112. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  113. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  114. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  115. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  116. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  117. data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
  118. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  119. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  120. data/lib/active_merchant/billing/gateways/orbital.rb +175 -81
  121. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  122. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  123. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  125. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  126. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  127. data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
  128. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  130. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  131. data/lib/active_merchant/billing/gateways/payeezy.rb +35 -17
  132. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  133. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  138. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  139. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  140. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  141. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  143. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  144. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  145. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  146. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  147. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  148. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  149. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  150. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  152. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  153. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  154. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  156. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  159. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/redsys.rb +87 -7
  161. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  162. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  163. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  164. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  165. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  169. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  170. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  172. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  173. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  174. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/stripe.rb +12 -12
  176. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  177. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  180. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  181. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  182. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  183. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  185. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  186. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  188. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  190. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  191. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  192. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  193. data/lib/active_merchant/billing/gateways/worldpay.rb +18 -10
  194. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  195. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  196. data/lib/active_merchant/billing/response.rb +3 -2
  197. data/lib/active_merchant/country.rb +1 -1
  198. data/lib/active_merchant/network_connection_retries.rb +2 -2
  199. data/lib/active_merchant/post_data.rb +1 -1
  200. data/lib/active_merchant/posts_data.rb +1 -1
  201. data/lib/active_merchant/version.rb +1 -1
  202. data/lib/support/ssl_verify.rb +2 -2
  203. data/lib/support/ssl_version.rb +2 -2
  204. metadata +2 -2
@@ -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'),
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.supported_countries = %w[AD AE AR AT AU BE BG BH BR CH CL CN CO CY CZ DE DK EE EG ES FI FR GB GR HK HR HU IE IS IT JO JP KW LI LT LU LV MC MT MX MY NL NO NZ OM PE PL PT QA RO SA SE SG SI SK SM TR US]
10
10
  self.default_currency = 'USD'
11
11
  self.money_format = :cents
12
- self.supported_cardtypes = %i[visa master american_express diners_club maestro discover]
12
+ self.supported_cardtypes = %i[visa master american_express diners_club maestro discover jcb]
13
13
  self.currencies_without_fractions = %w(BIF DJF GNF ISK KMF XAF CLF XPF JPY PYG RWF KRW VUV VND XOF)
14
14
  self.currencies_with_three_decimal_places = %w(BHD LYD JOD KWD OMR TND)
15
15
 
@@ -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]
@@ -148,6 +144,7 @@ module ActiveMerchant #:nodoc:
148
144
  post[:'3ds'][:enabled] = true
149
145
  post[:success_url] = options[:callback_url] if options[:callback_url]
150
146
  post[:failure_url] = options[:callback_url] if options[:callback_url]
147
+ post[:'3ds'][:attempt_n3d] = options[:attempt_n3d] if options[:attempt_n3d]
151
148
  end
152
149
 
153
150
  if options[:three_d_secure]
@@ -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
 
@@ -102,7 +102,7 @@ module ActiveMerchant #:nodoc:
102
102
  response,
103
103
  authorization: response['transID'],
104
104
  test: test?,
105
- avs_result: {code: response['avsCode']},
105
+ avs_result: { code: response['avsCode'] },
106
106
  cvv_result: response['cvvCode']
107
107
  )
108
108
  end
@@ -180,7 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
  'Accept-Language' => 'es',
181
181
  'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
182
182
  'RaiseHtmlError' => 'false',
183
- 'Conekta-Client-User-Agent' => {'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
183
+ 'Conekta-Client-User-Agent' => { 'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}" }.to_json,
184
184
  'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
185
185
  'X-Conekta-Client-User-Metadata' => options[:meta].to_json
186
186
  }
@@ -189,7 +189,7 @@ module ActiveMerchant #:nodoc:
189
189
  def conekta_client_user_agent(options)
190
190
  return user_agent unless options[:application]
191
191
 
192
- JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
192
+ JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
193
193
  end
194
194
 
195
195
  def commit(method, url, parameters, options = {})
@@ -41,12 +41,12 @@ module ActiveMerchant #:nodoc:
41
41
  'partialmatched;partialmatch' => 'C'
42
42
  }
43
43
 
44
- def initialize(options={})
44
+ def initialize(options = {})
45
45
  requires!(options, :terminal_id, :transaction_key)
46
46
  super
47
47
  end
48
48
 
49
- def purchase(money, payment_method, options={})
49
+ def purchase(money, payment_method, options = {})
50
50
  multi_response = MultiResponse.run do |r|
51
51
  r.process { authorize(money, payment_method, options) }
52
52
  r.process { capture(money, r.authorization, options) }
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
  )
67
67
  end
68
68
 
69
- def authorize(money, payment_method, options={})
69
+ def authorize(money, payment_method, options = {})
70
70
  request = build_xml_request do |xml|
71
71
  add_transaction_details(xml, money, nil, 'Auth', options)
72
72
  add_terminal_details(xml, options)
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  commit(request)
77
77
  end
78
78
 
79
- def capture(money, authorization, options={})
79
+ def capture(money, authorization, options = {})
80
80
  request = build_xml_request do |xml|
81
81
  add_transaction_details(xml, money, authorization, 'Conf', options)
82
82
  add_terminal_details(xml, options)
@@ -85,7 +85,7 @@ module ActiveMerchant #:nodoc:
85
85
  commit(request)
86
86
  end
87
87
 
88
- def refund(money, authorization, options={})
88
+ def refund(money, authorization, options = {})
89
89
  request = build_xml_request do |xml|
90
90
  add_transaction_details(xml, money, authorization, 'Refund', options)
91
91
  add_terminal_details(xml, options)
@@ -94,7 +94,7 @@ module ActiveMerchant #:nodoc:
94
94
  commit(request)
95
95
  end
96
96
 
97
- def void(authorization, options={})
97
+ def void(authorization, options = {})
98
98
  request = build_xml_request do |xml|
99
99
  add_transaction_details(xml, nil, authorization, 'Void', options)
100
100
  add_terminal_details(xml, options)
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  commit(request)
104
104
  end
105
105
 
106
- def verify(credit_card, options={})
106
+ def verify(credit_card, options = {})
107
107
  MultiResponse.run(:use_first_response) do |r|
108
108
  r.process { authorize(100, credit_card, options) }
109
109
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -144,7 +144,7 @@ module ActiveMerchant #:nodoc:
144
144
  builder.to_xml
145
145
  end
146
146
 
147
- def add_transaction_details(xml, amount, authorization, type, options={})
147
+ def add_transaction_details(xml, amount, authorization, type, options = {})
148
148
  xml.TransactionDetails do
149
149
  xml.MessageType type
150
150
  xml.Amount(unit: 'Minor') { xml.text(amount) } if amount
@@ -153,7 +153,7 @@ module ActiveMerchant #:nodoc:
153
153
  end
154
154
  end
155
155
 
156
- def add_terminal_details(xml, options={})
156
+ def add_terminal_details(xml, options = {})
157
157
  xml.TerminalDetails do
158
158
  xml.TerminalID @options[:terminal_id]
159
159
  xml.TransactionKey @options[:transaction_key]
@@ -161,7 +161,7 @@ module ActiveMerchant #:nodoc:
161
161
  end
162
162
  end
163
163
 
164
- def add_card_details(xml, payment_method, options={})
164
+ def add_card_details(xml, payment_method, options = {})
165
165
  xml.CardDetails do
166
166
  xml.Manual(type: manual_type(options)) do
167
167
  xml.PAN payment_method.number