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
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  self.money_format = :cents
45
45
 
46
46
  # Not all card types may be activated by the bank!
47
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club, :unionpay]
47
+ self.supported_cardtypes = %i[visa master american_express jcb diners_club unionpay]
48
48
  self.homepage_url = 'http://www.redsys.es/'
49
49
  self.display_name = 'Redsys'
50
50
 
@@ -225,7 +225,7 @@ module ActiveMerchant #:nodoc:
225
225
  data = {}
226
226
  add_action(data, :capture)
227
227
  add_amount(data, money, options)
228
- order_id, _, _ = split_authorization(authorization)
228
+ order_id, = split_authorization(authorization)
229
229
  add_order(data, order_id)
230
230
  data[:description] = options[:description]
231
231
 
@@ -247,7 +247,7 @@ module ActiveMerchant #:nodoc:
247
247
  data = {}
248
248
  add_action(data, :refund)
249
249
  add_amount(data, money, options)
250
- order_id, _, _ = split_authorization(authorization)
250
+ order_id, = split_authorization(authorization)
251
251
  add_order(data, order_id)
252
252
  data[:description] = options[:description]
253
253
 
@@ -480,7 +480,7 @@ module ActiveMerchant #:nodoc:
480
480
  else
481
481
  message = 'Response failed validation check'
482
482
  end
483
- elsif ['iniciaPeticion', 'trataPeticion'].include?(action)
483
+ elsif %w[iniciaPeticion trataPeticion].include?(action)
484
484
  vxml = Nokogiri::XML(data).remove_namespaces!.xpath("//Envelope/Body/#{action}Response/#{action}Return").inner_text
485
485
  xml = Nokogiri::XML(vxml)
486
486
  node = (action == 'iniciaPeticion' ? 'INFOTARJETA' : 'OPERACION')
@@ -565,7 +565,7 @@ module ActiveMerchant #:nodoc:
565
565
 
566
566
  def clean_order_id(order_id)
567
567
  cleansed = order_id.gsub(/[^\da-zA-Z]/, '')
568
- if cleansed =~ /^\d{4}/
568
+ if /^\d{4}/.match?(cleansed)
569
569
  cleansed[0..11]
570
570
  else
571
571
  '%04d%s' % [rand(0..9999), cleansed[0...8]]
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.supported_countries = ['DK']
10
10
  self.default_currency = 'EUR'
11
- self.supported_cardtypes = [:visa, :master, :maestro]
11
+ self.supported_cardtypes = %i[visa master maestro]
12
12
 
13
13
  self.homepage_url = 'http://www.s5.dk/'
14
14
  self.display_name = 'S5'
@@ -6,9 +6,9 @@ module ActiveMerchant #:nodoc:
6
6
  self.test_url = 'https://process.sandbox.safecharge.com/service.asmx/Process'
7
7
  self.live_url = 'https://process.safecharge.com/service.asmx/Process'
8
8
 
9
- self.supported_countries = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'GR', 'ES', 'FI', 'FR', 'GI', 'HK', 'HR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SG', 'SI', 'SK', 'GB', 'US']
9
+ self.supported_countries = %w[AT BE BG CY CZ DE DK EE GR ES FI FR GI HK HR HU IE IS IT LI LT LU LV MT MX NL NO PL PT RO SE SG SI SK GB US]
10
10
  self.default_currency = 'USD'
11
- self.supported_cardtypes = [:visa, :master]
11
+ self.supported_cardtypes = %i[visa master]
12
12
 
13
13
  self.homepage_url = 'https://www.safecharge.com'
14
14
  self.display_name = 'SafeCharge'
@@ -7,8 +7,8 @@ module ActiveMerchant #:nodoc:
7
7
  self.homepage_url = 'Sage Payment Solutions'
8
8
  self.live_url = 'https://www.sagepayments.net/cgi-bin'
9
9
 
10
- self.supported_countries = ['US', 'CA']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
10
+ self.supported_countries = %w[US CA]
11
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club]
12
12
 
13
13
  TRANSACTIONS = {
14
14
  purchase: '01',
@@ -215,7 +215,7 @@ module ActiveMerchant #:nodoc:
215
215
  end
216
216
 
217
217
  def add_reference(post, reference)
218
- ref, _ = reference.to_s.split(';')
218
+ ref, = reference.to_s.split(';')
219
219
  post[:T_reference] = ref
220
220
  end
221
221
 
@@ -69,8 +69,8 @@ module ActiveMerchant #:nodoc:
69
69
  recipient_dob: :FIRecipientDoB
70
70
  }
