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
@@ -6,7 +6,7 @@ module ActiveMerchant
6
6
  self.default_currency = 'GBP'
7
7
  self.supported_countries = ['GB']
8
8
 
9
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
9
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb maestro]
10
10
 
11
11
  self.homepage_url = 'http://www.datacash.com/'
12
12
  self.display_name = 'DataCash'
@@ -121,6 +121,7 @@ module ActiveMerchant #:nodoc:
121
121
 
122
122
  add_invoice(post, money, options)
123
123
  add_payment(post, credit_card, options)
124
+ add_aggregate_data(post, options) if options[:aggregate_data]
124
125
  end
125
126
 
126
127
  def add_payment_method_id(credit_card, options)
@@ -180,6 +181,29 @@ module ActiveMerchant #:nodoc:
180
181
  post[:card_data] = card_data
181
182
  end
182
183
 
184
+ def add_aggregate_data(post, options)
185
+ aggregate_data = {}
186
+ data = options[:aggregate_data]
187
+ aggregate_data[:indicator] = data[:indicator] if data[:indicator]
188
+ aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
189
+ aggregate_data[:bill_to_pay] = data[:bill_to_pay] if data[:bill_to_pay]
190
+ aggregate_data[:bill_to_refund] = data[:bill_to_refund] if data[:bill_to_refund]
191
+ aggregate_data[:merchant_name] = data[:merchant_name] if data[:merchant_name]
192
+ aggregate_data[:street] = data[:street] if data[:street]
193
+ aggregate_data[:number] = data[:number] if data[:number]
194
+ aggregate_data[:postal_code] = data[:postal_code] if data[:postal_code]
195
+ aggregate_data[:category] = data[:category] if data[:category]
196
+ aggregate_data[:channel] = data[:channel] if data[:channel]
197
+ aggregate_data[:geographic_code] = data[:geographic_code] if data[:geographic_code]
198
+ aggregate_data[:city] = data[:city] if data[:city]
199
+ aggregate_data[:merchant_id] = data[:merchant_id] if data[:merchant_id]
200
+ aggregate_data[:province] = data[:province] if data[:province]
201
+ aggregate_data[:country] = data[:country] if data[:country]
202
+ aggregate_data[:merchant_email] = data[:merchant_email] if data[:merchant_email]
203
+ aggregate_data[:merchant_phone] = data[:merchant_phone] if data[:merchant_phone]
204
+ post[:aggregate_data] = aggregate_data
205
+ end
206
+
183
207
  def add_fraud_detection(options = {})
184
208
  {}.tap do |hsh|
185
209
  hsh[:send_to_cs] = options[:send_to_cs] if valid_fraud_detection_option?(options[:send_to_cs]) # true/false
@@ -6,10 +6,10 @@ module ActiveMerchant #:nodoc:
6
6
 
7
7
  self.live_url = 'https://api.dibspayment.com/merchant/v1/JSON/Transaction/'
8
8
 
9
- self.supported_countries = ['US', 'FI', 'NO', 'SE', 'GB']
9
+ self.supported_countries = %w[US FI NO SE GB]
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
  def initialize(options={})
15
15
  requires!(options, :merchant_id, :secret_key)
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.supported_countries = ['US']
10
10
  self.default_currency = 'USD'
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
  self.money_format = :cents
13
13
 
14
14
  self.homepage_url = 'https://digitzs.com'
@@ -235,7 +235,7 @@ module ActiveMerchant #:nodoc:
235
235
 
236
236
  def authorization_from(response)
237
237
  if customer_id = response.try(:[], 'data').try(:[], 'attributes').try(:[], 'customerId')
238
- "#{customer_id}|#{response.try(:[], "data").try(:[], "id")}"
238
+ "#{customer_id}|#{response.try(:[], 'data').try(:[], 'id')}"
239
239
  else
240
240
  response.try(:[], 'data').try(:[], 'id')
241
241
  end
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
6
6
 
7
7
  self.supported_countries = %w(BR MX CO CL AR PE)
8
8
  self.default_currency = 'USD'
9
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
9
+ self.supported_cardtypes = %i[visa master american_express discover diners_club]
10
10
 
11
11
  self.homepage_url = 'http://www.ebanx.com/'
12
12
  self.display_name = 'EBANX'
@@ -237,7 +237,7 @@ module ActiveMerchant #:nodoc:
237
237
  end
238
238
 
239
239
  def success_from(action, response)
240
- if [:purchase, :capture, :refund].include?(action)
240
+ if %i[purchase capture refund].include?(action)
241
241
  response.try(:[], 'payment').try(:[], 'status') == 'CO'
