dodopayments 2.25.0 → 2.27.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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +7 -1
  6. data/lib/dodopayments/models/blocklist/block_by_customer_id.rb +18 -0
  7. data/lib/dodopayments/models/blocklist/block_by_email.rb +18 -0
  8. data/lib/dodopayments/models/blocklist/block_identifier.rb +21 -0
  9. data/lib/dodopayments/models/blocklist/blocked_customer.rb +128 -0
  10. data/lib/dodopayments/models/blocklist/blocked_customer_source.rb +22 -0
  11. data/lib/dodopayments/models/blocklist/create_blocked_customer_request.rb +66 -0
  12. data/lib/dodopayments/models/blocklist/customer_create_params.rb +16 -0
  13. data/lib/dodopayments/models/blocklist/customer_delete_params.rb +22 -0
  14. data/lib/dodopayments/models/blocklist/customer_list_params.rb +64 -0
  15. data/lib/dodopayments/models/blocklist/customer_retrieve_params.rb +22 -0
  16. data/lib/dodopayments/models/blocklist/customers/blocked_customer_note.rb +44 -0
  17. data/lib/dodopayments/models/blocklist/customers/note_create_params.rb +24 -0
  18. data/lib/dodopayments/models/blocklist/customers/note_request.rb +19 -0
  19. data/lib/dodopayments/models/blocklist/customers/note_update_params.rb +30 -0
  20. data/lib/dodopayments/models/customer.rb +22 -1
  21. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +1 -0
  22. data/lib/dodopayments/models/dunning_started_webhook_event.rb +1 -0
  23. data/lib/dodopayments/models/entitlements/license_key_grant.rb +24 -3
  24. data/lib/dodopayments/models/manual_retry.rb +76 -0
  25. data/lib/dodopayments/models/manual_retry_state.rb +50 -0
  26. data/lib/dodopayments/models/payment_retrieve_retry_state_params.rb +20 -0
  27. data/lib/dodopayments/models/payment_retry_params.rb +20 -0
  28. data/lib/dodopayments/models/price.rb +34 -30
  29. data/lib/dodopayments/models/subscription_active_webhook_event.rb +32 -4
  30. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +33 -4
  31. data/lib/dodopayments/models/subscription_change_plan_response.rb +47 -0
  32. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +32 -4
  33. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +32 -4
  34. data/lib/dodopayments/models/subscription_list_params.rb +1 -0
  35. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +32 -4
  36. data/lib/dodopayments/models/subscription_past_due_webhook_event.rb +68 -0
  37. data/lib/dodopayments/models/subscription_paused_webhook_event.rb +32 -4
  38. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +33 -4
  39. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +32 -4
  40. data/lib/dodopayments/models/subscription_status.rb +1 -0
  41. data/lib/dodopayments/models/subscription_unpaused_webhook_event.rb +32 -4
  42. data/lib/dodopayments/models/subscription_update_params.rb +17 -4
  43. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +34 -4
  44. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +32 -4
  45. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +3 -1
  46. data/lib/dodopayments/models/unwrap_webhook_event.rb +3 -1
  47. data/lib/dodopayments/models/update_subscription_plan_req.rb +35 -1
  48. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  49. data/lib/dodopayments/models/webhook_payload.rb +19 -1
  50. data/lib/dodopayments/models.rb +12 -0
  51. data/lib/dodopayments/resources/blocklist/customers/notes.rb +68 -0
  52. data/lib/dodopayments/resources/blocklist/customers.rb +107 -0
  53. data/lib/dodopayments/resources/blocklist.rb +18 -0
  54. data/lib/dodopayments/resources/payments.rb +36 -0
  55. data/lib/dodopayments/resources/subscriptions.rb +14 -6
  56. data/lib/dodopayments/resources/webhooks.rb +2 -2
  57. data/lib/dodopayments/version.rb +1 -1
  58. data/lib/dodopayments.rb +24 -1
  59. data/rbi/dodopayments/client.rbi +3 -0
  60. data/rbi/dodopayments/models/balance_ledger_entry.rbi +6 -0
  61. data/rbi/dodopayments/models/blocklist/block_by_customer_id.rbi +32 -0
  62. data/rbi/dodopayments/models/blocklist/block_by_email.rbi +32 -0
  63. data/rbi/dodopayments/models/blocklist/block_identifier.rbi +30 -0
  64. data/rbi/dodopayments/models/blocklist/blocked_customer.rbi +161 -0
  65. data/rbi/dodopayments/models/blocklist/blocked_customer_source.rbi +55 -0
  66. data/rbi/dodopayments/models/blocklist/create_blocked_customer_request.rbi +143 -0
  67. data/rbi/dodopayments/models/blocklist/customer_create_params.rbi +34 -0
  68. data/rbi/dodopayments/models/blocklist/customer_delete_params.rbi +40 -0
  69. data/rbi/dodopayments/models/blocklist/customer_list_params.rbi +88 -0
  70. data/rbi/dodopayments/models/blocklist/customer_retrieve_params.rbi +40 -0
  71. data/rbi/dodopayments/models/blocklist/customers/blocked_customer_note.rbi +66 -0
  72. data/rbi/dodopayments/models/blocklist/customers/note_create_params.rbi +45 -0
  73. data/rbi/dodopayments/models/blocklist/customers/note_request.rbi +30 -0
  74. data/rbi/dodopayments/models/blocklist/customers/note_update_params.rbi +50 -0
  75. data/rbi/dodopayments/models/customer.rbi +20 -0
  76. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +5 -0
  77. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +5 -0
  78. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +22 -2
  79. data/rbi/dodopayments/models/manual_retry.rbi +93 -0
  80. data/rbi/dodopayments/models/manual_retry_state.rbi +65 -0
  81. data/rbi/dodopayments/models/payment_retrieve_retry_state_params.rbi +38 -0
  82. data/rbi/dodopayments/models/payment_retry_params.rbi +38 -0
  83. data/rbi/dodopayments/models/price.rbi +47 -30
  84. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +53 -6
  85. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +53 -6
  86. data/rbi/dodopayments/models/subscription_change_plan_response.rbi +69 -0
  87. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +53 -6
  88. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +53 -6
  89. data/rbi/dodopayments/models/subscription_list_params.rbi +5 -0
  90. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +53 -6
  91. data/rbi/dodopayments/models/subscription_past_due_webhook_event.rbi +114 -0
  92. data/rbi/dodopayments/models/subscription_paused_webhook_event.rbi +53 -6
  93. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +53 -6
  94. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +53 -6
  95. data/rbi/dodopayments/models/subscription_status.rbi +2 -0
  96. data/rbi/dodopayments/models/subscription_unpaused_webhook_event.rbi +53 -6
  97. data/rbi/dodopayments/models/subscription_update_params.rbi +33 -4
  98. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +58 -6
  99. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +53 -6
  100. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
  101. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
  102. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +58 -0
  103. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  104. data/rbi/dodopayments/models/webhook_payload.rbi +37 -3
  105. data/rbi/dodopayments/models.rbi +14 -0
  106. data/rbi/dodopayments/resources/blocklist/customers/notes.rbi +50 -0
  107. data/rbi/dodopayments/resources/blocklist/customers.rbi +88 -0
  108. data/rbi/dodopayments/resources/blocklist.rbi +15 -0
  109. data/rbi/dodopayments/resources/payments.rbi +26 -0
  110. data/rbi/dodopayments/resources/subscriptions.rbi +63 -3
  111. data/rbi/dodopayments/resources/webhooks.rbi +2 -0
  112. data/sig/dodopayments/client.rbs +2 -0
  113. data/sig/dodopayments/models/balance_ledger_entry.rbs +5 -0
  114. data/sig/dodopayments/models/blocklist/block_by_customer_id.rbs +15 -0
  115. data/sig/dodopayments/models/blocklist/block_by_email.rbs +15 -0
  116. data/sig/dodopayments/models/blocklist/block_identifier.rbs +15 -0
  117. data/sig/dodopayments/models/blocklist/blocked_customer.rbs +87 -0
  118. data/sig/dodopayments/models/blocklist/blocked_customer_source.rbs +20 -0
  119. data/sig/dodopayments/models/blocklist/create_blocked_customer_request.rbs +71 -0
  120. data/sig/dodopayments/models/blocklist/customer_create_params.rbs +17 -0
  121. data/sig/dodopayments/models/blocklist/customer_delete_params.rbs +25 -0
  122. data/sig/dodopayments/models/blocklist/customer_list_params.rbs +53 -0
  123. data/sig/dodopayments/models/blocklist/customer_retrieve_params.rbs +25 -0
  124. data/sig/dodopayments/models/blocklist/customers/blocked_customer_note.rbs +44 -0
  125. data/sig/dodopayments/models/blocklist/customers/note_create_params.rbs +30 -0
  126. data/sig/dodopayments/models/blocklist/customers/note_request.rbs +17 -0
  127. data/sig/dodopayments/models/blocklist/customers/note_update_params.rbs +36 -0
  128. data/sig/dodopayments/models/customer.rbs +10 -0
  129. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +2 -1
  130. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +2 -1
  131. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +10 -0
  132. data/sig/dodopayments/models/manual_retry.rbs +55 -0
  133. data/sig/dodopayments/models/manual_retry_state.rbs +40 -0
  134. data/sig/dodopayments/models/payment_retrieve_retry_state_params.rbs +23 -0
  135. data/sig/dodopayments/models/payment_retry_params.rbs +23 -0
  136. data/sig/dodopayments/models/price.rbs +21 -15
  137. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +16 -4
  138. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +16 -4
  139. data/sig/dodopayments/models/subscription_change_plan_response.rbs +35 -0
  140. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +16 -4
  141. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +16 -4
  142. data/sig/dodopayments/models/subscription_list_params.rbs +2 -0
  143. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +16 -4
  144. data/sig/dodopayments/models/subscription_past_due_webhook_event.rbs +47 -0
  145. data/sig/dodopayments/models/subscription_paused_webhook_event.rbs +16 -4
  146. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +16 -4
  147. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +16 -4
  148. data/sig/dodopayments/models/subscription_status.rbs +9 -1
  149. data/sig/dodopayments/models/subscription_unpaused_webhook_event.rbs +16 -4
  150. data/sig/dodopayments/models/subscription_update_params.rbs +2 -0
  151. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +16 -4
  152. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +16 -4
  153. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
  154. data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
  155. data/sig/dodopayments/models/update_subscription_plan_req.rbs +14 -0
  156. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  157. data/sig/dodopayments/models/webhook_payload.rbs +16 -4
  158. data/sig/dodopayments/models.rbs +12 -0
  159. data/sig/dodopayments/resources/blocklist/customers/notes.rbs +24 -0
  160. data/sig/dodopayments/resources/blocklist/customers.rbs +36 -0
  161. data/sig/dodopayments/resources/blocklist.rbs +9 -0
  162. data/sig/dodopayments/resources/payments.rbs +10 -0
  163. data/sig/dodopayments/resources/subscriptions.rbs +5 -1
  164. data/sig/dodopayments/resources/webhooks.rbs +2 -0
  165. metadata +71 -2
