activemerchant 1.108.0 → 1.113.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +69 -0
  3. data/README.md +2 -2
  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 +3 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +10 -7
  8. data/lib/active_merchant/billing/gateway.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/adyen.rb +25 -14
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +13 -13
  12. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  13. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +4 -4
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
  15. data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +3 -3
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  18. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  19. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +2 -2
  20. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  21. data/lib/active_merchant/billing/gateways/be2bill.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -4
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -2
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +50 -13
  25. data/lib/active_merchant/billing/gateways/borgun.rb +4 -4
  26. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/braintree_blue.rb +85 -35
  29. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  30. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_stream.rb +4 -4
  34. data/lib/active_merchant/billing/gateways/cardknox.rb +5 -5
  35. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
  38. data/lib/active_merchant/billing/gateways/cenpos.rb +13 -13
  39. data/lib/active_merchant/billing/gateways/checkout.rb +3 -3
  40. data/lib/active_merchant/billing/gateways/checkout_v2.rb +3 -3
  41. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -3
  43. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  46. data/lib/active_merchant/billing/gateways/credorax.rb +13 -3
  47. data/lib/active_merchant/billing/gateways/ct_payment.rb +2 -2
  48. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/cyber_source.rb +66 -20
  50. data/lib/active_merchant/billing/gateways/d_local.rb +7 -3
  51. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  52. data/lib/active_merchant/billing/gateways/decidir.rb +1 -1
  53. data/lib/active_merchant/billing/gateways/dibs.rb +2 -2
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +3 -3
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +4 -4
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -3
  57. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  58. data/lib/active_merchant/billing/gateways/element.rb +7 -3
  59. data/lib/active_merchant/billing/gateways/epay.rb +3 -3
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +1 -1
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +4 -4
  64. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  65. data/lib/active_merchant/billing/gateways/ezic.rb +2 -2
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  69. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/first_pay.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +4 -4
  72. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +11 -3
  73. data/lib/active_merchant/billing/gateways/flo2cash.rb +11 -11
  74. data/lib/active_merchant/billing/gateways/forte.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
  76. data/lib/active_merchant/billing/gateways/global_collect.rb +10 -5
  77. data/lib/active_merchant/billing/gateways/global_transport.rb +1 -1
  78. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  79. data/lib/active_merchant/billing/gateways/hps.rb +10 -7
  80. data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
  81. data/lib/active_merchant/billing/gateways/inspire.rb +1 -1
  82. data/lib/active_merchant/billing/gateways/instapay.rb +1 -1
  83. data/lib/active_merchant/billing/gateways/ipp.rb +3 -3
  84. data/lib/active_merchant/billing/gateways/iridium.rb +5 -5
  85. data/lib/active_merchant/billing/gateways/itransact.rb +1 -1
  86. data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
  87. data/lib/active_merchant/billing/gateways/ixopay.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/jetpay.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -2
  90. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  91. data/lib/active_merchant/billing/gateways/kushki.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  93. data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
  94. data/lib/active_merchant/billing/gateways/litle.rb +5 -5
  95. data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
  96. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  97. data/lib/active_merchant/billing/gateways/mercado_pago.rb +12 -7
  98. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  100. data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +1 -1
  103. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +2 -2
  104. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  105. data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  107. data/lib/active_merchant/billing/gateways/migs.rb +1 -1
  108. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -1
  109. data/lib/active_merchant/billing/gateways/monei.rb +2 -2
  110. data/lib/active_merchant/billing/gateways/moneris.rb +17 -17
  111. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  114. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  115. data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netaxept.rb +2 -2
  117. data/lib/active_merchant/billing/gateways/netbanx.rb +53 -23
  118. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  120. data/lib/active_merchant/billing/gateways/network_merchants.rb +1 -1
  121. data/lib/active_merchant/billing/gateways/nmi.rb +4 -4
  122. data/lib/active_merchant/billing/gateways/ogone.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/omise.rb +1 -1
  124. data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
  125. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/optimal_payment.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/orbital.rb +14 -7
  128. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  129. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  130. data/lib/active_merchant/billing/gateways/pagarme.rb +3 -3
  131. data/lib/active_merchant/billing/gateways/pago_facil.rb +1 -1
  132. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +2 -2
  134. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/pay_junction.rb +5 -5
  136. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  137. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/paybox_direct.rb +3 -3
  139. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  140. data/lib/active_merchant/billing/gateways/payex.rb +18 -18
  141. data/lib/active_merchant/billing/gateways/payflow.rb +8 -5
  142. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +2 -2
  143. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  144. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paymill.rb +4 -4
  148. data/lib/active_merchant/billing/gateways/paypal.rb +2 -2
  149. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  150. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  151. data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
  152. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  153. data/lib/active_merchant/billing/gateways/payu_latam.rb +10 -8
  154. data/lib/active_merchant/billing/gateways/payway.rb +1 -1
  155. data/lib/active_merchant/billing/gateways/pin.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -6
  157. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  158. data/lib/active_merchant/billing/gateways/psigate.rb +2 -2
  159. data/lib/active_merchant/billing/gateways/psl_card.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/qbms.rb +4 -4
  161. data/lib/active_merchant/billing/gateways/quantum.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/quickbooks.rb +9 -8
  163. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +3 -3
  164. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +4 -4
  165. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
  166. data/lib/active_merchant/billing/gateways/realex.rb +2 -1
  167. data/lib/active_merchant/billing/gateways/redsys.rb +7 -7
  168. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  169. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -2
  170. data/lib/active_merchant/billing/gateways/sage.rb +3 -3
  171. data/lib/active_merchant/billing/gateways/sage_pay.rb +7 -7
  172. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -1
  173. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -1
  174. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  175. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -2
  176. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  177. data/lib/active_merchant/billing/gateways/securion_pay.rb +1 -1
  178. data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -6
  179. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  180. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/stripe.rb +8 -8
  182. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +20 -1
  183. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/telr.rb +5 -5
  185. data/lib/active_merchant/billing/gateways/tns.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +3 -3
  188. data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -1
  189. data/lib/active_merchant/billing/gateways/transax.rb +1 -1
  190. data/lib/active_merchant/billing/gateways/trexle.rb +1 -1
  191. data/lib/active_merchant/billing/gateways/trust_commerce.rb +12 -12
  192. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +10 -10
  193. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +2 -2
  194. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  195. data/lib/active_merchant/billing/gateways/verifi.rb +3 -3
  196. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
  197. data/lib/active_merchant/billing/gateways/visanet_peru.rb +3 -3
  198. data/lib/active_merchant/billing/gateways/webpay.rb +1 -1
  199. data/lib/active_merchant/billing/gateways/wepay.rb +2 -2
  200. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -1
  201. data/lib/active_merchant/billing/gateways/world_net.rb +35 -35
  202. data/lib/active_merchant/billing/gateways/worldpay.rb +6 -6
  203. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  204. data/lib/active_merchant/billing/gateways/worldpay_us.rb +3 -3
  205. data/lib/active_merchant/version.rb +1 -1
  206. data/lib/support/gateway_support.rb +1 -1
  207. metadata +45 -31