242
242
  elsif action == :authorize
243
243
  response.try(:[], 'payment').try(:[], 'status') == 'PE'
@@ -258,7 +258,7 @@ module ActiveMerchant #:nodoc:
258
258
 
259
259
  def authorization_from(action, parameters, response)
260
260
  if action == :store
261
- "#{response.try(:[], "token")}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}"
261
+ "#{response.try(:[], 'token')}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}"
262
262
  else
263
263
  response.try(:[], 'payment').try(:[], 'hash')
264
264
  end
@@ -278,7 +278,7 @@ module ActiveMerchant #:nodoc:
278
278
  end
279
279
 
280
280
  def requires_http_get(action)
281
- return true if [:capture, :void].include?(action)
281
+ return true if %i[capture void].include?(action)
282
282
 
283
283
  false
284
284
  end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class EfsnetGateway < Gateway
6
6
  self.supported_countries = ['US']
7
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
7
+ self.supported_cardtypes = %i[visa master american_express discover]
8
8
  self.homepage_url = 'http://www.concordefsnet.com/'
9
9
  self.display_name = 'Efsnet'
10
10
 
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
 
54
54
  def void(identification, options = {})
55
55
  requires!(options, :order_id)
56
- original_transaction_id, _ = identification.split(';')
56
+ original_transaction_id, = identification.split(';')
57
57
  commit(:void_transaction, {reference_number: format_reference_number(options[:order_id]), transaction_id: original_transaction_id})
58
58
  end
59
59
 
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
12
12
 
13
13
  self.display_name = 'Elavon MyVirtualMerchant'
14
14
  self.supported_countries = %w(US CA PR DE IE NO PL LU BE NL MX)
15
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
15
+ self.supported_cardtypes = %i[visa master american_express discover]
16
16
  self.homepage_url = 'http://www.elavon.com/'
17
17
 
18
18
  self.delimiter = "\n"
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  add_customer_data(form, options)
49
49
  add_test_mode(form, options)
50
50
  add_ip(form, options)
51
- add_ssl_dynamic_dba(form, options)
51
+ add_auth_purchase_params(form, options)
52
52
  add_level_3_fields(form, options) if options[:level_3_data]
53
53
  commit(:purchase, money, form, options)
54
54
  end
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  add_customer_data(form, options)
64
64
  add_test_mode(form, options)
65
65
  add_ip(form, options)
66
- add_ssl_dynamic_dba(form, options)
66
+ add_auth_purchase_params(form, options)
67
67
  add_level_3_fields(form, options) if options[:level_3_data]
68
68
  commit(:authorize, money, form, options)
69
69
  end
@@ -257,8 +257,9 @@ module ActiveMerchant #:nodoc:
257
257
  form[:cardholder_ip] = options[:ip] if options.has_key?(:ip)
258
258
  end
259
259
 
260
- def add_ssl_dynamic_dba(form, options)
260
+ def add_auth_purchase_params(form, options)
261
261
  form[:dynamic_dba] = options[:dba] if options.has_key?(:dba)
262
+ form[:merchant_initiated_unscheduled] = options[:merchant_initiated_unscheduled] if options.has_key?(:merchant_initiated_unscheduled)
262
263
  end
263
264
 
264
265
  def add_level_3_fields(form, options)
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
 
10
10
  self.supported_countries = ['US']
11
11
  self.default_currency = 'USD'
12
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
12
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
13
13
 
14
14
  self.homepage_url = 'http://www.elementps.com'
15
15
  self.display_name = 'Element'
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
  end
54
54
 
55
55
  def capture(money, authorization, options={})
56
- trans_id, _ = split_authorization(authorization)
56
+ trans_id, = split_authorization(authorization)
57
57
  options[:trans_id] = trans_id
58
58
 
59
59
  request = build_soap_request do |xml|
@@ -68,7 +68,7 @@ module ActiveMerchant #:nodoc:
68
68
  end
69
69
 
70
70
  def refund(money, authorization, options={})
71
- trans_id, _ = split_authorization(authorization)
71
+ trans_id, = split_authorization(authorization)
72
72
  options[:trans_id] = trans_id
73
73
 
74
74
  request = build_soap_request do |xml|
@@ -188,12 +188,16 @@ module ActiveMerchant #:nodoc:
188
188
  xml.TransactionAmount amount(money.to_i) if money
189
189
  xml.MarketCode 'Default' if money
190
190
  xml.ReferenceNumber options[:order_id] || SecureRandom.hex(20)
