activemerchant 1.107.4 → 1.112.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +63 -0
  3. data/README.md +3 -3
  4. data/lib/active_merchant/billing/base.rb +0 -13
  5. data/lib/active_merchant/billing/check.rb +1 -1
  6. data/lib/active_merchant/billing/credit_card.rb +2 -0
  7. data/lib/active_merchant/billing/credit_card_methods.rb +9 -6
  8. data/lib/active_merchant/billing/gateways/adyen.rb +23 -12
  9. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  10. data/lib/active_merchant/billing/gateways/authorize_net.rb +8 -8
  11. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  12. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  13. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/balanced.rb +1 -1
  15. data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  18. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +2 -2
  19. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/be2bill.rb +1 -1
  21. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -4
  22. data/lib/active_merchant/billing/gateways/blue_pay.rb +4 -4
  23. data/lib/active_merchant/billing/gateways/blue_snap.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/borgun.rb +3 -3
  25. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/braintree_blue.rb +82 -34
  28. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  30. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/card_stream.rb +4 -4
  33. data/lib/active_merchant/billing/gateways/cardknox.rb +4 -4
  34. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cenpos.rb +12 -12
  38. data/lib/active_merchant/billing/gateways/checkout.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -2
  40. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
  41. data/lib/active_merchant/billing/gateways/clearhaus.rb +4 -4
  42. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/credorax.rb +7 -3
  46. data/lib/active_merchant/billing/gateways/ct_payment.rb +2 -2
  47. data/lib/active_merchant/billing/gateways/culqi.rb +1 -1
  48. data/lib/active_merchant/billing/gateways/cyber_source.rb +67 -19
  49. data/lib/active_merchant/billing/gateways/d_local.rb +20 -6
  50. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  51. data/lib/active_merchant/billing/gateways/decidir.rb +24 -0
  52. data/lib/active_merchant/billing/gateways/dibs.rb +2 -2
  53. data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
  54. data/lib/active_merchant/billing/gateways/ebanx.rb +4 -4
  55. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/elavon.rb +5 -4
  57. data/lib/active_merchant/billing/gateways/element.rb +8 -4
  58. data/lib/active_merchant/billing/gateways/epay.rb +3 -3
  59. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/eway.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  62. data/lib/active_merchant/billing/gateways/eway_rapid.rb +2 -2
  63. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  64. data/lib/active_merchant/billing/gateways/ezic.rb +1 -1
  65. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
  66. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +5 -5
  71. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +12 -4
  72. data/lib/active_merchant/billing/gateways/flo2cash.rb +10 -10
  73. data/lib/active_merchant/billing/gateways/forte.rb +3 -3
  74. data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +10 -5
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
  80. data/lib/active_merchant/billing/gateways/inspire.rb +1 -1
  81. data/lib/active_merchant/billing/gateways/instapay.rb +1 -1
  82. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  83. data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
  84. data/lib/active_merchant/billing/gateways/itransact.rb +1 -1
  85. data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
  86. data/lib/active_merchant/billing/gateways/ixopay.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/jetpay.rb +2 -2
  88. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/kushki.rb +4 -4
  91. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  92. data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -2
  93. data/lib/active_merchant/billing/gateways/litle.rb +5 -5
  94. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  95. data/lib/active_merchant/billing/gateways/mercado_pago.rb +11 -6
  96. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -1
  97. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  100. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +2 -2
  102. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  103. data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
  104. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  105. data/lib/active_merchant/billing/gateways/migs.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -1
  107. data/lib/active_merchant/billing/gateways/monei.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/moneris.rb +17 -17
  109. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  110. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  111. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  112. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +3 -3
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +51 -23
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  117. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  118. data/lib/active_merchant/billing/gateways/network_merchants.rb +1 -1
  119. data/lib/active_merchant/billing/gateways/nmi.rb +4 -4
  120. data/lib/active_merchant/billing/gateways/ogone.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/omise.rb +1 -1
  122. data/lib/active_merchant/billing/gateways/openpay.rb +1 -1
  123. data/lib/active_merchant/billing/gateways/opp.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -4
  125. data/lib/active_merchant/billing/gateways/orbital.rb +6 -6
  126. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  127. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  128. data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
  129. data/lib/active_merchant/billing/gateways/pago_facil.rb +1 -1
  130. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +2 -2
  132. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/pay_junction.rb +3 -3
  134. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  135. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/paybox_direct.rb +3 -3
  137. data/lib/active_merchant/billing/gateways/payeezy.rb +2 -2
  138. data/lib/active_merchant/billing/gateways/payex.rb +13 -13
  139. data/lib/active_merchant/billing/gateways/payflow.rb +5 -5
  140. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  143. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -1
  144. data/lib/active_merchant/billing/gateways/paymill.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal.rb +2 -2
  146. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
  149. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  150. data/lib/active_merchant/billing/gateways/payu_latam.rb +11 -9
  151. data/lib/active_merchant/billing/gateways/payway.rb +1 -1
  152. data/lib/active_merchant/billing/gateways/pin.rb +2 -2
  153. data/lib/active_merchant/billing/gateways/plugnpay.rb +5 -5
  154. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/psl_card.rb +2 -2
  157. data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
  158. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  159. data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -6
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +3 -3
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +4 -4
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  163. data/lib/active_merchant/billing/gateways/realex.rb +3 -2
  164. data/lib/active_merchant/billing/gateways/redsys.rb +5 -5
  165. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -2
  167. data/lib/active_merchant/billing/gateways/sage.rb +3 -3
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +3 -3
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -1
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -1
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -2
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +1 -1
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +5 -5
  176. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  177. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  178. data/lib/active_merchant/billing/gateways/stripe.rb +6 -6
  179. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +21 -2
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/telr.rb +4 -4
  182. data/lib/active_merchant/billing/gateways/tns.rb +1 -1
  183. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  184. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +1 -1
  185. data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
  186. data/lib/active_merchant/billing/gateways/transax.rb +1 -1
  187. data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
  188. data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +6 -6
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +1 -1
  191. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  192. data/lib/active_merchant/billing/gateways/verifi.rb +3 -3
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +3 -3
  195. data/lib/active_merchant/billing/gateways/webpay.rb +1 -1
  196. data/lib/active_merchant/billing/gateways/wepay.rb +2 -2
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -1
  198. data/lib/active_merchant/billing/gateways/world_net.rb +35 -35
  199. data/lib/active_merchant/billing/gateways/worldpay.rb +7 -7
  200. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  201. data/lib/active_merchant/billing/gateways/worldpay_us.rb +1 -1
  202. data/lib/active_merchant/connection.rb +40 -42
  203. data/lib/active_merchant/network_connection_retries.rb +10 -12
  204. data/lib/active_merchant/version.rb +1 -1
  205. data/lib/support/gateway_support.rb +1 -1
  206. metadata +46 -32
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.supported_countries = ['US']
10
10
 