@@ -37,6 +37,38 @@ module Dodopayments
37
37
  sig { returns(T.nilable(T::Array[Dodopayments::AttachAddon])) }
38
38
  attr_accessor :addons
39
39
 
40
+ # Replace a scheduled plan change with this one.
41
+ #
42
+ # The scheduled change is cancelled by the transaction that applies this change. A
43
+ # change that never applies leaves the schedule in place.
44
+ #
45
+ # `effective_at: next_billing_date` is allowed. The new schedule then replaces the
46
+ # old one in the request transaction.
47
+ #
48
+ # A pending plan change still gets a `409`. This field does not affect it.
49
+ #
50
+ # The preview route shares this request body, so a preview that sets this field
51
+ # also passes the scheduled-change `409`.
52
+ sig { returns(T.nilable(T::Boolean)) }
53
+ attr_reader :cancel_scheduled_change_plan
54
+
55
+ sig { params(cancel_scheduled_change_plan: T::Boolean).void }
56
+ attr_writer :cancel_scheduled_change_plan
57
+
58
+ # Collect the plan-change amount with a payment link. The customer then pays on a
59
+ # checkout page.
60
+ #
61
+ # The business needs the `allow_plan_change_via_payment_link` capability. The
62
+ # request needs `effective_at: immediately`. The request also needs
63
+ # `on_payment_failure: prevent_change`.
64
+ #
65
+ # The preview route shares this request body and ignores this field.
66
+ sig { returns(T.nilable(T::Boolean)) }
67
+ attr_reader :collect_via_payment_link
68
+
69
+ sig { params(collect_via_payment_link: T::Boolean).void }
70
+ attr_writer :collect_via_payment_link
71
+
40
72
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
41
73
  # discount_codes.
