dodopayments 2.26.0 → 2.28.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 (205) 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/internal/type/union.rb +15 -5
  6. data/lib/dodopayments/models/balance_ledger_entry.rb +9 -1
  7. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +2 -0
  8. data/lib/dodopayments/models/blocklist/block_by_customer_id.rb +18 -0
  9. data/lib/dodopayments/models/blocklist/block_by_email.rb +18 -0
  10. data/lib/dodopayments/models/blocklist/block_identifier.rb +21 -0
  11. data/lib/dodopayments/models/blocklist/blocked_customer.rb +128 -0
  12. data/lib/dodopayments/models/blocklist/blocked_customer_source.rb +22 -0
  13. data/lib/dodopayments/models/blocklist/create_blocked_customer_request.rb +66 -0
  14. data/lib/dodopayments/models/blocklist/customer_create_params.rb +16 -0
  15. data/lib/dodopayments/models/blocklist/customer_delete_params.rb +22 -0
  16. data/lib/dodopayments/models/blocklist/customer_list_params.rb +64 -0
  17. data/lib/dodopayments/models/blocklist/customer_retrieve_params.rb +22 -0
  18. data/lib/dodopayments/models/blocklist/customers/blocked_customer_note.rb +44 -0
  19. data/lib/dodopayments/models/blocklist/customers/note_create_params.rb +24 -0
  20. data/lib/dodopayments/models/blocklist/customers/note_request.rb +19 -0
  21. data/lib/dodopayments/models/blocklist/customers/note_update_params.rb +30 -0
  22. data/lib/dodopayments/models/checkout_session_preview_response.rb +10 -1
  23. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +1 -1
  24. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rb +21 -1
  25. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +2 -7
  26. data/lib/dodopayments/models/customer.rb +22 -1
  27. data/lib/dodopayments/models/customers/email_body.rb +57 -0
  28. data/lib/dodopayments/models/customers/email_failure_code.rb +27 -0
  29. data/lib/dodopayments/models/customers/email_list_params.rb +39 -0
  30. data/lib/dodopayments/models/customers/email_log_item.rb +121 -0
  31. data/lib/dodopayments/models/customers/email_log_status.rb +24 -0
  32. data/lib/dodopayments/models/customers/email_policies.rb +45 -0
  33. data/lib/dodopayments/models/customers/email_retrieve_body_params.rb +28 -0
  34. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +1 -0
  35. data/lib/dodopayments/models/dunning_started_webhook_event.rb +1 -0
  36. data/lib/dodopayments/models/manual_retry.rb +76 -0
  37. data/lib/dodopayments/models/manual_retry_state.rb +50 -0
  38. data/lib/dodopayments/models/payment_retrieve_retry_state_params.rb +20 -0
  39. data/lib/dodopayments/models/payment_retry_params.rb +20 -0
  40. data/lib/dodopayments/models/price.rb +95 -27
  41. data/lib/dodopayments/models/subscription.rb +10 -1
  42. data/lib/dodopayments/models/subscription_active_webhook_event.rb +32 -4
  43. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +33 -4
  44. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  45. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +32 -4
  46. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +32 -4
  47. data/lib/dodopayments/models/subscription_list_params.rb +1 -0
  48. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  49. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +32 -4
  50. data/lib/dodopayments/models/subscription_past_due_webhook_event.rb +68 -0
  51. data/lib/dodopayments/models/subscription_paused_webhook_event.rb +32 -4
  52. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +33 -4
  53. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +32 -4
  54. data/lib/dodopayments/models/subscription_status.rb +1 -0
  55. data/lib/dodopayments/models/subscription_unpaused_webhook_event.rb +32 -4
  56. data/lib/dodopayments/models/subscription_update_params.rb +1 -0
  57. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +34 -4
  58. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +32 -4
  59. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +3 -1
  60. data/lib/dodopayments/models/unwrap_webhook_event.rb +3 -1
  61. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  62. data/lib/dodopayments/models/webhook_payload.rb +19 -1
  63. data/lib/dodopayments/models.rb +12 -0
  64. data/lib/dodopayments/resources/blocklist/customers/notes.rb +68 -0
  65. data/lib/dodopayments/resources/blocklist/customers.rb +107 -0
  66. data/lib/dodopayments/resources/blocklist.rb +18 -0
  67. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -0
  68. data/lib/dodopayments/resources/customers/emails.rb +76 -0
  69. data/lib/dodopayments/resources/customers.rb +4 -0
  70. data/lib/dodopayments/resources/payments.rb +36 -0
  71. data/lib/dodopayments/resources/webhooks.rb +2 -2
  72. data/lib/dodopayments/version.rb +1 -1
  73. data/lib/dodopayments.rb +31 -1
  74. data/rbi/dodopayments/client.rbi +3 -0
  75. data/rbi/dodopayments/models/balance_ledger_entry.rbi +16 -0
  76. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +10 -0
  77. data/rbi/dodopayments/models/blocklist/block_by_customer_id.rbi +32 -0
  78. data/rbi/dodopayments/models/blocklist/block_by_email.rbi +32 -0
  79. data/rbi/dodopayments/models/blocklist/block_identifier.rbi +30 -0
  80. data/rbi/dodopayments/models/blocklist/blocked_customer.rbi +161 -0
  81. data/rbi/dodopayments/models/blocklist/blocked_customer_source.rbi +55 -0
  82. data/rbi/dodopayments/models/blocklist/create_blocked_customer_request.rbi +143 -0
  83. data/rbi/dodopayments/models/blocklist/customer_create_params.rbi +34 -0
  84. data/rbi/dodopayments/models/blocklist/customer_delete_params.rbi +40 -0
  85. data/rbi/dodopayments/models/blocklist/customer_list_params.rbi +88 -0
  86. data/rbi/dodopayments/models/blocklist/customer_retrieve_params.rbi +40 -0
  87. data/rbi/dodopayments/models/blocklist/customers/blocked_customer_note.rbi +66 -0
  88. data/rbi/dodopayments/models/blocklist/customers/note_create_params.rbi +45 -0
  89. data/rbi/dodopayments/models/blocklist/customers/note_request.rbi +30 -0
  90. data/rbi/dodopayments/models/blocklist/customers/note_update_params.rbi +50 -0
  91. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +10 -0
  92. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +2 -2
  93. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbi +8 -0
  94. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +2 -6
  95. data/rbi/dodopayments/models/customer.rbi +20 -0
  96. data/rbi/dodopayments/models/customers/email_body.rbi +88 -0
  97. data/rbi/dodopayments/models/customers/email_failure_code.rbi +70 -0
  98. data/rbi/dodopayments/models/customers/email_list_params.rbi +68 -0
  99. data/rbi/dodopayments/models/customers/email_log_item.rbi +157 -0
  100. data/rbi/dodopayments/models/customers/email_log_status.rbi +46 -0
  101. data/rbi/dodopayments/models/customers/email_policies.rbi +68 -0
  102. data/rbi/dodopayments/models/customers/email_retrieve_body_params.rbi +48 -0
  103. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +5 -0
  104. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +5 -0
  105. data/rbi/dodopayments/models/manual_retry.rbi +93 -0
  106. data/rbi/dodopayments/models/manual_retry_state.rbi +65 -0
  107. data/rbi/dodopayments/models/payment_retrieve_retry_state_params.rbi +38 -0
  108. data/rbi/dodopayments/models/payment_retry_params.rbi +38 -0
  109. data/rbi/dodopayments/models/price.rbi +124 -25
  110. data/rbi/dodopayments/models/subscription.rbi +10 -0
  111. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +53 -6
  112. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +53 -6
  113. data/rbi/dodopayments/models/subscription_create_response.rbi +10 -0
  114. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +53 -6
  115. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +53 -6
  116. data/rbi/dodopayments/models/subscription_list_params.rbi +5 -0
  117. data/rbi/dodopayments/models/subscription_list_response.rbi +10 -0
  118. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +53 -6
  119. data/rbi/dodopayments/models/subscription_past_due_webhook_event.rbi +114 -0
  120. data/rbi/dodopayments/models/subscription_paused_webhook_event.rbi +53 -6
  121. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +53 -6
  122. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +53 -6
  123. data/rbi/dodopayments/models/subscription_status.rbi +2 -0
  124. data/rbi/dodopayments/models/subscription_unpaused_webhook_event.rbi +53 -6
  125. data/rbi/dodopayments/models/subscription_update_params.rbi +5 -0
  126. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +58 -6
  127. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +53 -6
  128. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
  129. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
  130. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  131. data/rbi/dodopayments/models/webhook_payload.rbi +37 -3
  132. data/rbi/dodopayments/models.rbi +14 -0
  133. data/rbi/dodopayments/resources/blocklist/customers/notes.rbi +50 -0
  134. data/rbi/dodopayments/resources/blocklist/customers.rbi +88 -0
  135. data/rbi/dodopayments/resources/blocklist.rbi +15 -0
  136. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +2 -1
  137. data/rbi/dodopayments/resources/customers/emails.rbi +60 -0
  138. data/rbi/dodopayments/resources/customers.rbi +3 -0
  139. data/rbi/dodopayments/resources/payments.rbi +26 -0
  140. data/rbi/dodopayments/resources/webhooks.rbi +2 -0
  141. data/sig/dodopayments/client.rbs +2 -0
  142. data/sig/dodopayments/models/balance_ledger_entry.rbs +9 -0
  143. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +4 -0
  144. data/sig/dodopayments/models/blocklist/block_by_customer_id.rbs +15 -0
  145. data/sig/dodopayments/models/blocklist/block_by_email.rbs +15 -0
  146. data/sig/dodopayments/models/blocklist/block_identifier.rbs +15 -0
  147. data/sig/dodopayments/models/blocklist/blocked_customer.rbs +87 -0
  148. data/sig/dodopayments/models/blocklist/blocked_customer_source.rbs +20 -0
  149. data/sig/dodopayments/models/blocklist/create_blocked_customer_request.rbs +71 -0
  150. data/sig/dodopayments/models/blocklist/customer_create_params.rbs +17 -0
  151. data/sig/dodopayments/models/blocklist/customer_delete_params.rbs +25 -0
  152. data/sig/dodopayments/models/blocklist/customer_list_params.rbs +53 -0
  153. data/sig/dodopayments/models/blocklist/customer_retrieve_params.rbs +25 -0
  154. data/sig/dodopayments/models/blocklist/customers/blocked_customer_note.rbs +44 -0
  155. data/sig/dodopayments/models/blocklist/customers/note_create_params.rbs +30 -0
  156. data/sig/dodopayments/models/blocklist/customers/note_request.rbs +17 -0
  157. data/sig/dodopayments/models/blocklist/customers/note_update_params.rbs +36 -0
  158. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  159. data/sig/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbs +5 -0
  160. data/sig/dodopayments/models/customer.rbs +10 -0
  161. data/sig/dodopayments/models/customers/email_body.rbs +42 -0
  162. data/sig/dodopayments/models/customers/email_failure_code.rbs +30 -0
  163. data/sig/dodopayments/models/customers/email_list_params.rbs +38 -0
  164. data/sig/dodopayments/models/customers/email_log_item.rbs +82 -0
  165. data/sig/dodopayments/models/customers/email_log_status.rbs +20 -0
  166. data/sig/dodopayments/models/customers/email_policies.rbs +37 -0
  167. data/sig/dodopayments/models/customers/email_retrieve_body_params.rbs +30 -0
  168. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +2 -1
  169. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +2 -1
  170. data/sig/dodopayments/models/manual_retry.rbs +55 -0
  171. data/sig/dodopayments/models/manual_retry_state.rbs +40 -0
  172. data/sig/dodopayments/models/payment_retrieve_retry_state_params.rbs +23 -0
  173. data/sig/dodopayments/models/payment_retry_params.rbs +23 -0
  174. data/sig/dodopayments/models/price.rbs +52 -17
  175. data/sig/dodopayments/models/subscription.rbs +5 -0
  176. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +16 -4
  177. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +16 -4
  178. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  179. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +16 -4
  180. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +16 -4
  181. data/sig/dodopayments/models/subscription_list_params.rbs +2 -0
  182. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  183. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +16 -4
  184. data/sig/dodopayments/models/subscription_past_due_webhook_event.rbs +47 -0
  185. data/sig/dodopayments/models/subscription_paused_webhook_event.rbs +16 -4
  186. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +16 -4
  187. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +16 -4
  188. data/sig/dodopayments/models/subscription_status.rbs +9 -1
  189. data/sig/dodopayments/models/subscription_unpaused_webhook_event.rbs +16 -4
  190. data/sig/dodopayments/models/subscription_update_params.rbs +2 -0
  191. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +16 -4
  192. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +16 -4
  193. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
  194. data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
  195. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  196. data/sig/dodopayments/models/webhook_payload.rbs +16 -4
  197. data/sig/dodopayments/models.rbs +12 -0
  198. data/sig/dodopayments/resources/blocklist/customers/notes.rbs +24 -0
  199. data/sig/dodopayments/resources/blocklist/customers.rbs +36 -0
  200. data/sig/dodopayments/resources/blocklist.rbs +9 -0
  201. data/sig/dodopayments/resources/customers/emails.rbs +22 -0
  202. data/sig/dodopayments/resources/customers.rbs +2 -0
  203. data/sig/dodopayments/resources/payments.rbs +10 -0
  204. data/sig/dodopayments/resources/webhooks.rbs +2 -0
  205. metadata +92 -2
