activemerchant 1.108.0 → 1.109.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +28 -0
  3. data/lib/active_merchant/billing/base.rb +0 -13
  4. data/lib/active_merchant/billing/check.rb +1 -1
  5. data/lib/active_merchant/billing/credit_card.rb +2 -0
  6. data/lib/active_merchant/billing/credit_card_methods.rb +9 -6
  7. data/lib/active_merchant/billing/gateways/adyen.rb +8 -8
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +7 -7
  10. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  11. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  12. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/balanced.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
  15. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +2 -2
  18. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/be2bill.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -4
  21. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -2
  22. data/lib/active_merchant/billing/gateways/blue_snap.rb +1 -1
  23. data/lib/active_merchant/billing/gateways/borgun.rb +3 -3
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/braintree_blue.rb +78 -28
  27. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  28. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/card_stream.rb +4 -4
  32. data/lib/active_merchant/billing/gateways/cardknox.rb +4 -4
  33. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cenpos.rb +12 -12
  37. data/lib/active_merchant/billing/gateways/checkout.rb +3 -3
  38. data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -3
  41. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/credorax.rb +6 -2
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/culqi.rb +1 -1
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +13 -4
  48. data/lib/active_merchant/billing/gateways/d_local.rb +7 -3
  49. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  50. data/lib/active_merchant/billing/gateways/dibs.rb +2 -2
  51. data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
  52. data/lib/active_merchant/billing/gateways/ebanx.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -2
  54. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  55. data/lib/active_merchant/billing/gateways/element.rb +3 -3
  56. data/lib/active_merchant/billing/gateways/epay.rb +3 -3
  57. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  58. data/lib/active_merchant/billing/gateways/eway.rb +1 -1
  59. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/eway_rapid.rb +2 -2
  61. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  62. data/lib/active_merchant/billing/gateways/ezic.rb +1 -1
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  64. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  65. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  66. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/first_pay.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +4 -4
  69. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +3 -3
  70. data/lib/active_merchant/billing/gateways/flo2cash.rb +10 -10
  71. data/lib/active_merchant/billing/gateways/forte.rb +2 -2
  72. data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
  73. data/lib/active_merchant/billing/gateways/global_collect.rb +5 -5
  74. data/lib/active_merchant/billing/gateways/global_transport.rb +1 -1
  75. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  76. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
  78. data/lib/active_merchant/billing/gateways/inspire.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/instapay.rb +1 -1
  80. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  81. data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
  82. data/lib/active_merchant/billing/gateways/itransact.rb +1 -1
  83. data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
  84. data/lib/active_merchant/billing/gateways/ixopay.rb +1 -1
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +2 -2
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -2
  87. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/kushki.rb +4 -4
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -2
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  93. data/lib/active_merchant/billing/gateways/mercado_pago.rb +11 -6
  94. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  96. data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
  97. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +2 -2
  100. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/migs.rb +1 -1
  104. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -1
  105. data/lib/active_merchant/billing/gateways/monei.rb +2 -2
  106. data/lib/active_merchant/billing/gateways/moneris.rb +17 -17
  107. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  108. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  109. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  110. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  111. data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
  112. data/lib/active_merchant/billing/gateways/netaxept.rb +2 -2
  113. data/lib/active_merchant/billing/gateways/netbanx.rb +46 -22
  114. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  115. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/network_merchants.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/nmi.rb +4 -4
  118. data/lib/active_merchant/billing/gateways/ogone.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/omise.rb +1 -1
  120. data/lib/active_merchant/billing/gateways/openpay.rb +1 -1
  121. data/lib/active_merchant/billing/gateways/opp.rb +1 -1
  122. data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/orbital.rb +6 -6
  124. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  125. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  126. data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
  127. data/lib/active_merchant/billing/gateways/pago_facil.rb +1 -1
  128. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  129. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +2 -2
  130. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/pay_junction.rb +3 -3
  132. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  133. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  134. data/lib/active_merchant/billing/gateways/paybox_direct.rb +3 -3
  135. data/lib/active_merchant/billing/gateways/payeezy.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/payex.rb +13 -13
  137. data/lib/active_merchant/billing/gateways/payflow.rb +5 -5
  138. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  140. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  141. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/paymill.rb +1 -1
  143. data/lib/active_merchant/billing/gateways/paypal.rb +2 -2
  144. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -7
  149. data/lib/active_merchant/billing/gateways/payway.rb +1 -1
  150. data/lib/active_merchant/billing/gateways/pin.rb +1 -1
  151. data/lib/active_merchant/billing/gateways/plugnpay.rb +5 -5
  152. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  153. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  154. data/lib/active_merchant/billing/gateways/psl_card.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/quantum.rb +3 -3
  157. data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -6
  158. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +3 -3
  159. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +4 -4
  160. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  161. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  162. data/lib/active_merchant/billing/gateways/redsys.rb +4 -4
  163. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  164. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -2
  165. data/lib/active_merchant/billing/gateways/sage.rb +3 -3
  166. data/lib/active_merchant/billing/gateways/sage_pay.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -1
  168. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -1
  169. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  170. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -2
  171. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  172. data/lib/active_merchant/billing/gateways/securion_pay.rb +1 -1
  173. data/lib/active_merchant/billing/gateways/skip_jack.rb +5 -5
  174. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/stripe.rb +6 -6
  177. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +20 -1
  178. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/telr.rb +4 -4
  180. data/lib/active_merchant/billing/gateways/tns.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +1 -1
  183. data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/transax.rb +1 -1
  185. data/lib/active_merchant/billing/gateways/trexle.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +6 -6
  188. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +1 -1
  189. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  190. data/lib/active_merchant/billing/gateways/verifi.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
  192. data/lib/active_merchant/billing/gateways/visanet_peru.rb +3 -3
  193. data/lib/active_merchant/billing/gateways/webpay.rb +1 -1
  194. data/lib/active_merchant/billing/gateways/wepay.rb +2 -2
  195. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -1
  196. data/lib/active_merchant/billing/gateways/world_net.rb +35 -35
  197. data/lib/active_merchant/billing/gateways/worldpay.rb +6 -6
  198. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  199. data/lib/active_merchant/billing/gateways/worldpay_us.rb +1 -1
  200. data/lib/active_merchant/version.rb +1 -1
  201. data/lib/support/gateway_support.rb +1 -1
  202. metadata +35 -35
