activemerchant 1.113.0 → 1.119.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +114 -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 -0
  8. data/lib/active_merchant/billing/credit_card_methods.rb +72 -13
  9. data/lib/active_merchant/billing/gateways/adyen.rb +24 -14
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +44 -12
  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 -1
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  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 +37 -12
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  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 +13 -10
  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 +7 -7
  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 +10 -10
  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 +26 -15
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -36
  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 +31 -10
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  55. data/lib/active_merchant/billing/gateways/elavon.rb +286 -225
  56. data/lib/active_merchant/billing/gateways/element.rb +8 -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 +19 -6
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  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 +21 -10
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  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 +35 -16
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  75. data/lib/active_merchant/billing/gateways/hps.rb +17 -8
  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 +5 -5
  81. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  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 +4 -5
  89. data/lib/active_merchant/billing/gateways/litle.rb +31 -15
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  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 +19 -8
  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 +3 -4
  117. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  119. data/lib/active_merchant/billing/gateways/orbital.rb +196 -85
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  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 +2 -3
  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 +32 -14
  131. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  132. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
  134. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  135. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  136. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  137. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  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 +17 -10
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  146. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  148. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  149. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  152. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  154. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  156. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  157. data/lib/active_merchant/billing/gateways/redsys.rb +86 -5
  158. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  159. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  160. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  161. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  162. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  164. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  166. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  168. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  169. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  170. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  171. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  172. data/lib/active_merchant/billing/gateways/stripe.rb +10 -10
  173. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  174. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  175. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  176. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  177. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  178. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  182. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  183. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  184. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  186. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  187. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  188. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  189. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  190. data/lib/active_merchant/billing/gateways/worldpay.rb +19 -11
  191. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  192. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  193. data/lib/active_merchant/billing/response.rb +3 -2
  194. data/lib/active_merchant/country.rb +1 -1
  195. data/lib/active_merchant/network_connection_retries.rb +2 -2
  196. data/lib/active_merchant/post_data.rb +1 -1
  197. data/lib/active_merchant/posts_data.rb +1 -1
  198. data/lib/active_merchant/version.rb +1 -1
  199. data/lib/support/ssl_verify.rb +2 -2
  200. data/lib/support/ssl_version.rb +2 -2
  201. metadata +2 -2
@@ -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]
@@ -199,7 +196,7 @@ module ActiveMerchant #:nodoc:
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
@@ -25,7 +25,7 @@ module ActiveMerchant #:nodoc:
25
25
  self.currencies_with_three_decimal_places = %w(BHD IQD JOD KWD LYD OMR TND)
26
26
 
27
27
  self.money_format = :cents
28
- self.supported_cardtypes = %i[visa master maestro]
28
+ self.supported_cardtypes = %i[visa master maestro american_express]
29
29
 
30
30
  RESPONSE_MESSAGES = {
31
31
  '00' => 'Approved or completed successfully',
@@ -117,15 +117,16 @@ module ActiveMerchant #:nodoc:
117
117
  '96' => 'System malfunction',
118
118
  'R0' => 'Stop Payment Order',
119
119
  'R1' => 'Revocation of Authorisation Order',
120
- 'R3' => 'Revocation of all Authorisations Order'
120
+ 'R3' => 'Revocation of all Authorisations Order',
121
+ '1A' => 'Strong Customer Authentication required'
121
122
  }
122
123
 
123
- def initialize(options={})
124
+ def initialize(options = {})
124
125
  requires!(options, :merchant_id, :cipher_key)
125
126
  super
126
127
  end
127
128
 
128
- def purchase(amount, payment_method, options={})
129
+ def purchase(amount, payment_method, options = {})
129
130
  post = {}
130
131
  add_invoice(post, amount, options)
131
132
  add_payment_method(post, payment_method)
@@ -141,7 +142,7 @@ module ActiveMerchant #:nodoc:
141
142
  commit(:purchase, post)
142
143
  end
143
144
 
144
- def authorize(amount, payment_method, options={})
145
+ def authorize(amount, payment_method, options = {})
145
146
  post = {}
146
147
  add_invoice(post, amount, options)
147
148
  add_payment_method(post, payment_method)