71
71
 
72
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro, :diners_club]
73
- self.supported_countries = ['GB', 'IE']
72
+ self.supported_countries = %w[GB IE]
73
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro diners_club]
74
74
  self.default_currency = 'GBP'
75
75
 
76
76
  self.homepage_url = 'http://www.sagepay.com'
@@ -390,7 +390,7 @@ module ActiveMerchant #:nodoc:
390
390
  end
391
391
 
392
392
  def build_simulator_url(action)
393
- endpoint = [:purchase, :authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
393
+ endpoint = %i[purchase authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
394
394
  "#{self.simulator_url}/#{endpoint}"
395
395
  end
396
396
 
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.supported_countries = ['US']
8
8
 
9
9
  # The card types supported by the payment gateway
10
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
10
+ self.supported_cardtypes = %i[visa master american_express discover]
11
11
 
12
12
  # The homepage URL of the gateway
13
13
  self.homepage_url = 'http://www.salliemae.com/'
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  NIL_ATTRIBUTE = { 'i:nil' => 'true' }
19
19
 
20
20
  self.supported_countries = ['US']
21
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
21
+ self.supported_cardtypes = %i[visa master american_express discover]
22
22
  self.homepage_url = 'http://www.securenet.com/'
23
23
  self.display_name = 'SecureNet'
24
24
 
@@ -17,7 +17,7 @@ module ActiveMerchant #:nodoc:
17
17
  self.default_currency = 'USD'
18
18
 
19
19
  self.supported_countries = %w(US CA GB AU)
20
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
20
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
21
21
  self.homepage_url = 'http://www.securepay.com/'
22
22
  self.display_name = 'SecurePay'
23
23
 
@@ -15,7 +15,7 @@ module ActiveMerchant #:nodoc:
15
15
  self.live_periodic_url = 'https://api.securepay.com.au/xmlapi/periodic'
16
16
 
17
17
  self.supported_countries = ['AU']
18
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
18
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
19
19
 
20
20
  # The homepage URL of the gateway
21
21
  self.homepage_url = 'http://securepay.com.au'
@@ -54,7 +54,7 @@ module ActiveMerchant #:nodoc:
54
54
  trigger: nil
55
55
  }
56
56
 
57
- SUCCESS_CODES = ['00', '08', '11', '16', '77']
57
+ SUCCESS_CODES = %w[00 08 11 16 77]
58
58
 
59
59
  def initialize(options = {})
60
60
  requires!(options, :login, :password)
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class SecurePayTechGateway < Gateway
4
4
  class SecurePayTechPostData < PostData
5
- self.required_fields = [:OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency]
5
+ self.required_fields = %i[OrderReference CardNumber CardExpiry CardHolderName CardType MerchantID MerchantKey Amount Currency]
6
6
  end
7
7
 
8
8
  self.live_url = self.test_url = 'https://tx.securepaytech.com/web/HttpPostPurchase'
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
 
22
22
  self.default_currency = 'NZD'
23
23
  self.supported_countries = ['NZ']
24
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
24
+ self.supported_cardtypes = %i[visa master american_express diners_club]
25
25
  self.homepage_url = 'http://www.securepaytech.com/'
26
26
  self.display_name = 'SecurePayTech'
27
27
 
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
 
10
10
  self.default_currency = 'USD'
11
11
  self.money_format = :cents
12
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
12
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club]
13
13
 
14
14
  self.homepage_url = 'https://securionpay.com/'
15
15
  self.display_name = 'SecurionPay'
@@ -160,8 +160,8 @@ module ActiveMerchant #:nodoc:
160
160
  '-117' => 'POS Check Invalid Cashier Number'
161
161
  }
162
162
 
163
- self.supported_countries = ['US', 'CA']
164
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover, :diners_club]
163
+ self.supported_countries = %w[US CA]
164
+ self.supported_cardtypes = %i[visa master american_express jcb discover diners_club]
165
165
  self.homepage_url = 'http://www.skipjack.com/'
166
166
  self.display_name = 'SkipJack'
167
167
 
@@ -300,9 +300,9 @@ module ActiveMerchant #:nodoc:
300
300
  when :authorization