@@ -3,8 +3,8 @@ module ActiveMerchant #:nodoc:
3
3
  class MercadoPagoGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://api.mercadopago.com/v1'
5
5
 
6
- self.supported_countries = ['AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY']
7
- self.supported_cardtypes = [:visa, :master, :american_express, :elo, :cabal, :naranja]
6
+ self.supported_countries = %w[AR BR CL CO MX PE UY]
7
+ self.supported_cardtypes = %i[visa master american_express elo cabal naranja]
8
8
 
9
9
  self.homepage_url = 'https://www.mercadopago.com/'
10
10
  self.display_name = 'Mercado Pago'
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
 
34
34
  def capture(money, authorization, options={})
35
35
  post = {}
36
- authorization, _ = authorization.split('|')
36
+ authorization, = authorization.split('|')
37
37
  post[:capture] = true
38
38
  post[:transaction_amount] = amount(money).to_f
39
39
  commit('capture', "payments/#{authorization}", post)
@@ -47,7 +47,7 @@ module ActiveMerchant #:nodoc:
47
47
  end
48
48
 
49
49
  def void(authorization, options={})
50
- authorization, _ = authorization.split('|')
50
+ authorization, = authorization.split('|')
51
51
  post = { status: 'cancelled' }
52
52
  commit('void', "payments/#{authorization}", post)
53
53
  end
@@ -98,6 +98,7 @@ module ActiveMerchant #:nodoc:
98
98
  add_processing_mode(post, options)
99
99
  add_net_amount(post, options)
100
100
  add_taxes(post, options)
101
+ add_notification_url(post, options)
101
102
  post[:binary_mode] = (options[:binary_mode].nil? ? true : options[:binary_mode])