11
11
  # The card types supported by the payment gateway
12
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
+ self.supported_cardtypes = %i[visa master american_express discover]
13
13
 
14
14
  # The homepage URL of the gateway
15
15
  self.homepage_url = 'https://www.nelixtransax.com/'
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  GI GR HK HU ID IE IL IM IN IS IT JO KW LB LI LK LT LU LV MC
11
11
  MT MU MV MX MY NL NO NZ OM PH PL PT QA RO SA SE SG SI SK SM
12
12
  TR TT UM US VA VN ZA)
13
- self.supported_cardtypes = [:visa, :master, :american_express]
13
+ self.supported_cardtypes = %i[visa master american_express]
14
14
  self.homepage_url = 'https://trexle.com'
15
15
  self.display_name = 'Trexle'
16
16
 
@@ -137,7 +137,7 @@ module ActiveMerchant #:nodoc:
137
137
  name: creditcard.name
138
138
  )
139
139
  elsif creditcard.kind_of?(String)
140
- if creditcard =~ /^token_/
140
+ if /^token_/.match?(creditcard)
141
141
  post[:card_token] = creditcard
142
142
  else
143
143
  post[:customer_token] = creditcard
@@ -67,7 +67,7 @@ module ActiveMerchant #:nodoc:
67
67
  class TrustCommerceGateway < Gateway
