dodopayments 2.1.2 → 2.3.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -0
  3. data/README.md +3 -3
  4. data/lib/dodopayments/client.rb +15 -0
  5. data/lib/dodopayments/models/checkout_session_customization.rb +4 -4
  6. data/lib/dodopayments/models/checkout_session_request.rb +10 -1
  7. data/lib/dodopayments/models/customer_retrieve_payment_methods_response.rb +13 -1
  8. data/lib/dodopayments/models/customers/customer_portal_create_params.rb +13 -1
  9. data/lib/dodopayments/models/invoices/payment_retrieve_payout_params.rb +22 -0
  10. data/lib/dodopayments/models/payment_method_types.rb +3 -0
  11. data/lib/dodopayments/models/product_collection_create_params.rb +98 -0
  12. data/lib/dodopayments/models/product_collection_create_response.rb +226 -0
  13. data/lib/dodopayments/models/product_collection_delete_params.rb +20 -0
  14. data/lib/dodopayments/models/product_collection_list_params.rb +46 -0
  15. data/lib/dodopayments/models/product_collection_list_response.rb +65 -0
  16. data/lib/dodopayments/models/product_collection_retrieve_params.rb +20 -0
  17. data/lib/dodopayments/models/product_collection_retrieve_response.rb +226 -0
  18. data/lib/dodopayments/models/product_collection_unarchive_params.rb +20 -0
  19. data/lib/dodopayments/models/product_collection_unarchive_response.rb +33 -0
  20. data/lib/dodopayments/models/product_collection_update_images_params.rb +29 -0
  21. data/lib/dodopayments/models/product_collection_update_images_response.rb +25 -0
  22. data/lib/dodopayments/models/product_collection_update_params.rb +61 -0
  23. data/lib/dodopayments/models/product_collections/group_create_params.rb +71 -0
  24. data/lib/dodopayments/models/product_collections/group_create_response.rb +160 -0
  25. data/lib/dodopayments/models/product_collections/group_delete_params.rb +28 -0
  26. data/lib/dodopayments/models/product_collections/group_update_params.rb +59 -0
  27. data/lib/dodopayments/models/product_collections/groups/item_create_params.rb +60 -0
  28. data/lib/dodopayments/models/product_collections/groups/item_create_response.rb +136 -0
  29. data/lib/dodopayments/models/product_collections/groups/item_delete_params.rb +36 -0
  30. data/lib/dodopayments/models/product_collections/groups/item_update_params.rb +47 -0
  31. data/lib/dodopayments/models/subscription.rb +107 -1
  32. data/lib/dodopayments/models/subscription_cancel_change_plan_params.rb +20 -0
  33. data/lib/dodopayments/models/subscription_list_response.rb +109 -1
  34. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +10 -1
  35. data/lib/dodopayments/models/update_subscription_plan_req.rb +29 -1
  36. data/lib/dodopayments/models/your_webhook_url_create_params.rb +32 -0
  37. data/lib/dodopayments/models.rb +20 -0
  38. data/lib/dodopayments/resources/checkout_sessions.rb +6 -2
  39. data/lib/dodopayments/resources/customers/customer_portal.rb +6 -1
  40. data/lib/dodopayments/resources/invoices/payments.rb +18 -0
  41. data/lib/dodopayments/resources/product_collections/groups/items.rb +111 -0
  42. data/lib/dodopayments/resources/product_collections/groups.rb +109 -0
  43. data/lib/dodopayments/resources/product_collections.rb +179 -0
  44. data/lib/dodopayments/resources/subscriptions.rb +24 -2
  45. data/lib/dodopayments/resources/webhooks.rb +11 -1
  46. data/lib/dodopayments/resources/your_webhook_url.rb +56 -0
  47. data/lib/dodopayments/version.rb +1 -1
  48. data/lib/dodopayments.rb +31 -3
  49. data/rbi/dodopayments/client.rbi +12 -0
  50. data/rbi/dodopayments/models/checkout_session_customization.rbi +12 -13
  51. data/rbi/dodopayments/models/checkout_session_request.rbi +10 -0
  52. data/rbi/dodopayments/models/credit_entitlement_cart_response.rbi +4 -4
  53. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +2 -2
  54. data/rbi/dodopayments/models/customer_retrieve_payment_methods_response.rbi +6 -0
  55. data/rbi/dodopayments/models/customers/customer_portal_create_params.rbi +13 -0
  56. data/rbi/dodopayments/models/dispute.rbi +4 -4
  57. data/rbi/dodopayments/models/get_dispute.rbi +4 -4
  58. data/rbi/dodopayments/models/invoices/payment_retrieve_payout_params.rbi +40 -0
  59. data/rbi/dodopayments/models/license_key.rbi +2 -2
  60. data/rbi/dodopayments/models/meter_cart_response_item.rbi +2 -2
  61. data/rbi/dodopayments/models/payment.rbi +10 -12
  62. data/rbi/dodopayments/models/payment_method_types.rbi +3 -0
  63. data/rbi/dodopayments/models/product_collection_create_params.rbi +180 -0
  64. data/rbi/dodopayments/models/product_collection_create_response.rbi +303 -0
  65. data/rbi/dodopayments/models/product_collection_delete_params.rbi +38 -0
  66. data/rbi/dodopayments/models/product_collection_list_params.rbi +82 -0
  67. data/rbi/dodopayments/models/product_collection_list_response.rbi +88 -0
  68. data/rbi/dodopayments/models/product_collection_retrieve_params.rbi +38 -0
  69. data/rbi/dodopayments/models/product_collection_retrieve_response.rbi +305 -0
  70. data/rbi/dodopayments/models/product_collection_unarchive_params.rbi +38 -0
  71. data/rbi/dodopayments/models/product_collection_unarchive_response.rbi +56 -0
  72. data/rbi/dodopayments/models/product_collection_update_images_params.rbi +52 -0
  73. data/rbi/dodopayments/models/product_collection_update_images_response.rbi +40 -0
  74. data/rbi/dodopayments/models/product_collection_update_params.rbi +84 -0
  75. data/rbi/dodopayments/models/product_collections/group_create_params.rbi +123 -0
  76. data/rbi/dodopayments/models/product_collections/group_create_response.rbi +204 -0
  77. data/rbi/dodopayments/models/product_collections/group_delete_params.rbi +48 -0
  78. data/rbi/dodopayments/models/product_collections/group_update_params.rbi +80 -0
  79. data/rbi/dodopayments/models/product_collections/groups/item_create_params.rbi +113 -0
  80. data/rbi/dodopayments/models/product_collections/groups/item_create_response.rbi +156 -0
  81. data/rbi/dodopayments/models/product_collections/groups/item_delete_params.rbi +55 -0
  82. data/rbi/dodopayments/models/product_collections/groups/item_update_params.rbi +68 -0
  83. data/rbi/dodopayments/models/refund.rbi +4 -4
  84. data/rbi/dodopayments/models/refund_list_item.rbi +4 -4
  85. data/rbi/dodopayments/models/subscription.rbi +169 -10
  86. data/rbi/dodopayments/models/subscription_cancel_change_plan_params.rbi +41 -0
  87. data/rbi/dodopayments/models/subscription_list_response.rbi +179 -0
  88. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +12 -1
  89. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +70 -0
  90. data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +56 -0
  91. data/rbi/dodopayments/models.rbi +28 -0
  92. data/rbi/dodopayments/resources/checkout_sessions.rbi +8 -0
  93. data/rbi/dodopayments/resources/customers/customer_portal.rbi +4 -0
  94. data/rbi/dodopayments/resources/invoices/payments.rbi +9 -0
  95. data/rbi/dodopayments/resources/product_collections/groups/items.rbi +83 -0
  96. data/rbi/dodopayments/resources/product_collections/groups.rbi +90 -0
  97. data/rbi/dodopayments/resources/product_collections.rbi +149 -0
  98. data/rbi/dodopayments/resources/subscriptions.rbi +27 -0
  99. data/rbi/dodopayments/resources/webhooks.rbi +10 -2
  100. data/rbi/dodopayments/resources/your_webhook_url.rbi +53 -0
  101. data/sig/dodopayments/client.rbs +7 -0
  102. data/sig/dodopayments/models/checkout_session_customization.rbs +4 -8
  103. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  104. data/sig/dodopayments/models/customers/customer_portal_create_params.rbs +7 -1
  105. data/sig/dodopayments/models/invoices/payment_retrieve_payout_params.rbs +25 -0
  106. data/sig/dodopayments/models/product_collection_create_params.rbs +80 -0
  107. data/sig/dodopayments/models/product_collection_create_response.rbs +179 -0
  108. data/sig/dodopayments/models/product_collection_delete_params.rbs +23 -0
  109. data/sig/dodopayments/models/product_collection_list_params.rbs +49 -0
  110. data/sig/dodopayments/models/product_collection_list_response.rbs +50 -0
  111. data/sig/dodopayments/models/product_collection_retrieve_params.rbs +23 -0
  112. data/sig/dodopayments/models/product_collection_retrieve_response.rbs +179 -0
  113. data/sig/dodopayments/models/product_collection_unarchive_params.rbs +23 -0
  114. data/sig/dodopayments/models/product_collection_unarchive_response.rbs +30 -0
  115. data/sig/dodopayments/models/product_collection_update_images_params.rbs +28 -0
  116. data/sig/dodopayments/models/product_collection_update_images_response.rbs +16 -0
  117. data/sig/dodopayments/models/product_collection_update_params.rbs +51 -0
  118. data/sig/dodopayments/models/product_collections/group_create_params.rbs +55 -0
  119. data/sig/dodopayments/models/product_collections/group_create_response.rbs +129 -0
  120. data/sig/dodopayments/models/product_collections/group_delete_params.rbs +30 -0
  121. data/sig/dodopayments/models/product_collections/group_update_params.rbs +48 -0
  122. data/sig/dodopayments/models/product_collections/groups/item_create_params.rbs +52 -0
  123. data/sig/dodopayments/models/product_collections/groups/item_create_response.rbs +104 -0
  124. data/sig/dodopayments/models/product_collections/groups/item_delete_params.rbs +36 -0
  125. data/sig/dodopayments/models/product_collections/groups/item_update_params.rbs +40 -0
  126. data/sig/dodopayments/models/subscription.rbs +75 -0
  127. data/sig/dodopayments/models/subscription_cancel_change_plan_params.rbs +24 -0
  128. data/sig/dodopayments/models/subscription_list_response.rbs +75 -0
  129. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +5 -0
  130. data/sig/dodopayments/models/update_subscription_plan_req.rbs +25 -1
  131. data/sig/dodopayments/models/your_webhook_url_create_params.rbs +42 -0
  132. data/sig/dodopayments/models.rbs +20 -0
  133. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  134. data/sig/dodopayments/resources/customers/customer_portal.rbs +1 -0
  135. data/sig/dodopayments/resources/invoices/payments.rbs +5 -0
  136. data/sig/dodopayments/resources/product_collections/groups/items.rbs +33 -0
  137. data/sig/dodopayments/resources/product_collections/groups.rbs +34 -0
  138. data/sig/dodopayments/resources/product_collections.rbs +56 -0
  139. data/sig/dodopayments/resources/subscriptions.rbs +7 -0
  140. data/sig/dodopayments/resources/webhooks.rbs +3 -1
  141. data/sig/dodopayments/resources/your_webhook_url.rbs +18 -0
  142. metadata +97 -2
