stripe 19.3.0 → 19.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04d6596aa44728702151bf47d822405b1431fd2637b86851aad96358abe2518e
4
- data.tar.gz: 780eee38bdc3c7c7013eb7c8b2d60baab1687e2a325418d5b0a3f1d7a5e49c82
3
+ metadata.gz: 6e4d3bf0319df6872457507dbb136e50fdd9fdf64db539204163da4e17a83f0a
4
+ data.tar.gz: 0fbb9105f8190a2d30956015a6e249d174872d9ec74cdbe3e231e09cb55f69b0
5
5
  SHA512:
6
- metadata.gz: ecaf57851c31d8120bd87988a1ea1111177aa079bf41349444f7eb8dedb9761ef4ea09cb021fb7b09c11aafa53e7ab72db539a6efc500f3547fd2fe401f4bf97
7
- data.tar.gz: 9fefe0d162b7b69c8224e596ec171cb6aaf231abea3fdf69a2cd543b7410338868a284d62b5e6cdef073cbf0888d1043ff0b10d1e2a777fe13552ba221500c02
6
+ metadata.gz: 8cfce98f2e4173401387c066922ab34e866c00314442cb2cf4206bed5772d363a42bd22c3bc7f8b109b51bbff5d57608b86fae86536413711bbd57f39eb67ee6
7
+ data.tar.gz: c4ca73fb4e897bf59b6470df9e50ca1cedd63d343cb2695361d05bb4834e41d3777e8f23fef5ce4d4bc9e581bd9a64827de9bbf8581031d4046fbf893986f525
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "digest"
4
3
  require "socket"
5
4
  require "stripe/instrumentation"
6
5
 
@@ -1068,31 +1067,6 @@ module Stripe
1068
1067
  # in so that we can generate a rich user agent header to help debug
1069
1068
  # integrations.
1070
1069
  class SystemProfiler