@@ -31,8 +31,8 @@ module ActiveMerchant #:nodoc:
31
31
 
32
32
  self.default_currency = 'USD'
33
33
 
34
- self.supported_countries = ['US', 'CA', 'GB']
35
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
34
+ self.supported_countries = %w[US CA GB]
35
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
36
36
  self.homepage_url = 'http://www.authorize.net/'
37
37
  self.display_name = 'Authorize.Net'
38
38
 
@@ -84,7 +84,7 @@ module ActiveMerchant #:nodoc:
84
84
  # initial billing occurs) and the total number of billing <tt>:occurrences</tt> or payments for the subscription. (REQUIRED)
85
85
  def recurring(money, creditcard, options={})
86
86
  requires!(options, :interval, :duration, :billing_address)
87
- requires!(options[:interval], :length, [:unit, :days, :months])
87
+ requires!(options[:interval], :length, %i[unit days months])
88
88
  requires!(options[:duration], :start_date, :occurrences)
89
89
  requires!(options[:billing_address], :first_name, :last_name)
90
90
 
@@ -81,7 +81,7 @@ module ActiveMerchant #:nodoc:
81
81
  self.homepage_url = 'http://www.authorize.net/'
82
82
  self.display_name = 'Authorize.Net CIM'
83
83
  self.supported_countries = ['US']
84
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
84
+ self.supported_cardtypes = %i[visa master american_express discover]
85
85
 
86
86
  # Creates a new AuthorizeNetCimGateway
87
87
  #
@@ -691,10 +691,10 @@ module ActiveMerchant #:nodoc:
691
691
  add_order(xml, transaction[:order]) if transaction[:order].present?
692
692
 
693
693
  end