@@ -15,11 +15,16 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
- # Response struct representing subscription details
19
- sig { returns(Dodopayments::Subscription) }
18
+ # Subscription payload sent on a webhook. It carries every field of
19
+ # `SubscriptionResponse`, plus the grace-period deadline.
20
+ sig { returns(Dodopayments::SubscriptionUnpausedWebhookEvent::Data) }
20
21
  attr_reader :data
21
22
 
22
- sig { params(data: Dodopayments::Subscription::OrHash).void }
23
+ sig do
24
+ params(
25
+ data: Dodopayments::SubscriptionUnpausedWebhookEvent::Data::OrHash
26
+ ).void
27
+ end
23
28
  attr_writer :data
24
29
 
25
30
  # The timestamp of when the event occurred
@@ -33,7 +38,7 @@ module Dodopayments
33
38
  sig do
34
39
  params(
35
40
  business_id: String,
36
- data: Dodopayments::Subscription::OrHash,
41
+ data: Dodopayments::SubscriptionUnpausedWebhookEvent::Data::OrHash,
37
42
  timestamp: Time,
38
43
  type: Symbol
39
44
  ).returns(T.attached_class)
@@ -41,7 +46,8 @@ module Dodopayments
41
46
  def self.new(
42
47
  # The business identifier
43
48
  business_id:,
44
- # Response struct representing subscription details
49
+ # Subscription payload sent on a webhook. It carries every field of
50
+ # `SubscriptionResponse`, plus the grace-period deadline.
45
51
  data:,
46
52
  # The timestamp of when the event occurred
47
53
  timestamp:,
@@ -54,7 +60,7 @@ module Dodopayments
54
60
  override.returns(
55
61
  {
56
62
  business_id: String,
57
- data: Dodopayments::Subscription,
63
+ data: Dodopayments::SubscriptionUnpausedWebhookEvent::Data,
58
64
  timestamp: Time,
59
65
  type: Symbol
60
66
  }
@@ -62,6 +68,47 @@ module Dodopayments
62
68
  end
63
69
  def to_hash
64
70
  end
71
+
72
+ class Data < Dodopayments::Models::Subscription
73
+ OrHash =
74
+ T.type_alias do
75
+ T.any(
76
+ Dodopayments::SubscriptionUnpausedWebhookEvent::Data,
77
+ Dodopayments::Internal::AnyHash
78
+ )
79
+ end
80
+
81
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
82
+ # `cancelled` at this time.
83
+ #
84
+ # Read in the same query as the rest of the payload, so it always comes from the
85
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
86
+ # a window at that moment. A delayed event of another type therefore carries the
87
+ # deadline too, next to a `past_due` status.
88
+ sig { returns(T.nilable(Time)) }
89
+ attr_accessor :past_due_ends_at
90
+
91
+ # Subscription payload sent on a webhook. It carries every field of
92
+ # `SubscriptionResponse`, plus the grace-period deadline.
93
+ sig do
94
+ params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
95
+ end
96
+ def self.new(
97
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
98
+ # `cancelled` at this time.
99
+ #
100
+ # Read in the same query as the rest of the payload, so it always comes from the
101
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
102
+ # a window at that moment. A delayed event of another type therefore carries the
103
+ # deadline too, next to a `past_due` status.
104
+ past_due_ends_at: nil
105
+ )
106
+ end
107
+
108
+ sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
109
+ def to_hash
110
+ end
111
+ end
65
112
  end
66
113
  end
67
114
  end
@@ -289,6 +289,11 @@ module Dodopayments
289
289
  :cancelled_by_merchant_send_dunning,
290
290
  Dodopayments::SubscriptionUpdateParams::CancelReason::TaggedSymbol
291
291
  )
292
+ CANCELLED_BY_MERCHANT_GRACE_PERIOD_EXPIRED =
293
+ T.let(
294
+ :cancelled_by_merchant_grace_period_expired,
295
+ Dodopayments::SubscriptionUpdateParams::CancelReason::TaggedSymbol
296
+ )
292
297
  DODO_TEAM =
293
298
  T.let(
294
299
  :dodo_team,
@@ -15,11 +15,19 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
- # Response struct representing subscription details
19
- sig { returns(Dodopayments::Subscription) }
18
+ # Subscription payload sent on a webhook. It carries every field of
19
+ # `SubscriptionResponse`, plus the grace-period deadline.
20
+ sig do
21
+ returns(Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent::Data)
22
+ end
20
23
  attr_reader :data
21
24
 
22
- sig { params(data: Dodopayments::Subscription::OrHash).void }
25
+ sig do
26
+ params(
27
+ data:
28
+ Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent::Data::OrHash
29
+ ).void
30
+ end
23
31
  attr_writer :data
24
32
 
25
33
  # The timestamp of when the event occurred
@@ -33,7 +41,8 @@ module Dodopayments
33
41
  sig do
34
42
  params(
35
43
  business_id: String,
36
- data: Dodopayments::Subscription::OrHash,
44
+ data:
45
+ Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent::Data::OrHash,
37
46
  timestamp: Time,
38
47
  type: Symbol
39
48
  ).returns(T.attached_class)
@@ -41,7 +50,8 @@ module Dodopayments
41
50
  def self.new(
42
51
  # The business identifier
43
52
  business_id:,
44
- # Response struct representing subscription details
53
+ # Subscription payload sent on a webhook. It carries every field of
54
+ # `SubscriptionResponse`, plus the grace-period deadline.
45
55
  data:,
46
56
  # The timestamp of when the event occurred
47
57
  timestamp:,
@@ -54,7 +64,8 @@ module Dodopayments
54
64
  override.returns(
55
65
  {
56
66
  business_id: String,
57
- data: Dodopayments::Subscription,
67
+ data:
68
+ Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent::Data,
58
69
  timestamp: Time,
59
70
  type: Symbol
60
71
  }
@@ -62,6 +73,47 @@ module Dodopayments
62
73
  end
63
74
  def to_hash
64
75
  end
76
+
77
+ class Data < Dodopayments::Models::Subscription
78
+ OrHash =
79
+ T.type_alias do
80
+ T.any(
81
+ Dodopayments::SubscriptionUpdatePaymentMethodWebhookEvent::Data,
82
+ Dodopayments::Internal::AnyHash
83
+ )
84
+ end
85
+
86
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
87
+ # `cancelled` at this time.
88
+ #
89
+ # Read in the same query as the rest of the payload, so it always comes from the
90
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
91
+ # a window at that moment. A delayed event of another type therefore carries the
92
+ # deadline too, next to a `past_due` status.
93
+ sig { returns(T.nilable(Time)) }
94
+ attr_accessor :past_due_ends_at
95
+
96
+ # Subscription payload sent on a webhook. It carries every field of
97
+ # `SubscriptionResponse`, plus the grace-period deadline.
98
+ sig do
99
+ params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
100
+ end
101
+ def self.new(
102
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
103
+ # `cancelled` at this time.
104
+ #
105
+ # Read in the same query as the rest of the payload, so it always comes from the
106
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
107
+ # a window at that moment. A delayed event of another type therefore carries the
108
+ # deadline too, next to a `past_due` status.
109
+ past_due_ends_at: nil
110
+ )
111
+ end
112
+
113
+ sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
114
+ def to_hash
115
+ end
116
+ end
65
117
  end
66
118
  end
67
119
  end
@@ -15,11 +15,16 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
- # Response struct representing subscription details
19
- sig { returns(Dodopayments::Subscription) }
18
+ # Subscription payload sent on a webhook. It carries every field of
19
+ # `SubscriptionResponse`, plus the grace-period deadline.
20
+ sig { returns(Dodopayments::SubscriptionUpdatedWebhookEvent::Data) }
20
21
  attr_reader :data
21
22
 
22
- sig { params(data: Dodopayments::Subscription::OrHash).void }
23
+ sig do
24
+ params(
25
+ data: Dodopayments::SubscriptionUpdatedWebhookEvent::Data::OrHash
26
+ ).void
27
+ end
23
28
  attr_writer :data
24
29
 
25
30
  # The timestamp of when the event occurred
@@ -33,7 +38,7 @@ module Dodopayments
33
38
  sig do
34
39
  params(
35
40
  business_id: String,
36
- data: Dodopayments::Subscription::OrHash,
41
+ data: Dodopayments::SubscriptionUpdatedWebhookEvent::Data::OrHash,
37
42
  timestamp: Time,
38
43
  type: Symbol
39
44
  ).returns(T.attached_class)
@@ -41,7 +46,8 @@ module Dodopayments
41
46
  def self.new(
42
47
  # The business identifier
43
48
  business_id:,
44
- # Response struct representing subscription details
49
+ # Subscription payload sent on a webhook. It carries every field of
50
+ # `SubscriptionResponse`, plus the grace-period deadline.
45
51
  data:,
46
52
  # The timestamp of when the event occurred
47
53
  timestamp:,
@@ -54,7 +60,7 @@ module Dodopayments
54
60
  override.returns(
55
61
  {
56
62
  business_id: String,
57
- data: Dodopayments::Subscription,
63
+ data: Dodopayments::SubscriptionUpdatedWebhookEvent::Data,
58
64
  timestamp: Time,
59
65
  type: Symbol
60
66
  }
@@ -62,6 +68,47 @@ module Dodopayments
62
68
  end
63
69
  def to_hash
64
70
  end
71
+
72
+ class Data < Dodopayments::Models::Subscription
73
+ OrHash =
74
+ T.type_alias do
75
+ T.any(
76
+ Dodopayments::SubscriptionUpdatedWebhookEvent::Data,
77
+ Dodopayments::Internal::AnyHash
78
+ )
79
+ end
80
+
81
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
82
+ # `cancelled` at this time.
83
+ #
84
+ # Read in the same query as the rest of the payload, so it always comes from the
85
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
86
+ # a window at that moment. A delayed event of another type therefore carries the
87
+ # deadline too, next to a `past_due` status.
88
+ sig { returns(T.nilable(Time)) }
89
+ attr_accessor :past_due_ends_at
90
+
91
+ # Subscription payload sent on a webhook. It carries every field of
92
+ # `SubscriptionResponse`, plus the grace-period deadline.
93
+ sig do
94
+ params(past_due_ends_at: T.nilable(Time)).returns(T.attached_class)
95
+ end
96
+ def self.new(
97
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
98
+ # `cancelled` at this time.
99
+ #
100
+ # Read in the same query as the rest of the payload, so it always comes from the
101
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
102
+ # a window at that moment. A delayed event of another type therefore carries the
103
+ # deadline too, next to a `past_due` status.
104
+ past_due_ends_at: nil
105
+ )
106
+ end
107
+
108
+ sig { override.returns({ past_due_ends_at: T.nilable(Time) }) }
109
+ def to_hash
110
+ end
111
+ end
65
112
  end
66
113
  end
67
114
  end
@@ -49,6 +49,7 @@ module Dodopayments
49
49
  Dodopayments::SubscriptionExpiredWebhookEvent,
50
50
  Dodopayments::SubscriptionFailedWebhookEvent,
51
51
  Dodopayments::SubscriptionOnHoldWebhookEvent,
52
+ Dodopayments::SubscriptionPastDueWebhookEvent,
52
53
  Dodopayments::SubscriptionPausedWebhookEvent,
53
54
  Dodopayments::SubscriptionPlanChangedWebhookEvent,
54
55
  Dodopayments::SubscriptionRenewedWebhookEvent,
@@ -49,6 +49,7 @@ module Dodopayments
49
49
  Dodopayments::SubscriptionExpiredWebhookEvent,
50
50
  Dodopayments::SubscriptionFailedWebhookEvent,
51
51
  Dodopayments::SubscriptionOnHoldWebhookEvent,
52
+ Dodopayments::SubscriptionPastDueWebhookEvent,
52
53
  Dodopayments::SubscriptionPausedWebhookEvent,
53
54
  Dodopayments::SubscriptionPlanChangedWebhookEvent,
54
55
  Dodopayments::SubscriptionRenewedWebhookEvent,
@@ -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
@@ -104,6 +104,7 @@ module Dodopayments
104
104
  # - `reason` - Optional human-readable reason
105
105
  # - `expires_at` - Optional expiration for credited amount (only for credit type)
106
106
  # - `idempotency_key` - Optional key to prevent duplicate entries
107
+ # - `metadata` - Optional key-value pairs
107
108
  #
108
109
  # # Responses
109
110
  #
@@ -145,7 +146,7 @@ module Dodopayments
145
146
  # Body param: Idempotency key to prevent duplicate entries
146
147
  idempotency_key: nil,
147
148
  # Body param: Optional metadata (max 50 key-value pairs, key max 40 chars, value
148
- # max 500 chars)
149
+ # max 500 chars).
149
150
  metadata: nil,
150
151
  # Body param: Human-readable reason for the entry
151
152
  reason: nil,
@@ -0,0 +1,60 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Customers
6
+ class Emails
7
+ # Returns every transactional email sent to this customer in the last 180 days,
8
+ # newest first, with its delivery outcome. Delivery status comes from the email
9
+ # provider and is as fresh as replication, typically seconds.
10
+ sig do
11
+ params(
12
+ customer_id: String,
13
+ page_number: Integer,
14
+ page_size: Integer,
15
+ request_options: Dodopayments::RequestOptions::OrHash
16
+ ).returns(
17
+ Dodopayments::Internal::DefaultPageNumberPagination[
18
+ Dodopayments::Customers::EmailLogItem
19
+ ]
20
+ )
21
+ end
22
+ def list(
23
+ # The customer's id
24
+ customer_id,
25
+ # Which page to return. The default is 0.
26
+ page_number: nil,
27
+ # How many emails to return. The default is 10 and the maximum is 100.
28
+ page_size: nil,
29
+ request_options: {}
30
+ )
31
+ end
32
+
33
+ # Returns the email exactly as it was sent, plus the reason it failed when it did.
34
+ # Some emails have no body to show: an authentication email carries a live login
35
+ # token, a blocked email never reached the provider, and the provider clears
36
+ # bodies at 180 days.
37
+ sig do
38
+ params(
39
+ email_log_id: String,
40
+ customer_id: String,
41
+ request_options: Dodopayments::RequestOptions::OrHash
42
+ ).returns(Dodopayments::Customers::EmailBody)
43
+ end
44
+ def retrieve_body(
45
+ # The email log entry's id
46
+ email_log_id,
47
+ # The customer's id
48
+ customer_id:,
49
+ request_options: {}
50
+ )
51
+ end
52
+
53
+ # @api private
54
+ sig { params(client: Dodopayments::Client).returns(T.attached_class) }
55
+ def self.new(client:)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -9,6 +9,9 @@ module Dodopayments
9
9
  sig { returns(Dodopayments::Resources::Customers::Wallets) }
10
10
  attr_reader :wallets
11
11
 
12
+ sig { returns(Dodopayments::Resources::Customers::Emails) }
13
+ attr_reader :emails
14
+
12
15
  sig do
13
16
  params(
14
17
  email: String,