stripe 10.3.0 → 10.4.0.pre.beta.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +247 -40
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +11 -0
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +2 -1
  7. data/lib/stripe/api_version.rb +1 -0
  8. data/lib/stripe/object_types.rb +21 -0
  9. data/lib/stripe/request_signing_authenticator.rb +79 -0
  10. data/lib/stripe/resources/account_notice.rb +14 -0
  11. data/lib/stripe/resources/capital/financing_offer.rb +32 -0
  12. data/lib/stripe/resources/capital/financing_summary.rb +12 -0
  13. data/lib/stripe/resources/capital/financing_transaction.rb +13 -0
  14. data/lib/stripe/resources/confirmation_token.rb +11 -0
  15. data/lib/stripe/resources/customer_session.rb +12 -0
  16. data/lib/stripe/resources/financial_connections/account.rb +39 -0
  17. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +13 -0
  18. data/lib/stripe/resources/financial_connections/transaction.rb +13 -0
  19. data/lib/stripe/resources/gift_cards/card.rb +25 -0
  20. data/lib/stripe/resources/gift_cards/transaction.rb +56 -0
  21. data/lib/stripe/resources/invoice.rb +21 -0
  22. data/lib/stripe/resources/invoice_payment.rb +11 -0
  23. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +69 -0
  24. data/lib/stripe/resources/issuing/personalization_design.rb +77 -0
  25. data/lib/stripe/resources/issuing/physical_bundle.rb +13 -0
  26. data/lib/stripe/resources/margin.rb +14 -0
  27. data/lib/stripe/resources/order.rb +89 -0
  28. data/lib/stripe/resources/quote.rb +94 -0
  29. data/lib/stripe/resources/quote_phase.rb +29 -0
  30. data/lib/stripe/resources/quote_preview_invoice.rb +42 -0
  31. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +10 -0
  32. data/lib/stripe/resources/subscription_schedule.rb +18 -0
  33. data/lib/stripe/resources/tax/form.rb +39 -0
  34. data/lib/stripe/resources/terminal/reader.rb +54 -0
  35. data/lib/stripe/resources.rb +20 -0
  36. data/lib/stripe/stripe_client.rb +62 -28
  37. data/lib/stripe/stripe_configuration.rb +2 -1
  38. data/lib/stripe/util.rb +8 -1
  39. data/lib/stripe/version.rb +1 -1
  40. data/lib/stripe.rb +46 -0
  41. metadata +25 -4
@@ -25,7 +25,7 @@ module Stripe
25
25
  # If `.logger` is set, the value of `.log_level` is ignored. The decision on
26
26
  # what levels to print is entirely deferred to the logger.
27
27
  class StripeConfiguration
28
- attr_accessor :api_key, :api_version, :client_id, :enable_telemetry, :logger, :stripe_account
28
+ attr_accessor :api_key, :api_version, :authenticator, :client_id, :enable_telemetry, :logger, :stripe_account
29
29
 
30
30
  attr_reader :api_base, :uploads_base, :connect_base, :ca_bundle_path, :log_level, :initial_network_retry_delay,
31
31
  # rubocop:todo Layout/LineLength
@@ -50,6 +50,7 @@ module Stripe
50
50
 
51
51
  def initialize
52
52
  @api_version = ApiVersion::CURRENT
53
+
53
54
  @ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
54
55
  @enable_telemetry = true
55
56
  @verify_ssl_certs = true
data/lib/stripe/util.rb CHANGED
@@ -7,6 +7,7 @@ module Stripe
7
7
  # Options that a user is allowed to specify.