68
68
  self.live_url = self.test_url = 'https://vault.trustcommerce.com/trans/'
69
69
 
70
- SUCCESS_TYPES = ['approved', 'accepted']
70
+ SUCCESS_TYPES = %w[approved accepted]
71
71
 
72
72
  DECLINE_CODES = {
73
73
  'decline' => 'The credit card was declined',
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  VOIDABLE_ACTIONS = %w(preauth sale postauth credit)
108
108
 
109
109
  self.money_format = :cents
110
- self.supported_cardtypes = [:visa, :master, :discover, :american_express, :diners_club, :jcb]
110
+ self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
111
111
  self.supported_countries = ['US']
112
112
  self.homepage_url = 'http://www.trustcommerce.com/'
113
113
  self.display_name = 'TrustCommerce'
@@ -185,7 +185,7 @@ module ActiveMerchant #:nodoc:
185
185
  # postauth, we preserve active_merchant's nomenclature of capture() for consistency with the rest of the library. To process
186
186
  # a postauthorization with TC, you need an amount in cents or a money object, and a TC transid.
187
187
  def capture(money, authorization, options = {})
188
- transaction_id, _ = split_authorization(authorization)
188
+ transaction_id, = split_authorization(authorization)
189
189
  parameters = {
190
190
  amount: amount(money),
191
191
  transid: transaction_id,
@@ -199,7 +199,7 @@ module ActiveMerchant #:nodoc:
199
199
  # refund() allows you to return money to a card that was previously billed. You need to supply the amount, in cents or a money object,
200
200
  # that you want to refund, and a TC transid for the transaction that you are refunding.
201
201
  def refund(money, identification, options = {})
202
- transaction_id, _ = split_authorization(identification)
202
+ transaction_id, = split_authorization(identification)
203
203
 
204
204
  parameters = {
205
205
  amount: amount(money),
@@ -262,7 +262,7 @@ module ActiveMerchant #:nodoc:
262
262
  def recurring(money, creditcard, options = {})
263
263
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
264
264
 
265
- requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily])
265
+ requires!(options, %i[periodicity bimonthly monthly biweekly weekly yearly daily])
266
266
 
267
267
  cycle =
268
268
  case options[:periodicity]
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  FAILURE_MESSAGE = 'Default Failure' #:nodoc:
74
74
 
75
75
  self.supported_countries = ['US']
76
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
76
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
77
77
  self.homepage_url = 'http://www.usaepay.com/'
78
78
  self.display_name = 'USA ePay Advanced SOAP Interface'
79
79
 
@@ -676,9 +676,9 @@ module ActiveMerchant #:nodoc:
676
676
  commit(__method__, request)
677
677
  end
678
678
 
679
- TRANSACTION_METHODS = [
680
- :run_sale, :run_auth_only, :run_credit,
681
- :run_check_sale, :run_check_credit
679
+ TRANSACTION_METHODS = %i[
680
+ run_sale run_auth_only run_credit
681
+ run_check_sale run_check_credit
682
682
  ] #:nodoc:
683
683
 
684
684
  TRANSACTION_METHODS.each do |method|
@@ -1336,7 +1336,7 @@ module ActiveMerchant #:nodoc:
1336
1336
  when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
1337
1337
  build_tag soap, :string, 'CardNumber', payment_method[:method].number
1338
1338
  build_tag soap, :string, 'CardExpiration',
1339
- "#{"%02d" % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
1339
+ "#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
1340
1340
  if options[:billing_address]
1341
1341
  build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
1342
1342
  build_tag soap, :string, 'AvsZip', options[:billing_address][:zip]
@@ -1432,7 +1432,7 @@ module ActiveMerchant #:nodoc:
1432
1432
  def build_card_expiration(options)
1433
1433
  month = options[:payment_method].month
1434
1434
  year = options[:payment_method].year
1435
- "#{"%02d" % month}#{year.to_s[-2..-1]}" unless month.nil? || year.nil?
1435
+ "#{'%02d' % month}#{year.to_s[-2..-1]}" unless month.nil? || year.nil?
1436
1436
  end
1437
1437
 
1438
1438
  def build_check_data(soap, options)
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.live_url = 'https://www.usaepay.com/gate'
5
5
  self.test_url = 'https://sandbox.usaepay.com/gate'
6
6
 
7
- self.supported_cardtypes = [:visa, :master, :american_express]
7
+ self.supported_cardtypes = %i[visa master american_express]
8
8
  self.supported_countries = ['US']
9
9
  self.homepage_url = 'http://www.usaepay.com/'
10
10
  self.display_name = 'USA ePay'
@@ -10,7 +10,7 @@ module ActiveMerchant
10
10
 
11
11
  self.supported_countries = ['US']
12
12
  self.default_currency = 'USD'
13
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
13
+ self.supported_cardtypes = %i[visa master american_express discover]
14
14
 
15
15
  self.homepage_url = 'http://vancopayments.com/'
16
16
  self.display_name = 'Vanco Payment Solutions'
@@ -5,8 +5,8 @@ module ActiveMerchant #:nodoc:
5
5
  class VerifiGateway < Gateway
6
6
  class VerifiPostData < PostData
7
7
  # Fields that will be sent even if they are blank
8
- self.required_fields = [:amount, :type, :ccnumber, :ccexp, :firstname, :lastname,
9
- :company, :address1, :address2, :city, :state, :zip, :country, :phone]
8
+ self.required_fields = %i[amount type ccnumber ccexp firstname lastname
9
+ company address1 address2 city state zip country phone]
10
10
  end
11
11
 
12
12
  self.live_url = self.test_url = 'https://secure.verifi.com/gw/api/transact.php'
@@ -59,7 +59,7 @@ module ActiveMerchant #:nodoc:
59
59
  }
60
60
 
61
61
  self.supported_countries = ['US']
62
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
62
+ self.supported_cardtypes = %i[visa master american_express discover]
63
63
  self.homepage_url = 'http://www.verifi.com/'
64
64
  self.display_name = 'Verifi'
65
65
 
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
14
14
 
15
15
  APPROVED = '0'
16
16
 
17
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
17
+ self.supported_cardtypes = %i[visa master american_express discover]
18
18
  self.supported_countries = ['US']
19
19
  self.display_name = 'ViaKLIX'
20
20
  self.homepage_url = 'http://viaklix.com'
@@ -8,10 +8,10 @@ module ActiveMerchant #:nodoc:
8
8
  self.test_url = 'https://devapi.vnforapps.com/api.tokenization/api/v2/merchant'
9
9
  self.live_url = 'https://api.vnforapps.com/api.tokenization/api/v2/merchant'
10
10
 
11
- self.supported_countries = ['US', 'PE']
11
+ self.supported_countries = %w[US PE]
12
12
  self.default_currency = 'PEN'
13
13
  self.money_format = :dollars
14
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
14
+ self.supported_cardtypes = %i[visa master american_express discover]
15
15
 
16
16
  def initialize(options={})
17
17
  requires!(options, :access_key_id, :secret_access_key, :merchant_id)
@@ -98,7 +98,7 @@ module ActiveMerchant #:nodoc:
98
98
  end
99
99
 
100
100
  def add_auth_order_id(params, authorization, options)
101
- purchase_number, _ = split_authorization(authorization)
101
+ purchase_number, = split_authorization(authorization)
102
102
  params[:purchaseNumber] = purchase_number
103
103
  params[:externalTransactionId] = options[:order_id]
104
104
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.supported_countries = ['JP']
9
9
  self.default_currency = 'JPY'
10
10
  self.money_format = :cents
11
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club]
11
+ self.supported_cardtypes = %i[visa master american_express jcb diners_club]
12
12
 