102
103
  post
103
104
  end
@@ -203,6 +204,10 @@ module ActiveMerchant #:nodoc:
203
204
  post[:net_amount] = Float(options[:net_amount]) if options[:net_amount]
204
205
  end
205
206
 
207
+ def add_notification_url(post, options)
208
+ post[:notification_url] = options[:notification_url] if options[:notification_url]
209
+ end
210
+
206
211
  def add_taxes(post, options)
207
212
  return unless (tax_object = options[:taxes])
208
213
 
@@ -251,7 +256,7 @@ module ActiveMerchant #:nodoc:
251
256
  end
252
257
 
253
258
  def commit(action, path, parameters)
254
- if ['capture', 'void'].include?(action)
259
+ if %w[capture void].include?(action)
255
260
  response = parse(ssl_request(:put, url(path), post_data(parameters), headers))
256
261
  else
257
262
  response = parse(ssl_post(url(path), post_data(parameters), headers(parameters)))
@@ -271,7 +276,7 @@ module ActiveMerchant #:nodoc:
271
276
  if action == 'refund'
272
277
  response['status'] != 404 && response['error'].nil?
273
278
  else
274
- ['active', 'approved', 'authorized', 'cancelled', 'in_process'].include?(response['status'])
279
+ %w[active approved authorized cancelled in_process].include?(response['status'])
275
280
  end
276
281
  end
277
282
 
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  self.supported_countries = ['US']
11
11
 
12
12
  # The card types supported by the payment gateway
13
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb]
13
+ self.supported_cardtypes = %i[visa master american_express discover jcb]
14
14
 
15
15
  # The homepage URL of the gateway
16
16
  self.homepage_url = 'http://www.merchante-solutions.com/'
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
13
13
  BASE_URL = 'https://secure.merchantonegateway.com/api/transact.php'
14
14
 
15
15
  self.supported_countries = ['US']
16
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
+ self.supported_cardtypes = %i[visa master american_express discover]
17
17
  self.homepage_url = 'http://merchantone.com/'
18
18
  self.display_name = 'Merchant One Gateway'
19
19
  self.money_format = :dollars
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  def add_creditcard(post, creditcard)
77
77
  post['cvv'] = creditcard.verification_value
78
78
  post['ccnumber'] = creditcard.number
79
- post['ccexp'] = "#{sprintf("%02d", creditcard.month)}#{creditcard.year.to_s[-2, 2]}"
79
+ post['ccexp'] = "#{sprintf('%02d', creditcard.month)}#{creditcard.year.to_s[-2, 2]}"
80
80
  end
81
81
 
82
82
  def commit(action, money, parameters={})
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
  self.supported_countries = ['US']
12
12
  self.default_currency = 'USD'
13
13
  self.money_format = :dollars
14
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
14
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
15
15
 
16
16
  def initialize(options={})
17
17
  requires!(options, :account_id, :merchant_pin)
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.v4_live_url = 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v4/Credit.asmx'
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://merchantwarehouse.com/merchantware'
12
12
  self.display_name = 'MerchantWARE'
13
13
 
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.test_url = 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v4/Credit.asmx'
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://merchantwarehouse.com/merchantware'
10
10
  self.display_name = 'MerchantWARE'
11
11
 
@@ -11,8 +11,8 @@ module ActiveMerchant #:nodoc:
11
11
  POST_LIVE_URL = 'https://api.merchantwarrior.com/post/'
12
12
 
13
13
  self.supported_countries = ['AU']
14
- self.supported_cardtypes = [:visa, :master, :american_express,
15
- :diners_club, :discover, :jcb]
14
+ self.supported_cardtypes = %i[visa master american_express
15
+ diners_club discover jcb]
16
16
  self.homepage_url = 'https://www.merchantwarrior.com/'
17
17
  self.display_name = 'Merchant Warrior'
18
18
 
@@ -18,8 +18,8 @@ module ActiveMerchant #:nodoc:
18
18
 