191
+
192
+ xml.PaymentType options[:payment_type] if options[:payment_type]
193
+ xml.SubmissionType options[:submission_type] if options[:submission_type]
194
+ xml.DuplicateCheckDisableFlag options[:duplicate_check_disable_flag].to_s == 'true' ? 'True' : 'False' unless options[:duplicate_check_disable_flag].nil?
191
195
  end
192
196
  end
193
197
 
194
198
  def add_terminal(xml, options)
195
199
  xml.terminal do
196
- xml.TerminalID '01'
200
+ xml.TerminalID options[:terminal_id] || '01'
197
201
  xml.CardPresentCode options[:card_present_code] || 'UseDefault'
198
202
  xml.CardholderPresentCode 'UseDefault'
199
203
  xml.CardInputCode 'UseDefault'
@@ -5,9 +5,9 @@ module ActiveMerchant #:nodoc:
5
5
 
6
6
  self.default_currency = 'DKK'
7
7
  self.money_format = :cents
8
- self.supported_cardtypes = [:dankort, :forbrugsforeningen, :visa, :master,
9
- :american_express, :diners_club, :jcb, :maestro]
10
- self.supported_countries = ['DK', 'SE', 'NO']
8
+ self.supported_countries = %w[DK SE NO]
9
+ self.supported_cardtypes = %i[dankort forbrugsforeningen visa master
10
+ american_express diners_club jcb maestro]
11
11
  self.homepage_url = 'http://epay.dk/'
12
12
  self.display_name = 'ePay'
13
13
 
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
  self.live_url = 'https://secure.evoepay.com/api/transact.php'
37
37
 
38
38
  self.supported_countries = ['CA']
39
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
39
+ self.supported_cardtypes = %i[visa master american_express jcb discover]
40
40
  self.money_format = :dollars
41
41
  self.homepage_url = 'http://www.evocanada.com/'
42
42
  self.display_name = 'EVO Canada'
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
 
10
10
  self.money_format = :cents
11
11
  self.supported_countries = ['AU']
12
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
12
+ self.supported_cardtypes = %i[visa master american_express diners_club]
13
13
  self.homepage_url = 'http://www.eway.com.au/'
14
14
  self.display_name = 'eWAY'
15
15
 
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.supported_countries = ['AU']
9
9
 
10
10
  # The card types supported by the payment gateway
11
- self.supported_cardtypes = [:visa, :master]
11
+ self.supported_cardtypes = %i[visa master]
12
12
 
13
13
  self.default_currency = 'AUD'
14
14
 
@@ -7,8 +7,8 @@ module ActiveMerchant #:nodoc:
7
7
  self.live_url = 'https://api.ewaypayments.com/'
8
8
 
9
9
  self.money_format = :cents
10
- self.supported_countries = ['AU', 'NZ', 'GB', 'SG', 'MY', 'HK']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
10
+ self.supported_countries = %w[AU NZ GB SG MY HK]
11
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
12
12
  self.homepage_url = 'http://www.eway.com.au/'
13
13
  self.display_name = 'eWAY Rapid 3.1'
14
14
  self.default_currency = 'AUD'
@@ -28,10 +28,10 @@ module ActiveMerchant #:nodoc:
28
28
 
29
29
  SUCCESS = 'true'
30
30
 
31
- SENSITIVE_FIELDS = [:verification_str2, :expiry_date, :card_number]
31
+ SENSITIVE_FIELDS = %i[verification_str2 expiry_date card_number]
32
32
 
33
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
34
- self.supported_countries = ['CA', 'US']
33
+ self.supported_countries = %w[CA US]
34
+ self.supported_cardtypes = %i[visa master american_express jcb discover]
35
35
  self.homepage_url = 'http://www.e-xact.com'
36
36
  self.display_name = 'E-xact'
37
37
 
@@ -5,7 +5,7 @@ module ActiveMerchant
5
5
 
6
6
  self.supported_countries = %w(AU CA CN FR DE GI IL MT MU MX NL NZ PA PH RU SG KR ES KN GB US)
7
7
  self.default_currency = 'USD'
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
8
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club]
9
9
 
10
10
  self.homepage_url = 'http://www.ezic.com/'
11
11
  self.display_name = 'Ezic'
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.supported_countries = ['AU']
10
10
  self.default_currency = 'AUD'
11
11
  self.money_format = :cents
12
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb]
12
+ self.supported_cardtypes = %i[visa master american_express jcb]
13
13
 
14
14
  self.homepage_url = 'https://www.fatzebra.com.au/'
15
15
  self.display_name = 'Fat Zebra'
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  end
49
49
 
