activemerchant 1.107.2 → 1.110.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 +73 -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 +18 -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 +84 -35
  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 +72 -23
  49. data/lib/active_merchant/billing/gateways/d_local.rb +24 -8
  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 +6 -4
  55. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/elavon.rb +56 -9
  57. data/lib/active_merchant/billing/gateways/element.rb +16 -8
  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 +4 -4
  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 +9 -8
  74. data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +5 -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 +3 -3
  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 +10 -5
  94. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  95. data/lib/active_merchant/billing/gateways/mercado_pago.rb +12 -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 +49 -7
  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 +7 -8
  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 +11 -4
  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 +13 -8
  179. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +46 -3
  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 +8 -8
  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 +36 -36
@@ -4,7 +4,7 @@ module ActiveMerchant
4
4
  self.live_url = self.test_url = 'https://ccapi.client.qvalent.com/payway/ccapi'
5
5
 
6
6
  self.supported_countries = ['AU']
7
- self.supported_cardtypes = [:visa, :master, :diners_club, :american_express, :bankcard]
7
+ self.supported_cardtypes = %i[visa master diners_club american_express bankcard]
8
8
  self.display_name = 'Pay Way'
9
9
  self.homepage_url = 'http://www.payway.com.au'
10
10
  self.default_currency = 'AUD'
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.default_currency = 'AUD'
8
8
  self.money_format = :cents
9
9
  self.supported_countries = ['AU']
10
- self.supported_cardtypes = [:visa, :master, :american_express]
10
+ self.supported_cardtypes = %i[visa master american_express]
11
11
  self.homepage_url = 'http://www.pinpayments.com/'
12
12
  self.display_name = 'Pin Payments'
13
13
 
@@ -138,7 +138,7 @@ module ActiveMerchant #:nodoc:
138
138
  name: creditcard.name
139
139
  )
140
140
  elsif creditcard.kind_of?(String)
141
- if creditcard =~ /^card_/
141
+ if /^card_/.match?(creditcard)
142
142
  post[:card_token] = get_card_token(creditcard)
143
143
  else
144
144
  post[:customer_token] = creditcard
@@ -3,8 +3,8 @@ module ActiveMerchant
3
3
  class PlugnpayGateway < Gateway
4
4
  class PlugnpayPostData < PostData
5
5
  # Fields that will be sent even if they are blank
6
- self.required_fields = [:publisher_name, :publisher_password,
7
- :card_amount, :card_name, :card_number, :card_exp, :orderID]
6
+ self.required_fields = %i[publisher_name publisher_password
7
+ card_amount card_name card_number card_exp orderID]
8
8
  end
9
9
  self.live_url = self.test_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'
10
10
 
@@ -88,12 +88,12 @@ module ActiveMerchant
88
88
  credit: 'newreturn'
89
89
  }
90
90
 
91
- SUCCESS_CODES = ['pending', 'success']
92
- FAILURE_CODES = ['badcard', 'fraud']
91
+ SUCCESS_CODES = %w[pending success]
92
+ FAILURE_CODES = %w[badcard fraud]
93
93
 
94
94
  self.default_currency = 'USD'
95
95
  self.supported_countries = ['US']
96
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
96
+ self.supported_cardtypes = %i[visa master american_express discover]
97
97
  self.homepage_url = 'http://www.plugnpay.com/'
98
98
  self.display_name = "Plug'n Pay"
99
99
 
@@ -6,10 +6,10 @@ module ActiveMerchant #:nodoc:
6
6
  self.test_url = 'https://xmltest.propay.com/API/PropayAPI.aspx'
7
7
  self.live_url = 'https://epay.propay.com/api/propayapi.aspx'
8
8
 
9
- self.supported_countries = ['US', 'CA']
9
+ self.supported_countries = %w[US CA]
10
10
  self.default_currency = 'USD'
11
11
  self.money_format = :cents
12
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
+ self.supported_cardtypes = %i[visa master american_express discover]
13
13
 
14
14
  self.homepage_url = 'https://www.propay.com/'
15
15
  self.display_name = 'ProPay'
@@ -38,7 +38,7 @@ module ActiveMerchant #:nodoc:
38
38
  self.test_url = 'https://realtimestaging.psigate.com/xml'
39
39
  self.live_url = 'https://realtime.psigate.com/xml'
40
40
 
41
- self.supported_cardtypes = [:visa, :master, :american_express]
41
+ self.supported_cardtypes = %i[visa master american_express]
42
42
  self.supported_countries = ['CA']
43
43
  self.homepage_url = 'http://www.psigate.com/'
44
44
  self.display_name = 'Psigate'
@@ -21,7 +21,7 @@ module ActiveMerchant
21
21
  # American Express, Diners Club, JCB, International Maestro,
22
22
  # Style, Clydesdale Financial Services, Other
23
23
 
24
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :maestro]
24
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb maestro]
25
25
  self.homepage_url = 'http://www.paymentsolutionsltd.com/'
26
26
  self.display_name = 'PSL Payment Solutions'