42
74
  sig { returns(T.nilable(String)) }
@@ -103,6 +135,8 @@ module Dodopayments
103
135
  quantity: Integer,
104
136
  adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
105
137
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
138
+ cancel_scheduled_change_plan: T::Boolean,
139
+ collect_via_payment_link: T::Boolean,
106
140
  discount_code: T.nilable(String),
107
141
  discount_codes: T.nilable(T::Array[String]),
108
142
  effective_at:
@@ -128,6 +162,28 @@ module Dodopayments
128
162
  # Addons for the new plan. Note : Leaving this empty would remove any existing
129
163
  # addons
130
164
  addons: nil,
165
+ # Replace a scheduled plan change with this one.
166
+ #
167
+ # The scheduled change is cancelled by the transaction that applies this change. A
168
+ # change that never applies leaves the schedule in place.
169
+ #
170
+ # `effective_at: next_billing_date` is allowed. The new schedule then replaces the
171
+ # old one in the request transaction.
172
+ #
173
+ # A pending plan change still gets a `409`. This field does not affect it.
174
+ #
175
+ # The preview route shares this request body, so a preview that sets this field
176
+ # also passes the scheduled-change `409`.
177
+ cancel_scheduled_change_plan: nil,
178
+ # Collect the plan-change amount with a payment link. The customer then pays on a
179
+ # checkout page.
180
+ #
181
+ # The business needs the `allow_plan_change_via_payment_link` capability. The
182
+ # request needs `effective_at: immediately`. The request also needs
183
+ # `on_payment_failure: prevent_change`.
184
+ #
185
+ # The preview route shares this request body and ignores this field.
186
+ collect_via_payment_link: nil,
131
187
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
132
188
  # discount_codes.