@@ -158,7 +159,7 @@ module ActiveMerchant #:nodoc:
158
159
  commit(:authorize, post)
159
160
  end
160
161
 
161
- def capture(amount, authorization, options={})
162
+ def capture(amount, authorization, options = {})
162
163
  post = {}
163
164
  add_invoice(post, amount, options)
164
165
  add_reference(post, authorization)
@@ -170,7 +171,7 @@ module ActiveMerchant #:nodoc:
170
171
  commit(:capture, post)
171
172
  end
172
173
 
173
- def void(authorization, options={})
174
+ def void(authorization, options = {})
174
175
  post = {}
175
176
  add_customer_data(post, options)
176
177
  reference_action = add_reference(post, authorization)
@@ -182,7 +183,7 @@ module ActiveMerchant #:nodoc:
182
183
  commit(:void, post, reference_action)
183
184
  end
184
185
 
185
- def refund(amount, authorization, options={})
186
+ def refund(amount, authorization, options = {})
186
187
  post = {}
187
188
  add_invoice(post, amount, options)
188
189
  add_reference(post, authorization)
@@ -200,7 +201,7 @@ module ActiveMerchant #:nodoc:
200
201
  end
201
202
  end
202
203
 
203
- def credit(amount, payment_method, options={})
204
+ def credit(amount, payment_method, options = {})
204
205
  post = {}
205
206
  add_invoice(post, amount, options)
206
207
  add_payment_method(post, payment_method)
@@ -214,7 +215,7 @@ module ActiveMerchant #:nodoc:
214
215
  commit(:credit, post)
215
216
  end
216
217
 
217
- def verify(credit_card, options={})
218
+ def verify(credit_card, options = {})
218
219
  MultiResponse.run(:use_first_response) do |r|
219
220
  r.process { authorize(100, credit_card, options) }
220
221
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -324,12 +325,13 @@ module ActiveMerchant #:nodoc:
324
325
  end
325
326
 
326
327
  def add_3d_secure(post, options)
327
- if options[:eci] && options[:xid]
328
+ if (options[:eci] && options[:xid]) || (options[:three_d_secure] && options[:three_d_secure][:version]&.start_with?('1'))
328
329
  add_3d_secure_1_data(post, options)
329
330
  elsif options[:execute_threed] && options[:three_ds_2]
330
331
  three_ds_2_options = options[:three_ds_2]
331
332
  browser_info = three_ds_2_options[:browser_info]
332
333
  post[:'3ds_initiate'] = options[:three_ds_initiate] || '01'
334
+ post[:f23] = options[:f23] if options[:f23]
333
335
  post[:'3ds_purchasedate'] = Time.now.utc.strftime('%Y%m%d%I%M%S')
334
336
  options.dig(:stored_credential, :initiator) == 'merchant' ? post[:'3ds_channel'] = '03' : post[:'3ds_channel'] = '02'
335
337
  post[:'3ds_redirect_url'] = three_ds_2_options[:notification_url]
@@ -357,8 +359,17 @@ module ActiveMerchant #:nodoc:
357
359
  end
358
360
 
359
361
  def add_3d_secure_1_data(post, options)
360
- post[:i8] = build_i8(options[:eci], options[:cavv], options[:xid])
361
- post[:'3ds_version'] = options[:three_ds_version].nil? || options[:three_ds_version] == '1' ? '1.0' : options[:three_ds_version]
362
+ if three_d_secure_options = options[:three_d_secure]
363
+ post[:i8] = build_i8(
364
+ three_d_secure_options[:eci],
365
+ three_d_secure_options[:cavv],
366
+ three_d_secure_options[:xid]
367
+ )
368
+ post[:'3ds_version'] = three_d_secure_options[:version]&.start_with?('1') ? '1.0' : three_d_secure_options[:version]
369
+ else
370
+ post[:i8] = build_i8(options[:eci], options[:cavv], options[:xid])
371
+ post[:'3ds_version'] = options[:three_ds_version].nil? || options[:three_ds_version]&.start_with?('1') ? '1.0' : options[:three_ds_version]
372
+ end
362
373
  end
363
374
 
364
375
  def add_normalized_3d_secure_2_data(post, options)