694
- if [:auth_capture, :auth_only, :capture_only].include?(transaction[:type])
694
+ if %i[auth_capture auth_only capture_only].include?(transaction[:type])
695
695
  xml.tag!('recurringBilling', transaction[:recurring_billing]) if transaction.has_key?(:recurring_billing)
696
696
  end
697
- tag_unless_blank(xml, 'cardCode', transaction[:card_code]) unless [:void, :refund, :prior_auth_capture].include?(transaction[:type])
697
+ tag_unless_blank(xml, 'cardCode', transaction[:card_code]) unless %i[void refund prior_auth_capture].include?(transaction[:type])
698
698
  end
699
699
  end
700
700
  end
@@ -928,7 +928,7 @@ module ActiveMerchant #:nodoc:
928
928
  'card_type' => direct_response_fields[51] || '',
929
929
  'split_tender_id' => direct_response_fields[52] || '',
930
930
  'requested_amount' => direct_response_fields[53] || '',
931
- 'balance_on_card' => direct_response_fields[54] || '',
931
+ 'balance_on_card' => direct_response_fields[54] || ''
932
932
  }
933
933
  )
934
934
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT MX NL
9
9
  NO PL PT RO RU SE SI SK TR US VA)
10
10
 
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro]
12
12
 
13
13
  self.homepage_url = 'http://www.axcessms.com/'
14
14
  self.display_name = 'Axcess MS'
@@ -22,7 +22,7 @@ module ActiveMerchant #:nodoc:
22
22
  self.live_url = 'https://api.balancedpayments.com'
23
23
 
24
24
  self.supported_countries = ['US']
25
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
25
+ self.supported_cardtypes = %i[visa master american_express discover]
26
26
  self.homepage_url = 'https://www.balancedpayments.com/'
27
27
  self.display_name = 'Balanced'
28
28
  self.money_format = :cents
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
254
254
  'Authorization' => 'Basic ' + Base64.encode64(@options[:login].to_s + ':').strip,
255
255
  'User-Agent' => "Balanced/v1.1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
256
256
  'Accept' => 'application/vnd.api+json;revision=1.1',
257
- 'X-Balanced-User-Agent' => @@ua,
257
+ 'X-Balanced-User-Agent' => @@ua
258
258
  }
259
259
  end
260
260
  end
@@ -6,8 +6,8 @@ module ActiveMerchant #:nodoc:
6
6
  self.live_url = 'https://www.bambora.co.nz/interface/api'
7
7
  self.test_url = 'https://demo.bambora.co.nz/interface/api'
8
8
 
9
- self.supported_countries = ['AU', 'NZ']
10
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
9
+ self.supported_countries = %w[AU NZ]
10
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
11
11
 
12
12
  self.homepage_url = 'http://www.bambora.com/'
13
13
  self.display_name = 'Bambora Asia-Pacific'
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  '05' => STANDARD_ERROR_CODE[:card_declined],
19
19
  '06' => STANDARD_ERROR_CODE[:processing_error],
20
20
  '14' => STANDARD_ERROR_CODE[:invalid_number],
21
- '54' => STANDARD_ERROR_CODE[:expired_card],
21
+ '54' => STANDARD_ERROR_CODE[:expired_card]
22
22
  }
23
23
 
24
24
  def initialize(options={})
@@ -9,9 +9,9 @@ module ActiveMerchant #:nodoc:
9
9
  self.test_url = 'https://test.ctpe.io/payment/ctpe'
10
10
  self.live_url = 'https://ctpe.io/payment/ctpe'
11
11
 
12
- self.supported_countries = ['LI', 'US']
12
+ self.supported_countries = %w[LI US]
13
13
  self.default_currency = 'EUR'
14
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
14
+ self.supported_cardtypes = %i[visa master american_express discover]
15
15
 
16
16
  self.homepage_url = 'http://www.bankfrickacquiring.com/'
17
17
  self.display_name = 'Bank Frick'
@@ -24,7 +24,7 @@ module ActiveMerchant #:nodoc:
24
24
  'authonly' => 'CC.PA',
25
25
  'capture' => 'CC.CP',
26
26
  'refund' => 'CC.RF',
27
- 'void' => 'CC.RV',
27
+ 'void' => 'CC.RV'
28
28
  }
29
29
 
30
30
  def initialize(options={})
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  URL = 'https://banwire.com/api.pago_pro'
5
5
 
6
6
  self.supported_countries = ['MX']