@@ -39,6 +39,27 @@ module Dodopayments
39
39
  sig { returns(T.nilable(String)) }
40
40
  attr_accessor :discount_code
41
41
 
42
+ # When to apply the plan change.
43
+ #
44
+ # - `immediately` (default): Apply the plan change right away
45
+ # - `next_billing_date`: Schedule the change for the next billing date
46
+ sig do
47
+ returns(
48
+ T.nilable(
49
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol
50
+ )
51
+ )
52
+ end
53
+ attr_reader :effective_at
54
+
55
+ sig do
56
+ params(
57
+ effective_at:
58
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol
59
+ ).void
60
+ end
61
+ attr_writer :effective_at
62
+
42
63
  # Metadata for the payment. If not passed, the metadata of the subscription will
43
64
  # be taken
44
65
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
@@ -68,6 +89,8 @@ module Dodopayments
68
89
  quantity: Integer,
69
90
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
70
91
  discount_code: T.nilable(String),
92
+ effective_at:
93
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol,
71
94
  metadata: T.nilable(T::Hash[Symbol, String]),
72
95
  on_payment_failure:
73
96
  T.nilable(
@@ -90,6 +113,11 @@ module Dodopayments
90
113
  # has an existing discount with `preserve_on_plan_change=true`, the existing
91
114
  # discount will be preserved (if applicable to the new product).
92
115
  discount_code: nil,
116
+ # When to apply the plan change.
117
+ #
118
+ # - `immediately` (default): Apply the plan change right away
119
+ # - `next_billing_date`: Schedule the change for the next billing date
120
+ effective_at: nil,
93
121
  # Metadata for the payment. If not passed, the metadata of the subscription will
94
122
  # be taken
95
123
  metadata: nil,
@@ -113,6 +141,8 @@ module Dodopayments
113
141
  quantity: Integer,
114
142
  addons: T.nilable(T::Array[Dodopayments::AttachAddon]),
115
143
  discount_code: T.nilable(String),
144
+ effective_at:
145
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol,
116
146
  metadata: T.nilable(T::Hash[Symbol, String]),
117
147
  on_payment_failure:
118
148
  T.nilable(
@@ -152,6 +182,11 @@ module Dodopayments
152
182
  :difference_immediately,
153
183
  Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::TaggedSymbol
154
184
  )
185
+ DO_NOT_BILL =
186
+ T.let(
187
+ :do_not_bill,
188
+ Dodopayments::UpdateSubscriptionPlanReq::ProrationBillingMode::TaggedSymbol
189
+ )
155
190
 
156
191
  sig do
157
192
  override.returns(
@@ -164,6 +199,41 @@ module Dodopayments
164
199
  end
165
200
  end
166
201
 
202
+ # When to apply the plan change.
203
+ #
204
+ # - `immediately` (default): Apply the plan change right away
205
+ # - `next_billing_date`: Schedule the change for the next billing date
206
+ module EffectiveAt
207
+ extend Dodopayments::Internal::Type::Enum
208
+
209
+ TaggedSymbol =
210
+ T.type_alias do
211
+ T.all(Symbol, Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt)
212
+ end
213
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
214
+
215
+ IMMEDIATELY =
216
+ T.let(
217
+ :immediately,
218
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::TaggedSymbol
219
+ )
220
+ NEXT_BILLING_DATE =
221
+ T.let(
222
+ :next_billing_date,
223
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::TaggedSymbol
224
+ )
225
+
226
+ sig do
227
+ override.returns(
228
+ T::Array[
229
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::TaggedSymbol
230
+ ]
231
+ )
232
+ end
233
+ def self.values
234
+ end
235
+ end
236
+
167
237
  # Controls behavior when the plan change payment fails.
168
238
  #
169
239
  # - `prevent_change`: Keep subscription on current plan until payment succeeds
@@ -0,0 +1,56 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class YourWebhookURLCreateParams < Dodopayments::Models::WebhookPayload
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::YourWebhookURLCreateParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :webhook_id
19
+
20
+ sig { returns(String) }
21
+ attr_accessor :webhook_signature
22
+
23
+ sig { returns(String) }
24
+ attr_accessor :webhook_timestamp
25
+
26
+ sig do
27
+ params(
28
+ webhook_id: String,
29
+ webhook_signature: String,
30
+ webhook_timestamp: String,
31
+ request_options: Dodopayments::RequestOptions::OrHash
32
+ ).returns(T.attached_class)
33
+ end
34
+ def self.new(
35
+ webhook_id:,
36
+ webhook_signature:,
37
+ webhook_timestamp:,
38
+ request_options: {}
39
+ )
40
+ end
41
+
42
+ sig do
43
+ override.returns(
44
+ {
45
+ webhook_id: String,
46
+ webhook_signature: String,
47
+ webhook_timestamp: String,
48
+ request_options: Dodopayments::RequestOptions
49
+ }
50
+ )
51
+ end
52
+ def to_hash
53
+ end
54
+ end
55
+ end
56
+ end
@@ -310,6 +310,29 @@ module Dodopayments
310
310
 
311
311
  ProductArchiveParams = Dodopayments::Models::ProductArchiveParams
312
312
 
313
+ ProductCollectionCreateParams =
314
+ Dodopayments::Models::ProductCollectionCreateParams
315
+
316
+ ProductCollectionDeleteParams =
317
+ Dodopayments::Models::ProductCollectionDeleteParams
318
+
319
+ ProductCollectionListParams =
320
+ Dodopayments::Models::ProductCollectionListParams
321
+
322
+ ProductCollectionRetrieveParams =
323
+ Dodopayments::Models::ProductCollectionRetrieveParams
324
+
325
+ ProductCollections = Dodopayments::Models::ProductCollections
326
+
327
+ ProductCollectionUnarchiveParams =
328
+ Dodopayments::Models::ProductCollectionUnarchiveParams
329
+
330
+ ProductCollectionUpdateImagesParams =
331
+ Dodopayments::Models::ProductCollectionUpdateImagesParams
332
+
333
+ ProductCollectionUpdateParams =
334
+ Dodopayments::Models::ProductCollectionUpdateParams
335
+
313
336
  ProductCreateParams = Dodopayments::Models::ProductCreateParams
314
337
 
315
338
  ProductItemReq = Dodopayments::Models::ProductItemReq
@@ -348,6 +371,9 @@ module Dodopayments
348
371
  SubscriptionActiveWebhookEvent =
349
372
  Dodopayments::Models::SubscriptionActiveWebhookEvent
350
373
 
374
+ SubscriptionCancelChangePlanParams =
375
+ Dodopayments::Models::SubscriptionCancelChangePlanParams
376
+
351
377
  SubscriptionCancelledWebhookEvent =
352
378
  Dodopayments::Models::SubscriptionCancelledWebhookEvent
353
379
 
@@ -442,4 +468,6 @@ module Dodopayments
442
468
  WebhookUnwrapParams = Dodopayments::Models::WebhookUnwrapParams
443
469
 
444
470
  WebhookUpdateParams = Dodopayments::Models::WebhookUpdateParams
471
+
472
+ YourWebhookURLCreateParams = Dodopayments::Models::YourWebhookURLCreateParams
445
473
  end
@@ -11,6 +11,7 @@ module Dodopayments
11
11
  billing_address:
12
12
  T.nilable(Dodopayments::CheckoutSessionBillingAddress::OrHash),
13
13
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
14
+ cancel_url: T.nilable(String),
14
15
  confirm: T::Boolean,
15
16
  custom_fields: T.nilable(T::Array[Dodopayments::CustomField::OrHash]),
16
17
  customer:
@@ -49,6 +50,9 @@ module Dodopayments
49
50
  billing_address: nil,
50
51
  # This field is ingored if adaptive pricing is disabled
51
52
  billing_currency: nil,
53
+ # The URL to redirect the customer if they cancel or go back from the checkout. If
54
+ # not provided, the back button will not be displayed.
55
+ cancel_url: nil,
52
56
  # If confirm is true, all the details will be finalized. If required data is
53
57
  # missing, an API error is thrown.
54
58
  confirm: nil,
@@ -104,6 +108,7 @@ module Dodopayments
104
108
  billing_address:
105
109
  T.nilable(Dodopayments::CheckoutSessionBillingAddress::OrHash),
106
110
  billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
111
+ cancel_url: T.nilable(String),
107
112
  confirm: T::Boolean,
108
113
  custom_fields: T.nilable(T::Array[Dodopayments::CustomField::OrHash]),
109
114
  customer:
@@ -142,6 +147,9 @@ module Dodopayments
142
147
  billing_address: nil,
143
148
  # This field is ingored if adaptive pricing is disabled
144
149
  billing_currency: nil,
150
+ # The URL to redirect the customer if they cancel or go back from the checkout. If
151
+ # not provided, the back button will not be displayed.
152
+ cancel_url: nil,
145
153
  # If confirm is true, all the details will be finalized. If required data is
146
154
  # missing, an API error is thrown.
147
155
  confirm: nil,
@@ -7,6 +7,7 @@ module Dodopayments
7
7
  sig do
8
8
  params(
9
9
  customer_id: String,
10
+ return_url: String,
10
11
  send_email: T::Boolean,
11
12
  request_options: Dodopayments::RequestOptions::OrHash
12
13
  ).returns(Dodopayments::CustomerPortalSession)
@@ -14,6 +15,9 @@ module Dodopayments
14
15
  def create(
15
16
  # Customer Id
16
17
  customer_id,
18
+ # Optional return URL for this session. Overrides the business-level default. This
19
+ # URL will be shown as a "Return to {business}" back button in the portal.
20
+ return_url: nil,
17
21
  # If true, will send link to user.
18
22
  send_email: nil,
19
23
  request_options: {}
@@ -13,6 +13,15 @@ module Dodopayments
13
13
  def retrieve(payment_id, request_options: {})
14
14
  end
15
15
 
16
+ sig do
17
+ params(
18
+ payout_id: String,
19
+ request_options: Dodopayments::RequestOptions::OrHash
20
+ ).returns(StringIO)
21
+ end
22
+ def retrieve_payout(payout_id, request_options: {})
23
+ end
24
+
16
25
  sig do
17
26
  params(
18
27
  refund_id: String,
@@ -0,0 +1,83 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class ProductCollections
6
+ class Groups
7
+ class Items
8
+ sig do
9
+ params(
10
+ group_id: String,
11
+ id: String,
12
+ products:
13
+ T::Array[
14
+ Dodopayments::ProductCollections::Groups::ItemCreateParams::Product::OrHash
15
+ ],
16
+ request_options: Dodopayments::RequestOptions::OrHash
17
+ ).returns(
18
+ T::Array[
19
+ Dodopayments::Models::ProductCollections::Groups::ItemCreateResponseItem
20
+ ]
21
+ )
22
+ end
23
+ def create(
24
+ # Path param: Product Collection Group Id
25
+ group_id,
26
+ # Path param: Product Collection Id
27
+ id:,
28
+ # Body param: Products to add to the group
29
+ products:,
30
+ request_options: {}
31
+ )
32
+ end
33
+
34
+ sig do
35
+ params(
36
+ item_id: String,
37
+ id: String,
38
+ group_id: String,
39
+ status: T::Boolean,
40
+ request_options: Dodopayments::RequestOptions::OrHash
41
+ ).void
42
+ end
43
+ def update(
44
+ # Path param: Collection item Id (product membership in group)
45
+ item_id,
46
+ # Path param: Product Collection Id
47
+ id:,
48
+ # Path param: Product Collection Group Id
49
+ group_id:,
50
+ # Body param: Status of the product in the group
51
+ status:,
52
+ request_options: {}
53
+ )
54
+ end
55
+
56
+ sig do
57
+ params(
58
+ item_id: String,
59
+ id: String,
60
+ group_id: String,
61
+ request_options: Dodopayments::RequestOptions::OrHash
62
+ ).void
63
+ end
64
+ def delete(
65
+ # Collection item Id (product membership in group)
66
+ item_id,
67
+ # Product Collection Id
68
+ id:,
69
+ # Product Collection Group Id
70
+ group_id:,
71
+ request_options: {}
72
+ )
73
+ end
74
+
75
+ # @api private
76
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
77
+ def self.new(client:)
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,90 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class ProductCollections
6
+ class Groups
7
+ sig do
8
+ returns(Dodopayments::Resources::ProductCollections::Groups::Items)
9
+ end
10
+ attr_reader :items
11
+
12
+ sig do
13
+ params(
14
+ id: String,
15
+ products:
16
+ T::Array[
17
+ Dodopayments::ProductCollections::GroupCreateParams::Product::OrHash
18
+ ],
19
+ group_name: T.nilable(String),
20
+ status: T.nilable(T::Boolean),
21
+ request_options: Dodopayments::RequestOptions::OrHash
22
+ ).returns(
23
+ Dodopayments::Models::ProductCollections::GroupCreateResponse
24
+ )
25
+ end
26
+ def create(
27
+ # Product Collection Id
28
+ id,
29
+ # Products in this group
30
+ products:,
31
+ # Optional group name. Multiple groups can have null names, but named groups must
32
+ # be unique per collection
33
+ group_name: nil,
34
+ # Status of the group (defaults to true if not provided)
35
+ status: nil,
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ sig do
41
+ params(
42
+ group_id: String,
43
+ id: String,
44
+ group_name: T.nilable(String),
45
+ product_order: T.nilable(T::Array[String]),
46
+ status: T.nilable(T::Boolean),
47
+ request_options: Dodopayments::RequestOptions::OrHash
48
+ ).void
49
+ end
50
+ def update(
51
+ # Path param: Product Collection Group Id
52
+ group_id,
53
+ # Path param: Product Collection Id
54
+ id:,
55
+ # Body param: Optional group name update: Some(Some(name)) = set name, Some(None)
56
+ # = clear name, None = no change
57
+ group_name: nil,
58
+ # Body param: Optional new order for products in this group (array of
59
+ # product_collection_group_pdts UUIDs)
60
+ product_order: nil,
61
+ # Body param: Optional status update
62
+ status: nil,
63
+ request_options: {}
64
+ )
65
+ end
66
+
67
+ sig do
68
+ params(
69
+ group_id: String,
70
+ id: String,
71
+ request_options: Dodopayments::RequestOptions::OrHash
72
+ ).void
73
+ end
74
+ def delete(
75
+ # Product Collection Group Id
76
+ group_id,
77
+ # Product Collection Id
78
+ id:,
79
+ request_options: {}
80
+ )
81
+ end
82
+
83
+ # @api private
84
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
85
+ def self.new(client:)
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,149 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class ProductCollections
6
+ sig { returns(Dodopayments::Resources::ProductCollections::Groups) }
7
+ attr_reader :groups
8
+
9
+ sig do
10
+ params(
11
+ groups:
12
+ T::Array[
13
+ Dodopayments::ProductCollectionCreateParams::Group::OrHash
14
+ ],
15
+ name: String,
16
+ brand_id: T.nilable(String),
17
+ description: T.nilable(String),
18
+ request_options: Dodopayments::RequestOptions::OrHash
19
+ ).returns(Dodopayments::Models::ProductCollectionCreateResponse)
20
+ end
21
+ def create(
22
+ # Groups of products in this collection
23
+ groups:,
24
+ # Name of the product collection
25
+ name:,
26
+ # Brand id for the collection, if not provided will default to primary brand
27
+ brand_id: nil,
28
+ # Optional description of the product collection
29
+ description: nil,
30
+ request_options: {}
31
+ )
32
+ end
33
+
34
+ sig do
35
+ params(
36
+ id: String,
37
+ request_options: Dodopayments::RequestOptions::OrHash
38
+ ).returns(Dodopayments::Models::ProductCollectionRetrieveResponse)
39
+ end
40
+ def retrieve(
41
+ # Product Collection Id
42
+ id,
43
+ request_options: {}
44
+ )
45
+ end
46
+
47
+ sig do
48
+ params(
49
+ id: String,
50
+ brand_id: T.nilable(String),
51
+ description: T.nilable(String),
52
+ group_order: T.nilable(T::Array[String]),
53
+ image_id: T.nilable(String),
54
+ name: T.nilable(String),
55
+ request_options: Dodopayments::RequestOptions::OrHash
56
+ ).void
57
+ end
58
+ def update(
59
+ # Product Collection Id
60
+ id,
61
+ # Optional brand_id update
62
+ brand_id: nil,
63
+ # Optional description update - pass null to remove, omit to keep unchanged
64
+ description: nil,
65
+ # Optional new order for groups (array of group UUIDs in desired order)
66
+ group_order: nil,
67
+ # Optional image update - pass null to remove, omit to keep unchanged
68
+ image_id: nil,
69
+ # Optional new name for the collection
70
+ name: nil,
71
+ request_options: {}
72
+ )
73
+ end
74
+
75
+ sig do
76
+ params(
77
+ archived: T::Boolean,
78
+ brand_id: String,
79
+ page_number: Integer,
80
+ page_size: Integer,
81
+ request_options: Dodopayments::RequestOptions::OrHash
82
+ ).returns(
83
+ Dodopayments::Internal::DefaultPageNumberPagination[
84
+ Dodopayments::Models::ProductCollectionListResponse
85
+ ]
86
+ )
87
+ end
88
+ def list(
89
+ # List archived collections
90
+ archived: nil,
91
+ # Filter by Brand id
92
+ brand_id: nil,
93
+ # Page number default is 0
94
+ page_number: nil,
95
+ # Page size default is 10 max is 100
96
+ page_size: nil,
97
+ request_options: {}
98
+ )
99
+ end
100
+
101
+ sig do
102
+ params(
103
+ id: String,
104
+ request_options: Dodopayments::RequestOptions::OrHash
105
+ ).void
106
+ end
107
+ def delete(
108
+ # Product Collection Id
109
+ id,
110
+ request_options: {}
111
+ )
112
+ end
113
+
114
+ sig do
115
+ params(
116
+ id: String,
117
+ request_options: Dodopayments::RequestOptions::OrHash
118
+ ).returns(Dodopayments::Models::ProductCollectionUnarchiveResponse)
119
+ end
120
+ def unarchive(
121
+ # Product Collection Id
122
+ id,
123
+ request_options: {}
124
+ )
125
+ end
126
+
127
+ sig do
128
+ params(
129
+ id: String,
130
+ force_update: T.nilable(T::Boolean),
131
+ request_options: Dodopayments::RequestOptions::OrHash
132
+ ).returns(Dodopayments::Models::ProductCollectionUpdateImagesResponse)
133
+ end
134
+ def update_images(
135
+ # Product Collection Id
136
+ id,
137
+ # If true, generates a new image ID to force cache invalidation
138
+ force_update: nil,
139
+ request_options: {}
140
+ )
141
+ end
142
+
143
+ # @api private
144
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
145
+ def self.new(client:)
146
+ end
147
+ end
148
+ end
149
+ end
@@ -186,6 +186,19 @@ module Dodopayments
186
186
  )
187
187
  end
188
188
 
189
+ sig do
190
+ params(
191
+ subscription_id: String,
192
+ request_options: Dodopayments::RequestOptions::OrHash
193
+ ).void
194
+ end
195
+ def cancel_change_plan(
196
+ # Subscription Id
197
+ subscription_id,
198
+ request_options: {}
199
+ )
200
+ end
201
+
189
202
  sig do
190
203
  params(
191
204
  subscription_id: String,
@@ -195,6 +208,8 @@ module Dodopayments
195
208
  quantity: Integer,
196
209
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
197
210
  discount_code: T.nilable(String),
211
+ effective_at:
212
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol,
198
213
  metadata: T.nilable(T::Hash[Symbol, String]),
199
214
  on_payment_failure:
200
215
  T.nilable(
@@ -220,6 +235,11 @@ module Dodopayments
220
235
  # has an existing discount with `preserve_on_plan_change=true`, the existing
221
236
  # discount will be preserved (if applicable to the new product).
222
237
  discount_code: nil,
238
+ # When to apply the plan change.
239
+ #
240
+ # - `immediately` (default): Apply the plan change right away
241
+ # - `next_billing_date`: Schedule the change for the next billing date
242
+ effective_at: nil,
223
243
  # Metadata for the payment. If not passed, the metadata of the subscription will
224
244
  # be taken
225
245
  metadata: nil,
@@ -284,6 +304,8 @@ module Dodopayments
284
304
  quantity: Integer,
285
305
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
286
306
  discount_code: T.nilable(String),
307
+ effective_at:
308
+ Dodopayments::UpdateSubscriptionPlanReq::EffectiveAt::OrSymbol,
287
309
  metadata: T.nilable(T::Hash[Symbol, String]),
288
310
  on_payment_failure:
289
311
  T.nilable(
@@ -309,6 +331,11 @@ module Dodopayments
309
331
  # has an existing discount with `preserve_on_plan_change=true`, the existing
310
332
  # discount will be preserved (if applicable to the new product).
311
333
  discount_code: nil,
334
+ # When to apply the plan change.
335
+ #
336
+ # - `immediately` (default): Apply the plan change right away
337
+ # - `next_billing_date`: Schedule the change for the next billing date
338
+ effective_at: nil,
312
339
  # Metadata for the payment. If not passed, the metadata of the subscription will
313
340
  # be taken
314
341
  metadata: nil,
@@ -171,7 +171,11 @@ module Dodopayments
171
171
  end
172
172
 
173
173
  sig do
174
- params(payload: String).returns(
174
+ params(
175
+ payload: String,
176
+ headers: T::Hash[String, String],
177
+ key: T.nilable(String)
178
+ ).returns(
175
179
  T.any(
176
180
  Dodopayments::CreditAddedWebhookEvent,
177
181
  Dodopayments::CreditBalanceLowWebhookEvent,
@@ -208,7 +212,11 @@ module Dodopayments
208
212
  end
209
213
  def unwrap(
210
214
  # The raw webhook payload as a string
211
- payload
215
+ payload,
216
+ # The raw HTTP headers that came with the payload
217
+ headers:,
218
+ # The webhook signing key
219
+ key: @client.webhook_key
212
220
  )
213
221
  end
214
222