19
19
  self.homepage_url = 'http://www.mercurypay.com'
20
20
  self.display_name = 'Mercury'
21
- self.supported_countries = ['US', 'CA']
22
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
21
+ self.supported_countries = %w[US CA]
22
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
23
23
  self.default_currency = 'USD'
24
24
 
25
25
  STANDARD_ERROR_CODE_MAPPING = {
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  xml.tag! 'Transaction' do
104
104
  xml.tag! 'TranType', 'Credit'
105
105
  xml.tag! 'TranCode', action
106
- xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && ['PreAuth', 'Sale'].include?(action)
106
+ xml.tag! 'PartialAuth', 'Allow' if options[:allow_partial_auth] && %w[PreAuth Sale].include?(action)
107
107
  add_invoice(xml, options[:order_id], nil, options)
108
108
  add_reference(xml, 'RecordNumberRequested')
109
109
  add_customer_data(xml, options)
@@ -294,7 +294,7 @@ module ActiveMerchant #:nodoc:
294
294
  }
295
295
  end
296
296
 
297
- SUCCESS_CODES = ['Approved', 'Success']
297
+ SUCCESS_CODES = %w[Approved Success]
298
298
 
299
299
  def commit(action, request)
300
300
  response = parse(action, ssl_post(endpoint_url, build_soap_request(request), build_header))
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE = 5, 6, 38
32
32
 
33
33
  self.supported_countries = ['US']
34
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
34
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
35
35
  self.homepage_url = 'http://www.metricsglobal.com'
36
36
  self.display_name = 'Metrics Global'
37
37
 
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.supported_countries = %w(DE)
10
10
  self.default_currency = 'EUR'
11
11
  self.money_format = :cents
12
- self.supported_cardtypes = [:visa, :master, :american_express]
12
+ self.supported_cardtypes = %i[visa master american_express]
13
13
 
14
14
  def initialize(options={})
15
15
  requires!(options, :access_key)
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
175
175
 
176
176
  def authorization_from(response, request_params)
177
177
  session_id = response['sessionId'] || request_params[:sessionId]
178
- "#{session_id}|#{response["transactionId"]}"
178
+ "#{session_id}|#{response['transactionId']}"
179
179
  end
180
180
  end
181
181
  end
@@ -20,7 +20,7 @@ module ActiveMerchant #:nodoc:
20
20
  self.supported_countries = %w(AU AE BD BN EG HK ID JO KW LB LK MU MV MY NZ OM PH QA SA SG TT VN)
21
21
 
22
22
  # The card types supported by the payment gateway
23
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
23
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
24
24
 
25
25
  self.money_format = :cents
26
26
  self.currencies_without_fractions = %w(IDR)
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  TEST_XMLNS = 'https://secure.modpay.com/netservices/test/'
9
9
 
10
10
  self.supported_countries = ['US']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
  self.homepage_url = 'http://www.modpay.com'
13
13
  self.display_name = 'Modern Payments'
14
14
 
@@ -14,9 +14,9 @@ module ActiveMerchant #:nodoc:
14
14
  self.test_url = 'https://test.monei-api.net/payment/ctpe'
15
15
  self.live_url = 'https://monei-api.net/payment/ctpe'
16
16
 
17
- self.supported_countries = ['AD', 'AT', 'BE', 'BG', 'CA', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'GB', 'GI', 'GR', 'HU', 'IE', 'IL', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'TR', 'US', 'VA']
17
+ self.supported_countries = %w[AD AT BE BG CA CH CY CZ DE DK EE ES FI FO FR GB GI GR HU IE IL IS IT LI LT LU LV MT NL NO PL PT RO SE SI SK TR US VA]
18
18
  self.default_currency = 'EUR'
19
- self.supported_cardtypes = [:visa, :master, :maestro, :jcb, :american_express]
19
+ self.supported_cardtypes = %i[visa master maestro jcb american_express]
20
20
 
21
21
  self.homepage_url = 'http://www.monei.net/'