8
8
  OPTS_USER_SPECIFIED = Set[
9
9
  :api_key,
10
+ :authenticator,
10
11
  :idempotency_key,
11
12
  :stripe_account,
12
13
  :stripe_version
@@ -279,7 +280,13 @@ module Stripe
279
280
  when String
280
281
  { api_key: opts }
281
282
  when Hash
282
- check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
283
+ # If the user is using request signing for authentication,
284
+ # no need to check the api_key per request.
285
+ if !(opts.key?(:client) &&
286
+ opts.fetch(:client).config.authenticator) &&
287
+ opts.key?(:api_key)
288
+ check_api_key!(opts.fetch(:api_key))
289
+ end
283
290
  # Explicitly use dup here instead of clone to avoid preserving freeze
284
291
  # state on input params.
285
292
  opts.dup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "10.3.0"
4
+ VERSION = "10.4.0-beta.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -13,6 +13,7 @@ require "set"
13
13
  require "socket"
14
14
  require "uri"
15
15
  require "forwardable"
16
+ require "base64"
16
17
 
17
18
  # Version
18
19
  require "stripe/api_version"
@@ -44,6 +45,7 @@ require "stripe/api_resource_test_helpers"
44
45
  require "stripe/singleton_api_resource"
45
46
  require "stripe/webhook"
46
47
  require "stripe/stripe_configuration"
48
+ require "stripe/request_signing_authenticator"
47
49
 
48
50
  # Named API resources
49
51
  require "stripe/resources"
@@ -70,6 +72,7 @@ module Stripe
70
72
 
71
73
  # User configurable options
72
74
  def_delegators :@config, :api_key, :api_key=
75
+ def_delegators :@config, :authenticator, :authenticator=
73
76
  def_delegators :@config, :api_version, :api_version=
74
77
  def_delegators :@config, :stripe_account, :stripe_account=
75
78
  def_delegators :@config, :api_base, :api_base=
@@ -116,6 +119,49 @@ module Stripe
116
119
  version: version,
117
120
  }
118
121
  end
122
+
123
+ class Preview
124
+ def self._get_default_opts(opts)
125
+ { api_mode: :preview }.merge(opts)
126
+ end
127
+
128
+ def self.get(url, opts = {})
129
+ Stripe.raw_request(:get, url, {}, _get_default_opts(opts))
130
+ end
131
+
132
+ def self.post(url, params = {}, opts = {})
133
+ Stripe.raw_request(:post, url, params, _get_default_opts(opts))
134
+ end
135
+
136
+ def self.delete(url, opts = {})
137
+ Stripe.raw_request(:delete, url, {}, _get_default_opts(opts))
138
+ end
139
+ end
140
+
141
+ class RawRequest
142
+ include Stripe::APIOperations::Request
143
+
144
+ def initialize
145
+ @opts = {}
146
+ end
147
+
148
+ def execute(method, url, params = {}, opts = {})
149
+ resp, = execute_resource_request(method, url, params, opts)
150
+
151
+ resp
152
+ end
153
+ end
154
+
155
+ # Sends a request to Stripe REST API
156
+ def self.raw_request(method, url, params = {}, opts = {})
157
+ req = RawRequest.new
158
+ req.execute(method, url, params, opts)
159
+ end
160
+
161
+ def self.deserialize(data)
162
+ data = JSON.parse(data) if data.is_a?(String)
163
+ Util.convert_to_stripe_object(data, {})
164
+ end
119
165
  end
120
166
 
121
167
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
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: 10.3.0
4
+ version: 10.4.0.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.
@@ -50,9 +50,11 @@ files:
50
50
  - lib/stripe/multipart_encoder.rb
51
51
  - lib/stripe/oauth.rb
52
52
  - lib/stripe/object_types.rb
53
+ - lib/stripe/request_signing_authenticator.rb
53
54
  - lib/stripe/resources.rb
54
55
  - lib/stripe/resources/account.rb
55
56
  - lib/stripe/resources/account_link.rb
57
+ - lib/stripe/resources/account_notice.rb
56
58
  - lib/stripe/resources/account_session.rb
57
59
  - lib/stripe/resources/alipay_account.rb
58
60
  - lib/stripe/resources/apple_pay_domain.rb
@@ -65,6 +67,9 @@ files:
65
67
  - lib/stripe/resources/billing_portal/configuration.rb
66
68
  - lib/stripe/resources/billing_portal/session.rb
67
69
  - lib/stripe/resources/capability.rb
70
+ - lib/stripe/resources/capital/financing_offer.rb
71
+ - lib/stripe/resources/capital/financing_summary.rb
72
+ - lib/stripe/resources/capital/financing_transaction.rb
68
73
  - lib/stripe/resources/card.rb
69
74
  - lib/stripe/resources/cash_balance.rb
70
75
  - lib/stripe/resources/charge.rb
@@ -72,6 +77,7 @@ files:
72
77
  - lib/stripe/resources/climate/order.rb
73
78
  - lib/stripe/resources/climate/product.rb
74
79
  - lib/stripe/resources/climate/supplier.rb
80
+ - lib/stripe/resources/confirmation_token.rb
75
81
  - lib/stripe/resources/country_spec.rb
76
82
  - lib/stripe/resources/coupon.rb