13
13
  self.homepage_url = 'https://webpay.jp/'
14
14
  self.display_name = 'WebPay'
@@ -4,8 +4,8 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://stage.wepayapi.com/v2'
5
5
  self.live_url = 'https://wepayapi.com/v2'
6
6
 
7
- self.supported_countries = ['US', 'CA']
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
7
+ self.supported_countries = %w[US CA]
8
+ self.supported_cardtypes = %i[visa master american_express discover]
9
9
  self.homepage_url = 'https://www.wepay.com/'
10
10
  self.default_currency = 'USD'
11
11
  self.display_name = 'WePay'
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
26
26
  # number 5551234 within area code 202 (country code 1).
27
27
  VALID_PHONE_FORMAT = /\+\d{1,3}(\(?\d{3}\)?)?\d{3}-\d{4}-\d{3}/
28
28
 
29
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
29
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
30
30
  self.supported_countries = %w(AD CY GI IM MT RO CH AT DK GR IT MC SM TR BE EE HU LV NL SK GB BG FI IS LI NO SI VA FR IL LT PL ES CZ DE IE LU PT SE)
31
31
  self.homepage_url = 'http://www.wirecard.com'
32
32
  self.display_name = 'Wirecard'
@@ -279,49 +279,49 @@ module ActiveMerchant #:nodoc:
279
279
  # Gateway expects fields in fixed order below.