133
189
  discount_code: nil,
@@ -164,6 +220,8 @@ module Dodopayments
164
220
  quantity: Integer,
165
221
  adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
166
222
  addons: T.nilable(T::Array[Dodopayments::AttachAddon]),
223
+ cancel_scheduled_change_plan: T::Boolean,
224
+ collect_via_payment_link: T::Boolean,
167
225
  discount_code: T.nilable(String),
168
226
  discount_codes: T.nilable(T::Array[String]),
169
227
  effective_at:
@@ -66,6 +66,11 @@ module Dodopayments
66
66
  :"subscription.on_hold",
67
67
  Dodopayments::WebhookEventType::TaggedSymbol
68
68
  )
69
+ SUBSCRIPTION_PAST_DUE =
70
+ T.let(
71
+ :"subscription.past_due",
72
+ Dodopayments::WebhookEventType::TaggedSymbol
73
+ )
69
74
  SUBSCRIPTION_PAUSED =
70
75
  T.let(
71
76
  :"subscription.paused",
@@ -153,12 +153,41 @@ module Dodopayments
153
153
  sig { returns(Symbol) }
154
154
  attr_accessor :payload_type
155
155
 
156
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
157
+ # `cancelled` at this time.
158
+ #
159
+ # Read in the same query as the rest of the payload, so it always comes from the
160
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
161
+ # a window at that moment. A delayed event of another type therefore carries the
162
+ # deadline too, next to a `past_due` status.
163
+ sig { returns(T.nilable(Time)) }
164
+ attr_accessor :past_due_ends_at
165
+
156
166
  # Response struct representing subscription details
157
- sig { params(payload_type: Symbol).returns(T.attached_class) }
158
- def self.new(payload_type: :Subscription)
167
+ sig do
168
+ params(
169
+ past_due_ends_at: T.nilable(Time),
170
+ payload_type: Symbol
171
+ ).returns(T.attached_class)
172
+ end
173
+ def self.new(
174
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
175
+ # `cancelled` at this time.
176
+ #
177
+ # Read in the same query as the rest of the payload, so it always comes from the
178
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
179
+ # a window at that moment. A delayed event of another type therefore carries the
180
+ # deadline too, next to a `past_due` status.
181
+ past_due_ends_at: nil,
182
+ payload_type: :Subscription
183
+ )
159
184
  end
160
185
 
161
- sig { override.returns({ payload_type: Symbol }) }
186
+ sig do
187
+ override.returns(
188
+ { payload_type: Symbol, past_due_ends_at: T.nilable(Time) }
189
+ )
190
+ end
162
191
  def to_hash
163
192
  end
164
193
  end
@@ -867,6 +896,11 @@ module Dodopayments
867
896
  :cancelled,
868
897
  Dodopayments::WebhookPayload::Data::DunningAttempt::TriggerState::TaggedSymbol
869
898
  )
899
+ PAST_DUE =
900
+ T.let(
901
+ :past_due,
902
+ Dodopayments::WebhookPayload::Data::DunningAttempt::TriggerState::TaggedSymbol
903
+ )
870
904
 
871
905
  sig do
872
906
  override.returns(
@@ -38,6 +38,8 @@ module Dodopayments
38
38
 
39
39
  BillingAddress = Dodopayments::Models::BillingAddress
40
40
 
41
+ Blocklist = Dodopayments::Models::Blocklist
42
+
41
43
  Brand = Dodopayments::Models::Brand
42
44
 
43
45
  BrandArchiveParams = Dodopayments::Models::BrandArchiveParams
@@ -319,6 +321,10 @@ module Dodopayments
319
321
 
320
322
  LicenseValidateParams = Dodopayments::Models::LicenseValidateParams
321
323
 
324
+ ManualRetry = Dodopayments::Models::ManualRetry
325
+
326
+ ManualRetryState = Dodopayments::Models::ManualRetryState
327
+
322
328
  Metadata =
323
329
  T.let(
324
330
  Dodopayments::Models::Metadata,
@@ -380,6 +386,11 @@ module Dodopayments
380
386
 
381
387
  PaymentRetrieveParams = Dodopayments::Models::PaymentRetrieveParams
382
388
 
389
+ PaymentRetrieveRetryStateParams =
390
+ Dodopayments::Models::PaymentRetrieveRetryStateParams
391
+
392
+ PaymentRetryParams = Dodopayments::Models::PaymentRetryParams
393
+
383
394
  PaymentSucceededWebhookEvent =
384
395
  Dodopayments::Models::PaymentSucceededWebhookEvent
385
396
 
@@ -497,6 +508,9 @@ module Dodopayments
497
508
  SubscriptionOnHoldWebhookEvent =
498
509
  Dodopayments::Models::SubscriptionOnHoldWebhookEvent
499
510
 
511
+ SubscriptionPastDueWebhookEvent =
512
+ Dodopayments::Models::SubscriptionPastDueWebhookEvent
513
+
500
514
  SubscriptionPausedWebhookEvent =
501
515
  Dodopayments::Models::SubscriptionPausedWebhookEvent
502
516
 
@@ -0,0 +1,50 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Blocklist
6
+ class Customers
7
+ class Notes
8
+ sig do
9
+ params(
10
+ entry_id: String,
11
+ note: String,
12
+ request_options: Dodopayments::RequestOptions::OrHash
13
+ ).returns(Dodopayments::Blocklist::Customers::BlockedCustomerNote)
14
+ end
15
+ def create(
16
+ # Blocklist entry id
17
+ entry_id,
18
+ note:,
19
+ request_options: {}
20
+ )
21
+ end
22
+
23
+ sig do
24
+ params(
25
+ note_id: String,
26
+ entry_id: String,
27
+ note: String,
28
+ request_options: Dodopayments::RequestOptions::OrHash
29
+ ).returns(Dodopayments::Blocklist::Customers::BlockedCustomerNote)
30
+ end
31
+ def update(
32
+ # Path param: Note id
33
+ note_id,
34
+ # Path param: Blocklist entry id
35
+ entry_id:,
36
+ # Body param
37
+ note:,
38
+ request_options: {}
39
+ )
40
+ end
41
+
42
+ # @api private
43
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
44
+ def self.new(client:)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,88 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Blocklist
6
+ class Customers
7
+ sig { returns(Dodopayments::Resources::Blocklist::Customers::Notes) }
8
+ attr_reader :notes
9
+
10
+ sig do
11
+ params(
12
+ create_blocked_customer_request:
13
+ T.any(
14
+ Dodopayments::Blocklist::CreateBlockedCustomerRequest::BlocklistCustomersBlockByCustomerID::OrHash,
15
+ Dodopayments::Blocklist::CreateBlockedCustomerRequest::BlocklistCustomersBlockByEmail::OrHash
16
+ ),
17
+ request_options: Dodopayments::RequestOptions::OrHash
18
+ ).returns(Dodopayments::Blocklist::BlockedCustomer)
19
+ end
20
+ def create(create_blocked_customer_request:, request_options: {})
21
+ end
22
+
23
+ sig do
24
+ params(
25
+ entry_id: String,
26
+ request_options: Dodopayments::RequestOptions::OrHash
27
+ ).returns(Dodopayments::Blocklist::BlockedCustomer)
28
+ end
29
+ def retrieve(
30
+ # Blocklist entry id
31
+ entry_id,
32
+ request_options: {}
33
+ )
34
+ end
35
+
36
+ sig do
37
+ params(
38
+ blocked_by_email: T.nilable(String),
39
+ created_at_gte: T.nilable(Time),
40
+ created_at_lte: T.nilable(Time),
41
+ identifier: T.nilable(String),
42
+ page_number: T.nilable(Integer),
43
+ page_size: T.nilable(Integer),
44
+ request_options: Dodopayments::RequestOptions::OrHash
45
+ ).returns(
46
+ Dodopayments::Internal::DefaultPageNumberPagination[
47
+ Dodopayments::Blocklist::BlockedCustomer
48
+ ]
49
+ )
50
+ end
51
+ def list(
52
+ # Filter by the dashboard user who blocked the customer.
53
+ blocked_by_email: nil,
54
+ # Blocked on or after this time.
55
+ created_at_gte: nil,
56
+ # Blocked on or before this time.
57
+ created_at_lte: nil,
58
+ # Partial, case-insensitive match on the email and on the customer id.
59
+ identifier: nil,
60
+ # Page number. Default 0.
61
+ page_number: nil,
62
+ # Page size. Default 10, maximum 100.
63
+ page_size: nil,
64
+ request_options: {}
65
+ )
66
+ end
67
+
68
+ sig do
69
+ params(
70
+ entry_id: String,
71
+ request_options: Dodopayments::RequestOptions::OrHash
72
+ ).void
73
+ end
74
+ def delete(
75
+ # Blocklist entry id
76
+ entry_id,
77
+ request_options: {}
78
+ )
79
+ end
80
+
81
+ # @api private
82
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
83
+ def self.new(client:)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,15 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Blocklist
6
+ sig { returns(Dodopayments::Resources::Blocklist::Customers) }
7
+ attr_reader :customers
8
+
9
+ # @api private
10
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
11
+ def self.new(client:)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -165,6 +165,32 @@ module Dodopayments
165
165
  )
166
166
  end
167
167
 
168
+ sig do
169
+ params(
170
+ payment_id: String,
171
+ request_options: Dodopayments::RequestOptions::OrHash
172
+ ).returns(Dodopayments::ManualRetryState)
173
+ end
174
+ def retrieve_retry_state(
175
+ # Id of the failed payment
176
+ payment_id,
177
+ request_options: {}
178
+ )
179
+ end
180
+
181
+ sig do
182
+ params(
183
+ payment_id: String,
184
+ request_options: Dodopayments::RequestOptions::OrHash
185
+ ).returns(Dodopayments::ManualRetry)
186
+ end
187
+ def retry_(
188
+ # Id of the failed payment
189
+ payment_id,
190
+ request_options: {}
191
+ )
192
+ end
193
+
168
194
  # @api private
169
195
  sig { params(client: Dodopayments::Client).returns(T.attached_class) }
170
196
  def self.new(client:)
@@ -187,9 +187,21 @@ module Dodopayments
187
187
  # Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
188
188
  metadata: nil,
189
189
  next_billing_date: nil,
190
- # `Some(true)` pauses an active subscription; `Some(false)` unpauses a `Paused`
191
- # (or abandoned `OnHold`) subscription. Exclusive of every other field.
190
+ # Removed. Use `status: paused` to pause and `status: active` to resume. This
191
+ # field always fails with 422, so a caller still on it gets a loud error instead
192
+ # of a silent no-op.
192
193
  pause: nil,
194
+ # Set to `cancelled` to cancel the subscription. See `cancel_reason`,
195
+ # `cancellation_feedback`, `cancellation_comment`, and
196
+ # `cancel_at_next_billing_date` for cancellation options.
197
+ #
198
+ # Set to `paused` to pause an active subscription. Set to `active` to resume a
199
+ # `paused` subscription. `active` also resumes an `on_hold` subscription that has
200
+ # an unpaid pause invoice. This voids that invoice.
201
+ #
202
+ # Send `paused` or `active` alone. A request that combines either with any other
203
+ # field fails with 422. `cancelled` is not exclusive this way — see
204
+ # `cancel_reason` and friends below.
193
205
  status: nil,
194
206
  # New number of `subscription_period_interval` units the subscription entitlement
195
207
  # should span. Used together with `subscription_period_interval` to extend the
@@ -268,6 +280,8 @@ module Dodopayments
268
280
  quantity: Integer,
269
281
  adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
270
282
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
283
+ cancel_scheduled_change_plan: T::Boolean,
284
+ collect_via_payment_link: T::Boolean,
271
285
  discount_code: T.nilable(String),
272
286
  discount_codes: T.nilable(T::Array[String]),
273
287
  effective_at:
@@ -279,7 +293,7 @@ module Dodopayments
279
293
  Dodopayments::UpdateSubscriptionPlanReq::OnPaymentFailure::OrSymbol
280
294
  ),