77
83
  - lib/stripe/resources/credit_note.rb
@@ -79,6 +85,7 @@ files:
79
85
  - lib/stripe/resources/customer.rb
80
86
  - lib/stripe/resources/customer_balance_transaction.rb
81
87
  - lib/stripe/resources/customer_cash_balance_transaction.rb
88
+ - lib/stripe/resources/customer_session.rb
82
89
  - lib/stripe/resources/discount.rb
83
90
  - lib/stripe/resources/dispute.rb
84
91
  - lib/stripe/resources/ephemeral_key.rb
@@ -87,24 +94,34 @@ files:
87
94
  - lib/stripe/resources/file.rb
88
95
  - lib/stripe/resources/file_link.rb
89
96
  - lib/stripe/resources/financial_connections/account.rb
97
+ - lib/stripe/resources/financial_connections/account_inferred_balance.rb
90
98
  - lib/stripe/resources/financial_connections/account_owner.rb
91
99
  - lib/stripe/resources/financial_connections/account_ownership.rb
92
100
  - lib/stripe/resources/financial_connections/session.rb
101
+ - lib/stripe/resources/financial_connections/transaction.rb
93
102
  - lib/stripe/resources/funding_instructions.rb
103
+ - lib/stripe/resources/gift_cards/card.rb
104
+ - lib/stripe/resources/gift_cards/transaction.rb
94
105
  - lib/stripe/resources/identity/verification_report.rb
95
106
  - lib/stripe/resources/identity/verification_session.rb
96
107
  - lib/stripe/resources/invoice.rb
97
108
  - lib/stripe/resources/invoice_item.rb
98
109
  - lib/stripe/resources/invoice_line_item.rb
110
+ - lib/stripe/resources/invoice_payment.rb
99
111
  - lib/stripe/resources/issuing/authorization.rb
100
112
  - lib/stripe/resources/issuing/card.rb
101
113
  - lib/stripe/resources/issuing/cardholder.rb
114
+ - lib/stripe/resources/issuing/credit_underwriting_record.rb
102
115
  - lib/stripe/resources/issuing/dispute.rb
116
+ - lib/stripe/resources/issuing/personalization_design.rb
117
+ - lib/stripe/resources/issuing/physical_bundle.rb
103
118
  - lib/stripe/resources/issuing/token.rb
104
119
  - lib/stripe/resources/issuing/transaction.rb
105
120
  - lib/stripe/resources/line_item.rb
106
121
  - lib/stripe/resources/login_link.rb
107
122
  - lib/stripe/resources/mandate.rb
123
+ - lib/stripe/resources/margin.rb
124
+ - lib/stripe/resources/order.rb
108
125
  - lib/stripe/resources/payment_intent.rb
109
126
  - lib/stripe/resources/payment_link.rb
110
127
  - lib/stripe/resources/payment_method.rb
@@ -117,6 +134,9 @@ files:
117
134
  - lib/stripe/resources/product.rb
118
135
  - lib/stripe/resources/promotion_code.rb
119
136
  - lib/stripe/resources/quote.rb
137
+ - lib/stripe/resources/quote_phase.rb
138
+ - lib/stripe/resources/quote_preview_invoice.rb
139
+ - lib/stripe/resources/quote_preview_subscription_schedule.rb
120
140
  - lib/stripe/resources/radar/early_fraud_warning.rb
121
141
  - lib/stripe/resources/radar/value_list.rb
122
142
  - lib/stripe/resources/radar/value_list_item.rb
@@ -137,6 +157,7 @@ files:
137
157
  - lib/stripe/resources/subscription_schedule.rb
138
158
  - lib/stripe/resources/tax/calculation.rb
139
159
  - lib/stripe/resources/tax/calculation_line_item.rb
160
+ - lib/stripe/resources/tax/form.rb
140
161
  - lib/stripe/resources/tax/registration.rb
141
162
  - lib/stripe/resources/tax/settings.rb
142
163
  - lib/stripe/resources/tax/transaction.rb
@@ -198,9 +219,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
219
  version: 2.3.0
199
220
  required_rubygems_version: !ruby/object:Gem::Requirement
200
221
  requirements:
201
- - - ">="
222
+ - - ">"
202
223
  - !ruby/object:Gem::Version
203
- version: '0'
224
+ version: 1.3.1
204
225
  requirements: []
205
226
  rubygems_version: 3.3.26
206
227
  signing_key: