activemerchant 1.113.0 → 1.119.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +114 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/compatibility.rb +3 -3
  7. data/lib/active_merchant/billing/credit_card.rb +3 -0
  8. data/lib/active_merchant/billing/credit_card_methods.rb +72 -13
  9. data/lib/active_merchant/billing/gateways/adyen.rb +24 -14
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +44 -12
  12. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  13. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -1
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  18. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  20. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  22. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  23. data/lib/active_merchant/billing/gateways/blue_snap.rb +37 -12
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  26. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  27. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/braintree_blue.rb +13 -10
  29. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  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 +2 -2
  34. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  35. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  37. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  38. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/checkout_v2.rb +17 -20
  40. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  41. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  43. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/credorax.rb +26 -15
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -36
  48. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  50. data/lib/active_merchant/billing/gateways/decidir.rb +31 -10
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  55. data/lib/active_merchant/billing/gateways/elavon.rb +286 -225
  56. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  57. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  58. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  59. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  60. data/lib/active_merchant/billing/gateways/eway_rapid.rb +19 -6
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  64. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  65. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  67. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  68. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  70. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  72. data/lib/active_merchant/billing/gateways/global_collect.rb +35 -16
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  75. data/lib/active_merchant/billing/gateways/hps.rb +17 -8
  76. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  77. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  78. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  79. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  80. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  81. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  82. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  83. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  86. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  87. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  88. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  89. data/lib/active_merchant/billing/gateways/litle.rb +31 -15
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  92. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  95. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  96. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  97. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  98. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  99. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  100. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  101. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  102. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  104. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  105. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  106. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  107. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  108. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  109. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  110. data/lib/active_merchant/billing/gateways/netbanx.rb +19 -8
  111. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  112. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  113. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  114. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  115. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  116. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  117. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  119. data/lib/active_merchant/billing/gateways/orbital.rb +196 -85
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  122. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  125. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  126. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  127. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  130. data/lib/active_merchant/billing/gateways/payeezy.rb +32 -14
  131. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  132. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
  134. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  135. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  136. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  137. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  138. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  140. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  141. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  142. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  143. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  146. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  148. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  149. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  152. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  154. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  156. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  157. data/lib/active_merchant/billing/gateways/redsys.rb +86 -5
  158. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  159. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  160. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  161. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  162. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  164. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  166. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  168. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  169. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  170. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  171. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  172. data/lib/active_merchant/billing/gateways/stripe.rb +10 -10
  173. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  174. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  175. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  176. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  177. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  178. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  182. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  183. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  184. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  186. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  187. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  188. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  189. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  190. data/lib/active_merchant/billing/gateways/worldpay.rb +19 -11
  191. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  192. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  193. data/lib/active_merchant/billing/response.rb +3 -2
  194. data/lib/active_merchant/country.rb +1 -1
  195. data/lib/active_merchant/network_connection_retries.rb +2 -2
  196. data/lib/active_merchant/post_data.rb +1 -1
  197. data/lib/active_merchant/posts_data.rb +1 -1
  198. data/lib/active_merchant/version.rb +1 -1
  199. data/lib/support/ssl_verify.rb +2 -2
  200. data/lib/support/ssl_version.rb +2 -2
  201. metadata +2 -2
@@ -168,14 +168,15 @@ module ActiveMerchant #:nodoc:
168
168
  JSON.parse(response)
169
169
  end
170
170
 
171
- def commit(action, params, options={})
171
+ def commit(action, params, options = {})
172
172
  begin
173
173
  response = parse(
174
174
  ssl_post(
175
175
  ((test? ? test_url : live_url) + action),
176
176
  params.to_json,
177
177
  headers(options)
178
- ))
178
+ )
179
+ )
179
180
  rescue ResponseError => e
180
181
  response = parse(e.response.body)
181
182
  end
@@ -183,8 +183,7 @@ module ActiveMerchant #:nodoc:
183
183
  test: test?,
184
184
  authorization: authorization,
185
185
  avs_result: { code: avs_code(response, options) },