7
- self.supported_cardtypes = [:visa, :master, :american_express]
7
+ self.supported_cardtypes = %i[visa master american_express]
8
8
  self.homepage_url = 'http://www.banwire.com/'
9
9
  self.display_name = 'Banwire'
10
10
 
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  post[:card_num] = creditcard.number
64
64
  post[:card_name] = creditcard.name
65
65
  post[:card_type] = card_brand(creditcard)
66
- post[:card_exp] = "#{sprintf("%02d", creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
66
+ post[:card_exp] = "#{sprintf('%02d', creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
67
67
  post[:card_ccv2] = creditcard.verification_value
68
68
  end
69
69
 
@@ -4,11 +4,11 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
5
5
  self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
6
6
 
7
- self.supported_countries = ['AL', 'AD', 'AM', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'KZ', 'LV', 'LI', 'LT', 'LU', 'MK', 'MT', 'MD', 'MC', 'ME', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TR', 'UA', 'GB', 'VA']
7
+ self.supported_countries = %w[AL AD AM AT AZ BY BE BA BG HR CY CZ DK EE FI FR DE GR HU IS IE IT KZ LV LI LT LU MK MT MD MC ME NL NO PL PT RO RU SM RS SK SI ES SE CH TR UA GB VA]
8
8
  self.default_currency = 'EUR'
9
9
  self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
10
10
  self.money_format = :cents
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb dankort maestro]
12
12
 
13
13
  self.homepage_url = 'https://www.barclaycardsmartpay.com/'
14
14
  self.display_name = 'Barclaycard Smartpay'
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/'
9
9
 
10
10
  self.supported_countries = ['GB']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
12
12
  self.default_currency = 'GBP'
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.display_name = 'Be2Bill'
10
10
  self.homepage_url = 'http://www.be2bill.com/'
11
11
  self.supported_countries = ['FR']
12
- self.supported_cardtypes = [:visa, :master, :american_express]
12
+ self.supported_cardtypes = %i[visa master american_express]
13
13
  self.default_currency = 'EUR'
14
14
  self.money_format = :cents
15
15
 
@@ -131,10 +131,10 @@ module ActiveMerchant #:nodoc:
131
131
  base.default_currency = 'CAD'
132
132
 
133
133
  # The countries the gateway supports merchants from as 2 digit ISO country codes
134
- base.supported_countries = ['CA', 'US']
134
+ base.supported_countries = %w[CA US]
135
135
 
136
136
  # The card types supported by the payment gateway
137
- base.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
137
+ base.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
138
138
 
139
139
  # The homepage URL of the gateway
140
140
  base.homepage_url = 'http://www.beanstream.com/'
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  end
156
156
 
157
157
  def capture(money, authorization, options = {})
158
- reference, _, _ = split_auth(authorization)
158
+ reference, = split_auth(authorization)
159
159
  post = {}
160
160
  add_amount(post, money)
161
161
  add_reference(post, reference)
@@ -259,7 +259,7 @@ module ActiveMerchant #:nodoc:
259
259
  [options[:billing_address], options[:shipping_address]].compact.each do |address|
260
260
  next if empty?(address[:country])
261
261
 
262
- unless ['US', 'CA'].include?(address[:country])
262
+ unless %w[US CA].include?(address[:country])
263
263
  address[:state] = '--'
264
264
  address[:zip] = '000000' unless address[:zip]
265
265
  end
@@ -44,8 +44,8 @@ module ActiveMerchant #:nodoc:
44
44
  'CUST_TOKEN' => :cust_token
45
45
  }
46
46
 
47
- self.supported_countries = ['US', 'CA']
48
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
47
+ self.supported_countries = %w[US CA]
48
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
49
49
  self.homepage_url = 'http://www.bluepay.com/'
50
50
  self.display_name = 'BluePay'
51
51
  self.money_format = :dollars
@@ -8,7 +8,7 @@ module ActiveMerchant
8
8
  self.supported_countries = %w(US CA GB AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE AR BO BR BZ CL CO CR DO EC GF GP GT HN HT MF MQ MX NI PA PE PR PY SV UY VE)
9
9
 
10
10
  self.default_currency = 'USD'
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro, :naranja, :cabal]
11
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro naranja cabal]
12
12
  self.currencies_without_fractions = %w(BYR CLP ILS JPY KRW VND XOF)
13
13
  self.currencies_with_three_decimal_places = %w(BHD JOD KWD OMR TND)
