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
@@ -0,0 +1,50 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Blocklist
6
+ module Customers
7
+ class NoteUpdateParams < Dodopayments::Models::Blocklist::Customers::NoteRequest
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ OrHash =
12
+ T.type_alias do
13
+ T.any(
14
+ Dodopayments::Blocklist::Customers::NoteUpdateParams,
15
+ Dodopayments::Internal::AnyHash
16
+ )
17
+ end
18
+
19
+ sig { returns(String) }
20
+ attr_accessor :entry_id
21
+
22
+ sig { returns(String) }
23
+ attr_accessor :note_id
24
+
25
+ sig do
26
+ params(
27
+ entry_id: String,
28
+ note_id: String,
29
+ request_options: Dodopayments::RequestOptions::OrHash
30
+ ).returns(T.attached_class)
31
+ end
32
+ def self.new(entry_id:, note_id:, request_options: {})
33
+ end
34
+
35
+ sig do
36
+ override.returns(
37
+ {
38
+ entry_id: String,
39
+ note_id: String,
40
+ request_options: Dodopayments::RequestOptions
41
+ }
42
+ )
43
+ end
44
+ def to_hash
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -42,6 +42,11 @@ module Dodopayments
42
42
  sig { returns(T::Boolean) }
43
43
  attr_accessor :is_byop
44
44
 
45
+ # False when the customer can confirm this session with no card. True for every
46
+ # other cart, including a one-time cart.
47
+ sig { returns(T::Boolean) }
48
+ attr_accessor :payment_method_required
49
+
45
50
  # The total product cart
46
51
  sig do
