activemerchant 1.103.0 → 1.104.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +41 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +8 -8
  5. data/lib/active_merchant/billing/compatibility.rb +2 -1
  6. data/lib/active_merchant/billing/credit_card.rb +3 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
  8. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  9. data/lib/active_merchant/billing/gateway.rb +3 -0
  10. data/lib/active_merchant/billing/gateways/adyen.rb +32 -9
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +10 -9
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -0
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -0
  16. data/lib/active_merchant/billing/gateways/balanced.rb +18 -15
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +4 -0
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -1
  19. data/lib/active_merchant/billing/gateways/blue_pay.rb +6 -5
  20. data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -3
  21. data/lib/active_merchant/billing/gateways/borgun.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/bpoint.rb +0 -2
  23. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
  24. data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -4
  25. data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/card_connect.rb +2 -1
  27. data/lib/active_merchant/billing/gateways/card_save.rb +2 -3
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +6 -6
  29. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -0
  30. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
  31. data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -0
  33. data/lib/active_merchant/billing/gateways/cenpos.rb +4 -3
  34. data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -0
  35. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  36. data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -2
  37. data/lib/active_merchant/billing/gateways/conekta.rb +5 -3
  38. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -0
  39. data/lib/active_merchant/billing/gateways/credorax.rb +17 -10
  40. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -0
  41. data/lib/active_merchant/billing/gateways/cyber_source.rb +38 -0
  42. data/lib/active_merchant/billing/gateways/d_local.rb +6 -0
  43. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/decidir.rb +18 -2
  45. data/lib/active_merchant/billing/gateways/digitzs.rb +3 -0
  46. data/lib/active_merchant/billing/gateways/ebanx.rb +13 -2
  47. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -2
  48. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/eway.rb +2 -1
  50. data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -0
  52. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  53. data/lib/active_merchant/billing/gateways/fat_zebra.rb +2 -1
  54. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -1
  55. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +1 -0
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
  58. data/lib/active_merchant/billing/gateways/forte.rb +1 -0
  59. data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -0
  61. data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
  62. data/lib/active_merchant/billing/gateways/hdfc.rb +1 -0
  63. data/lib/active_merchant/billing/gateways/hps.rb +9 -7
  64. data/lib/active_merchant/billing/gateways/iats_payments.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/itransact.rb +3 -2
  67. data/lib/active_merchant/billing/gateways/iveri.rb +1 -0
  68. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -1
  71. data/lib/active_merchant/billing/gateways/litle.rb +3 -0
  72. data/lib/active_merchant/billing/gateways/mastercard.rb +1 -0
  73. data/lib/active_merchant/billing/gateways/mercado_pago.rb +45 -0
  74. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/merchant_partners.rb +3 -3
  76. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -1
  78. data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
  79. data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
  80. data/lib/active_merchant/billing/gateways/micropayment.rb +0 -1
  81. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/moneris.rb +36 -8
  83. data/lib/active_merchant/billing/gateways/moneris_us.rb +2 -0
  84. data/lib/active_merchant/billing/gateways/mundipagg.rb +6 -1
  85. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  86. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/netbanx.rb +3 -1
  88. data/lib/active_merchant/billing/gateways/netbilling.rb +3 -3
  89. data/lib/active_merchant/billing/gateways/netpay.rb +1 -0
  90. data/lib/active_merchant/billing/gateways/nmi.rb +5 -6
  91. data/lib/active_merchant/billing/gateways/ogone.rb +4 -2
  92. data/lib/active_merchant/billing/gateways/omise.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/openpay.rb +3 -1
  94. data/lib/active_merchant/billing/gateways/opp.rb +1 -0
  95. data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -5
  96. data/lib/active_merchant/billing/gateways/orbital.rb +17 -13
  97. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -0
  100. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -0
  103. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -0
  104. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  105. data/lib/active_merchant/billing/gateways/paybox_direct.rb +4 -2
  106. data/lib/active_merchant/billing/gateways/payeezy.rb +2 -0
  107. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
  108. data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
  109. data/lib/active_merchant/billing/gateways/paymentez.rb +4 -0
  110. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  111. data/lib/active_merchant/billing/gateways/paystation.rb +1 -3
  112. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -0
  114. data/lib/active_merchant/billing/gateways/payway.rb +3 -2
  115. data/lib/active_merchant/billing/gateways/pin.rb +1 -0
  116. data/lib/active_merchant/billing/gateways/plugnpay.rb +4 -4
  117. data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -0
  118. data/lib/active_merchant/billing/gateways/psigate.rb +2 -1
  119. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
  120. data/lib/active_merchant/billing/gateways/qbms.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/quantum.rb +0 -1
  122. data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -0
  123. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  124. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +5 -5
  125. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -0
  126. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -0
  127. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -0
  128. data/lib/active_merchant/billing/gateways/realex.rb +3 -1
  129. data/lib/active_merchant/billing/gateways/redsys.rb +3 -2
  130. data/lib/active_merchant/billing/gateways/s5.rb +1 -0
  131. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -0
  132. data/lib/active_merchant/billing/gateways/sage.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
  134. data/lib/active_merchant/billing/gateways/secure_net.rb +2 -4
  135. data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
  137. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -0
  139. data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -5
  140. data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
  141. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +0 -1
  142. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -0
  143. data/lib/active_merchant/billing/gateways/stripe.rb +7 -0
  144. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -4
  145. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/telr.rb +3 -0
  147. data/lib/active_merchant/billing/gateways/tns.rb +0 -1
  148. data/lib/active_merchant/billing/gateways/trans_first.rb +1 -0
  149. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +4 -2
  150. data/lib/active_merchant/billing/gateways/transax.rb +0 -1
  151. data/lib/active_merchant/billing/gateways/trexle.rb +3 -0
  152. data/lib/active_merchant/billing/gateways/usa_epay.rb +0 -1
  153. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +15 -16
  154. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +5 -0
  155. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -0
  157. data/lib/active_merchant/billing/gateways/wepay.rb +7 -6
  158. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -3
  159. data/lib/active_merchant/billing/gateways/world_net.rb +1 -0
  160. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -0
  161. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +0 -1
  162. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  163. data/lib/active_merchant/billing/response.rb +1 -1
  164. data/lib/active_merchant/connection.rb +2 -0
  165. data/lib/active_merchant/country.rb +1 -0
  166. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  167. data/lib/active_merchant/post_data.rb +1 -0
  168. data/lib/active_merchant/version.rb +1 -1
  169. data/lib/support/ssl_verify.rb +0 -2
  170. data/lib/support/ssl_version.rb +0 -1
  171. metadata +2 -2