22
22
  self.display_name = 'Monei'
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
13
13
  self.live_url = 'https://www3.moneris.com/gateway2/servlet/MpgRequest'
14
14
 
15
15
  self.supported_countries = ['CA']
16
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover]
16
+ self.supported_cardtypes = %i[visa master american_express diners_club discover]
17
17
  self.homepage_url = 'http://www.moneris.com/'
18
18
  self.display_name = 'Moneris'
19
19
 
@@ -417,27 +417,27 @@ module ActiveMerchant #:nodoc:
417
417
 
418
418
  def actions
419
419
  {
420
- 'purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
421
- 'preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
420
+ 'purchase' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
421
+ 'preauth' => %i[order_id cust_id amount pan expdate crypt_type avs_info cvd_info track2 pos_code cof_info],
422
422
  'command' => [:order_id],
423
- 'refund' => [:order_id, :amount, :txn_number, :crypt_type],
424
- 'indrefund' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
425
- 'completion' => [:order_id, :comp_amount, :txn_number, :crypt_type],
426
- 'purchasecorrection' => [:order_id, :txn_number, :crypt_type],
427
- 'cavv_preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
428
- 'cavv_purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
429
- 'card_verification' => [:order_id, :cust_id, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :cof_info],
430
- 'transact' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
423
+ 'refund' => %i[order_id amount txn_number crypt_type],
424
+ 'indrefund' => %i[order_id cust_id amount pan expdate crypt_type],
425
+ 'completion' => %i[order_id comp_amount txn_number crypt_type],
426
+ 'purchasecorrection' => %i[order_id txn_number crypt_type],
427
+ 'cavv_preauth' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
428
+ 'cavv_purchase' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
429
+ 'card_verification' => %i[order_id cust_id pan expdate crypt_type avs_info cvd_info cof_info],
430
+ 'transact' => %i[order_id cust_id amount pan expdate crypt_type],
431
431
  'Batchcloseall' => [],
432
432
  'opentotals' => [:ecr_number],
433
433
  'batchclose' => [:ecr_number],
434
- 'res_add_cc' => [:pan, :expdate, :crypt_type, :avs_info, :cof_info],
435
- 'res_temp_add' => [:pan, :expdate, :crypt_type, :duration],
434
+ 'res_add_cc' => %i[pan expdate crypt_type avs_info cof_info],
435
+ 'res_temp_add' => %i[pan expdate crypt_type duration],
436
436
  'res_delete' => [:data_key],
437
- 'res_update_cc' => [:data_key, :pan, :expdate, :crypt_type, :avs_info, :cof_info],
438
- 'res_purchase_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
439
- 'res_preauth_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
440
- 'res_card_verification_cc' => [:order_id, :data_key, :expdate, :crypt_type, :cof_info]
437
+ 'res_update_cc' => %i[data_key pan expdate crypt_type avs_info cof_info],
438
+ 'res_purchase_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
439
+ 'res_preauth_cc' => %i[data_key order_id cust_id amount crypt_type cof_info],
440
+ 'res_card_verification_cc' => %i[order_id data_key expdate crypt_type cof_info]
441
441
  }
442
442
  end
443
443
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.homepage_url = 'http://mmoa.us/'
9
9
  self.display_name = 'MoneyMovers'
10
10
  self.supported_countries = ['US']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
12
 
13
13
  def initialize(options = {})
14
14
  requires!(options, :login, :password)
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
 
6
6
  self.supported_countries = ['US']
7
7
  self.default_currency = 'USD'
8
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :alelo]
8
+ self.supported_cardtypes = %i[visa master american_express discover alelo]
9
9
 
10
10
  self.homepage_url = 'https://www.mundipagg.com/'
11
11
  self.display_name = 'Mundipagg'
@@ -16,7 +16,7 @@ module ActiveMerchant #:nodoc:
16
16
  self.live_periodic_url = 'https://transact.nab.com.au/xmlapi/periodic'
17
17
 
18
18
  self.supported_countries = ['AU']
19
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
19
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
20
20
 
21
21
  self.homepage_url = 'http://transact.nab.com.au'