27
27
 
@@ -183,7 +183,7 @@ module ActiveMerchant
183
183
  address = options[:billing_address] || options[:address]
184
184
  return if address.nil?
185
185
 
186
- post[:QAAddress] = [:address1, :address2, :city, :state].collect { |a| address[a] }.reject(&:blank?).join(' ')
186
+ post[:QAAddress] = %i[address1 address2 city state].collect { |a| address[a] }.reject(&:blank?).join(' ')
187
187
  post[:QAPostcode] = address[:zip]
188
188
  end
189
189
 
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
  self.homepage_url = 'http://payments.intuit.com/'
12
12
  self.display_name = 'QuickBooks Merchant Services'
13
13
  self.default_currency = 'USD'
14
- self.supported_cardtypes = [:visa, :master, :discover, :american_express, :diners_club, :jcb]
14
+ self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
15
15
  self.supported_countries = ['US']
16
16
 
17
17
  TYPES = {
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
13
13
  self.live_url = self.test_url = 'https://secure.quantumgateway.com/cgi/xml_requester.php'
14
14
 
15
15
  # visa, master, american_express, discover
16
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
+ self.supported_cardtypes = %i[visa master american_express discover]
17
17
  self.supported_countries = ['US']
18
18
  self.default_currency = 'USD'
19
19
  self.money_format = :dollars
@@ -95,7 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
  def build_capture_request(money, authorization, options)
96
96
  xml = Builder::XmlMarkup.new
97
97
  add_common_credit_card_info(xml, 'PREVIOUS_SALE')
98
- transaction_id, _ = authorization_parts_from(authorization)
98
+ transaction_id, = authorization_parts_from(authorization)
99
99
  add_transaction_id(xml, transaction_id)
100
100
  xml.target!
101
101
  end
@@ -116,7 +116,7 @@ module ActiveMerchant #:nodoc:
116
116
  def build_void_request(authorization, options)
117
117
  xml = Builder::XmlMarkup.new
118
118
  add_common_credit_card_info(xml, 'VOID')
119
- transaction_id, _ = authorization_parts_from(authorization)
119
+ transaction_id, = authorization_parts_from(authorization)
120
120
  add_transaction_id(xml, transaction_id)
121
121
  xml.target!
122
122
  end
@@ -253,7 +253,7 @@ module ActiveMerchant #:nodoc:
253
253
  if node.has_elements?
254
254
  node.elements.each { |e| parse_element(reply, e) }
255
255
  else
256
- if node.parent.name =~ /item/
256
+ if /item/.match?(node.parent.name)
257
257
  parent = node.parent.name + (node.parent.attributes['id'] ? '_' + node.parent.attributes['id'] : '')
258
258
  reply[(parent + '_' + node.name).to_sym] = node.text
259
259
  else
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
6
6
 
7
7
  self.supported_countries = ['US']
8
8
  self.default_currency = 'USD'
9
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners]
9
+ self.supported_cardtypes = %i[visa master american_express discover diners]
10
10
 
11
11
  self.homepage_url = 'http://payments.intuit.com'
12
12
  self.display_name = 'QuickBooks Payments'
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
 
84
84
  def capture(money, authorization, options = {})
85
85
  post = {}
86
- authorization, _ = split_authorization(authorization)
86
+ authorization, = split_authorization(authorization)
87
87
  post[:amount] = localized_amount(money, currency(money))
88
88
  add_context(post, options)
89
89
 
@@ -95,7 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
  post = {}
96
96
  post[:amount] = localized_amount(money, currency(money))
97
97
  add_context(post, options)
98
- authorization, _ = split_authorization(authorization)
98
+ authorization, = split_authorization(authorization)
99
99
 
100
100
  response = commit(refund_uri(authorization), post)
101
101
  check_token_response(response, refund_uri(authorization), post, options)
@@ -239,7 +239,7 @@ module ActiveMerchant #:nodoc:
239
239
  def headers(method, uri)
240
240
  return oauth_v2_headers if @options[:refresh_token]
241
241
 
242
- raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless [:post, :get].include?(method)
242
+ raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless %i[post get].include?(method)
243
243
 
244
244
  request_uri = URI.parse(uri)
245
245
 
@@ -323,7 +323,7 @@ module ActiveMerchant #:nodoc:
323
323
  def success?(response)
324
324
  return FRAUD_WARNING_CODES.concat(['0']).include?(response['errors'].first['code']) if response['errors']
325
325
 
326
- !['DECLINED', 'CANCELLED'].include?(response['status']) && !['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
326
+ !%w[DECLINED CANCELLED].include?(response['status']) && !%w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
327
327
  end
328
328
 
329
329
  def message_from(response)
@@ -331,7 +331,7 @@ module ActiveMerchant #:nodoc:
331
331
  end
332
332
 
333
333
  def errors_from(response)
334
- if ['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
334
+ if %w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
335
335
  response['code']
336
336
  else
337
337
  response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
@@ -168,9 +168,9 @@ module QuickpayCommon
168
168
  base.default_currency = 'DKK'
169
169
  base.money_format = :cents
170
170
 
171
- base.supported_cardtypes = [:dankort, :forbrugsforeningen, :visa, :master,
172
- :american_express, :diners_club, :jcb, :maestro]
173
- base.supported_countries = ['DE', 'DK', 'ES', 'FI', 'FR', 'FO', 'GB', 'IS', 'NO', 'SE']
171
+ base.supported_countries = %w[DE DK ES FI FR FO GB IS NO SE]
172
+ base.supported_cardtypes = %i[dankort forbrugsforeningen visa master
173
+ american_express diners_club jcb maestro]
174
174
  base.homepage_url = 'http://quickpay.net/'
175
175
  base.display_name = 'QuickPay'
176
176
  end
@@ -24,11 +24,11 @@ module ActiveMerchant
24
24
  r.process {
25
25
  post = authorization_params(money, credit_card_or_reference, options)
26
26
  add_autocapture(post, false)
27
- commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
27
+ commit(synchronized_path("/payments/#{r.responses.last.params['id']}/authorize"), post)
28
28
  }
29
29
  r.process {
30
30
  post = capture_params(money, credit_card_or_reference, options)
31
- commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/capture"), post)
31
+ commit(synchronized_path("/payments/#{r.responses.last.params['id']}/capture"), post)
32
32
  }
33
33
  end
34
34
  end
@@ -42,7 +42,7 @@ module ActiveMerchant
42
42
  r.process { create_payment(money, options) }
43
43
  r.process {
44
44
  post = authorization_params(money, credit_card_or_reference, options)
45
- commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
45
+ commit(synchronized_path("/payments/#{r.responses.last.params['id']}/authorize"), post)
46
46
  }
47
47
  end
48
48
  end
@@ -191,7 +191,7 @@ module ActiveMerchant
191
191
 
192
192
  post[:shipping_address] = map_address(options[:shipping_address]) if options[:shipping_address]
193
193
 
194
- [:metadata, :branding_id, :variables].each do |field|
194
+ %i[metadata branding_id variables].each do |field|
195
195
  post[field] = options[field] if options[field]
196
196
  end
197
197
  end
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  self.supported_countries = ['AU']
11
11
  self.default_currency = 'AUD'
12
12
  self.money_format = :cents
13
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners]
13
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners]
14
14
 
15
15
  CVV_CODE_MAPPING = {
16
16
  'S' => 'D'
@@ -31,7 +31,7 @@ module ActiveMerchant
31
31
 
32
32
  self.money_format = :cents
33
33
  self.default_currency = 'EUR'
34
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
34
+ self.supported_cardtypes = %i[visa master american_express diners_club]
35
35
  self.supported_countries = %w(IE GB FR BE NL LU IT US CA ES)
36
36
  self.homepage_url = 'http://www.realexpayments.com/'
37
37
  self.display_name = 'Realex'
@@ -230,13 +230,14 @@ module ActiveMerchant
230
230
  def add_address_and_customer_info(xml, options)
231
231
  billing_address = options[:billing_address] || options[:address]
232
232
  shipping_address = options[:shipping_address]
233
+ ipv4_address = ipv4?(options[:ip]) ? options[:ip] : nil
233
234
 
234
- return unless billing_address || shipping_address || options[:customer] || options[:invoice] || options[:ip]
235
+ return unless billing_address || shipping_address || options[:customer] || options[:invoice] || ipv4_address
235
236
 
236
237
  xml.tag! 'tssinfo' do
237
238
  xml.tag! 'custnum', options[:customer] if options[:customer]
238
239
  xml.tag! 'prodid', options[:invoice] if options[:invoice]
239
- xml.tag! 'custipaddress', options[:ip] if options[:ip]
240
+ xml.tag! 'custipaddress', options[:ip] if ipv4_address
240
241
 
241
242
  if billing_address
242
243
  xml.tag! 'address', 'type' => 'billing' do
@@ -309,7 +310,7 @@ module ActiveMerchant
309
310
 
310
311
  version = three_d_secure.fetch(:version, '')
311
312
  xml.tag! 'mpi' do
312
- if version =~ /^2/
313
+ if /^2/.match?(version)
313
314
  xml.tag! 'authentication_value', three_d_secure[:cavv]
314
315
  xml.tag! 'ds_trans_id', three_d_secure[:ds_transaction_id]
315
316
  else
@@ -369,6 +370,12 @@ module ActiveMerchant
369
370
  def sanitize_order_id(order_id)
370
371
  order_id.to_s.gsub(/[^a-zA-Z0-9\-_]/, '')
371
372
  end
373
+
374
+ def ipv4?(ip_address)
375
+ return false if ip_address.nil?
376
+
377
+ !ip_address.match(/\A\d+\.\d+\.\d+\.\d+\z/).nil?
378
+ end
372
379
  end
373
380
  end
374
381
  end
@@ -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)