47
52
  returns(
@@ -118,6 +123,7 @@ module Dodopayments
118
123
  current_breakup:
119
124
  Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup::OrHash,
120
125
  is_byop: T::Boolean,
126
+ payment_method_required: T::Boolean,
121
127
  product_cart:
122
128
  T::Array[
123
129
  Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart::OrHash
@@ -148,6 +154,9 @@ module Dodopayments
148
154
  # country; in that case the quoted amounts exclude Dodo-computed tax because the
149
155
  # merchant is MoR and owns tax.
150
156
  is_byop:,
157
+ # False when the customer can confirm this session with no card. True for every
158
+ # other cart, including a one-time cart.
159
+ payment_method_required:,
151
160
  # The total product cart
152
161
  product_cart:,
153
162
  # Total calculate price of the product cart
@@ -185,6 +194,7 @@ module Dodopayments
185
194
  current_breakup:
186
195
  Dodopayments::Models::CheckoutSessionPreviewResponse::CurrentBreakup,
187
196
  is_byop: T::Boolean,
197
+ payment_method_required: T::Boolean,
188
198
  product_cart:
189
199
  T::Array[
190
200
  Dodopayments::Models::CheckoutSessionPreviewResponse::ProductCart
@@ -42,7 +42,7 @@ module Dodopayments
42
42
  attr_accessor :idempotency_key
43
43
 
44
44
  # Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500
45
- # chars)
45
+ # chars).
46
46
  sig do
47
47
  returns(
48
48
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants])
@@ -83,7 +83,7 @@ module Dodopayments
83
83
  # Idempotency key to prevent duplicate entries
84
84
  idempotency_key: nil,
85
85
  # Optional metadata (max 50 key-value pairs, key max 40 chars, value max 500
86
- # chars)
86
+ # chars).
87
87
  metadata: nil,
88
88
  # Human-readable reason for the entry
89
89
  reason: nil,
@@ -43,6 +43,10 @@ module Dodopayments
43
43
  sig { returns(T::Boolean) }
44
44
  attr_accessor :is_credit
45
45
 
46
+ # Metadata stored on this entry.
47
+ sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
48
+ attr_accessor :metadata
49
+
46
50
  sig { returns(String) }
47
51
  attr_accessor :overage_after
48
52
 
@@ -68,6 +72,7 @@ module Dodopayments
68
72
  entry_type:
69
73
  Dodopayments::CreditEntitlements::LedgerEntryType::OrSymbol,
70
74
  is_credit: T::Boolean,
75
+ metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
71
76
  overage_after: String,
72
77
  overage_before: String,
73
78
  grant_id: T.nilable(String),
@@ -84,6 +89,8 @@ module Dodopayments
84
89
  customer_id:,
85
90
  entry_type:,
86
91
  is_credit:,
92
+ # Metadata stored on this entry.
93
+ metadata:,
87
94
  overage_after:,
88
95
  overage_before:,
89
96
  grant_id: nil,
@@ -104,6 +111,7 @@ module Dodopayments
104
111
  entry_type:
105
112
  Dodopayments::CreditEntitlements::LedgerEntryType::TaggedSymbol,
106
113
  is_credit: T::Boolean,
114
+ metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
107
115
  overage_after: String,
108
116
  overage_before: String,
109
117
  grant_id: T.nilable(String),
@@ -43,9 +43,7 @@ module Dodopayments
43
43
  sig { returns(T::Boolean) }
44
44
  attr_accessor :is_credit
45
45
 
46
- # Metadata associated with the credit grant's source (the subscription or payment
47
- # created at checkout). Empty when the grant has no resolvable source (e.g.
48
- # credits granted directly via the API).
46
+ # Metadata associated with this entry.
49
47
  sig { returns(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]) }
50
48
  attr_accessor :metadata
51
49
 
@@ -110,9 +108,7 @@ module Dodopayments
110
108
  credit_entitlement_id:,
111
109
  customer_id:,
112
110
  is_credit:,
113
- # Metadata associated with the credit grant's source (the subscription or payment
114
- # created at checkout). Empty when the grant has no resolvable source (e.g.
115
- # credits granted directly via the API).
111
+ # Metadata associated with this entry.
116
112
  metadata:,
117
113
  overage_after:,
118
114
  overage_before:,
@@ -23,6 +23,16 @@ module Dodopayments
23
23
  sig { returns(String) }
24
24
  attr_accessor :name
25
25
 
26
+ # When the merchant blocked this customer. The dashboard shows the "Blocked" badge
27
+ # and the unblock action from it. The list route leaves it empty; only the
28
+ # single-customer route resolves it.
29
+ sig { returns(T.nilable(Time)) }
30
+ attr_accessor :blocked_at
31
+
32
+ # Blocklist entry behind `blocked_at`, so the dashboard can link to it.
33
+ sig { returns(T.nilable(String)) }
34
+ attr_accessor :blocklist_entry_id
35
+
26
36
  # Additional metadata for the customer
27
37
  sig do
28
38
  returns(
@@ -48,6 +58,8 @@ module Dodopayments
48
58
  customer_id: String,
49
59
  email: String,
50
60
  name: String,
61
+ blocked_at: T.nilable(Time),
62
+ blocklist_entry_id: T.nilable(String),
51
63
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
52
64
  phone_number: T.nilable(String)
53
65
  ).returns(T.attached_class)
@@ -58,6 +70,12 @@ module Dodopayments
58
70
  customer_id:,
59
71
  email:,
60
72
  name:,
73
+ # When the merchant blocked this customer. The dashboard shows the "Blocked" badge
74
+ # and the unblock action from it. The list route leaves it empty; only the
75
+ # single-customer route resolves it.
76
+ blocked_at: nil,
77
+ # Blocklist entry behind `blocked_at`, so the dashboard can link to it.
78
+ blocklist_entry_id: nil,
61
79
  # Additional metadata for the customer
62
80
  metadata: nil,
63
81
  phone_number: nil
@@ -72,6 +90,8 @@ module Dodopayments
72
90
  customer_id: String,
73
91
  email: String,
74
92
  name: String,
93
+ blocked_at: T.nilable(Time),
94
+ blocklist_entry_id: T.nilable(String),
75
95
  metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
76
96
  phone_number: T.nilable(String)
77
97
  }