22
22
  self.display_name = 'NAB Transact'
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  trigger: 8
40
40
  }
41
41
 
42
- SUCCESS_CODES = ['00', '08', '11', '16', '77']
42
+ SUCCESS_CODES = %w[00 08 11 16 77]
43
43
 
44
44
  def initialize(options = {})
45
45
  requires!(options, :login, :password)
@@ -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
 
13
13
  self.homepage_url = 'http://www.ncrretailonline.com'
14
14
  self.display_name = 'NCR Secure Pay'
@@ -24,7 +24,7 @@ module ActiveMerchant
24
24
  class NetRegistryGateway < Gateway
25
25
  self.live_url = self.test_url = 'https://paygate.ssllock.net/external2.pl'
26
26
 
27
- FILTERED_PARAMS = ['card_no', 'card_expiry', 'receipt_array']
27
+ FILTERED_PARAMS = %w[card_no card_expiry receipt_array]
28
28
 
29
29
  self.supported_countries = ['AU']
30
30
 
@@ -32,7 +32,7 @@ module ActiveMerchant
32
32
  # steps in setting up your account, as detailed in
33
33
  # "Programming for NetRegistry's E-commerce Gateway."
34
34
  # [http://rubyurl.com/hNG]
35
- self.supported_cardtypes = [:visa, :master, :diners_club, :american_express, :jcb]
35
+ self.supported_cardtypes = %i[visa master diners_club american_express jcb]
36
36
  self.display_name = 'NetRegistry'
37
37
  self.homepage_url = 'http://www.netregistry.com.au'
38
38
 
@@ -7,10 +7,10 @@ module ActiveMerchant #:nodoc:
7
7
  self.live_url = 'https://epayment.bbs.no/'
8
8
 
9
9
  # The countries the gateway supports merchants from as 2 digit ISO country codes
10
- self.supported_countries = ['NO', 'DK', 'SE', 'FI']
10
+ self.supported_countries = %w[NO DK SE FI]
11
11
 
12
12
  # The card types supported by the payment gateway
13
- self.supported_cardtypes = [:visa, :master, :american_express]
13
+ self.supported_cardtypes = %i[visa master american_express]
14
14
 
15
15
  # The homepage URL of the gateway
16
16
  self.homepage_url = 'http://www.betalingsterminal.no/Netthandel-forside/'
@@ -7,14 +7,14 @@ module ActiveMerchant #:nodoc:
7
7
 
8
8
  self.supported_countries = %w(AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BQ BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CD CK CR CI HR CU CW CY CZ DK DJ DM DO EC EG SV GQ ER EE ET FK FO FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GG GN GW GY HT HM HN HK HU IS IN ID IR IQ IE IM IL IT JM JP JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME MS MA MZ MM NA NR NP NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL PT PR QA RE RO RU RW BL SH KN LC MF VC WS SM ST SA SN RS SC SL SG SX SK SI SB SO ZA GS SS ES LK PM SD SR SJ SZ SE CH SY TW TJ TZ TH NL TL TG TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VA VE VN VG VI WF EH YE ZM ZW)
9
9
  self.default_currency = 'CAD'