14
14
 
@@ -58,7 +58,7 @@ module ActiveMerchant
58
58
  'line1: N, zip: M, name: N' => 'W',
59
59
  'line1: N, zip: N, name: U' => 'N',
60
60
  'line1: N, zip: N, name: M' => 'K',
61
- 'line1: N, zip: N, name: N' => 'N',
61
+ 'line1: N, zip: N, name: N' => 'N'
62
62
  }
63
63
 
64
64
  BANK_ACCOUNT_TYPE_MAPPING = {
@@ -212,12 +212,28 @@ module ActiveMerchant
212
212
  end
213
213
  end
214
214
 
215
- def add_description(doc, description)
215
+ def add_metadata(doc, options)
216
+ transaction_meta_data = options.fetch(:transaction_meta_data, {})
217
+ return if transaction_meta_data.empty? && !options[:description]
218
+
216
219
  doc.send('transaction-meta-data') do
217
- doc.send('meta-data') do
218
- doc.send('meta-key', 'description')
219
- doc.send('meta-value', truncate(description, 500))
220
- doc.send('meta-description', 'Description')
220
+ # ensure backwards compatibility for calls expecting :description
221
+ # to become meta-data fields.
222
+ if options[:description]
223
+ doc.send('meta-data') do
224
+ doc.send('meta-key', 'description')
225
+ doc.send('meta-value', truncate(options[:description], 500))
226
+ doc.send('meta-description', 'Description')
227
+ end
228
+ end
229
+
230
+ # https://developers.bluesnap.com/v8976-XML/docs/meta-data
231
+ transaction_meta_data.each do |entry|
232
+ doc.send('meta-data') do
233
+ doc.send('meta-key', truncate(entry[:meta_key], 40))
234
+ doc.send('meta-value', truncate(entry[:meta_value], 500))
235
+ doc.send('meta-description', truncate(entry[:meta_description], 40))
236
+ end
221
237
  end
222
238
  end
223
239
  end
@@ -225,7 +241,7 @@ module ActiveMerchant
225
241
  def add_order(doc, options)
226
242
  doc.send('merchant-transaction-id', truncate(options[:order_id], 50)) if options[:order_id]
227
243
  doc.send('soft-descriptor', options[:soft_descriptor]) if options[:soft_descriptor]
228
- add_description(doc, options[:description]) if options[:description]
244
+ add_metadata(doc, options)
229
245
  add_3ds(doc, options[:three_d_secure]) if options[:three_d_secure]
230
246
  add_level_3_data(doc, options)
231
247
  end
@@ -315,7 +331,7 @@ module ActiveMerchant
315
331
  add_echeck_transaction(doc, payment_method_details.payment_method, options, vaulted_shopper_id.present?) if payment_method_details.check?
316
332
 
317
333
  add_fraud_info(doc, options)
318
- add_description(doc, options)
334
+ add_metadata(doc, options)
319
335
  end
320
336
 
321
337
  def add_echeck_transaction(doc, check, options, vaulted_shopper)
@@ -350,12 +366,21 @@ module ActiveMerchant
350
366
  parsed = {}
351
367
  doc = Nokogiri::XML(response.body)
352
368
  doc.root.xpath('*').each do |node|
369
+ name = node.name.downcase
370
+
353
371
  if node.elements.empty?
354
- parsed[node.name.downcase] = node.text
372
+ parsed[name] = node.text
373
+ elsif name == 'transaction-meta-data'
374
+ metadata = []
375
+ node.elements.each { |m|
376
+ metadata.push parse_metadata_entry(m)
377
+ }
378
+
379
+ parsed['transaction-meta-data'] = metadata
355
380
  else
356
- node.elements.each do |childnode|
381
+ node.elements.each { |childnode|
357
382
  parse_element(parsed, childnode)
358
- end
383
+ }
359
384
  end
360
385
  end
361
386
 
@@ -363,6 +388,18 @@ module ActiveMerchant
363
388
  parsed
364
389
  end
365
390
 
391
+ def parse_metadata_entry(node)
392
+ entry = {}
393
+
394
+ node.elements.each { |e|
395
+ entry = entry.merge({
396
+ e.name => e.text
397
+ })
398
+ }
399
+
400
+ entry
401
+ end
402
+
366
403
  def parse_element(parsed, node)
367
404
  if !node.elements.empty?
368
405
  node.elements.each { |e| parse_element(parsed, e) }
@@ -476,7 +513,7 @@ module ActiveMerchant
476
513
  def headers
477
514
  {
478
515
  'Content-Type' => 'application/xml',
479
- 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:api_username]}:#{@options[:api_password]}").strip),
516
+ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:api_username]}:#{@options[:api_password]}").strip)
480
517
  }