@@ -0,0 +1,88 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailBody < Dodopayments::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Dodopayments::Customers::EmailBody,
11
+ Dodopayments::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # Whether the merchant wrote this content. It is true for the recovery and dunning
16
+ # emails, which the merchant writes.
17
+ #
18
+ # The content is email HTML. Render it in a sandbox, whatever this value is.
19
+ sig { returns(T::Boolean) }
20
+ attr_accessor :merchant_authored
21
+
22
+ # Why the email did not arrive. It is null unless the email failed.
23
+ sig do
24
+ returns(
25
+ T.nilable(Dodopayments::Customers::EmailFailureCode::TaggedSymbol)
26
+ )
27
+ end
28
+ attr_accessor :failure_code
29
+
30
+ # A sentence that explains `failure_code`. It is null unless the email failed.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_accessor :failure_reason
33
+
34
+ # The stored HTML. It is null on a text-only email.
35
+ sig { returns(T.nilable(String)) }
36
+ attr_accessor :html
37
+
38
+ # The stored plain text.
39
+ sig { returns(T.nilable(String)) }
40
+ attr_accessor :text
41
+
42
+ sig do
43
+ params(
44
+ merchant_authored: T::Boolean,
45
+ failure_code:
46
+ T.nilable(Dodopayments::Customers::EmailFailureCode::OrSymbol),
47
+ failure_reason: T.nilable(String),
48
+ html: T.nilable(String),
49
+ text: T.nilable(String)
50
+ ).returns(T.attached_class)
51
+ end
52
+ def self.new(
53
+ # Whether the merchant wrote this content. It is true for the recovery and dunning
54
+ # emails, which the merchant writes.
55
+ #
56
+ # The content is email HTML. Render it in a sandbox, whatever this value is.
57
+ merchant_authored:,
58
+ # Why the email did not arrive. It is null unless the email failed.
59
+ failure_code: nil,
60
+ # A sentence that explains `failure_code`. It is null unless the email failed.
61
+ failure_reason: nil,
62
+ # The stored HTML. It is null on a text-only email.
63
+ html: nil,
64
+ # The stored plain text.
65
+ text: nil
66
+ )
67
+ end
68
+
69
+ sig do
70
+ override.returns(
71
+ {
72
+ merchant_authored: T::Boolean,
73
+ failure_code:
74
+ T.nilable(
75
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
76
+ ),
77
+ failure_reason: T.nilable(String),
78
+ html: T.nilable(String),
79
+ text: T.nilable(String)
80
+ }
81
+ )
82
+ end
83
+ def to_hash
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,70 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ # Why an email did not reach the recipient.
7
+ #
8
+ # The code is stable. `send_failed` is the catch-all: it covers every failure that
9
+ # the other codes do not name.
10
+ module EmailFailureCode
11
+ extend Dodopayments::Internal::Type::Enum
12
+
13
+ TaggedSymbol =
14
+ T.type_alias do
15
+ T.all(Symbol, Dodopayments::Customers::EmailFailureCode)
16
+ end
17
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
18
+
19
+ MAILBOX_NOT_FOUND =
20
+ T.let(
21
+ :mailbox_not_found,
22
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
23
+ )
24
+ ADDRESS_REJECTED =
25
+ T.let(
26
+ :address_rejected,
27
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
28
+ )
29
+ ADDRESS_SUPPRESSED =
30
+ T.let(
31
+ :address_suppressed,
32
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
33
+ )
34
+ MAILBOX_FULL =
35
+ T.let(
36
+ :mailbox_full,
37
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
38
+ )
39
+ TEMPORARY_FAILURE =
40
+ T.let(
41
+ :temporary_failure,
42
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
43
+ )
44
+ MESSAGE_TOO_LARGE =
45
+ T.let(
46
+ :message_too_large,
47
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
48
+ )
49
+ MARKED_AS_SPAM =
50
+ T.let(
51
+ :marked_as_spam,
52
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
53
+ )
54
+ SEND_FAILED =
55
+ T.let(
56
+ :send_failed,
57
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
58
+ )
59
+
60
+ sig do
61
+ override.returns(
62
+ T::Array[Dodopayments::Customers::EmailFailureCode::TaggedSymbol]
63
+ )
64
+ end
65
+ def self.values
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,68 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailListParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Dodopayments::Customers::EmailListParams,
14
+ Dodopayments::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :customer_id
20
+
21
+ # Which page to return. The default is 0.
22
+ sig { returns(T.nilable(Integer)) }
23
+ attr_reader :page_number
24
+
25
+ sig { params(page_number: Integer).void }
26
+ attr_writer :page_number
27
+
28
+ # How many emails to return. The default is 10 and the maximum is 100.
29
+ sig { returns(T.nilable(Integer)) }
30
+ attr_reader :page_size
31
+
32
+ sig { params(page_size: Integer).void }
33
+ attr_writer :page_size
34
+
35
+ sig do
36
+ params(
37
+ customer_id: String,
38
+ page_number: Integer,
39
+ page_size: Integer,
40
+ request_options: Dodopayments::RequestOptions::OrHash
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(
44
+ customer_id:,
45
+ # Which page to return. The default is 0.
46
+ page_number: nil,
47
+ # How many emails to return. The default is 10 and the maximum is 100.
48
+ page_size: nil,
49
+ request_options: {}
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ customer_id: String,
57
+ page_number: Integer,
58
+ page_size: Integer,
59
+ request_options: Dodopayments::RequestOptions
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,157 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailLogItem < Dodopayments::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Dodopayments::Customers::EmailLogItem,
11
+ Dodopayments::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The group this email belongs to: payments, refunds, subscriptions,
16
+ # dunning_recovery, entitlements or auth.
17
+ sig { returns(String) }
18
+ attr_accessor :category
19
+
20
+ # When this email was sent.
21
+ sig { returns(Time) }
22
+ attr_accessor :created_at
23
+
24
+ # Identifies this email. Use it to read the body or to send it again.
25
+ sig { returns(String) }
26
+ attr_accessor :email_log_id
27
+
28
+ # What kind of email this is, for example `payment_successful`.
29
+ sig { returns(String) }
30
+ attr_accessor :email_type
31
+
32
+ # Whether this email has content to show. The content endpoint can still refuse,
33
+ # because the content is removed after 180 days.
34
+ sig { returns(T::Boolean) }
35
+ attr_accessor :has_preview
36
+
37
+ # What you may do with this email.
38
+ sig { returns(Dodopayments::Customers::EmailPolicies) }
39
+ attr_reader :policies
40
+
41
+ sig do
42
+ params(policies: Dodopayments::Customers::EmailPolicies::OrHash).void
43
+ end
44
+ attr_writer :policies
45
+
46
+ # Where the email got to: sent, delivered, failed, complained or blocked.
47
+ sig { returns(Dodopayments::Customers::EmailLogStatus::TaggedSymbol) }
48
+ attr_accessor :status
49
+
50
+ # Why the email did not arrive. It is null unless the email failed.
51
+ sig do
52
+ returns(
53
+ T.nilable(Dodopayments::Customers::EmailFailureCode::TaggedSymbol)
54
+ )
55
+ end
56
+ attr_accessor :failure_code
57
+
58
+ # A sentence that explains `failure_code`. It is null unless the email failed.
59
+ sig { returns(T.nilable(String)) }
60
+ attr_accessor :failure_reason
61
+
62
+ # The address the email was sent from.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :from
65
+
66
+ # What the merchant typed, when test mode redirected the send to the business
67
+ # owner.
68
+ sig { returns(T.nilable(String)) }
69
+ attr_accessor :intended_recipient
70
+
71
+ # The address the email reached.
72
+ sig { returns(T.nilable(String)) }
73
+ attr_accessor :recipient
74
+
75
+ # The subject line as it was sent. Empty until the provider replicates.
76
+ sig { returns(T.nilable(String)) }
77
+ attr_accessor :subject
78
+
79
+ sig do
80
+ params(
81
+ category: String,
82
+ created_at: Time,
83
+ email_log_id: String,
84
+ email_type: String,
85
+ has_preview: T::Boolean,
86
+ policies: Dodopayments::Customers::EmailPolicies::OrHash,
87
+ status: Dodopayments::Customers::EmailLogStatus::OrSymbol,
88
+ failure_code:
89
+ T.nilable(Dodopayments::Customers::EmailFailureCode::OrSymbol),
90
+ failure_reason: T.nilable(String),
91
+ from: T.nilable(String),
92
+ intended_recipient: T.nilable(String),
93
+ recipient: T.nilable(String),
94
+ subject: T.nilable(String)
95
+ ).returns(T.attached_class)
96
+ end
97
+ def self.new(
98
+ # The group this email belongs to: payments, refunds, subscriptions,
99
+ # dunning_recovery, entitlements or auth.
100
+ category:,
101
+ # When this email was sent.
102
+ created_at:,
103
+ # Identifies this email. Use it to read the body or to send it again.
104
+ email_log_id:,
105
+ # What kind of email this is, for example `payment_successful`.
106
+ email_type:,
107
+ # Whether this email has content to show. The content endpoint can still refuse,
108
+ # because the content is removed after 180 days.
109
+ has_preview:,
110
+ # What you may do with this email.
111
+ policies:,
112
+ # Where the email got to: sent, delivered, failed, complained or blocked.
113
+ status:,
114
+ # Why the email did not arrive. It is null unless the email failed.
115
+ failure_code: nil,
116
+ # A sentence that explains `failure_code`. It is null unless the email failed.
117
+ failure_reason: nil,
118
+ # The address the email was sent from.
119
+ from: nil,
120
+ # What the merchant typed, when test mode redirected the send to the business
121
+ # owner.
122
+ intended_recipient: nil,
123
+ # The address the email reached.
124
+ recipient: nil,
125
+ # The subject line as it was sent. Empty until the provider replicates.
126
+ subject: nil
127
+ )
128
+ end
129
+
130
+ sig do
131
+ override.returns(
132
+ {
133
+ category: String,
134
+ created_at: Time,
135
+ email_log_id: String,
136
+ email_type: String,
137
+ has_preview: T::Boolean,
138
+ policies: Dodopayments::Customers::EmailPolicies,
139
+ status: Dodopayments::Customers::EmailLogStatus::TaggedSymbol,
140
+ failure_code:
141
+ T.nilable(
142
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
143
+ ),
144
+ failure_reason: T.nilable(String),
145
+ from: T.nilable(String),
146
+ intended_recipient: T.nilable(String),
147
+ recipient: T.nilable(String),
148
+ subject: T.nilable(String)
149
+ }
150
+ )
151
+ end
152
+ def to_hash
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ # The delivery status of one email.
7
+ #
8
+ # `sent` also covers an email that is still on its way. A status only becomes
9
+ # `delivered`, `failed` or `complained` when the mail server answers.
10
+ module EmailLogStatus
11
+ extend Dodopayments::Internal::Type::Enum
12
+
13
+ TaggedSymbol =
14
+ T.type_alias do
15
+ T.all(Symbol, Dodopayments::Customers::EmailLogStatus)
16
+ end
17
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
18
+
19
+ SENT =
20
+ T.let(:sent, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
21
+ DELIVERED =
22
+ T.let(
23
+ :delivered,
24
+ Dodopayments::Customers::EmailLogStatus::TaggedSymbol
25
+ )
26
+ FAILED =
27
+ T.let(:failed, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
28
+ COMPLAINED =
29
+ T.let(
30
+ :complained,
31
+ Dodopayments::Customers::EmailLogStatus::TaggedSymbol
32
+ )
33
+ BLOCKED =
34
+ T.let(:blocked, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
35
+
36
+ sig do
37
+ override.returns(
38
+ T::Array[Dodopayments::Customers::EmailLogStatus::TaggedSymbol]
39
+ )
40
+ end
41
+ def self.values
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end