10
- self.supported_cardtypes = [
11
- :american_express,
12
- :diners_club,
13
- :discover,
14
- :jcb,
15
- :master,
16
- :maestro,
17
- :visa
10
+ self.supported_cardtypes = %i[
11
+ american_express
12
+ diners_club
13
+ discover
14
+ jcb
15
+ master
16
+ maestro
17
+ visa
18
18
  ]
19
19
 
20
20
  self.money_format = :cents
@@ -37,6 +37,10 @@ module ActiveMerchant #:nodoc:
37
37
  end
38
38
 
39
39
  def authorize(money, payment, options={})
40
+ # Do a Verification with AVS prior to Auth + Settle
41
+ verification_response = verify(payment, options)
42
+ return verification_response if verification_response.message != 'OK'
43
+
40
44
  post = {}
41
45
  add_invoice(post, money, options)
42
46
  add_payment(post, payment, options)
@@ -52,14 +56,28 @@ module ActiveMerchant #:nodoc:
52
56
  end
53
57
 
54
58
  def refund(money, authorization, options={})
59
+ # If the transactions that are pending, API call needs to be Cancellation
60
+ settlement_data = get_settlement(authorization)
61
+ return settlement_data if settlement_data.message != 'OK'
62
+
55
63
  post = {}
56
- add_invoice(post, money, options)
64
+ if settlement_data.params['status'] == 'PENDING'
65
+ post[:status] = 'CANCELLED'
66
+ commit(:put, "settlements/#{authorization}", post)
67
+ else
68
+ add_invoice(post, money, options)
57
69
 
58
- # Setting merchantRefNumber to a unique id for each refund
59
- # This is to support multiple partial refunds for the same order
60
- post[:merchantRefNum] = SecureRandom.uuid
70
+ # Setting merchantRefNumber to a unique id for each refund
71
+ # This is to support multiple partial refunds for the same order
72
+ post[:merchantRefNum] = SecureRandom.uuid
61
73
 
62
- commit(:post, "settlements/#{authorization}/refunds", post)
74
+ commit(:post, "settlements/#{authorization}/refunds", post)
75
+ end
76
+ end
77
+
78
+ def get_settlement(authorization)
79
+ post = {}
80
+ commit(:get, "settlements/#{authorization}", post)
63
81
  end
64
82
 
65
83
  def void(authorization, options={})
@@ -71,7 +89,7 @@ module ActiveMerchant #:nodoc:
71
89
 
72
90
  def verify(credit_card, options={})
73
91
  post = {}
74
- add_payment(post, credit_card)
92
+ add_payment(post, credit_card, options)
75
93
  add_order_id(post, options)
76
94
 
77
95
  commit(:post, 'verifications', post)
@@ -139,14 +157,14 @@ module ActiveMerchant #:nodoc:
139
157
  add_order_id(post, options)
140
158
  end
141
159
 
142
- def add_payment(post, credit_card_or_reference, options = {})
160
+ def add_payment(post, credit_card_reference, options = {})
143
161
  post[:card] ||= {}
144
- if credit_card_or_reference.is_a?(String)
145
- post[:card][:paymentToken] = credit_card_or_reference
162
+ if credit_card_reference.is_a?(String)
163
+ post[:card][:paymentToken] = credit_card_reference
146
164
  else
147
- post[:card][:cardNum] = credit_card_or_reference.number
148
- post[:card][:cvv] = credit_card_or_reference.verification_value
149
- post[:card][:cardExpiry] = expdate(credit_card_or_reference)
165
+ post[:card][:cardNum] = credit_card_reference.number
166
+ post[:card][:cvv] = credit_card_reference.verification_value
167
+ post[:card][:cardExpiry] = expdate(credit_card_reference)
150
168
  end
151
169
 
152
170
  post[:currencyCode] = options[:currency] if options[:currency]
@@ -202,7 +220,11 @@ module ActiveMerchant #:nodoc:
202
220
  params = parameters.to_json unless parameters.nil?
203
221
  response =
204
222
  begin
205
- parse(ssl_request(method, get_url(uri), params, headers))
223
+ if method == :get
224
+ parse(ssl_request(method, get_url(uri), nil, headers))
225
+ else
226
+ parse(ssl_request(method, get_url(uri), params, headers))
227
+ end
206
228
  rescue ResponseError => e
207
229
  return Response.new(false, 'Invalid Login') if e.response.code == '401'
208
230
 
@@ -216,7 +238,9 @@ module ActiveMerchant #:nodoc:
216
238
  response,
217
239
  test: test?,
218
240
  error_code: error_code_from(response),
219
- authorization: authorization_from(success, get_url(uri), method, response)
241
+ authorization: authorization_from(success, get_url(uri), method, response),
242
+ avs_result: AVSResult.new(code: response['avsResponse']),
243
+ cvv_result: CVVResult.new(response['cvvVerification'])
220
244
  )
221
245
  end
222
246