481
518
  end
482
519
 
@@ -9,10 +9,10 @@ module ActiveMerchant #:nodoc:
9
9
  self.test_url = 'https://gatewaytest.borgun.is/ws/Heimir.pub.ws:Authorization'
10
10
  self.live_url = 'https://gateway01.borgun.is/ws/Heimir.pub.ws:Authorization'
11
11
 
12
- self.supported_countries = ['IS', 'GB', 'HU', 'CZ', 'DE', 'DK', 'SE']
12
+ self.supported_countries = %w[IS GB HU CZ DE DK SE]
13
13
  self.default_currency = 'ISK'
14
14
  self.money_format = :cents
15
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb]
15
+ self.supported_cardtypes = %i[visa master american_express diners_club discover jcb]
16
16
 
17
17
  self.homepage_url = 'https://www.borgun.is/'
18
18
 
@@ -96,7 +96,7 @@ module ActiveMerchant #:nodoc:
96
96
  end
97
97
 
98
98
  def add_reference(post, authorization)
99
- dateandtime, _batch, transaction, rrn, authcode, _, _, _ = split_authorization(authorization)
99
+ dateandtime, _batch, transaction, rrn, authcode, = split_authorization(authorization)
100
100
  post[:DateAndTime] = dateandtime
101
101
  post[:Transaction] = transaction
102
102
  post[:RRN] = rrn
@@ -176,7 +176,7 @@ module ActiveMerchant #:nodoc:
176
176
 
177
177
  def headers
178
178
  {
179
- 'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:password].to_s),
179
+ 'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:password].to_s)
180
180
  }
181
181
  end
182
182
 
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
 
8
8
  self.supported_countries = ['AU']
9
9
  self.default_currency = 'AUD'
10
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
10
+ self.supported_cardtypes = %i[visa master american_express diners_club]
11
11
 
12
12
  self.homepage_url = 'https://www.bpoint.com.au/bpoint'
13
13
  self.display_name = 'BPoint'
@@ -1,7 +1,7 @@
1
1
  module BraintreeCommon
2
2
  def self.included(base)
3
3
  base.supported_countries = %w(US CA AD AT BE BG HR CY CZ DK EE FI FR GI DE GR GG HU IS IM IE IT JE LV LI LT LU MT MC NL NO PL PT RO SM SK SI ES SE CH TR GB SG HK MY AU NZ)
4
- base.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro]
4
+ base.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro]
5
5
  base.homepage_url = 'http://www.braintreepaymentsolutions.com'
6
6
  base.display_name = 'Braintree'
7
7
  base.default_currency = 'USD'
@@ -234,7 +234,7 @@ module ActiveMerchant #:nodoc:
234
234
  phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
235
235
  options[:billing_address][:phone]),
236
236
  id: options[:customer],
237
- device_data: options[:device_data],
237
+ device_data: options[:device_data]
238
238
  }.merge credit_card_params
239
239
  result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
240
240
  Response.new(result.success?, message_from_result(result),
@@ -258,7 +258,7 @@ module ActiveMerchant #:nodoc:
258
258
  cvv: credit_card.verification_value,
259
259
  expiration_month: credit_card.month.to_s.rjust(2, '0'),
260
260
  expiration_year: credit_card.year.to_s,
261
- device_data: options[:device_data],
261
+ device_data: options[:device_data]
262
262
  }
263
263
  if options[:billing_address]
264
264
  address = map_address(options[:billing_address])
@@ -299,7 +299,7 @@ module ActiveMerchant #:nodoc:
299
299
  def merge_credit_card_options(parameters, options)
300
300
  valid_options = {}
301
301
  options.each do |key, value|
302
- valid_options[key] = value if [:update_existing_token, :verify_card, :verification_merchant_account_id].include?(key)
302
+ valid_options[key] = value if %i[update_existing_token verify_card verification_merchant_account_id].include?(key)
303
303
  end
304
304
 
305
305
  valid_options[:verification_merchant_account_id] ||= @merchant_account_id if valid_options.include?(:verify_card) && @merchant_account_id
@@ -320,7 +320,7 @@ module ActiveMerchant #:nodoc:
320
320
  company: address[:company],