186
- cvv_result: response[:CVCResponseCode]
187
- )
186
+ cvv_result: response[:CVCResponseCode])
188
187
  rescue ResponseError => e
189
188
  if e.response.code == '401'
190
189
  return Response.new(false, 'Invalid Login')
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.default_currency = 'GBP'
10
10
  self.money_format = :cents
11
11
  self.supported_countries = %w(HK GB AU AD AR BE BR CA CH CN CO CR CY CZ DE DK ES FI FR GI GR HU IE IN IT JP LI LU MC MT MY MX NL NO NZ PA PE PL PT SE SG SI SM TR UM VA)
12
- self.supported_cardtypes = %i[visa master american_express discover jcb maestro elo naranja cabal]
12
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro elo naranja cabal unionpay]
13
13
  self.currencies_without_fractions = %w(HUF IDR ISK JPY KRW)
14
14
  self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
15
15
  self.homepage_url = 'http://www.worldpay.com/'
@@ -26,6 +26,7 @@ module ActiveMerchant #:nodoc:
26
26
  'elo' => 'ELO-SSL',
27
27
  'naranja' => 'NARANJA-SSL',
28
28
  'cabal' => 'CABAL-SSL',
29
+ 'unionpay' => 'CHINAUNIONPAY-SSL',
29
30
  'unknown' => 'CARD-SSL'
30
31
  }
31
32
 
@@ -57,7 +58,7 @@ module ActiveMerchant #:nodoc:
57
58
  def purchase(money, payment_method, options = {})
58
59
  MultiResponse.run do |r|
59
60
  r.process { authorize(money, payment_method, options) }
60
- r.process { capture(money, r.authorization, options.merge(authorization_validated: true)) }
61
+ r.process { capture(money, r.authorization, options.merge(authorization_validated: true)) } unless options[:skip_capture]
61
62
  end
62
63
  end
63
64
 
@@ -111,14 +112,14 @@ module ActiveMerchant #:nodoc:
111
112
  credit_request(money, payment_method, payment_details.merge(credit: true, **options))
112
113
  end
113
114
 
114
- def verify(payment_method, options={})
115
+ def verify(payment_method, options = {})
115
116
  MultiResponse.run(:use_first_response) do |r|
116
117
  r.process { authorize(100, payment_method, options) }
117
118
  r.process(:ignore_result) { void(r.authorization, options.merge(authorization_validated: true)) }
118
119
  end
119
120
  end
120
121
 
121
- def store(credit_card, options={})
122
+ def store(credit_card, options = {})
122
123
  requires!(options, :customer)
123
124
  store_request(credit_card, options)
124
125
  end
@@ -259,7 +260,10 @@ module ActiveMerchant #:nodoc:
259
260
  end
260
261
 
261
262
  def add_additional_3ds_data(xml, options)
262
- xml.additional3DSData 'dfReferenceId' => options[:session_id]
263
+ additional_data = { 'dfReferenceId' => options[:session_id] }
264
+ additional_data['challengeWindowSize'] = options[:browser_size] if options[:browser_size]
265
+
266
+ xml.additional3DSData additional_data
263
267
  end
264
268
 
265
269
  def add_3ds_exemption(xml, options)
@@ -432,7 +436,7 @@ module ActiveMerchant #:nodoc:
432
436
  add_address(xml, (options[:billing_address] || options[:address]), options)
433
437
  end
434
438
 
435
- def add_stored_credential_options(xml, options={})
439
+ def add_stored_credential_options(xml, options = {})
436
440
  if options[:stored_credential]
437
441
  add_stored_credential_using_normalized_fields(xml, options)
438
442
  else
@@ -510,7 +514,7 @@ module ActiveMerchant #:nodoc:
510
514
  def add_hcg_additional_data(xml, options)
511
515
  xml.hcgAdditionalData do
512
516
  options[:hcg_additional_data].each do |k, v|
513
- xml.param({name: k.to_s}, v)
517
+ xml.param({ name: k.to_s }, v)
514
518
  end
515
519
  end
516
520
  end