1071
- UNAME_HASH = begin
1072
- parts = []
1073
- parts << if RUBY_PLATFORM.match?(/mswin|mingw|cygwin/)
1074
- begin
1075
- `ver 2>NUL`.strip
1076
- rescue StandardError
1077
- ""
1078
- end
1079
- else
1080
- begin
1081
- `uname -a 2>/dev/null`.strip
1082
- rescue StandardError
1083
- ""
1084
- end
1085
- end
1086
- parts << begin
1087
- Socket.gethostname
1088
- rescue StandardError
1089
- ""
1090
- end
1091
- Digest::MD5.hexdigest(parts.join(" "))
1092
- rescue StandardError
1093
- ""
1094
- end
1095
-
1096
1070
  AI_AGENTS = [
1097
1071
  # aiAgents: The beginning of the section generated from our OpenAPI spec
1098
1072
  %w[ANTIGRAVITY_CLI_ALIAS antigravity],
@@ -1130,7 +1104,8 @@ module Stripe
1130
1104
 
1131
1105
  if Stripe.enable_telemetry?
1132
1106
  ua[:platform] = RUBY_PLATFORM
1133
- ua[:source] = UNAME_HASH unless UNAME_HASH.empty?
1107
+ tid = TelemetryId.get
1108
+ ua[:telemetry_id] = tid if tid
1134
1109
  end
1135
1110
 
1136
1111
  ai_agent = detect_ai_agent
@@ -11,69 +11,93 @@ module Stripe
11
11
  # methods would cause users to run into `NoMethodError` exceptions and
12
12
  # get in the way of generic error handling.
13
13
 
14
+ # errorFields: The beginning of the section generated from our OpenAPI spec
15
+ # For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://docs.stripe.com/declines#retrying-issuer-declines) if they provide one.
16
+ def advice_code
17
+ @values[:advice_code]
18
+ end
19
+
14
20
  # For card errors, the ID of the failed charge.
15
21
  def charge
16
22
  @values[:charge]
17
23
  end
18
24
 
19
- # For some errors that could be handled programmatically, a short string
20
- # indicating the error code reported.
25
+ # For some errors that could be handled programmatically, a short string indicating the [error code](https://docs.stripe.com/error-codes) reported.
21
26
  def code
22
27
  @values[:code]
23
28
  end
24
29
 
25
- # For card errors resulting from a card issuer decline, a short string
26
- # indicating the card issuer's reason for the decline if they provide one.
30
+ # For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://docs.stripe.com/declines#issuer-declines) if they provide one.
27
31
  def decline_code
28
32
  @values[:decline_code]
29
33
  end
30
34
 
31
- # A URL to more information about the error code reported.
35
+ # A URL to more information about the [error code](https://docs.stripe.com/error-codes) reported.
32
36
  def doc_url
33
37
  @values[:doc_url]
34
38
  end
35
39
 
36
- # A human-readable message providing more details about the error. For card
37
- # errors, these messages can be shown to your users.
40
+ # A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
38
41
  def message
39
42
  @values[:message]
40
43
  end
41
44
 
42
- # If the error is parameter-specific, the parameter related to the error.
43
- # For example, you can use this to display a message near the correct form
44
- # field.
45
+ # For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error.
46
+ def network_advice_code
47
+ @values[:network_advice_code]
48
+ end
49
+
50
+ # For payments declined by the network, an alphanumeric code which indicates the reason the payment failed.
51
+ def network_decline_code
52
+ @values[:network_decline_code]
53
+ end
54
+
55
+ # If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
45
56
  def param
46
57
  @values[:param]
47
58
  end
48
59
 
49
- # The PaymentIntent object for errors returned on a request involving a
50
- # PaymentIntent.
60
+ # The PaymentIntent object for errors returned on a request involving a PaymentIntent.
51
61
  def payment_intent
52
62
  @values[:payment_intent]
53
63
  end
54
64
 
55
- # The PaymentMethod object for errors returned on a request involving a
56
- # PaymentMethod.
65
+ # The PaymentMethod object for errors returned on a request involving a PaymentMethod.
57
66
  def payment_method
58
67
  @values[:payment_method]
59
68
  end
60
69
 
61
- # The SetupIntent object for errors returned on a request involving a
62
- # SetupIntent.
70
+ # If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
71
+ def payment_method_type
72
+ @values[:payment_method_type]
73
+ end
74
+
75
+ # A URL to the request log entry in your dashboard.
76
+ def request_log_url
77
+ @values[:request_log_url]
78
+ end
79
+
80
+ # The SetupIntent object for errors returned on a request involving a SetupIntent.
63
81
  def setup_intent
64
82
  @values[:setup_intent]
65
83
  end
66
84
 
67
- # The source object for errors returned on a request involving a source.
85
+ # The PaymentSource object for errors returned on a request involving a PaymentSource.
68
86
  def source
69
87
  @values[:source]
70
88
  end
71
89
 
72
- # The type of error returned. One of `api_error`, `card_error`,
73
- # `idempotency_error`, or `invalid_request_error`.
90
+ # The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`
74
91
  def type
75
92
  @values[:type]
76
93
  end
94
+
95
+ # The user message associated with the error.
96
+ def user_message
97
+ @values[:user_message]
98
+ end
99
+
100
+ # errorFields: The end of the section generated from our OpenAPI spec
77
101
  end
78
102
 
79
103
  # Represents on OAuth error returned by the OAuth API.
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ module TelemetryId
5
+ @cached_id = nil
6
+ @loaded = false
7
+
8
+ def self.config_dir
9
+ if Gem.win_platform?
10
+ appdata = ENV.fetch("APPDATA", nil)
11
+ return nil unless appdata && !appdata.empty?
12
+
13
+ ::File.join(appdata, "Stripe")
14
+ else
15
+ xdg = ENV.fetch("XDG_CONFIG_HOME", nil)
16
+ if xdg && !xdg.empty?
17
+ ::File.join(xdg, "stripe")
18
+ else
19
+ ::File.expand_path("~/.config/stripe")
20
+ end
21
+ end
22
+ rescue ArgumentError
23
+ nil
24
+ end
25
+
26
+ def self.get
27
+ return @cached_id if @loaded
28
+
29
+ dir = config_dir
30
+ return nil unless dir
31
+
32
+ file_path = ::File.join(dir, "telemetry_id")
33
+
34
+ begin
35
+ content = ::File.read(file_path).strip
36
+ unless content.empty?
37
+ @cached_id = content
38
+ return @cached_id
39
+ end
40
+ rescue SystemCallError
41
+ # File doesn't exist or can't be read
42
+ end
43
+
44
+ new_id = SecureRandom.hex(16)
45
+
46
+ begin
47
+ ::FileUtils.mkdir_p(dir)
48
+ ::File.write(file_path, new_id)
49
+ rescue SystemCallError
50
+ return nil
51
+ end
52
+
53
+ @cached_id = new_id
54
+ @cached_id
55
+ ensure
56
+ @loaded = true
57
+ end
58
+
59
+ # For testing only
60
+ def self.reset!
61
+ @cached_id = nil
62
+ @loaded = false
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "19.3.0"
4
+ VERSION = "19.3.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -8,6 +8,7 @@ require "logger"
8
8
  require "net/http"
9
9
  require "openssl"
10
10
  require "rbconfig"
11
+ require "fileutils"
11
12
  require "securerandom"
12
13
  require "set"
13
14
  require "socket"
@@ -36,6 +37,7 @@ require "stripe/request_options"
36
37
  require "stripe/request_params"
37
38
  require "stripe/stripe_context"
38
39
  require "stripe/util"
40
+ require "stripe/telemetry_id"
39
41
  require "stripe/connection_manager"
40
42
  require "stripe/multipart_encoder"
41
43
  require "stripe/api_requestor"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.3.0
4
+ version: 19.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-24 00:00:00.000000000 Z
11
+ date: 2026-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -1080,6 +1080,7 @@ files:
1080
1080
  - lib/stripe/stripe_object.rb
1081
1081
  - lib/stripe/stripe_response.rb
1082
1082
  - lib/stripe/stripe_service.rb
1083
+ - lib/stripe/telemetry_id.rb
1083
1084
  - lib/stripe/util.rb
1084
1085
  - lib/stripe/v2_list_object.rb
1085
1086
  - lib/stripe/version.rb