@@ -368,11 +379,11 @@ module ActiveMerchant #:nodoc:
368
379
  three_d_secure_options[:eci],
369
380
  three_d_secure_options[:cavv]
370
381
  )
371
- post[:'3ds_version'] = three_d_secure_options[:version] == '2' ? '2.0' : three_d_secure_options[:version]
382
+ post[:'3ds_version'] = three_d_secure_options[:version]&.start_with?('2') ? '2.0' : three_d_secure_options[:version]
372
383
  post[:'3ds_dstrxid'] = three_d_secure_options[:ds_transaction_id]
373
384
  end
374
385
 
375
- def build_i8(eci, cavv=nil, xid=nil)
386
+ def build_i8(eci, cavv = nil, xid = nil)
376
387
  "#{eci}:#{cavv || 'none'}:#{xid || 'none'}"
377
388
  end
378
389
 
@@ -26,12 +26,12 @@ module ActiveMerchant #:nodoc:
26
26
  'discover' => 'O'
27
27
  }
28
28
 
29
- def initialize(options={})
29
+ def initialize(options = {})
30
30
  requires!(options, :api_key, :company_number, :merchant_number)
31
31
  super
32
32
  end
33
33
 
34
- def purchase(money, payment, options={})
34
+ def purchase(money, payment, options = {})
35
35
  requires!(options, :order_id)
36
36
  post = {}
37
37
  add_terminal_number(post, options)
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  payment.is_a?(String) ? commit('purchaseWithToken', post) : commit('purchase', post)
46
46
  end
47
47
 
48
- def authorize(money, payment, options={})
48
+ def authorize(money, payment, options = {})
49
49
  requires!(options, :order_id)
50
50
  post = {}
51
51
  add_money(post, money)
@@ -59,7 +59,7 @@ module ActiveMerchant #:nodoc:
59
59
  payment.is_a?(String) ? commit('preAuthorizationWithToken', post) : commit('preAuthorization', post)
60
60
  end
61
61
 
62
- def capture(money, authorization, options={})
62
+ def capture(money, authorization, options = {})
63
63
  requires!(options, :order_id)
64
64
  post = {}
65
65
  add_invoice(post, money, options)
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  commit('completion', post)
74
74
  end
75
75
 
76
- def refund(money, authorization, options={})
76
+ def refund(money, authorization, options = {})
77
77
  requires!(options, :order_id)
78
78
  post = {}
79
79
  add_invoice(post, money, options)
@@ -86,7 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
  commit('refundWithoutCard', post)
87
87
  end
88
88
 
89
- def credit(money, payment, options={})
89
+ def credit(money, payment, options = {})
90
90
  requires!(options, :order_id)
91
91
  post = {}
92
92
  add_terminal_number(post, options)
@@ -100,7 +100,7 @@ module ActiveMerchant #:nodoc:
100
100
  payment.is_a?(String) ? commit('refundWithToken', post) : commit('refund', post)
101
101
  end
102
102
 
103
- def void(authorization, options={})
103
+ def void(authorization, options = {})
104
104
  post = {}
105
105
  post[:InputType] = 'I'
106
106
  post[:LanguageCode] = 'E'
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
  commit('void', post)
114
114
  end
115
115
 
116
- def verify(credit_card, options={})
116
+ def verify(credit_card, options = {})
117
117
  requires!(options, :order_id)
118
118
  post = {}
119
119
  add_terminal_number(post, options)
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  commit('verifyAccount', post)
127
127
  end
128
128
 
129
- def store(credit_card, options={})
129
+ def store(credit_card, options = {})
130
130
  requires!(options, :email)
131
131
  post = {
132
132
  LanguageCode: 'E',
@@ -228,7 +228,7 @@ module ActiveMerchant #:nodoc:
228
228
  r.process {
229
229
  split_auth = split_authorization(r.authorization)
230
230
  auth = (action.include?('recur') ? split_auth[4] : split_auth[0])
231
- action.include?('recur') ? commit_raw('recur/ack', {ID: auth}) : commit_raw('ack', {TransactionNumber: auth})
231
+ action.include?('recur') ? commit_raw('recur/ack', { ID: auth }) : commit_raw('ack', { TransactionNumber: auth })
232
232
  }
233
233
  end
234
234
  end