@@ -546,7 +550,7 @@ module ActiveMerchant #:nodoc:
546
550
  xml = xml.strip.gsub(/\&/, '&')
547
551
  doc = Nokogiri::XML(xml, &:strict)
548
552
  doc.remove_namespaces!
549
- resp_params = {action: action}
553
+ resp_params = { action: action }
550
554
 
551
555
  parse_elements(doc.root, resp_params)
552
556
  resp_params
@@ -568,6 +572,8 @@ module ActiveMerchant #:nodoc:
568
572
  end
569
573
 
570
574
  def headers(options)
575
+ idempotency_key = options[:idempotency_key]
576
+
571
577
  headers = {
572
578
  'Content-Type' => 'text/xml',
573
579
  'Authorization' => encoded_credentials
@@ -575,6 +581,8 @@ module ActiveMerchant #:nodoc:
575
581
  if options[:cookie]
576
582
  headers['Cookie'] = options[:cookie] if options[:cookie]
577
583
  end
584
+
585
+ headers['Idempotency-Key'] = idempotency_key if idempotency_key
578
586
  headers
579
587
  end
580
588
 
@@ -683,11 +691,11 @@ module ActiveMerchant #:nodoc:
683
691
  end
684
692
 
685
693
  def order_id_from(raw)
686
- pair = raw.detect { |k, v| k.to_s =~ /_order_code$/ }
694
+ pair = raw.detect { |k, _v| k.to_s =~ /_order_code$/ }
687
695
  (pair ? pair.last : nil)
688
696
  end
689
697
 
690
- def authorization_from_token_details(options={})
698
+ def authorization_from_token_details(options = {})
691
699
  [options[:order_id], options[:token_id], options[:token_scope], options[:customer]].join('|')
692
700
  end
693
701
 
@@ -727,7 +735,7 @@ module ActiveMerchant #:nodoc:
727
735
  def credit_fund_transfer_attribute(options)
728
736
  return unless options[:credit]
729
737
 
730
- {'action' => 'REFUND'}
738
+ { 'action' => 'REFUND' }
731
739
  end
732
740
 
733
741
  def encoded_credentials
@@ -13,14 +13,14 @@ module ActiveMerchant #:nodoc:
13
13
  self.homepage_url = 'http://online.worldpay.com'
14
14
  self.display_name = 'Worldpay Online Payments'
15
15
 
16
- def initialize(options={})
16
+ def initialize(options = {})
17
17
  requires!(options, :client_key, :service_key)
18
18
  @client_key = options[:client_key]
19
19
  @service_key = options[:service_key]
20
20
  super
21
21
  end
22
22
 
23
- def authorize(money, credit_card, options={})
23
+ def authorize(money, credit_card, options = {})
24
24
  response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
25
25
  if response.success?
26
26
  options[:authorizeOnly] = true
@@ -30,9 +30,9 @@ module ActiveMerchant #:nodoc:
30
30
  response
31
31
  end
32
32
 
33
- def capture(money, authorization, options={})
33
+ def capture(money, authorization, options = {})
34
34
  if authorization
35
- commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount' => money}, options, 'capture')
35
+ commit(:post, "orders/#{CGI.escape(authorization)}/capture", { 'captureAmount' => money }, options, 'capture')
36
36
  else
37
37
  Response.new(false,
38
38
  'FAILED',
@@ -41,12 +41,11 @@ module ActiveMerchant #:nodoc:
41
41
  authorization: false,
42
42
  avs_result: {},
43
43
  cvv_result: {},
44
- error_code: false
45
- )
44
+ error_code: false)
46
45
  end
47
46
  end
48
47
 
49
- def purchase(money, credit_card, options={})
48
+ def purchase(money, credit_card, options = {})
50
49
  response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
51
50
  if response.success?
52
51
  post = create_post_for_auth_or_purchase(response.authorization, money, options)
@@ -55,18 +54,18 @@ module ActiveMerchant #:nodoc:
55
54
  response
56
55
  end
57
56
 