280
280
  case action
281
281
  when 'PAYMENT', 'PREAUTH'
282
- [
283
- :orderid,
284
- :terminalid,
285
- :amount,
286
- :datetime,
287
- :cardnumber, :cardtype, :cardexpiry, :cardholdername,
288
- :hash,
289
- :currency,
290
- :terminaltype,
291
- :transactiontype,
292
- :email,
293
- :cvv,
294
- :address1, :address2,
295
- :postcode,
296
- :description,
297
- :city, :country,
298
- :ipaddress
282
+ %i[
283
+ orderid
284
+ terminalid
285
+ amount
286
+ datetime
287
+ cardnumber cardtype cardexpiry cardholdername
288
+ hash
289
+ currency
290
+ terminaltype
291
+ transactiontype
292
+ email
293
+ cvv
294
+ address1 address2
295
+ postcode
296
+ description
297
+ city country
298
+ ipaddress
299
299
  ]
300
300
  when 'PREAUTHCOMPLETION'
301
- [:uniqueref, :terminalid, :amount, :datetime, :hash]
301
+ %i[uniqueref terminalid amount datetime hash]
302
302
  when 'REFUND'
303
- [:uniqueref, :terminalid, :amount, :datetime, :hash,
304
- :operator, :reason]
303
+ %i[uniqueref terminalid amount datetime hash
304
+ operator reason]
305
305
  when 'VOID'
306
306
  [:uniqueref]
307
307
  when 'SECURECARDREGISTRATION'
308
- [
309
- :merchantref,
310
- :terminalid,
311
- :datetime,
312
- :cardnumber, :cardexpiry, :cardtype, :cardholdername,
313
- :hash,
314
- :dontchecksecurity,
315
- :cvv,
316
- :issueno
308
+ %i[
309
+ merchantref
310
+ terminalid
311
+ datetime
312
+ cardnumber cardexpiry cardtype cardholdername
313
+ hash
314
+ dontchecksecurity
315
+ cvv
316
+ issueno
317
317
  ]
318
318
  when 'SECURECARDREMOVAL'
319
- [
320
- :merchantref,
321
- :cardreference,
322
- :terminalid,
323
- :datetime,
324
- :hash
319
+ %i[
320
+ merchantref
321
+ cardreference
322
+ terminalid
323
+ datetime
324
+ hash
325
325
  ]
326
326
  end
327
327
  end
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.default_currency = 'GBP'
10
10
  self.money_format = :cents
11
11
  self.supported_countries = %w(HK GB AU AD AR BE BR CA CH CN CO CR CY CZ DE DK ES FI FR GI GR HU IE IN IT JP LI LU MC MT MY MX NL NO NZ PA PE PL PT SE SG SI SM TR UM VA)
12
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro, :elo, :naranja, :cabal]
12
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro elo naranja cabal]
13
13
  self.currencies_without_fractions = %w(HUF IDR ISK JPY KRW)
14
14
  self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
15
15
  self.homepage_url = 'http://www.worldpay.com/'
@@ -217,7 +217,7 @@ module ActiveMerchant #:nodoc:
217
217
  end
218
218
 
219
219
  def order_tag_attributes(options)
220
- { 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v }
220
+ { 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v.present? }
221
221
  end
222
222
 
223
223
  def build_capture_request(money, authorization, options)
@@ -406,7 +406,7 @@ module ActiveMerchant #:nodoc:
406
406
  def add_three_d_secure(three_d_secure, xml)
407
407
  xml.info3DSecure do
408
408
  xml.threeDSVersion three_d_secure[:version]
409
- if three_d_secure[:version] =~ /^2/
409
+ if /^2/.match?(three_d_secure[:version])
410
410
  xml.dsTransactionId three_d_secure[:ds_transaction_id]
411
411
  else
412
412
  xml.xid three_d_secure[:xid]
@@ -429,7 +429,7 @@ module ActiveMerchant #:nodoc:
429
429
  xml.cardHolderName card_holder_name
430
430
  xml.cvc payment_method.verification_value
431
431
 
432
- add_address(xml, (options[:billing_address] || options[:address]))
432
+ add_address(xml, (options[:billing_address] || options[:address]), options)
433
433
  end
434
434
 
435
435
  def add_stored_credential_options(xml, options={})
@@ -485,7 +485,7 @@ module ActiveMerchant #:nodoc:
485
485
  xml.authenticatedShopperID options[:customer] if options[:customer]
486
486
  end
487
487
 
488
- def add_address(xml, address)
488
+ def add_address(xml, address, options)
489
489
  return unless address
490
490
 
491
491
  address = address_with_defaults(address)
@@ -500,7 +500,7 @@ module ActiveMerchant #:nodoc:
500
500
  xml.address2 address[:address2] if address[:address2]
501
501
  xml.postalCode address[:zip]
502
502
  xml.city address[:city]
503
- xml.state address[:state]
503
+ xml.state address[:state] unless address[:country] != 'US' && options[:execute_threed]
504
504
  xml.countryCode address[:country]
505
505
  xml.telephoneNumber address[:phone] if address[:phone]
506
506
  end
@@ -663,7 +663,7 @@ module ActiveMerchant #:nodoc:
663
663
  end
664
664
 
665
665
  def required_status_message(raw, success_criteria)
666
- "A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required." if !success_criteria.include?(raw[:last_event])
666
+ "A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(' or ')} is required." if !success_criteria.include?(raw[:last_event])
667
667
  end
668
668
 
669
669
  def authorization_from(action, raw, options)
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.money_format = :cents
9
9
 
10
10
  self.supported_countries = %w(HK US GB BE CH CZ DE DK ES FI FR GR HU IE IT LU MT NL NO PL PT SE SG TR)
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro]
12
12
 