281
295
  request_options: Dodopayments::RequestOptions::OrHash
282
- ).void
296
+ ).returns(Dodopayments::Models::SubscriptionChangePlanResponse)
283
297
  end
284
298
  def change_plan(
285
299
  # Subscription Id
@@ -296,6 +310,28 @@ module Dodopayments
296
310
  # Addons for the new plan. Note : Leaving this empty would remove any existing
297
311
  # addons
298
312
  addons: nil,
313
+ # Replace a scheduled plan change with this one.
314
+ #
315
+ # The scheduled change is cancelled by the transaction that applies this change. A
316
+ # change that never applies leaves the schedule in place.
317
+ #
318
+ # `effective_at: next_billing_date` is allowed. The new schedule then replaces the
319
+ # old one in the request transaction.
320
+ #
321
+ # A pending plan change still gets a `409`. This field does not affect it.
322
+ #
323
+ # The preview route shares this request body, so a preview that sets this field
324
+ # also passes the scheduled-change `409`.
325
+ cancel_scheduled_change_plan: nil,
326
+ # Collect the plan-change amount with a payment link. The customer then pays on a
327
+ # checkout page.
328
+ #
329
+ # The business needs the `allow_plan_change_via_payment_link` capability. The
330
+ # request needs `effective_at: immediately`. The request also needs
331
+ # `on_payment_failure: prevent_change`.
332
+ #
333
+ # The preview route shares this request body and ignores this field.
334
+ collect_via_payment_link: nil,
299
335
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
300
336
  # discount_codes.
301
337
  discount_code: nil,
@@ -374,6 +410,8 @@ module Dodopayments
374
410
  quantity: Integer,
375
411
  adaptive_currency_fees_inclusive: T.nilable(T::Boolean),
376
412
  addons: T.nilable(T::Array[Dodopayments::AttachAddon::OrHash]),
413
+ cancel_scheduled_change_plan: T::Boolean,
414
+ collect_via_payment_link: T::Boolean,
377
415
  discount_code: T.nilable(String),
378
416
  discount_codes: T.nilable(T::Array[String]),
379
417
  effective_at:
@@ -402,6 +440,28 @@ module Dodopayments
402
440
  # Addons for the new plan. Note : Leaving this empty would remove any existing
403
441
  # addons
404
442
  addons: nil,
443
+ # Replace a scheduled plan change with this one.
444
+ #
445
+ # The scheduled change is cancelled by the transaction that applies this change. A
446
+ # change that never applies leaves the schedule in place.
447
+ #
448
+ # `effective_at: next_billing_date` is allowed. The new schedule then replaces the
449
+ # old one in the request transaction.
450
+ #
451
+ # A pending plan change still gets a `409`. This field does not affect it.
452
+ #
453
+ # The preview route shares this request body, so a preview that sets this field
454
+ # also passes the scheduled-change `409`.
455
+ cancel_scheduled_change_plan: nil,
456
+ # Collect the plan-change amount with a payment link. The customer then pays on a
457
+ # checkout page.
458
+ #
459
+ # The business needs the `allow_plan_change_via_payment_link` capability. The
460
+ # request needs `effective_at: immediately`. The request also needs
461
+ # `on_payment_failure: prevent_change`.
462
+ #
463
+ # The preview route shares this request body and ignores this field.
464
+ collect_via_payment_link: nil,
405
465
  # DEPRECATED: Use discount_codes instead. Cannot be used together with
406
466
  # discount_codes.
407
467
  discount_code: nil,
@@ -185,6 +185,7 @@ module Dodopayments
185
185
  Dodopayments::SubscriptionExpiredWebhookEvent,
186
186
  Dodopayments::SubscriptionFailedWebhookEvent,
187
187
  Dodopayments::SubscriptionOnHoldWebhookEvent,
188
+ Dodopayments::SubscriptionPastDueWebhookEvent,
188
189
  Dodopayments::SubscriptionPausedWebhookEvent,
189
190
  Dodopayments::SubscriptionPlanChangedWebhookEvent,
190
191
  Dodopayments::SubscriptionRenewedWebhookEvent,
@@ -248,6 +249,7 @@ module Dodopayments
248
249
  Dodopayments::SubscriptionExpiredWebhookEvent,
249
250
  Dodopayments::SubscriptionFailedWebhookEvent,
250
251
  Dodopayments::SubscriptionOnHoldWebhookEvent,
252
+ Dodopayments::SubscriptionPastDueWebhookEvent,
251
253
  Dodopayments::SubscriptionPausedWebhookEvent,
252
254
  Dodopayments::SubscriptionPlanChangedWebhookEvent,
253
255
  Dodopayments::SubscriptionRenewedWebhookEvent,
@@ -33,6 +33,8 @@ module Dodopayments
33
33
 
34
34
  attr_reader customers: Dodopayments::Resources::Customers
35
35
 
36
+ attr_reader blocklist: Dodopayments::Resources::Blocklist
37
+
36
38
  attr_reader refunds: Dodopayments::Resources::Refunds
37
39
 
38
40
  attr_reader disputes: Dodopayments::Resources::Disputes
@@ -13,6 +13,7 @@ module Dodopayments
13
13
  after_balance: Integer?,
14
14
  before_balance: Integer?,
15
15
  description: String?,
16
+ payout_id: String?,
16
17
  reference_object_id: String?
17
18
  }
18
19
 
@@ -39,6 +40,8 @@ module Dodopayments
39
40
 
40
41
  attr_accessor description: String?
41
42
 
43
+ attr_accessor payout_id: String?
44
+
42
45
  attr_accessor reference_object_id: String?
43
46
 
44
47
  def initialize: (
@@ -53,6 +56,7 @@ module Dodopayments
53
56
  ?after_balance: Integer?,
54
57
  ?before_balance: Integer?,
55
58
  ?description: String?,
59
+ ?payout_id: String?,
56
60
  ?reference_object_id: String?
57
61
  ) -> void
58
62
 
@@ -68,6 +72,7 @@ module Dodopayments
68
72
  after_balance: Integer?,
69
73
  before_balance: Integer?,
70
74
  description: String?,
75
+ payout_id: String?,
71
76
  reference_object_id: String?
72
77
  }
73
78
 
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ module Blocklist
4
+ type block_by_customer_id = { customer_id: String }
5
+
6
+ class BlockByCustomerID < Dodopayments::Internal::Type::BaseModel
7
+ attr_accessor customer_id: String
8
+
9
+ def initialize: (customer_id: String) -> void
10
+
11
+ def to_hash: -> { customer_id: String }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ module Blocklist
4
+ type block_by_email = { email: String }
5
+
6
+ class BlockByEmail < Dodopayments::Internal::Type::BaseModel
7
+ attr_accessor email: String
8
+
9
+ def initialize: (email: String) -> void
10
+
11
+ def to_hash: -> { email: String }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Dodopayments
2
+ module Models
3
+ module Blocklist
4
+ type block_identifier =
5
+ Dodopayments::Blocklist::BlockByCustomerID
6
+ | Dodopayments::Blocklist::BlockByEmail
7
+
8
+ module BlockIdentifier
9
+ extend Dodopayments::Internal::Type::Union
10
+
11
+ def self?.variants: -> ::Array[Dodopayments::Models::Blocklist::block_identifier]
12
+ end
13
+ end
14
+ end
15
+ end