301
301
  parse_authorization_response(body)
302
302
  when :get_status
303
- parse_status_response(body, [:SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber])
303
+ parse_status_response(body, %i[SerialNumber TransactionAmount TransactionStatusCode TransactionStatusMessage OrderNumber TransactionDateTime TransactionID ApprovalCode BatchNumber])
304
304
  else
305
- parse_status_response(body, [:SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID])
305
+ parse_status_response(body, %i[SerialNumber TransactionAmount DesiredStatus StatusResponse StatusResponseMessage OrderNumber AuditID])
306
306
  end
307
307
  end
308
308
 
@@ -329,7 +329,7 @@ module ActiveMerchant #:nodoc:
329
329
  def parse_status_response(body, response_keys)
330
330
  lines = split_lines(body)
331
331
 
332
- keys = [:szSerialNumber, :szErrorCode, :szNumberRecords]
332
+ keys = %i[szSerialNumber szErrorCode szNumberRecords]
333
333
  values = split_line(lines[0])[0..2]
334
334
 
335
335
  result = Hash[*keys.zip(values).flatten]
@@ -4,13 +4,13 @@ module ActiveMerchant #:nodoc:
4
4
  self.live_url = self.test_url = 'https://secure.soeasypay.com/gateway.asmx'
5
5
  self.money_format = :cents
6
6
 
7
- self.supported_countries = [
8
- 'US', 'CA', 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE',
9
- 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU',
10
- 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB',
11
- 'IS', 'NO', 'CH'
7
+ self.supported_countries = %w[
8
+ US CA AT BE BG HR CY CZ DK EE
9
+ FI FR DE GR HU IE IT LV LT LU
10
+ MT NL PL PT RO SK SI ES SE GB
11
+ IS NO CH
12
12
  ]
13
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :maestro, :jcb, :diners_club]
13
+ self.supported_cardtypes = %i[visa master american_express discover maestro jcb diners_club]
14
14
  self.homepage_url = 'http://www.soeasypay.com/'
15
15
  self.display_name = 'SoEasyPay'
16
16
 
@@ -149,7 +149,7 @@ module ActiveMerchant #:nodoc:
149
149
  def parse(response, action)
150
150
  result = {}
151
151
  document = REXML::Document.new(response)
152
- response_element = document.root.get_elements("//[@xsi:type='tns:#{action}Response']").first
152
+ response_element = document.root.get_elements("//*[@xsi:type='tns:#{action}Response']").first
153
153
  response_element.elements.each do |element|
154
154
  result[element.name.underscore] = element.text
155
155
  end
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
14
14
  MT MU MV MX MY NL NO NZ OM PH PL PT QA RO SA SE SG SI SK SM
15
15
  TR TT UM US VA VN ZA)
16
16
 
17
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
17
+ self.supported_cardtypes = %i[visa master american_express discover]
18
18
  self.homepage_url = 'https://spreedly.com'
19
19
  self.display_name = 'Spreedly'
20
20
  self.money_format = :cents
@@ -25,10 +25,10 @@ module ActiveMerchant #:nodoc:
25
25
 
26
26
  DEFAULT_API_VERSION = '2015-04-07'
27
27
 
28
- self.supported_countries = %w(AT AU BE BR CA CH DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MX NL NO NZ PL PT SE SG SI SK US)
28
+ self.supported_countries = %w(AT AU BE BG BR CA CH CY CZ DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MT MX NL NO NZ PL PT RO SE SG SI SK US)
29
29
  self.default_currency = 'USD'
30
30
  self.money_format = :cents
31
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro]
31
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro]
32
32
  self.currencies_without_fractions = %w(BIF CLP DJF GNF JPY KMF KRW MGA PYG RWF VND VUV XAF XOF XPF UGX)
33
33
 
34
34
  self.homepage_url = 'https://stripe.com/'
@@ -430,7 +430,7 @@ module ActiveMerchant #:nodoc:
430
430
  end
431
431
 
432
432
  def add_customer_data(post, options)
433
- metadata_options = [:description, :ip, :user_agent, :referrer]
433
+ metadata_options = %i[description ip user_agent referrer]
434
434
  post.update(options.slice(*metadata_options))
435
435
 
436
436
  post[:external_id] = options[:order_id]