50
50
  def capture(money, authorization, options = {})
51
- txn_id, _ = authorization.to_s.split('|')
51
+ txn_id, = authorization.to_s.split('|')
52
52
  post = {}
53
53
 
54
54
  add_amount(post, money, options)
@@ -58,7 +58,7 @@ module ActiveMerchant #:nodoc:
58
58
  end
59
59
 
60
60
  def refund(money, authorization, options={})
61
- txn_id, _ = authorization.to_s.split('|')
61
+ txn_id, = authorization.to_s.split('|')
62
62
  post = {}
63
63
 
64
64
  add_extra_options(post, options)
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
  post[:cvv] = creditcard.verification_value if creditcard.verification_value?
111
111
  post[:card_holder] = creditcard.name if creditcard.name
112
112
  elsif creditcard.is_a?(String)
113
- id, _ = creditcard.to_s.split('|')
113
+ id, = creditcard.to_s.split('|')
114
114
  post[:card_token] = id
115
115
  post[:cvv] = options[:cvv]
116
116
  elsif creditcard.is_a?(Hash)
@@ -125,11 +125,13 @@ module ActiveMerchant #:nodoc:
125
125
  def add_extra_options(post, options)
126
126
  extra = {}
127
127
  extra[:ecm] = '32' if options[:recurring]
128
- extra[:cavv] = options[:cavv] if options[:cavv]
129
- extra[:xid] = options[:xid] if options[:xid]
130
- extra[:sli] = options[:sli] if options[:sli]
128
+ extra[:cavv] = options[:cavv] || options.dig(:three_d_secure, :cavv) if options[:cavv] || options.dig(:three_d_secure, :cavv)
129
+ extra[:xid] = options[:xid] || options.dig(:three_d_secure, :xid) if options[:xid] || options.dig(:three_d_secure, :xid)
130
+ extra[:sli] = options[:sli] || options.dig(:three_d_secure, :eci) if options[:sli] || options.dig(:three_d_secure, :eci)
131
131
  extra[:name] = options[:merchant] if options[:merchant]
132
132
  extra[:location] = options[:merchant_location] if options[:merchant_location]
133
+ extra[:card_on_file] = options.dig(:extra, :card_on_file) if options.dig(:extra, :card_on_file)
134
+ extra[:auth_reason] = options.dig(:extra, :auth_reason) if options.dig(:extra, :auth_reason)
133
135
  post[:extra] = extra if extra.any?
134
136
  end
135
137
 
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
12
12
  self.default_currency = 'CAD'
13
13
 
14
14
  # The card types supported by the payment gateway
15
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
15
+ self.supported_cardtypes = %i[visa master american_express discover]
16
16
 
17
17
  # The homepage URL of the gateway
18
18
  self.homepage_url = 'http://www.federatedcanada.com/'
@@ -7,10 +7,10 @@ module ActiveMerchant #:nodoc:
7
7
  self.test_url = 'https://entegrasyon.asseco-see.com.tr/fim/api'
8
8
 
9
9
  # The countries the gateway supports merchants from as 2 digit ISO country codes
10
- self.supported_countries = ['US', 'TR']
10
+ self.supported_countries = %w[US TR]
11
11
 
12
12
  # The card types supported by the payment gateway
13
- self.supported_cardtypes = [:visa, :master]
13
+ self.supported_cardtypes = %i[visa master]
14
14
 
15
15
  # The homepage URL of the gateway
16
16
  self.homepage_url = 'https://www.fbwebpos.com/'
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.live_url = 'https://api.firstgiving.com'
8
8
 
9
9
  self.supported_countries = ['US']
10
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
10
+ self.supported_cardtypes = %i[visa master american_express discover]
11
11
  self.homepage_url = 'http://www.firstgiving.com/'
12
12
  self.default_currency = 'USD'
13
13
  self.display_name = 'FirstGiving'
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.supported_countries = ['US']
9
9
  self.default_currency = 'USD'
10
10
  self.money_format = :dollars
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
 
13
13
  self.homepage_url = 'http://1stpaygateway.net/'
14
14
  self.display_name = '1stPayGateway.Net'
@@ -22,7 +22,7 @@ module ActiveMerchant #:nodoc:
22
22
 
23
23
  SUCCESS = 'true'
24
24
 
25
- SENSITIVE_FIELDS = [:verification_str2, :expiry_date, :card_number]
25
+ SENSITIVE_FIELDS = %i[verification_str2 expiry_date card_number]
26
26
 
27
27
  BRANDS = {
28
28
  visa: 'Visa',
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
37
37
  DEFAULT_ECI = '07'
38
38
 
39
39
  self.supported_cardtypes = BRANDS.keys
40
- self.supported_countries = ['CA', 'US']
40
+ self.supported_countries = %w[CA US]
41
41
  self.default_currency = 'USD'
42
42
  self.homepage_url = 'http://www.firstdata.com'
43
43
  self.display_name = 'FirstData Global Gateway e4'
@@ -217,7 +217,7 @@ module ActiveMerchant #:nodoc:
217
217
  end
218
218
 
219
219
  def add_identification(xml, identification)
220
- authorization_num, transaction_tag, _ = identification.split(';')
220
+ authorization_num, transaction_tag, = identification.split(';')
221
221
 
222
222
  xml.tag! 'Authorization_Num', authorization_num
223
223
  xml.tag! 'Transaction_Tag', transaction_tag
@@ -255,14 +255,14 @@ module ActiveMerchant #:nodoc:
255
255
  (credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
256
256
  end
257
257
 
258
- xml.tag! 'Ecommerce_Flag', eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
258
+ xml.tag! 'Ecommerce_Flag', /^[0-9]+$/.match?(eci.to_s) ? eci.to_s.rjust(2, '0') : eci
259
259
  end
260
260
 
261
261
  def add_credit_card_verification_strings(xml, credit_card, options)
262
262
  address = options[:billing_address] || options[:address]
263
263
  if address
264
264
  address_values = []
265
- [:address1, :zip, :city, :state, :country].each { |part| address_values << address[part].to_s.tr("\r\n", ' ').strip }
265
+ %i[address1 zip city state country].each { |part| address_values << address[part].to_s.tr("\r\n", ' ').strip }
266
266
  xml.tag! 'VerificationStr1', address_values.join('|')
267
267
  end
268
268
 
@@ -16,7 +16,7 @@ module ActiveMerchant #:nodoc:
16
16
 
17
17
  SUCCESS = 'true'
18
18
 
19
- SENSITIVE_FIELDS = [:cvdcode, :expiry_date, :card_number]
19
+ SENSITIVE_FIELDS = %i[cvdcode expiry_date card_number]
20
20
 
21
21
  BRANDS = {
22
22
  visa: 'Visa',
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
  DEFAULT_ECI = '07'
30
30
 
31
31
  self.supported_cardtypes = BRANDS.keys
32
- self.supported_countries = ['CA', 'US']
32
+ self.supported_countries = %w[CA US]
33
33
  self.default_currency = 'USD'
34
34
  self.homepage_url = 'http://www.firstdata.com'
35
35
  self.display_name = 'FirstData Global Gateway e4 v27'
@@ -191,7 +191,7 @@ module ActiveMerchant #:nodoc:
191
191
  end
192
192
 
193
193
  def add_identification(xml, identification)
194
- authorization_num, transaction_tag, _ = identification.split(';')
194
+ authorization_num, transaction_tag, = identification.split(';')
195
195
 
196
196
  xml.tag! 'Authorization_Num', authorization_num
197
197
  xml.tag! 'Transaction_Tag', transaction_tag
@@ -229,7 +229,7 @@ module ActiveMerchant #:nodoc:
229
229
  (credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
230
230
  end
231
231
 
232
- xml.tag! 'Ecommerce_Flag', eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
232
+ xml.tag! 'Ecommerce_Flag', /^[0-9]+$/.match?(eci.to_s) ? eci.to_s.rjust(2, '0') : eci
233
233
  end
234
234
 
235
235
  def add_credit_card_verification_strings(xml, credit_card, options)
@@ -287,6 +287,8 @@ module ActiveMerchant #:nodoc:
287
287
 
288
288
  def add_address(xml, options)
289
289
  if (address = options[:billing_address] || options[:address])
290
+ address = strip_line_breaks(address)
291
+
290
292
  xml.tag! 'Address' do
291
293
  xml.tag! 'Address1', address[:address1]
292
294
  xml.tag! 'Address2', address[:address2] if address[:address2]
@@ -299,6 +301,12 @@ module ActiveMerchant #:nodoc:
299
301
  end
300
302
  end
301
303
 
304
+ def strip_line_breaks(address)
305
+ return unless address.is_a?(Hash)
306
+
307
+ Hash[address.map { |k, s| [k, s&.tr("\r\n", ' ')&.strip] }]
308
+ end
309
+
302
310
  def add_invoice(xml, options)
303
311
  xml.tag! 'Reference_No', options[:order_id]
304
312
  xml.tag! 'Reference_3', options[:description] if options[:description]