321
321
  locality: address[:city],
322
322
  region: address[:state],
323
- postal_code: scrub_zip(address[:zip]),
323
+ postal_code: scrub_zip(address[:zip])
324
324
  }
325
325
 
326
326
  mapped[:country_code_alpha2] = (address[:country] || address[:country_code_alpha2]) if address[:country] || address[:country_code_alpha2]
@@ -508,7 +508,7 @@ module ActiveMerchant #:nodoc:
508
508
  customer_details = {
509
509
  'id' => transaction.customer_details.id,
510
510
  'email' => transaction.customer_details.email,
511
- 'phone' => transaction.customer_details.phone,
511
+ 'phone' => transaction.customer_details.phone
512
512
  }
513
513
 
514
514
  billing_details = {
@@ -518,7 +518,7 @@ module ActiveMerchant #:nodoc:
518
518
  'locality' => transaction.billing_details.locality,
519
519
  'region' => transaction.billing_details.region,
520
520
  'postal_code' => transaction.billing_details.postal_code,
521
- 'country_name' => transaction.billing_details.country_name,
521
+ 'country_name' => transaction.billing_details.country_name
522
522
  }
523
523
 
524
524
  shipping_details = {
@@ -528,7 +528,7 @@ module ActiveMerchant #:nodoc:
528
528
  'locality' => transaction.shipping_details.locality,
529
529
  'region' => transaction.shipping_details.region,
530
530
  'postal_code' => transaction.shipping_details.postal_code,
531
- 'country_name' => transaction.shipping_details.country_name,
531
+ 'country_name' => transaction.shipping_details.country_name
532
532
  }
533
533
  credit_card_details = {
534
534
  'masked_number' => transaction.credit_card_details.masked_number,
@@ -578,64 +578,114 @@ module ActiveMerchant #:nodoc:
578
578
  options: {
579
579
  store_in_vault: options[:store] ? true : false,
580
580
  submit_for_settlement: options[:submit_for_settlement],
581
- hold_in_escrow: options[:hold_in_escrow],
581
+ hold_in_escrow: options[:hold_in_escrow]
582
582
  }
583
583
  }
584
584
 
585
- parameters[:options][:skip_advanced_fraud_checking] = options[:skip_advanced_fraud_checking] if options[:skip_advanced_fraud_checking]
586
-
587
- parameters[:options][:skip_avs] = options[:skip_avs] if options[:skip_avs]
588
-
589
- parameters[:options][:skip_cvv] = options[:skip_cvv] if options[:skip_cvv]
590
-
591
585
  parameters[:custom_fields] = options[:custom_fields]
592
586
  parameters[:device_data] = options[:device_data] if options[:device_data]