@@ -452,7 +452,7 @@ module ActiveMerchant #:nodoc:
452
452
 
453
453
  def add_statement_address(post, options)
454
454
  return unless statement_address = options[:statement_address]
455
- return unless [:address1, :city, :zip, :state].all? { |key| statement_address[key].present? }
455
+ return unless %i[address1 city zip state].all? { |key| statement_address[key].present? }
456
456
 
457
457
  post[:statement_address] = {}
458
458
  post[:statement_address][:line1] = statement_address[:address1]
@@ -613,7 +613,7 @@ module ActiveMerchant #:nodoc:
613
613
  idempotency_key = options[:idempotency_key]
614
614
 
615
615
  headers = {
616
- 'Authorization' => 'Basic ' + Base64.encode64(key.to_s + ':').strip,
616
+ 'Authorization' => 'Basic ' + Base64.strict_encode64(key.to_s + ':').strip,
617
617
  'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
618
618
  'Stripe-Version' => api_version(options),
619
619
  'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
@@ -655,7 +655,7 @@ module ActiveMerchant #:nodoc:
655
655
  success = success_from(response, options)
656
656
 
657
657
  card = card_from_response(response)
658
- avs_code = AVS_CODE_TRANSLATOR["line1: #{card["address_line1_check"]}, zip: #{card["address_zip_check"]}"]
658
+ avs_code = AVS_CODE_TRANSLATOR["line1: #{card['address_line1_check']}, zip: #{card['address_zip_check']}"]
659
659
  cvc_code = CVC_CODE_TRANSLATOR[card['cvc_check']]
660
660
 
661
661
  Response.new(success,
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  # This gateway uses the current Stripe {Payment Intents API}[https://stripe.com/docs/api/payment_intents].
6
6
  # For the legacy API, see the Stripe gateway
7
7
  class StripePaymentIntentsGateway < StripeGateway
8
- self.supported_countries = %w(AT AU BE BR CA CH DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MX NL NO NZ PL PT SE SG SI SK US)
8
+ self.supported_countries = %w(AT AU BE BG BR CA CH CY CZ DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MT MX NL NO NZ PL PT RO SE SG SI SK US)
9
9
 
10
10
  ALLOWED_METHOD_STATES = %w[automatic manual].freeze
11
11
  ALLOWED_CANCELLATION_REASONS = %w[duplicate fraudulent requested_by_customer abandoned].freeze
@@ -84,6 +84,21 @@ module ActiveMerchant #:nodoc:
84
84
  commit(:post, "payment_intents/#{intent_id}", post, options)
85
85
  end
86
86
 
87
+ def create_setup_intent(payment_method, options = {})
88
+ post = {}
89
+ add_customer(post, options)
90
+ payment_method = add_payment_method_token(post, payment_method, options)
91
+ return payment_method if payment_method.is_a?(ActiveMerchant::Billing::Response)
92
+
93
+ add_metadata(post, options)
94
+ add_return_url(post, options)
95
+ post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
96
+ post[:usage] = options[:usage] if %w(on_session off_session).include?(options[:usage])
97
+ post[:description] = options[:description] if options[:description]
98
+
99
+ commit(:post, 'setup_intents', post, options)
100
+ end
101
+
87
102
  def authorize(money, payment_method, options = {})
88
103
  create_intent(money, payment_method, options.merge!(confirm: true, capture_method: 'manual'))
89
104
  end
@@ -121,7 +136,7 @@ module ActiveMerchant #:nodoc:
121
136
 
122
137
  if charge_id.nil?
123
138
  error_message = "No associated charge for #{intent['id']}"
124
- error_message << "; payment_intent has a status of #{intent['status']}" if intent.try(:[], 'status') && intent.try(:[], 'status') != 'succeeded'
139
+ error_message << "; payment_intent has a status of #{intent['status']}" if intent.try(:[], 'status') && intent.try(:[], 'status') != 'succeeded'
125
140
  return Response.new(false, error_message, intent)
126
141
  end
127
142
  else
@@ -170,6 +185,10 @@ module ActiveMerchant #:nodoc:
170
185
  end
171
186
  end
172
187
 
188
+ def verify(payment_method, options = {})
189
+ create_setup_intent(payment_method, options.merge!(confirm: true))
190
+ end
191
+
173
192
  private
174
193
 
175
194
  def add_connected_account(post, options = {})
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
13
13
 
14
14
  self.supported_countries = %w[NZ CA]
15
15
  self.default_currency = 'NZD'
16
- self.supported_cardtypes = [:visa, :master]
16
+ self.supported_cardtypes = %i[visa master]
17
17
  self.homepage_url = 'https://www.swipehq.com/checkout'
18
18
  self.display_name = 'Swipe Checkout'
19
19
  self.money_format = :dollars
@@ -8,10 +8,10 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.live_url = 'https://secure.telr.com/gateway/remote.xml'
10
10
 
11
- self.supported_countries = ['AE', 'IN', 'SA']
11
+ self.supported_countries = %w[AE IN SA]
12
12
  self.default_currency = 'AED'
13
13
  self.money_format = :dollars
14
- self.supported_cardtypes = [:visa, :master, :american_express, :maestro, :jcb]
14
+ self.supported_cardtypes = %i[visa master american_express maestro jcb]
15
15
 
16
16
  CVC_CODE_TRANSLATOR = {
17
17
  'Y' => 'M',
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
 
79
79
  def verify_credentials
80
80
  response = void('0')
81
- !['01', '04'].include?(response.error_code)
81
+ !%w[01 04].include?(response.error_code)
82
82
  end
83
83
 
84
84
  def supports_scrubbing?
@@ -149,7 +149,7 @@ module ActiveMerchant #:nodoc:
149
149
  end
150
150
 
151
151
  def add_ref(doc, action, payment_method)
152
- doc.ref(split_authorization(payment_method)[0]) if ['capture', 'refund', 'void'].include?(action) || payment_method.is_a?(String)
152
+ doc.ref(split_authorization(payment_method)[0]) if %w[capture refund void].include?(action) || payment_method.is_a?(String)
153
153
  end
154
154
 
155
155
  def add_authentication(doc)
@@ -20,7 +20,7 @@ module ActiveMerchant
20
20
  self.homepage_url = 'http://www.tnsi.com/'
21
21
  self.supported_countries = %w(AR AU BR FR DE HK MX NZ SG GB US)
22
22
  self.default_currency = 'USD'
23
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
23
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro]
24
24
  end
25
25
  end
26
26
  end
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.live_url = 'https://webservices.primerchants.com'
6
6
 
7
7
  self.supported_countries = ['US']
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
8
+ self.supported_cardtypes = %i[visa master american_express discover]
9
9
  self.homepage_url = 'http://www.transfirst.com/'
10
10
  self.display_name = 'TransFirst'
11
11
 
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  def void(authorization, options={})
61
61
  post = {}
62
62
 
63
- transaction_id, _ = split_authorization(authorization)
63
+ transaction_id, = split_authorization(authorization)
64
64
  add_pair(post, :TransID, transaction_id)
65
65
 
66
66
  commit(:void, post)
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
12
12
  self.supported_countries = ['US']
13
13
  self.default_currency = 'USD'
14
14
  self.money_format = :cents
15
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
15
+ self.supported_cardtypes = %i[visa master american_express discover diners_club]
16
16
 
17
17
  V1_NAMESPACE = 'http://postilion/realtime/merchantframework/xsd/v1/'
18
18
  SOAPENV_NAMESPACE = 'http://schemas.xmlsoap.org/soap/envelope/'
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
12
12
  self.supported_countries = ['US']
13
13
  self.default_currency = 'USD'
14
14
  self.money_format = :cents
15
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
15
+ self.supported_cardtypes = %i[visa master american_express discover]
16
16
 
17
17
  self.homepage_url = 'https://www.transactpro.lv/business/online-payments-acceptance'
18
18
  self.display_name = 'Transact Pro'
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
162
162
  end
163
163
 
164
164
  def parse(body)
165
- if body =~ /^ID:/
165
+ if /^ID:/.match?(body)
166
166
  body.split('~').reduce(Hash.new) { |h, v|
167
167
  m = v.match('(.*?):(.*)')
168
168
  h.merge!(m[1].underscore.to_sym => m[2])
@@ -197,7 +197,7 @@ module ActiveMerchant #:nodoc:
197
197
  end
198
198
 
199
199
  def split_authorization(authorization)
200
- if authorization =~ /|/
200
+ if /|/.match?(authorization)
201
201
  identifier, amount = authorization.split('|')
202
202
  [identifier, amount.to_i]
203
203
  else