dodopayments 1.47.0 → 1.51.0

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +17 -51
  4. data/lib/dodopayments/client.rb +4 -4
  5. data/lib/dodopayments/internal/transport/base_client.rb +1 -4
  6. data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -9
  7. data/lib/dodopayments/internal/type/base_model.rb +6 -11
  8. data/lib/dodopayments/internal/util.rb +1 -1
  9. data/lib/dodopayments/models/checkout_session_create_params.rb +14 -0
  10. data/lib/dodopayments/models/checkout_session_request.rb +347 -0
  11. data/lib/dodopayments/models/checkout_session_response.rb +25 -0
  12. data/lib/dodopayments/models/on_demand_subscription.rb +58 -0
  13. data/lib/dodopayments/models/payment_create_params.rb +1 -4
  14. data/lib/dodopayments/models/subscription.rb +9 -1
  15. data/lib/dodopayments/models/subscription_create_params.rb +3 -56
  16. data/lib/dodopayments/models/subscription_update_params.rb +16 -2
  17. data/lib/dodopayments/models/webhook_create_params.rb +6 -9
  18. data/lib/dodopayments/models/{webhook_create_response.rb → webhook_details.rb} +2 -2
  19. data/lib/dodopayments/models/webhook_retrieve_secret_params.rb +14 -0
  20. data/lib/dodopayments/models/webhook_retrieve_secret_response.rb +16 -0
  21. data/lib/dodopayments/models.rb +12 -2
  22. data/lib/dodopayments/resources/checkout_sessions.rb +61 -0
  23. data/lib/dodopayments/resources/subscriptions.rb +5 -3
  24. data/lib/dodopayments/resources/webhooks.rb +29 -10
  25. data/lib/dodopayments/version.rb +1 -1
  26. data/lib/dodopayments.rb +9 -7
  27. data/rbi/dodopayments/client.rbi +3 -3
  28. data/rbi/dodopayments/errors.rbi +2 -2
  29. data/rbi/dodopayments/models/checkout_session_create_params.rbi +32 -0
  30. data/rbi/dodopayments/models/checkout_session_request.rbi +652 -0
  31. data/rbi/dodopayments/models/checkout_session_response.rbi +40 -0
  32. data/rbi/dodopayments/models/dispute.rbi +4 -4
  33. data/rbi/dodopayments/models/get_dispute.rbi +4 -4
  34. data/rbi/dodopayments/models/license_key.rbi +2 -2
  35. data/rbi/dodopayments/models/on_demand_subscription.rbi +86 -0
  36. data/rbi/dodopayments/models/payment.rbi +8 -8
  37. data/rbi/dodopayments/models/refund.rbi +4 -4
  38. data/rbi/dodopayments/models/subscription.rbi +21 -11
  39. data/rbi/dodopayments/models/subscription_create_params.rbi +4 -90
  40. data/rbi/dodopayments/models/subscription_update_params.rbi +8 -0
  41. data/rbi/dodopayments/models/webhook_create_params.rbi +6 -6
  42. data/rbi/dodopayments/models/{webhook_list_response.rbi → webhook_details.rbi} +2 -5
  43. data/rbi/dodopayments/models/webhook_retrieve_secret_params.rbi +32 -0
  44. data/rbi/dodopayments/models/webhook_retrieve_secret_response.rbi +26 -0
  45. data/rbi/dodopayments/models.rbi +14 -2
  46. data/rbi/dodopayments/resources/checkout_sessions.rbi +80 -0
  47. data/rbi/dodopayments/resources/subscriptions.rbi +4 -2
  48. data/rbi/dodopayments/resources/webhooks.rbi +17 -7
  49. data/sig/dodopayments/client.rbs +2 -2
  50. data/sig/dodopayments/models/checkout_session_create_params.rbs +15 -0
  51. data/sig/dodopayments/models/checkout_session_request.rbs +277 -0
  52. data/sig/dodopayments/models/checkout_session_response.rbs +16 -0
  53. data/sig/dodopayments/models/on_demand_subscription.rbs +40 -0
  54. data/sig/dodopayments/models/subscription.rbs +8 -3
  55. data/sig/dodopayments/models/subscription_create_params.rbs +4 -41
  56. data/sig/dodopayments/models/subscription_update_params.rbs +5 -0
  57. data/sig/dodopayments/models/{webhook_list_response.rbs → webhook_details.rbs} +2 -2
  58. data/sig/dodopayments/models/webhook_retrieve_secret_params.rbs +15 -0
  59. data/sig/dodopayments/models/webhook_retrieve_secret_response.rbs +13 -0
  60. data/sig/dodopayments/models.rbs +12 -2
  61. data/sig/dodopayments/resources/checkout_sessions.rbs +24 -0
  62. data/sig/dodopayments/resources/subscriptions.rbs +2 -1
  63. data/sig/dodopayments/resources/webhooks.rbs +9 -4
  64. metadata +26 -20
  65. data/lib/dodopayments/models/webhook_list_response.rb +0 -88
  66. data/lib/dodopayments/models/webhook_retrieve_response.rb +0 -88
  67. data/lib/dodopayments/models/webhook_update_response.rb +0 -88
  68. data/lib/dodopayments/models/your_webhook_url_create_params.rb +0 -32
  69. data/lib/dodopayments/resources/your_webhook_url.rb +0 -56
  70. data/rbi/dodopayments/models/webhook_create_response.rbi +0 -112
  71. data/rbi/dodopayments/models/webhook_retrieve_response.rbi +0 -112
  72. data/rbi/dodopayments/models/webhook_update_response.rbi +0 -112
  73. data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +0 -56
  74. data/rbi/dodopayments/resources/your_webhook_url.rbi +0 -51
  75. data/sig/dodopayments/models/webhook_create_response.rbs +0 -60
  76. data/sig/dodopayments/models/webhook_retrieve_response.rbs +0 -60
  77. data/sig/dodopayments/models/webhook_update_response.rbs +0 -60
  78. data/sig/dodopayments/models/your_webhook_url_create_params.rbs +0 -42
  79. data/sig/dodopayments/resources/your_webhook_url.rbs +0 -18