13
13
  self.homepage_url = 'http://online.worldpay.com'
14
14
  self.display_name = 'Worldpay Online Payments'
@@ -15,7 +15,7 @@ module ActiveMerchant #:nodoc:
15
15
  self.supported_countries = ['US']
16
16
  self.default_currency = 'USD'
17
17
  self.money_format = :dollars
18
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb]
18
+ self.supported_cardtypes = %i[visa master american_express discover jcb]
19
19
 
20
20
  def initialize(options={})
21
21
  requires!(options, :acctid, :subid, :merchantpin)
@@ -73,52 +73,50 @@ module ActiveMerchant
73
73
  headers['connection'] ||= 'close'
74
74
 
75
75
  retry_exceptions(max_retries: max_retries, logger: logger, tag: tag) do
76
- begin
77
- info "connection_http_method=#{method.to_s.upcase} connection_uri=#{endpoint}", tag
78
-
79
- result = nil
80
-
81
- realtime = Benchmark.realtime do
82
- http.start unless http.started?
83
- @ssl_connection = http.ssl_connection
84
- info "connection_ssl_version=#{ssl_connection[:version]} connection_ssl_cipher=#{ssl_connection[:cipher]}", tag
85
-
86
- result =
87
- case method
88
- when :get
89
- raise ArgumentError, 'GET requests do not support a request body' if body
90
-
91
- http.get(endpoint.request_uri, headers)
92
- when :post
76
+ info "connection_http_method=#{method.to_s.upcase} connection_uri=#{endpoint}", tag
77
+
78
+ result = nil
79
+
80
+ realtime = Benchmark.realtime do
81
+ http.start unless http.started?
82
+ @ssl_connection = http.ssl_connection
83
+ info "connection_ssl_version=#{ssl_connection[:version]} connection_ssl_cipher=#{ssl_connection[:cipher]}", tag
84
+
85
+ result =
86
+ case method
87
+ when :get
88
+ raise ArgumentError, 'GET requests do not support a request body' if body
89
+
90
+ http.get(endpoint.request_uri, headers)
91
+ when :post
92
+ debug body
93
+ http.post(endpoint.request_uri, body, RUBY_184_POST_HEADERS.merge(headers))
94
+ when :put
95
+ debug body
96
+ http.put(endpoint.request_uri, body, headers)
97
+ when :patch
98
+ debug body
99
+ http.patch(endpoint.request_uri, body, headers)
100
+ when :delete
101
+ # It's kind of ambiguous whether the RFC allows bodies
102
+ # for DELETE requests. But Net::HTTP's delete method
103
+ # very unambiguously does not.
104
+ if body
93
105
  debug body