@@ -143,6 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
 
144
144
  def add_customer(xml, creditcard, options)
145
145
  return unless creditcard.respond_to?(:number)
146
+
146
147
  address = options[:billing_address]
147
148
  xml.Customer do
148
149
  xml.Contact do
@@ -207,6 +207,7 @@ module ActiveMerchant #:nodoc:
207
207
 
208
208
  def message_from(response)
209
209
  return 'Success' if success_from(response)
210
+
210
211
  response[:reason_codes] || response[:reason]
211
212
  end
212
213
 
@@ -240,6 +241,7 @@ module ActiveMerchant #:nodoc:
240
241
 
241
242
  params.map do |key, value|
242
243
  next if value != false && value.blank?
244
+
243
245
  "#{key}=#{CGI.escape(value.to_s)}"
244
246
  end.compact.join('&')
245
247
  end
@@ -115,6 +115,7 @@ module ActiveMerchant #:nodoc:
115
115
  # use the same method as in pay_conex
116
116
  def force_utf8(string)
117
117
  return nil unless string
118
+
118
119
  binary = string.encode('BINARY', invalid: :replace, undef: :replace, replace: '?') # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
119
120
  binary.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
120
121
  end
@@ -296,7 +297,6 @@ module ActiveMerchant #:nodoc:
296
297
  end
297
298
 
298
299
  class SageVault
299
-
300
300
  def initialize(options, gateway)
301
301
  @live_url = 'https://www.sagepayments.net/web_services/wsVault/wsVault.asmx'
302
302
  @options = options
@@ -312,6 +312,7 @@ module ActiveMerchant #:nodoc:
312
312
 
313
313
  def sanitize_phone(phone)
314
314
  return nil unless phone
315
+
315
316
  cleansed = phone.to_s.gsub(/[^0-9+]/, '')
316
317
  truncate(cleansed, 20)
317
318
  end
@@ -361,11 +362,11 @@ module ActiveMerchant #:nodoc:
361
362
  when :store
362
363
  response['Token']
363
364
  else