@@ -23,6 +23,9 @@ module Dodopayments
23
23
  sig { returns(String) }
24
24
  attr_reader :bearer_token
25
25
 
26
+ sig { returns(Dodopayments::Resources::CheckoutSessions) }
27
+ attr_reader :checkout_sessions
28
+
26
29
  sig { returns(Dodopayments::Resources::Payments) }
27
30
  attr_reader :payments
28
31
 
@@ -74,9 +77,6 @@ module Dodopayments
74
77
  sig { returns(Dodopayments::Resources::Webhooks) }
75
78
  attr_reader :webhooks
76
79
 
77
- sig { returns(Dodopayments::Resources::YourWebhookURL) }
78
- attr_reader :your_webhook_url
79
-
80
80
  # @api private
81
81
  sig { override.returns(T::Hash[String, String]) }
82
82
  private def auth_headers
@@ -59,10 +59,10 @@ module Dodopayments
59
59
  end
60
60
 
61
61
  class APIConnectionError < Dodopayments::Errors::APIError
62
- sig { void }
62
+ sig { returns(NilClass) }
63
63
  attr_accessor :status
64
64
 
65
- sig { void }
65
+ sig { returns(NilClass) }
66
66
  attr_accessor :body
67
67
 
68
68
  # @api private
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class CheckoutSessionCreateParams < Dodopayments::Models::CheckoutSessionRequest
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Dodopayments::CheckoutSessionCreateParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: Dodopayments::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig do
26
+ override.returns({ request_options: Dodopayments::RequestOptions })
27
+ end
28
+ def to_hash
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,652 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class CheckoutSessionRequest < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::CheckoutSessionRequest,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig do
15
+ returns(T::Array[Dodopayments::CheckoutSessionRequest::ProductCart])
16
+ end
17
+ attr_accessor :product_cart
18
+
19
+ # Customers will never see payment methods that are not in this list. However,
20
+ # adding a method here does not guarantee customers will see it. Availability
21
+ # still depends on other factors (e.g., customer location, merchant settings).
22
+ #
23
+ # Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
24
+ # methods are unavailable, checkout session will fail.
25
+ sig do
26
+ returns(T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]))
27
+ end
28
+ attr_accessor :allowed_payment_method_types
29
+
30
+ # Billing address information for the session
31
+ sig do
32
+ returns(T.nilable(Dodopayments::CheckoutSessionRequest::BillingAddress))
33
+ end
34
+ attr_reader :billing_address
35
+
36
+ sig do
37
+ params(
38
+ billing_address:
39
+ T.nilable(
40
+ Dodopayments::CheckoutSessionRequest::BillingAddress::OrHash
41
+ )
42
+ ).void
43
+ end
44
+ attr_writer :billing_address
45
+
46
+ # This field is ingored if adaptive pricing is disabled
47
+ sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
48
+ attr_accessor :billing_currency
49
+
50
+ # If confirm is true, all the details will be finalized. If required data is
51
+ # missing, an API error is thrown.
52
+ sig { returns(T.nilable(T::Boolean)) }
53
+ attr_reader :confirm
54
+
55
+ sig { params(confirm: T::Boolean).void }
56
+ attr_writer :confirm
57
+
58
+ # Customer details for the session
59
+ sig do
60
+ returns(
61
+ T.nilable(
62
+ T.any(
63
+ Dodopayments::AttachExistingCustomer,
64
+ Dodopayments::NewCustomer
65
+ )
66
+ )
67
+ )
68
+ end
69
+ attr_accessor :customer
70
+
71
+ # Customization for the checkout session page
72
+ sig do
73
+ returns(T.nilable(Dodopayments::CheckoutSessionRequest::Customization))
74
+ end
75
+ attr_reader :customization
76
+
77
+ sig do
78
+ params(
79
+ customization:
80
+ Dodopayments::CheckoutSessionRequest::Customization::OrHash
81
+ ).void
82
+ end
83
+ attr_writer :customization
84
+
85
+ sig { returns(T.nilable(String)) }
86
+ attr_accessor :discount_code
87
+
88
+ sig do
89
+ returns(T.nilable(Dodopayments::CheckoutSessionRequest::FeatureFlags))
90
+ end
91
+ attr_reader :feature_flags
92
+
93
+ sig do
94
+ params(
95
+ feature_flags:
96
+ Dodopayments::CheckoutSessionRequest::FeatureFlags::OrHash
97
+ ).void
98
+ end
99
+ attr_writer :feature_flags
100
+
101
+ # Additional metadata associated with the payment. Defaults to empty if not
102
+ # provided.
103
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
104
+ attr_accessor :metadata
105
+
106
+ # The url to redirect after payment failure or success.
107
+ sig { returns(T.nilable(String)) }
108
+ attr_accessor :return_url
109
+
110
+ # Display saved payment methods of a returning customer False by default
111
+ sig { returns(T.nilable(T::Boolean)) }
112
+ attr_reader :show_saved_payment_methods
113
+
114
+ sig { params(show_saved_payment_methods: T::Boolean).void }
115
+ attr_writer :show_saved_payment_methods
116
+
117
+ sig do
118
+ returns(
119
+ T.nilable(Dodopayments::CheckoutSessionRequest::SubscriptionData)
120
+ )
121
+ end
122
+ attr_reader :subscription_data
123
+
124
+ sig do
125
+ params(
126
+ subscription_data:
127
+ T.nilable(
128
+ Dodopayments::CheckoutSessionRequest::SubscriptionData::OrHash
129
+ )
130
+ ).void
131
+ end
132
+ attr_writer :subscription_data
133
+
134
+ sig do
135
+ params(
136
+ product_cart:
137
+ T::Array[Dodopayments::CheckoutSessionRequest::ProductCart::OrHash],
138
+ allowed_payment_method_types:
139
+ T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
140
+ billing_address:
141
+ T.nilable(
142
+ Dodopayments::CheckoutSessionRequest::BillingAddress::OrHash
143
+ ),
144
+ billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
145
+ confirm: T::Boolean,
146
+ customer:
147
+ T.nilable(
148
+ T.any(
149
+ Dodopayments::AttachExistingCustomer::OrHash,
150
+ Dodopayments::NewCustomer::OrHash
151
+ )
152
+ ),
153
+ customization:
154
+ Dodopayments::CheckoutSessionRequest::Customization::OrHash,
155
+ discount_code: T.nilable(String),
156
+ feature_flags:
157
+ Dodopayments::CheckoutSessionRequest::FeatureFlags::OrHash,
158
+ metadata: T.nilable(T::Hash[Symbol, String]),
159
+ return_url: T.nilable(String),
160
+ show_saved_payment_methods: T::Boolean,
161
+ subscription_data:
162
+ T.nilable(
163
+ Dodopayments::CheckoutSessionRequest::SubscriptionData::OrHash
164
+ )
165
+ ).returns(T.attached_class)
166
+ end
167
+ def self.new(
168
+ product_cart:,
169
+ # Customers will never see payment methods that are not in this list. However,
170
+ # adding a method here does not guarantee customers will see it. Availability
171
+ # still depends on other factors (e.g., customer location, merchant settings).
172
+ #
173
+ # Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
174
+ # methods are unavailable, checkout session will fail.
175
+ allowed_payment_method_types: nil,
176
+ # Billing address information for the session
177
+ billing_address: nil,
178
+ # This field is ingored if adaptive pricing is disabled
179
+ billing_currency: nil,
180
+ # If confirm is true, all the details will be finalized. If required data is
181
+ # missing, an API error is thrown.
182
+ confirm: nil,
183
+ # Customer details for the session
184
+ customer: nil,
185
+ # Customization for the checkout session page
186
+ customization: nil,
187
+ discount_code: nil,
188
+ feature_flags: nil,
189
+ # Additional metadata associated with the payment. Defaults to empty if not
190
+ # provided.
191
+ metadata: nil,
192
+ # The url to redirect after payment failure or success.
193
+ return_url: nil,
194
+ # Display saved payment methods of a returning customer False by default
195
+ show_saved_payment_methods: nil,
196
+ subscription_data: nil
197
+ )
198
+ end
199
+
200
+ sig do
201
+ override.returns(
202
+ {
203
+ product_cart:
204
+ T::Array[Dodopayments::CheckoutSessionRequest::ProductCart],
205
+ allowed_payment_method_types:
206
+ T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
207
+ billing_address:
208
+ T.nilable(Dodopayments::CheckoutSessionRequest::BillingAddress),
209
+ billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
210
+ confirm: T::Boolean,
211
+ customer:
212
+ T.nilable(
213
+ T.any(
214
+ Dodopayments::AttachExistingCustomer,
215
+ Dodopayments::NewCustomer
216
+ )
217
+ ),
218
+ customization: Dodopayments::CheckoutSessionRequest::Customization,
219
+ discount_code: T.nilable(String),
220
+ feature_flags: Dodopayments::CheckoutSessionRequest::FeatureFlags,
221
+ metadata: T.nilable(T::Hash[Symbol, String]),
222
+ return_url: T.nilable(String),
223
+ show_saved_payment_methods: T::Boolean,
224
+ subscription_data:
225
+ T.nilable(Dodopayments::CheckoutSessionRequest::SubscriptionData)
226
+ }
227
+ )
228
+ end
229
+ def to_hash
230
+ end
231
+
232
+ class ProductCart < Dodopayments::Internal::Type::BaseModel
233
+ OrHash =
234
+ T.type_alias do
235
+ T.any(
236
+ Dodopayments::CheckoutSessionRequest::ProductCart,
237
+ Dodopayments::Internal::AnyHash
238
+ )
239
+ end
240
+
241
+ # unique id of the product
242
+ sig { returns(String) }
243
+ attr_accessor :product_id
244
+
245
+ sig { returns(Integer) }
246
+ attr_accessor :quantity
247
+
248
+ # only valid if product is a subscription
249
+ sig { returns(T.nilable(T::Array[Dodopayments::AttachAddon])) }
250
+ attr_accessor :addons
251
+
252
+ # Amount the customer pays if pay_what_you_want is enabled. If disabled then
253
+ # amount will be ignored Represented in the lowest denomination of the currency
254
+ # (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
255
+ # for one time payments
256
+ #
257
+ # If amount is not set for pay_what_you_want product, customer is allowed to
258
+ # select the amount.
259
+ sig { returns(T.nilable(Integer)) }
260
+ attr_accessor :amount
261
+
262
+ sig do
263
+ params(
264
+ product_id: String,
265
+ quantity: Integer,
266
+ addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
267
+ amount: T.nilable(Integer)
268
+ ).returns(T.attached_class)
269
+ end
270
+ def self.new(
271
+ # unique id of the product
272
+ product_id:,
273
+ quantity:,
274
+ # only valid if product is a subscription
275
+ addons: nil,
276
+ # Amount the customer pays if pay_what_you_want is enabled. If disabled then
277
+ # amount will be ignored Represented in the lowest denomination of the currency
278
+ # (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable
279
+ # for one time payments
280
+ #
281
+ # If amount is not set for pay_what_you_want product, customer is allowed to
282
+ # select the amount.
283
+ amount: nil
284
+ )
285
+ end
286
+
287
+ sig do
288
+ override.returns(
289
+ {
290
+ product_id: String,
291
+ quantity: Integer,
292
+ addons: T.nilable(T::Array[Dodopayments::AttachAddon]),
293
+ amount: T.nilable(Integer)
294
+ }
295
+ )
296
+ end
297
+ def to_hash
298
+ end
299
+ end
300
+
301
+ class BillingAddress < Dodopayments::Internal::Type::BaseModel
302
+ OrHash =
303
+ T.type_alias do
304
+ T.any(
305
+ Dodopayments::CheckoutSessionRequest::BillingAddress,
306
+ Dodopayments::Internal::AnyHash
307
+ )
308
+ end
309
+
310
+ # Two-letter ISO country code (ISO 3166-1 alpha-2)
311
+ sig { returns(Dodopayments::CountryCode::OrSymbol) }
312
+ attr_accessor :country
313
+
314
+ # City name
315
+ sig { returns(T.nilable(String)) }
316
+ attr_accessor :city
317
+
318
+ # State or province name
319
+ sig { returns(T.nilable(String)) }
320
+ attr_accessor :state
321
+
322
+ # Street address including house number and unit/apartment if applicable
323
+ sig { returns(T.nilable(String)) }
324
+ attr_accessor :street
325
+
326
+ # Postal code or ZIP code
327
+ sig { returns(T.nilable(String)) }
328
+ attr_accessor :zipcode
329
+
330
+ # Billing address information for the session
331
+ sig do
332
+ params(
333
+ country: Dodopayments::CountryCode::OrSymbol,
334
+ city: T.nilable(String),
335
+ state: T.nilable(String),
336
+ street: T.nilable(String),
337
+ zipcode: T.nilable(String)
338
+ ).returns(T.attached_class)
339
+ end
340
+ def self.new(
341
+ # Two-letter ISO country code (ISO 3166-1 alpha-2)
342
+ country:,
343
+ # City name
344
+ city: nil,
345
+ # State or province name
346
+ state: nil,
347
+ # Street address including house number and unit/apartment if applicable
348
+ street: nil,
349
+ # Postal code or ZIP code
350
+ zipcode: nil
351
+ )
352
+ end
353
+
354
+ sig do
355
+ override.returns(
356
+ {
357
+ country: Dodopayments::CountryCode::OrSymbol,
358
+ city: T.nilable(String),
359
+ state: T.nilable(String),
360
+ street: T.nilable(String),
361
+ zipcode: T.nilable(String)
362
+ }
363
+ )
364
+ end
365
+ def to_hash
366
+ end
367
+ end
368
+
369
+ class Customization < Dodopayments::Internal::Type::BaseModel
370
+ OrHash =
371
+ T.type_alias do
372
+ T.any(
373
+ Dodopayments::CheckoutSessionRequest::Customization,
374
+ Dodopayments::Internal::AnyHash
375
+ )
376
+ end
377
+
378
+ # Show on demand tag
379
+ #
380
+ # Default is true
381
+ sig { returns(T.nilable(T::Boolean)) }
382
+ attr_reader :show_on_demand_tag
383
+
384
+ sig { params(show_on_demand_tag: T::Boolean).void }
385
+ attr_writer :show_on_demand_tag
386
+
387
+ # Show order details by default
388
+ #
389
+ # Default is true
390
+ sig { returns(T.nilable(T::Boolean)) }
391
+ attr_reader :show_order_details
392
+
393
+ sig { params(show_order_details: T::Boolean).void }
394
+ attr_writer :show_order_details
395
+
396
+ # Theme of the page
397
+ #
398
+ # Default is `System`.
399
+ sig do
400
+ returns(
401
+ T.nilable(
402
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::OrSymbol
403
+ )
404
+ )
405
+ end
406
+ attr_reader :theme
407
+
408
+ sig do
409
+ params(
410
+ theme:
411
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::OrSymbol
412
+ ).void
413
+ end
414
+ attr_writer :theme
415
+
416
+ # Customization for the checkout session page
417
+ sig do
418
+ params(
419
+ show_on_demand_tag: T::Boolean,
420
+ show_order_details: T::Boolean,
421
+ theme:
422
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::OrSymbol
423
+ ).returns(T.attached_class)
424
+ end
425
+ def self.new(
426
+ # Show on demand tag
427
+ #
428
+ # Default is true
429
+ show_on_demand_tag: nil,
430
+ # Show order details by default
431
+ #
432
+ # Default is true
433
+ show_order_details: nil,
434
+ # Theme of the page
435
+ #
436
+ # Default is `System`.
437
+ theme: nil
438
+ )
439
+ end
440
+
441
+ sig do
442
+ override.returns(
443
+ {
444
+ show_on_demand_tag: T::Boolean,
445
+ show_order_details: T::Boolean,
446
+ theme:
447
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::OrSymbol
448
+ }
449
+ )
450
+ end
451
+ def to_hash
452
+ end
453
+
454
+ # Theme of the page
455
+ #
456
+ # Default is `System`.
457
+ module Theme
458
+ extend Dodopayments::Internal::Type::Enum
459
+
460
+ TaggedSymbol =
461
+ T.type_alias do
462
+ T.all(
463
+ Symbol,
464
+ Dodopayments::CheckoutSessionRequest::Customization::Theme
465
+ )
466
+ end
467
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
468
+
469
+ DARK =
470
+ T.let(
471
+ :dark,
472
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::TaggedSymbol
473
+ )
474
+ LIGHT =
475
+ T.let(
476
+ :light,
477
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::TaggedSymbol
478
+ )
479
+ SYSTEM =
480
+ T.let(
481
+ :system,
482
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::TaggedSymbol
483
+ )
484
+
485
+ sig do
486
+ override.returns(
487
+ T::Array[
488
+ Dodopayments::CheckoutSessionRequest::Customization::Theme::TaggedSymbol
489
+ ]
490
+ )
491
+ end
492
+ def self.values
493
+ end
494
+ end
495
+ end
496
+
497
+ class FeatureFlags < Dodopayments::Internal::Type::BaseModel
498
+ OrHash =
499
+ T.type_alias do
500
+ T.any(
501
+ Dodopayments::CheckoutSessionRequest::FeatureFlags,
502
+ Dodopayments::Internal::AnyHash
503
+ )
504
+ end
505
+
506
+ # if customer is allowed to change currency, set it to true
507
+ #
508
+ # Default is true
509
+ sig { returns(T.nilable(T::Boolean)) }
510
+ attr_reader :allow_currency_selection
511
+
512
+ sig { params(allow_currency_selection: T::Boolean).void }
513
+ attr_writer :allow_currency_selection
514
+
515
+ # If the customer is allowed to apply discount code, set it to true.
516
+ #
517
+ # Default is true
518
+ sig { returns(T.nilable(T::Boolean)) }
519
+ attr_reader :allow_discount_code
520
+
521
+ sig { params(allow_discount_code: T::Boolean).void }
522
+ attr_writer :allow_discount_code
523
+
524
+ # If phone number is collected from customer, set it to rue
525
+ #
526
+ # Default is true
527
+ sig { returns(T.nilable(T::Boolean)) }
528
+ attr_reader :allow_phone_number_collection
529
+
530
+ sig { params(allow_phone_number_collection: T::Boolean).void }
531
+ attr_writer :allow_phone_number_collection
532
+
533
+ # If the customer is allowed to add tax id, set it to true
534
+ #
535
+ # Default is true
536
+ sig { returns(T.nilable(T::Boolean)) }
537
+ attr_reader :allow_tax_id
538
+
539
+ sig { params(allow_tax_id: T::Boolean).void }
540
+ attr_writer :allow_tax_id
541
+
542
+ # Set to true if a new customer object should be created. By default email is used
543
+ # to find an existing customer to attach the session to
544
+ #
545
+ # Default is false
546
+ sig { returns(T.nilable(T::Boolean)) }
547
+ attr_reader :always_create_new_customer
548
+
549
+ sig { params(always_create_new_customer: T::Boolean).void }
550
+ attr_writer :always_create_new_customer
551
+
552
+ sig do
553
+ params(
554
+ allow_currency_selection: T::Boolean,
555
+ allow_discount_code: T::Boolean,
556
+ allow_phone_number_collection: T::Boolean,
557
+ allow_tax_id: T::Boolean,
558
+ always_create_new_customer: T::Boolean
559
+ ).returns(T.attached_class)
560
+ end
561
+ def self.new(
562
+ # if customer is allowed to change currency, set it to true
563
+ #
564
+ # Default is true
565
+ allow_currency_selection: nil,
566
+ # If the customer is allowed to apply discount code, set it to true.
567
+ #
568
+ # Default is true
569
+ allow_discount_code: nil,
570
+ # If phone number is collected from customer, set it to rue
571
+ #
572
+ # Default is true
573
+ allow_phone_number_collection: nil,
574
+ # If the customer is allowed to add tax id, set it to true
575
+ #
576
+ # Default is true
577
+ allow_tax_id: nil,
578
+ # Set to true if a new customer object should be created. By default email is used
579
+ # to find an existing customer to attach the session to
580
+ #
581
+ # Default is false
582
+ always_create_new_customer: nil
583
+ )
584
+ end
585
+
586
+ sig do
587
+ override.returns(
588
+ {
589
+ allow_currency_selection: T::Boolean,
590
+ allow_discount_code: T::Boolean,
591
+ allow_phone_number_collection: T::Boolean,
592
+ allow_tax_id: T::Boolean,
593
+ always_create_new_customer: T::Boolean
594
+ }
595
+ )
596
+ end
597
+ def to_hash
598
+ end
599
+ end
600
+
601
+ class SubscriptionData < Dodopayments::Internal::Type::BaseModel
602
+ OrHash =
603
+ T.type_alias do
604
+ T.any(
605
+ Dodopayments::CheckoutSessionRequest::SubscriptionData,
606
+ Dodopayments::Internal::AnyHash
607
+ )
608
+ end
609
+
610
+ sig { returns(T.nilable(Dodopayments::OnDemandSubscription)) }
611
+ attr_reader :on_demand
612
+
613
+ sig do
614
+ params(
615
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash)
616
+ ).void
617
+ end
618
+ attr_writer :on_demand
619
+
620
+ # Optional trial period in days If specified, this value overrides the trial
621
+ # period set in the product's price Must be between 0 and 10000 days
622
+ sig { returns(T.nilable(Integer)) }
623
+ attr_accessor :trial_period_days
624
+
625
+ sig do
626
+ params(
627
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription::OrHash),
628
+ trial_period_days: T.nilable(Integer)
629
+ ).returns(T.attached_class)
630
+ end
631
+ def self.new(
632
+ on_demand: nil,
633
+ # Optional trial period in days If specified, this value overrides the trial
634
+ # period set in the product's price Must be between 0 and 10000 days
635
+ trial_period_days: nil
636
+ )
637
+ end
638
+
639
+ sig do
640
+ override.returns(
641
+ {
642
+ on_demand: T.nilable(Dodopayments::OnDemandSubscription),
643
+ trial_period_days: T.nilable(Integer)
644
+ }
645
+ )
646
+ end
647
+ def to_hash
648
+ end
649
+ end
650
+ end
651
+ end
652
+ end