94
- http.post(endpoint.request_uri, body, RUBY_184_POST_HEADERS.merge(headers))
95
- when :put
96
- debug body
97
- http.put(endpoint.request_uri, body, headers)
98
- when :patch
99
- debug body
100
- http.patch(endpoint.request_uri, body, headers)
101
- when :delete
102
- # It's kind of ambiguous whether the RFC allows bodies
103
- # for DELETE requests. But Net::HTTP's delete method
104
- # very unambiguously does not.
105
- if body
106
- debug body
107
- req = Net::HTTP::Delete.new(endpoint.request_uri, headers)
108
- req.body = body
109
- http.request(req)
110
- else
111
- http.delete(endpoint.request_uri, headers)
112
- end
106
+ req = Net::HTTP::Delete.new(endpoint.request_uri, headers)
107
+ req.body = body
108
+ http.request(req)
113
109
  else
114
- raise ArgumentError, "Unsupported request method #{method.to_s.upcase}"
110
+ http.delete(endpoint.request_uri, headers)
115
111
  end
116
- end
117
-
118
- info '--> %d %s (%d %.4fs)' % [result.code, result.message, result.body ? result.body.length : 0, realtime], tag
119
- debug result.body
120
- result
112
+ else
113
+ raise ArgumentError, "Unsupported request method #{method.to_s.upcase}"
114
+ end
121
115
  end
116
+
117
+ info '--> %d %s (%d %.4fs)' % [result.code, result.message, result.body ? result.body.length : 0, realtime], tag
118
+ debug result.body
119
+ result
122
120
  end
123
121
  ensure
124
122
  info 'connection_request_total_time=%.4fs' % [Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start], tag