364
- [ params[:VendorTxCode],
365
- response['VPSTxId'] || params[:VPSTxId],
366
- response['TxAuthNo'],
367
- response['SecurityKey'] || params[:SecurityKey],
368
- action ].join(';')
365
+ [params[:VendorTxCode],
366
+ response['VPSTxId'] || params[:VPSTxId],
367
+ response['TxAuthNo'],
368
+ response['SecurityKey'] || params[:SecurityKey],
369
+ action].join(';')
369
370
  end
370
371
  end
371
372
 
@@ -389,7 +390,7 @@ module ActiveMerchant #:nodoc:
389
390
  end
390
391
 
391
392
  def build_simulator_url(action)
392
- endpoint = [ :purchase, :authorization ].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
393
+ endpoint = [:purchase, :authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
393
394
  "#{self.simulator_url}/#{endpoint}"
394
395
  end
395
396
 
@@ -426,6 +427,7 @@ module ActiveMerchant #:nodoc:
426
427
 
427
428
  def past_purchase_reference?(payment_method)
428
429
  return false unless payment_method.is_a?(String)
430
+
429
431
  payment_method.split(';').last == 'purchase'
430
432
  end
431
433
  end
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class SecureNetGateway < Gateway
4
-
5
4
  API_VERSION = '4.0'
6
5
 
7
6
  TRANSACTIONS = {
@@ -28,8 +27,8 @@ module ActiveMerchant #:nodoc:
28
27
 
29
28
  APPROVED, DECLINED = 1, 2
30
29
 
31
- CARD_CODE_ERRORS = %w( N S )
32
- AVS_ERRORS = %w( A E N R W Z )
30
+ CARD_CODE_ERRORS = %w(N S)
31
+ AVS_ERRORS = %w(A E N R W Z)
33
32
 
34
33
  def initialize(options = {})
35
34
  requires!(options, :login, :password)
@@ -257,7 +256,6 @@ module ActiveMerchant #:nodoc:
257
256
  def build_authorization(response)
258
257
  [response[:transactionid], response[:transactionamount], response[:last4_digits]].join('|')
259
258
  end
260
-
261
259
  end
262
260
  end
263
261
  end
@@ -21,8 +21,8 @@ module ActiveMerchant #:nodoc:
21
21
  self.homepage_url = 'http://www.securepay.com/'
22
22
  self.display_name = 'SecurePay'
23
23
 
24
- CARD_CODE_ERRORS = %w( N S )
25
- AVS_ERRORS = %w( A E N R W Z )
24
+ CARD_CODE_ERRORS = %w(N S)
25
+ AVS_ERRORS = %w(A E N R W Z)
26
26
  AVS_REASON_CODES = %w(27 45)
27
27
  TRANSACTION_ALREADY_ACTIONED = %w(310 311)
28
28
 
@@ -54,7 +54,7 @@ module ActiveMerchant #:nodoc:
54
54
  :trigger => nil
55
55
  }
56
56
 
57
- SUCCESS_CODES = [ '00', '08', '11', '16', '77' ]
57
+ SUCCESS_CODES = ['00', '08', '11', '16', '77']
58
58
 
59
59
  def initialize(options = {})
60
60
  requires!(options, :login, :password)
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class SecurePayTechGateway < Gateway
4
4
  class SecurePayTechPostData < PostData
5
- self.required_fields = [ :OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency ]
5
+ self.required_fields = [:OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency]
6
6
  end
7
7
 
8
8
  self.live_url = self.test_url = 'https://tx.securepaytech.com/web/HttpPostPurchase'
@@ -166,6 +166,7 @@ module ActiveMerchant #:nodoc:
166
166
 
167
167
  def add_address(post, options)
168
168
  return unless post[:card]&.kind_of?(Hash)
169
+
169
170
  if address = options[:billing_address]
170
171
  post[:card][:addressLine1] = address[:address1] if address[:address1]
171
172
  post[:card][:addressLine2] = address[:address2] if address[:address2]
@@ -214,6 +215,7 @@ module ActiveMerchant #:nodoc:
214
215
 
215
216
  params.map do |key, value|
216
217
  next if value.blank?
218
+
217
219
  if value.is_a?(Hash)
218
220
  h = {}
219
221
  value.each do |k, v|
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
 
22
22
  MONETARY_CHANGE_STATUSES = ['SETTLE', 'AUTHORIZE', 'AUTHORIZE ADDITIONAL', 'CREDIT', 'SPLITSETTLE']
23
23
 
24
- CARD_CODE_ERRORS = %w( N S "" )
24
+ CARD_CODE_ERRORS = %w(N S "")
25
25
 
26
26
  CARD_CODE_MESSAGES = {
27
27
  'M' => 'Card verification number matched',
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  '' => 'Transaction failed because incorrect card verification number was entered or no number was entered'
33
33
  }
34
34
 
35
- AVS_ERRORS = %w( A B C E I N O P R W Z )
35
+ AVS_ERRORS = %w(A B C E I N O P R W Z)
36
36
 
37
37
  AVS_MESSAGES = {
38
38
  'A' => 'Street address matches billing information, zip/postal code does not',
@@ -300,9 +300,9 @@ module ActiveMerchant #:nodoc:
300
300
  when :authorization
301
301
  parse_authorization_response(body)
302
302
  when :get_status
303
- parse_status_response(body, [ :SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber ])
303
+ parse_status_response(body, [:SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber])
304
304
  else
305
- parse_status_response(body, [ :SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID ])
305
+ parse_status_response(body, [:SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID])
306
306
  end
307
307
  end
308
308
 
@@ -329,7 +329,7 @@ module ActiveMerchant #:nodoc:
329
329
  def parse_status_response(body, response_keys)
330
330
  lines = split_lines(body)
331
331
 
332
- keys = [ :szSerialNumber, :szErrorCode, :szNumberRecords]
332
+ keys = [:szSerialNumber, :szErrorCode, :szNumberRecords]
333
333
  values = split_line(lines[0])[0..2]
334
334
 
335
335
  result = Hash[*keys.zip(values).flatten]
@@ -434,6 +434,7 @@ module ActiveMerchant #:nodoc:
434
434
  return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
435
435
  return AVS_MESSAGES[response[:szAVSResponseMessage]] if AVS_ERRORS.include?(response[:szAVSResponseCode])
436
436
  return RETURN_CODE_MESSAGES[response[:szReturnCode]] if response[:szReturnCode] != '1'
437
+
437
438
  return response[:szAuthorizationDeclinedMessage]
438
439
  end
439
440
  end
@@ -3,7 +3,6 @@ require File.join(File.dirname(__FILE__), '..', 'check.rb')
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class SmartPs < Gateway #:nodoc:
6
-
7
6
  ##
8
7
  # This is the base gateway for processors who use the smartPS processing system
9
8
 
@@ -189,7 +189,6 @@ module ActiveMerchant #:nodoc:
189
189
  end
190
190
  retval.target!
191
191
  end
192
-
193
192
  end
194
193
  end
195
194
  end
@@ -228,6 +228,7 @@ module ActiveMerchant #:nodoc:
228
228
 
229
229
  def extra_options_to_doc(doc, value)
230
230
  return doc.text value unless value.kind_of? Hash
231
+
231
232
  value.each do |k, v|
232
233
  doc.send(k) do
233
234
  extra_options_to_doc(doc, v)
@@ -198,6 +198,7 @@ module ActiveMerchant #:nodoc:
198
198
  elsif payment.is_a?(Check)
199
199
  bank_token_response = tokenize_bank_account(payment)
200
200
  return bank_token_response unless bank_token_response.success?
201
+
201
202
  params = { source: bank_token_response.params['token']['id'] }
202
203
  else
203
204
  add_creditcard(params, payment, options)
@@ -431,6 +432,7 @@ module ActiveMerchant #:nodoc:
431
432
 
432
433
  def add_address(post, options)
433
434
  return unless post[:card]&.kind_of?(Hash)
435
+
434
436
  if address = options[:billing_address] || options[:address]
435
437
  post[:card][:address_line1] = address[:address1] if address[:address1]
436
438
  post[:card][:address_line2] = address[:address2] if address[:address2]
@@ -559,12 +561,14 @@ module ActiveMerchant #:nodoc:
559
561
 
560
562
  def post_data(params)
561
563
  return nil unless params
564
+
562
565
  flatten_params([], params).join('&')
563
566
  end
564
567
 
565
568
  def flatten_params(flattened, params, prefix = nil)
566
569
  params.each do |key, value|
567
570
  next if value != false && value.blank?
571
+
568
572
  flattened_key = prefix.nil? ? key : "#{prefix}[#{key}]"
569
573
  if value.is_a?(Hash)
570
574
  flatten_params(flattened, value, flattened_key)
@@ -608,6 +612,7 @@ module ActiveMerchant #:nodoc:
608
612
 
609
613
  def stripe_client_user_agent(options)
610
614
  return user_agent unless options[:application]
615
+
611
616
  JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
612
617
  end
613
618
 
@@ -761,6 +766,7 @@ module ActiveMerchant #:nodoc:
761
766
 
762
767
  def auth_minimum_amount(options)
763
768
  return 100 unless options[:currency]
769
+
764
770
  return MINIMUM_AUTHORIZE_AMOUNTS[options[:currency].upcase] || 100
765
771
  end
766
772
 
@@ -768,6 +774,7 @@ module ActiveMerchant #:nodoc:
768
774
  source_path ||= dest_path
769
775
  source_path.each do |key|
770
776
  return nil unless source[key]
777
+
771
778
  source = source[key]
772
779
  end
773
780
 
@@ -5,7 +5,6 @@ module ActiveMerchant #:nodoc:
5
5
  # This gateway uses the current Stripe {Payment Intents API}[https://stripe.com/docs/api/payment_intents].
6
6
  # For the legacy API, see the Stripe gateway
7
7
  class StripePaymentIntentsGateway < StripeGateway
8
-
9
8
  self.supported_countries = %w(AT AU BE BR CA CH DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MX NL NO NZ PL PT SE SG SI SK US)
10
9
 
11
10
  ALLOWED_METHOD_STATES = %w[automatic manual].freeze
@@ -65,7 +64,7 @@ module ActiveMerchant #:nodoc:
65
64
 
66
65
  def update_intent(money, intent_id, payment_method, options = {})
67
66
  post = {}
68
- post[:amount] = money if money
67
+ add_amount(post, money, options)
69
68
 
70
69
  add_payment_method_token(post, payment_method, options)
71
70
  add_payment_method_types(post, options)
@@ -91,7 +90,8 @@ module ActiveMerchant #:nodoc:
91
90
 
92
91
  def capture(money, intent_id, options = {})
93
92
  post = {}
94
- post[:amount_to_capture] = money
93
+ currency = options[:currency] || currency(money)
94
+ post[:amount_to_capture] = localized_amount(money, currency)
95
95
  if options[:transfer_amount]
96
96
  post[:transfer_data] = {}
97
97
  post[:transfer_data][:amount] = options[:transfer_amount]
@@ -174,6 +174,7 @@ module ActiveMerchant #:nodoc:
174
174
 
175
175
  def add_return_url(post, options)
176
176
  return unless options[:confirm]
177
+
177
178
  post[:confirm] = options[:confirm]
178
179
  post[:return_url] = options[:return_url] if options[:return_url]
179
180
  post
@@ -211,19 +212,21 @@ module ActiveMerchant #:nodoc:
211
212
 
212
213
  def add_exemption(post, options = {})
213
214
  return unless options[:confirm]
215
+
214
216
  post[:payment_method_options] ||= {}
215
217
  post[:payment_method_options][:card] ||= {}
216
218
  post[:payment_method_options][:card][:moto] = true if options[:moto]
217
219
  end
218
220
 
219
221
  def setup_future_usage(post, options = {})
220
- post[:setup_future_usage] = options[:setup_future_usage] if %w( on_session off_session ).include?(options[:setup_future_usage])
222
+ post[:setup_future_usage] = options[:setup_future_usage] if %w(on_session off_session).include?(options[:setup_future_usage])
221
223
  post[:off_session] = options[:off_session] if options[:off_session] && options[:confirm] == true
222
224
  post
223
225
  end
224
226
 
225
227
  def add_connected_account(post, options = {})
226
228
  return unless options[:transfer_destination]
229
+
227
230
  post[:transfer_data] = {}
228
231
  post[:transfer_data][:destination] = options[:transfer_destination]
229
232
  post[:transfer_data][:amount] = options[:transfer_amount] if options[:transfer_amount]
@@ -235,6 +238,7 @@ module ActiveMerchant #:nodoc:
235
238
 
236
239
  def add_billing_address(post, options = {})
237
240
  return unless billing = options[:billing_address] || options[:address]
241
+
238
242
  post[:billing_details] = {}
239
243
  post[:billing_details][:address] = {}
240
244
  post[:billing_details][:address][:city] = billing[:city] if billing[:city]
@@ -251,6 +255,7 @@ module ActiveMerchant #:nodoc:
251
255
 
252
256
  def add_shipping_address(post, options = {})
253
257
  return unless shipping = options[:shipping]
258
+
254
259
  post[:shipping] = {}
255
260
  post[:shipping][:address] = {}
256
261
  post[:shipping][:address][:line1] = shipping[:address][:line1]
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
 
12
12
  TRANSACTION_API = '/createShopifyTransaction.php'
13
13
 
14
- self.supported_countries = %w[ NZ CA ]
14
+ self.supported_countries = %w[NZ CA]
15
15
  self.default_currency = 'NZD'
16
16
  self.supported_cardtypes = [:visa, :master]
17
17
  self.homepage_url = 'https://www.swipehq.com/checkout'
@@ -109,6 +109,7 @@ module ActiveMerchant #:nodoc:
109
109
 
110
110
  def add_payment_method(doc, payment_method, options)
111
111
  return if payment_method.is_a?(String)
112
+
112
113
  doc.card do
113
114
  doc.number(payment_method.number)
114
115
  doc.cvv(payment_method.verification_value)
@@ -121,6 +122,7 @@ module ActiveMerchant #:nodoc:
121
122
 
122
123
  def add_customer_data(doc, payment_method, options)
123
124
  return if payment_method.is_a?(String)
125
+
124
126
  doc.billing do
125
127
  doc.name do
126
128
  doc.first(payment_method.first_name)
@@ -140,6 +142,7 @@ module ActiveMerchant #:nodoc:
140
142
  doc.city(address[:city] || 'City')
141
143
  doc.line1(address[:address1] || 'Address')
142
144
  return unless address
145
+
143
146
  doc.line2(address[:address2]) if address[:address2]
144
147
  doc.zip(address[:zip]) if address[:zip]
145
148
  doc.region(address[:state]) if address[:state]
@@ -21,7 +21,6 @@ module ActiveMerchant
21
21
  self.supported_countries = %w(AR AU BR FR DE HK MX NZ SG GB US)
22
22
  self.default_currency = 'USD'
23
23
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
24
-
25
24
  end
26
25
  end
27
26
  end
@@ -133,6 +133,7 @@ module ActiveMerchant #:nodoc:
133
133
 
134
134
  def add_or_use_default(payment_data, default_value)
135
135
  return payment_data.capitalize if payment_data
136
+
136
137
  return default_value
137
138
  end
138
139
 
@@ -291,6 +291,7 @@ module ActiveMerchant #:nodoc:
291
291
  MultiResponse.run do |r|
292
292
  r.process { commit(:store, store_customer_request) }
293
293
  return r unless r.success? && r.params['custId']
294
+
294
295
  customer_id = r.params['custId']
295
296
 
296
297
  store_payment_method_request = build_xml_payment_storage_request do |doc|
@@ -384,6 +385,7 @@ module ActiveMerchant #:nodoc:
384
385
 
385
386
  def error_code_from(succeeded, response)
386
387
  return if succeeded
388
+
387
389
  response['errorCode'] || response['rspCode']
388
390
  end
389
391
 
@@ -548,7 +550,7 @@ module ActiveMerchant #:nodoc:
548
550
  doc['v1'].addrLn2 billing_address[:address2] unless billing_address[:address2].blank?
549
551
  doc['v1'].city billing_address[:city] if billing_address[:city]
550
552
  doc['v1'].state billing_address[:state] if billing_address[:state]
551
- doc['v1'].zipCode billing_address[:zip] if billing_address[:zip]
553
+ doc['v1'].zipCode billing_address[:zip].delete('-') if billing_address[:zip]
552
554
  doc['v1'].ctry 'US'
553
555
  end
554
556
 
@@ -563,7 +565,7 @@ module ActiveMerchant #:nodoc:
563
565
  doc['v1'].addrLn2 shipping_address[:address2] unless shipping_address[:address2].blank?
564
566
  doc['v1'].city shipping_address[:city] if shipping_address[:city]
565
567
  doc['v1'].state shipping_address[:state] if shipping_address[:state]
566
- doc['v1'].zipCode shipping_address[:zip] if shipping_address[:zip]
568
+ doc['v1'].zipCode shipping_address[:zip].delete('-') if shipping_address[:zip]
567
569
  doc['v1'].phone shipping_address[:phone].gsub(/\D/, '') if shipping_address[:phone]
568
570
  doc['v1'].email shipping_address[:email] if shipping_address[:email]
569
571
  end
@@ -16,7 +16,6 @@ module ActiveMerchant #:nodoc:
16
16
 
17
17
  # The name of the gateway
18
18
  self.display_name = 'NELiX TransaX'
19
-
20
19
  end
21
20
  end
22
21
  end