58
- def refund(money, orderCode, options={})
59
- obj = money ? {'refundAmount' => money} : {}
57
+ def refund(money, orderCode, options = {})
58
+ obj = money ? { 'refundAmount' => money } : {}
60
59
  commit(:post, "orders/#{CGI.escape(orderCode)}/refund", obj, options, 'refund')
61
60
  end
62
61
 
63
- def void(orderCode, options={})
62
+ def void(orderCode, options = {})
64
63
  response = commit(:delete, "orders/#{CGI.escape(orderCode)}", nil, options, 'void')
65
64
  response = refund(nil, orderCode) if !response.success? && (response.params && response.params['customCode'] != 'ORDER_NOT_FOUND')
66
65
  response
67
66
  end
68
67
 
69
- def verify(credit_card, options={})
68
+ def verify(credit_card, options = {})
70
69
  authorize(0, credit_card, options)
71
70
  end
72
71
 
@@ -85,7 +84,7 @@ module ActiveMerchant #:nodoc:
85
84
  },
86
85
  'clientKey' => @client_key
87
86
  }
88
- token_response = commit(:post, 'tokens', obj, {'Authorization' => @service_key}, 'token')
87
+ token_response = commit(:post, 'tokens', obj, { 'Authorization' => @service_key }, 'token')
89
88
  token_response
90
89
  end
91
90
 
@@ -121,13 +120,13 @@ module ActiveMerchant #:nodoc:
121
120
  'Content-Type' => 'application/json',
122
121
  'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
123
122
  'X-Worldpay-Client-User-Agent' => user_agent,
124
- 'X-Worldpay-Client-User-Metadata' => {ip: options[:ip]}.to_json
123
+ 'X-Worldpay-Client-User-Metadata' => { ip: options[:ip] }.to_json
125
124
  }
126
125
  headers['Authorization'] = options['Authorization'] if options['Authorization']
127
126
  headers
128
127
  end
129
128
 
130
- def commit(method, url, parameters=nil, options = {}, type = false)
129
+ def commit(method, url, parameters = nil, options = {}, type = false)
131
130
  raw_response = response = nil
132
131
  success = false
133
132
  begin
@@ -178,8 +177,7 @@ module ActiveMerchant #:nodoc:
178
177
  authorization: authorization,
179
178
  avs_result: {},
180
179
  cvv_result: {},
181
- error_code: success ? nil : response['customCode']
182
- )
180
+ error_code: success ? nil : response['customCode'])
183
181
  end
184
182
 
185
183
  def test?
@@ -17,12 +17,12 @@ module ActiveMerchant #:nodoc:
17
17
  self.money_format = :dollars
18
18
  self.supported_cardtypes = %i[visa master american_express discover jcb]
19
19
 
20
- def initialize(options={})
20
+ def initialize(options = {})
21
21
  requires!(options, :acctid, :subid, :merchantpin)
22
22
  super
23
23
  end
24
24
 
25
- def purchase(money, payment_method, options={})
25
+ def purchase(money, payment_method, options = {})
26
26
  post = {}
27
27
  add_invoice(post, money, options)
28
28
  add_payment_method(post, payment_method)
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  commit('purchase', options, post)
32
32
  end
33
33
 
34
- def authorize(money, payment, options={})
34
+ def authorize(money, payment, options = {})
35
35
  post = {}
36
36
  add_invoice(post, money, options)
37
37
  add_credit_card(post, payment)
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
  commit('authorize', options, post)
41
41
  end
42
42
 
43
- def capture(amount, authorization, options={})
43
+ def capture(amount, authorization, options = {})
44
44
  post = {}
45
45
  add_invoice(post, amount, options)
46
46
  add_reference(post, authorization)
@@ -49,7 +49,7 @@ module ActiveMerchant #:nodoc:
49
49
  commit('capture', options, post)
50
50
  end
51
51
 
52
- def refund(amount, authorization, options={})
52
+ def refund(amount, authorization, options = {})
53
53
  post = {}
54
54
  add_invoice(post, amount, options)
55
55
  add_reference(post, authorization)
@@ -58,14 +58,14 @@ module ActiveMerchant #:nodoc:
58
58
  commit('refund', options, post)