593
587
  parameters[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
594
- if merchant_account_id = (options[:merchant_account_id] || @merchant_account_id)
595
- parameters[:merchant_account_id] = merchant_account_id
596
- end
597
588
 
598
- if options[:transaction_source]
599
- parameters[:transaction_source] = options[:transaction_source]
600
- elsif options[:recurring]
601
- parameters[:recurring] = true
602
- end
589
+ add_skip_options(parameters, options)
590
+ add_merchant_account_id(parameters, options)
603
591
 
604
592
  add_payment_method(parameters, credit_card_or_vault_id, options)
605
593
  add_stored_credential_data(parameters, credit_card_or_vault_id, options)
594
+ add_addresses(parameters, options)
595
+
596
+ add_descriptor(parameters, options)
597
+ add_travel_data(parameters, options) if options[:travel_data]
598
+ add_lodging_data(parameters, options) if options[:lodging_data]
599
+ add_channel(parameters, options)
600
+ add_transaction_source(parameters, options)
601
+
602
+ add_level_2_data(parameters, options)
603
+ add_level_3_data(parameters, options)
604
+
605
+ add_3ds_info(parameters, options[:three_d_secure])
606
+
607
+ if options[:payment_method_nonce].is_a?(String)
608
+ parameters.delete(:customer)
609
+ parameters[:payment_method_nonce] = options[:payment_method_nonce]
610
+ end
611
+
612
+ parameters
613
+ end
614
+
615
+ def add_skip_options(parameters, options)
616
+ parameters[:options][:skip_advanced_fraud_checking] = options[:skip_advanced_fraud_checking] if options[:skip_advanced_fraud_checking]
617
+ parameters[:options][:skip_avs] = options[:skip_avs] if options[:skip_avs]
618
+ parameters[:options][:skip_cvv] = options[:skip_cvv] if options[:skip_cvv]
619
+ end
606
620
 
621
+ def add_merchant_account_id(parameters, options)
622
+ return unless merchant_account_id = (options[:merchant_account_id] || @merchant_account_id)
623
+
624
+ parameters[:merchant_account_id] = merchant_account_id
625
+ end
626
+
627
+ def add_transaction_source(parameters, options)
628
+ parameters[:transaction_source] = options[:transaction_source] if options[:transaction_source]
629
+ parameters[:transaction_source] = 'recurring' if options[:recurring]
630
+ end
631
+
632
+ def add_addresses(parameters, options)
607
633
  parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
608
634
  parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
635
+ end
609
636
 
637
+ def add_channel(parameters, options)
610
638
  channel = @options[:channel] || application_id
611
639
  parameters[:channel] = channel if channel
640
+ end
612
641
 
613
- if options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
614
- parameters[:descriptor] = {
615
- name: options[:descriptor_name],
616
- phone: options[:descriptor_phone],
617
- url: options[:descriptor_url]
618
- }
619
- end
642
+ def add_descriptor(parameters, options)
643
+ return unless options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
620
644
 
621
- add_3ds_info(parameters, options[:three_d_secure])
645
+ parameters[:descriptor] = {
646
+ name: options[:descriptor_name],
647
+ phone: options[:descriptor_phone],
648
+ url: options[:descriptor_url]
649
+ }
650
+ end
622
651
 
652
+ def add_level_2_data(parameters, options)
623
653
  parameters[:tax_amount] = options[:tax_amount] if options[:tax_amount]
624
654
  parameters[:tax_exempt] = options[:tax_exempt] if options[:tax_exempt]
625
655
  parameters[:purchase_order_number] = options[:purchase_order_number] if options[:purchase_order_number]
656
+ end
626
657
 
658
+ def add_level_3_data(parameters, options)
627
659
  parameters[:shipping_amount] = options[:shipping_amount] if options[:shipping_amount]
628
660
  parameters[:discount_amount] = options[:discount_amount] if options[:discount_amount]
629
661
  parameters[:ships_from_postal_code] = options[:ships_from_postal_code] if options[:ships_from_postal_code]
630
662
 
631
663
  parameters[:line_items] = options[:line_items] if options[:line_items]
664
+ end
632
665
 
633
- if options[:payment_method_nonce].is_a?(String)
634
- parameters.delete(:customer)
635
- parameters[:payment_method_nonce] = options[:payment_method_nonce]
636
- end
666
+ def add_travel_data(parameters, options)
667
+ parameters[:industry] = {
668
+ industry_type: Braintree::Transaction::IndustryType::TravelAndCruise,
669
+ data: {}
670
+ }
637
671
 
638
- parameters
672
+ parameters[:industry][:data][:travel_package] = options[:travel_data][:travel_package] if options[:travel_data][:travel_package]
673
+ parameters[:industry][:data][:departure_date] = options[:travel_data][:departure_date] if options[:travel_data][:departure_date]
674
+ parameters[:industry][:data][:lodging_check_in_date] = options[:travel_data][:lodging_check_in_date] if options[:travel_data][:lodging_check_in_date]
675
+ parameters[:industry][:data][:lodging_check_out_date] = options[:travel_data][:lodging_check_out_date] if options[:travel_data][:lodging_check_out_date]
676
+ parameters[:industry][:data][:lodging_name] = options[:travel_data][:lodging_name] if options[:travel_data][:lodging_name]
677
+ end
678
+
679
+ def add_lodging_data(parameters, options)
680
+ parameters[:industry] = {
681
+ industry_type: Braintree::Transaction::IndustryType::Lodging,
682
+ data: {}
683
+ }
684
+
685
+ parameters[:industry][:data][:folio_number] = options[:lodging_data][:folio_number] if options[:lodging_data][:folio_number]
686
+ parameters[:industry][:data][:check_in_date] = options[:lodging_data][:check_in_date] if options[:lodging_data][:check_in_date]
687
+ parameters[:industry][:data][:check_out_date] = options[:lodging_data][:check_out_date] if options[:lodging_data][:check_out_date]
688
+ parameters[:industry][:data][:room_rate] = options[:lodging_data][:room_rate] if options[:lodging_data][:room_rate]
639
689
  end
640
690
 
641
691
  def add_3ds_info(parameters, three_d_secure_opts)