59
59
  end
60
60
 
61
- def void(authorization, options={})
61
+ def void(authorization, options = {})
62
62
  post = {}
63
63
  add_reference(post, authorization)
64
64
 
65
65
  commit('void', options, post)
66
66
  end
67
67
 
68
- def verify(credit_card, options={})
68
+ def verify(credit_card, options = {})
69
69
  MultiResponse.run(:use_first_response) do |r|
70
70
  r.process { authorize(100, credit_card, options) }
71
71
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  end
5
5
 
6
6
  class Response
7
- attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code, :emv_authorization
7
+ attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code, :emv_authorization, :network_transaction_id
8
8
 
9
9
  def success?
10
10
  @success
@@ -25,6 +25,7 @@ module ActiveMerchant #:nodoc:
25
25
  @fraud_review = options[:fraud_review]
26
26
  @error_code = options[:error_code]
27
27
  @emv_authorization = options[:emv_authorization]
28
+ @network_transaction_id = options[:network_transaction_id]
28
29
 
29
30
  @avs_result = if options[:avs_result].kind_of?(AVSResult)
30
31
  options[:avs_result].to_hash
@@ -53,7 +54,7 @@ module ActiveMerchant #:nodoc:
53
54
  @primary_response = nil
54
55
  end
55
56
 
56
- def process(ignore_result=false)
57
+ def process(ignore_result = false)
57
58
  return unless success?
58
59
 
59
60
  response = yield
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
 
40
40
  def initialize(options = {})
41
41
  @name = options.delete(:name)
42
- @codes = options.collect { |k, v| CountryCode.new(v) }
42
+ @codes = options.collect { |_k, v| CountryCode.new(v) }
43
43
  end
44
44
 
45
45
  def code(format)
@@ -17,7 +17,7 @@ module ActiveMerchant
17
17
  base.send(:attr_accessor, :retry_safe)
18
18
  end
19
19
 
20
- def retry_exceptions(options={})
20
+ def retry_exceptions(options = {})
21
21
  connection_errors = DEFAULT_CONNECTION_ERRORS.merge(options[:connection_exceptions] || {})
22
22
 
23
23
  retry_network_exceptions(options) do
@@ -34,7 +34,7 @@ module ActiveMerchant
34
34
  end
35
35
  end
36
36
 
37
- def self.log(logger, level, message, tag=nil)
37
+ def self.log(logger, level, message, tag = nil)
38
38
  tag ||= self.class.to_s
39
39
  message = "[#{tag}] #{message}"
40
40
  logger&.send(level, message)
@@ -15,7 +15,7 @@ module ActiveMerchant
15
15
  collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
16
16
  end
17
17
 
18
- alias_method :to_s, :to_post_data
18
+ alias to_s to_post_data
19
19
 
20
20
  private
21
21
 
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  base.class_attribute :proxy_port
33
33
  end
34
34
 
35
- def ssl_get(endpoint, headers={})
35
+ def ssl_get(endpoint, headers = {})
36
36
  ssl_request(:get, endpoint, nil, headers)
37
37
  end
38
38
 
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.113.0'
2
+ VERSION = '1.119.0'
3
3
  end
@@ -27,10 +27,10 @@ class SSLVerify
27
27
  success << g
28
28
  when :fail
29
29
  print 'F'
30
- failed << {gateway: g, message: message}
30
+ failed << { gateway: g, message: message }
31
31
  when :error
32
32
  print 'E'
33
- errored << {gateway: g, message: message}
33
+ errored << { gateway: g, message: message }
34
34
  end
35
35
  end
36
36
 
@@ -29,10 +29,10 @@ class SSLVersion
29
29
  success << g
30
30
  when :fail
31
31
  print 'F'
32
- failed << {gateway: g, message: message}
32
+ failed << { gateway: g, message: message }
33
33
  when :error
34
34
  print 'E'
35
- errored << {gateway: g, message: message}
35
+ errored << { gateway: g, message: message }
36
36
  end
37
37
  end
38
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.113.0
4
+ version: 1.119.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport