dodopayments 2.29.0 → 2.31.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 (102) 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 +3 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +3 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +14 -1
  8. data/lib/dodopayments/models/checkout_session_preview_response.rb +86 -4
  9. data/lib/dodopayments/models/checkout_session_request.rb +18 -5
  10. data/lib/dodopayments/models/customers/email_log_item.rb +3 -2
  11. data/lib/dodopayments/models/customers/email_policies.rb +7 -5
  12. data/lib/dodopayments/models/discount_create_params.rb +11 -8
  13. data/lib/dodopayments/models/discount_update_params.rb +6 -5
  14. data/lib/dodopayments/models/moderation_category.rb +31 -0
  15. data/lib/dodopayments/models/moderation_category_provenance.rb +150 -0
  16. data/lib/dodopayments/models/moderation_category_scores.rb +150 -0
  17. data/lib/dodopayments/models/moderation_decision.rb +18 -0
  18. data/lib/dodopayments/models/moderation_provenance.rb +18 -0
  19. data/lib/dodopayments/models/moderation_retrieve_usage_params.rb +14 -0
  20. data/lib/dodopayments/models/moderation_retrieve_usage_response.rb +61 -0
  21. data/lib/dodopayments/models/moderation_screen_params.rb +44 -0
  22. data/lib/dodopayments/models/moderation_screen_response.rb +99 -0
  23. data/lib/dodopayments/models/payment.rb +25 -3
  24. data/lib/dodopayments/models/payment_list_response.rb +21 -1
  25. data/lib/dodopayments/models/payouts/breakup/detail_list_response.rb +5 -4
  26. data/lib/dodopayments/models/payouts/breakup_retrieve_response.rb +17 -1
  27. data/lib/dodopayments/models/refund.rb +22 -1
  28. data/lib/dodopayments/models/refund_list_item.rb +22 -1
  29. data/lib/dodopayments/models/refund_network_reference_type.rb +19 -0
  30. data/lib/dodopayments/models/subscription.rb +10 -1
  31. data/lib/dodopayments/models/subscription_cancelled_by.rb +54 -0
  32. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  33. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +18 -7
  34. data/lib/dodopayments/models.rb +18 -0
  35. data/lib/dodopayments/resources/checkout_sessions.rb +6 -6
  36. data/lib/dodopayments/resources/moderation.rb +81 -0
  37. data/lib/dodopayments/resources/payouts/breakup/details.rb +4 -4
  38. data/lib/dodopayments/version.rb +1 -1
  39. data/lib/dodopayments.rb +12 -0
  40. data/rbi/dodopayments/client.rbi +3 -0
  41. data/rbi/dodopayments/models/balance_ledger_entry.rbi +15 -0
  42. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +15 -0
  43. data/rbi/dodopayments/models/checkout_session_flags.rbi +21 -0
  44. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +130 -6
  45. data/rbi/dodopayments/models/checkout_session_request.rbi +31 -8
  46. data/rbi/dodopayments/models/customers/email_log_item.rbi +4 -2
  47. data/rbi/dodopayments/models/customers/email_policies.rbi +10 -6
  48. data/rbi/dodopayments/models/discount_create_params.rbi +18 -12
  49. data/rbi/dodopayments/models/discount_update_params.rbi +8 -6
  50. data/rbi/dodopayments/models/moderation_category.rbi +88 -0
  51. data/rbi/dodopayments/models/moderation_category_provenance.rbi +184 -0
  52. data/rbi/dodopayments/models/moderation_category_scores.rbi +171 -0
  53. data/rbi/dodopayments/models/moderation_decision.rbi +27 -0
  54. data/rbi/dodopayments/models/moderation_provenance.rbi +28 -0
  55. data/rbi/dodopayments/models/moderation_retrieve_usage_params.rbi +32 -0
  56. data/rbi/dodopayments/models/moderation_retrieve_usage_response.rbi +104 -0
  57. data/rbi/dodopayments/models/moderation_screen_params.rbi +68 -0
  58. data/rbi/dodopayments/models/moderation_screen_response.rbi +135 -0
  59. data/rbi/dodopayments/models/payment.rbi +30 -2
  60. data/rbi/dodopayments/models/payment_list_response.rbi +24 -0
  61. data/rbi/dodopayments/models/payouts/breakup/detail_list_response.rbi +8 -6
  62. data/rbi/dodopayments/models/payouts/breakup_retrieve_response.rbi +19 -2
  63. data/rbi/dodopayments/models/refund.rbi +26 -0
  64. data/rbi/dodopayments/models/refund_list_item.rbi +26 -0
  65. data/rbi/dodopayments/models/refund_network_reference_type.rbi +41 -0
  66. data/rbi/dodopayments/models/subscription.rbi +18 -0
  67. data/rbi/dodopayments/models/subscription_cancelled_by.rbi +107 -0
  68. data/rbi/dodopayments/models/subscription_list_response.rbi +18 -0
  69. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +24 -10
  70. data/rbi/dodopayments/models.rbi +20 -0
  71. data/rbi/dodopayments/resources/checkout_sessions.rbi +30 -4
  72. data/rbi/dodopayments/resources/discounts.rbi +5 -3
  73. data/rbi/dodopayments/resources/moderation.rbi +64 -0
  74. data/rbi/dodopayments/resources/payouts/breakup/details.rbi +4 -4
  75. data/sig/dodopayments/client.rbs +2 -0
  76. data/sig/dodopayments/models/balance_ledger_entry.rbs +6 -0
  77. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +6 -0
  78. data/sig/dodopayments/models/checkout_session_flags.rbs +7 -0
  79. data/sig/dodopayments/models/checkout_session_preview_response.rbs +52 -0
  80. data/sig/dodopayments/models/checkout_session_request.rbs +4 -6
  81. data/sig/dodopayments/models/moderation_category.rbs +46 -0
  82. data/sig/dodopayments/models/moderation_category_provenance.rbs +100 -0
  83. data/sig/dodopayments/models/moderation_category_scores.rbs +100 -0
  84. data/sig/dodopayments/models/moderation_decision.rbs +15 -0
  85. data/sig/dodopayments/models/moderation_provenance.rbs +14 -0
  86. data/sig/dodopayments/models/moderation_retrieve_usage_params.rbs +15 -0
  87. data/sig/dodopayments/models/moderation_retrieve_usage_response.rbs +42 -0
  88. data/sig/dodopayments/models/moderation_screen_params.rbs +32 -0
  89. data/sig/dodopayments/models/moderation_screen_response.rbs +65 -0
  90. data/sig/dodopayments/models/payment.rbs +10 -0
  91. data/sig/dodopayments/models/payment_list_response.rbs +10 -0
  92. data/sig/dodopayments/models/refund.rbs +10 -0
  93. data/sig/dodopayments/models/refund_list_item.rbs +10 -0
  94. data/sig/dodopayments/models/refund_network_reference_type.rbs +20 -0
  95. data/sig/dodopayments/models/subscription.rbs +5 -0
  96. data/sig/dodopayments/models/subscription_cancelled_by.rbs +43 -0
  97. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  98. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +5 -0
  99. data/sig/dodopayments/models.rbs +18 -0
  100. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -2
  101. data/sig/dodopayments/resources/moderation.rbs +18 -0
  102. metadata +38 -2
@@ -64,7 +64,9 @@ module Dodopayments
64
64
  # The upcoming billing date for subscriptions, computed relative to now: with a
65
65
  # trial it is `now + trial_period_days`, otherwise `now + payment frequency`.
66
66
  # `None` for one-time-only carts. This is a preview estimate; the authoritative
67
- # value is set when the subscription activates.
67
+ # value is set when the subscription activates. For a cart of more than one
68
+ # subscription, this is the earliest date of the cart. `subscriptions` gives the
69
+ # date of each subscription.
68
70
  sig { returns(T.nilable(Time)) }
69
71
  attr_accessor :next_billing_date
70
72
 
@@ -88,6 +90,19 @@ module Dodopayments
88
90
  end
89
91
  attr_writer :recurring_breakup
90
92
 
93
+ # One entry for each subscription of a cart that holds more than one. Each
94
+ # subscription renews on its own schedule, so the checkout shows each one here.
95
+ sig do
96
+ returns(
97
+ T.nilable(
98
+ T::Array[
99
+ Dodopayments::Models::CheckoutSessionPreviewResponse::Subscription
100
+ ]
101
+ )
102
+ )
103
+ end
104
+ attr_accessor :subscriptions
105
+
91
106
  # Registered business name from the official registry (EU/GB/AU) when found
92
107
  sig { returns(T.nilable(String)) }
93
108
  attr_accessor :tax_id_business_name
@@ -106,12 +121,15 @@ module Dodopayments
106
121
 
107
122
  # Per-unit trial amount after discounts, in the price currency's minor units
108
123
  # (pre-quantity, pre-tax; see `current_breakup` for the taxed total due today).
109
- # Only present for a paid trial; `None` for a free trial or no trial.
124
+ # Only present for a paid trial; `None` for a free trial or no trial. Always
125
+ # `None` for a cart of more than one subscription.
110
126
  sig { returns(T.nilable(Integer)) }
111
127
  attr_accessor :trial_amount
112
128
 
113
129
  # Effective trial duration in days for the subscription line, when there's a trial
114
- # (free or paid). `None` if no subscription or no trial.
130
+ # (free or paid). `None` if no subscription or no trial. Always `None` for a cart
131
+ # of more than one subscription. Read the trial of each subscription from
132
+ # `subscriptions`.
115
133
  sig { returns(T.nilable(Integer)) }
116
134
  attr_accessor :trial_period_days
117
135
 
@@ -134,6 +152,12 @@ module Dodopayments
134
152
  T.nilable(
135
153
  Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup::OrHash
136
154
  ),
155
+ subscriptions:
156
+ T.nilable(
157
+ T::Array[
158
+ Dodopayments::Models::CheckoutSessionPreviewResponse::Subscription::OrHash
159
+ ]
160
+ ),
137
161
  tax_id_business_name: T.nilable(String),
138
162
  tax_id_err_msg: T.nilable(String),
139
163
  tax_id_format_name: T.nilable(String),
@@ -164,10 +188,15 @@ module Dodopayments
164
188
  # The upcoming billing date for subscriptions, computed relative to now: with a
165
189
  # trial it is `now + trial_period_days`, otherwise `now + payment frequency`.
166
190
  # `None` for one-time-only carts. This is a preview estimate; the authoritative
167
- # value is set when the subscription activates.
191
+ # value is set when the subscription activates. For a cart of more than one
192
+ # subscription, this is the earliest date of the cart. `subscriptions` gives the
193
+ # date of each subscription.
168
194
  next_billing_date: nil,
169
195
  # Breakup of recurring payments (None for one-time only)
170
196
  recurring_breakup: nil,
197
+ # One entry for each subscription of a cart that holds more than one. Each
198
+ # subscription renews on its own schedule, so the checkout shows each one here.
199
+ subscriptions: nil,
171
200
  # Registered business name from the official registry (EU/GB/AU) when found
172
201
  tax_id_business_name: nil,
173
202
  # Error message if tax ID validation failed
@@ -178,10 +207,13 @@ module Dodopayments
178
207
  total_tax: nil,
179
208
  # Per-unit trial amount after discounts, in the price currency's minor units
180
209
  # (pre-quantity, pre-tax; see `current_breakup` for the taxed total due today).
181
- # Only present for a paid trial; `None` for a free trial or no trial.
210
+ # Only present for a paid trial; `None` for a free trial or no trial. Always
211
+ # `None` for a cart of more than one subscription.
182
212
  trial_amount: nil,
183
213
  # Effective trial duration in days for the subscription line, when there's a trial
184
- # (free or paid). `None` if no subscription or no trial.
214
+ # (free or paid). `None` if no subscription or no trial. Always `None` for a cart
215
+ # of more than one subscription. Read the trial of each subscription from
216
+ # `subscriptions`.
185
217
  trial_period_days: nil
186
218
  )
187
219
  end
@@ -205,6 +237,12 @@ module Dodopayments
205
237
  T.nilable(
206
238
  Dodopayments::Models::CheckoutSessionPreviewResponse::RecurringBreakup
207
239
  ),
240
+ subscriptions:
241
+ T.nilable(
242
+ T::Array[
243
+ Dodopayments::Models::CheckoutSessionPreviewResponse::Subscription
244
+ ]
245
+ ),
208
246
  tax_id_business_name: T.nilable(String),
209
247
  tax_id_err_msg: T.nilable(String),
210
248
  tax_id_format_name: T.nilable(String),
@@ -796,6 +834,92 @@ module Dodopayments
796
834
  def to_hash
797
835
  end
798
836
  end
837
+
838
+ class Subscription < Dodopayments::Internal::Type::BaseModel
839
+ OrHash =
840
+ T.type_alias do
841
+ T.any(
842
+ Dodopayments::Models::CheckoutSessionPreviewResponse::Subscription,
843
+ Dodopayments::Internal::AnyHash
844
+ )
845
+ end
846
+
847
+ # The amount this subscription charges today, including tax.
848
+ sig { returns(Integer) }
849
+ attr_accessor :amount_due_now
850
+
851
+ # The subscription product.
852
+ sig { returns(String) }
853
+ attr_accessor :product_id
854
+
855
+ # The amount of each renewal, including tax.
856
+ sig { returns(Integer) }
857
+ attr_accessor :recurring_amount
858
+
859
+ # A preview of the first renewal date. The date is set when the subscription
860
+ # activates.
861
+ sig { returns(T.nilable(Time)) }
862
+ attr_accessor :next_billing_date
863
+
864
+ # The tax in `recurring_amount`.
865
+ sig { returns(T.nilable(Integer)) }
866
+ attr_accessor :recurring_tax
867
+
868
+ # The tax in `amount_due_now`.
869
+ sig { returns(T.nilable(Integer)) }
870
+ attr_accessor :tax_due_now
871
+
872
+ # The trial duration in days. `None` when the subscription has no trial.
873
+ sig { returns(T.nilable(Integer)) }
874
+ attr_accessor :trial_period_days
875
+
876
+ # The quote of one subscription in a cart of several.
877
+ sig do
878
+ params(
879
+ amount_due_now: Integer,
880
+ product_id: String,
881
+ recurring_amount: Integer,
882
+ next_billing_date: T.nilable(Time),
883
+ recurring_tax: T.nilable(Integer),
884
+ tax_due_now: T.nilable(Integer),
885
+ trial_period_days: T.nilable(Integer)
886
+ ).returns(T.attached_class)
887
+ end
888
+ def self.new(
889
+ # The amount this subscription charges today, including tax.
890
+ amount_due_now:,
891
+ # The subscription product.
892
+ product_id:,
893
+ # The amount of each renewal, including tax.
894
+ recurring_amount:,
895
+ # A preview of the first renewal date. The date is set when the subscription
896
+ # activates.
897
+ next_billing_date: nil,
898
+ # The tax in `recurring_amount`.
899
+ recurring_tax: nil,
900
+ # The tax in `amount_due_now`.
901
+ tax_due_now: nil,
902
+ # The trial duration in days. `None` when the subscription has no trial.
903
+ trial_period_days: nil
904
+ )
905
+ end
906
+
907
+ sig do
908
+ override.returns(
909
+ {
910
+ amount_due_now: Integer,
911
+ product_id: String,
912
+ recurring_amount: Integer,
913
+ next_billing_date: T.nilable(Time),
914
+ recurring_tax: T.nilable(Integer),
915
+ tax_due_now: T.nilable(Integer),
916
+ trial_period_days: T.nilable(Integer)
917
+ }
918
+ )
919
+ end
920
+ def to_hash
921
+ end
922
+ end
799
923
  end
800
924
  end
801
925
  end
@@ -11,6 +11,9 @@ module Dodopayments
11
11
  )
12
12
  end
13
13
 
14
+ # The products of the checkout. A cart holds at most 20 of them, one-time and
15
+ # subscription products together. An empty cart is valid for the
16
+ # product-collection flow, where the customer chooses the product later.
14
17
  sig { returns(T::Array[Dodopayments::ProductItemReq]) }
15
18
  attr_accessor :product_cart
16
19
 
@@ -37,7 +40,14 @@ module Dodopayments
37
40
  end
38
41
  attr_writer :billing_address
39
42
 
40
- # This field is ingored if adaptive pricing is disabled
43
+ # The currency to charge the customer in.
44
+ #
45
+ # Adaptive pricing must be enabled for the business. The customer then pays in
46
+ # this currency. If you do not set it, the currency comes from the billing
47
+ # country.
48
+ #
49
+ # If adaptive pricing is disabled, the API discards this field. The currency then
50
+ # comes from the product price, or from the billing country.
41
51
  sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
42
52
  attr_accessor :billing_currency
43
53
 
@@ -130,11 +140,11 @@ module Dodopayments
130
140
 
131
141
  # If true, only zipcode is required when confirm is true; other address fields
132
142
  # remain optional
143
+ #
144
+ # Default is true when `feature_flags.single_page` is true. Otherwise, default is
145
+ # false.
133
146
  sig { returns(T.nilable(T::Boolean)) }
134
- attr_reader :minimal_address
135
-
136
- sig { params(minimal_address: T::Boolean).void }
137
- attr_writer :minimal_address
147
+ attr_accessor :minimal_address
138
148
 
139
149
  # Optional payment method ID to use for this checkout session. Only allowed when
140
150
  # `confirm` is true. If provided, existing customer id must also be provided.
@@ -205,7 +215,7 @@ module Dodopayments
205
215
  mandate_min_amount_inr_paise: T.nilable(Integer),
206
216
  metadata:
207
217
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
208
- minimal_address: T::Boolean,
218
+ minimal_address: T.nilable(T::Boolean),
209
219
  payment_method_id: T.nilable(String),
210
220
  product_collection_id: T.nilable(String),
211
221
  return_url: T.nilable(String),
@@ -216,6 +226,9 @@ module Dodopayments
216
226
  ).returns(T.attached_class)
217
227
  end
218
228
  def self.new(
229
+ # The products of the checkout. A cart holds at most 20 of them, one-time and
230
+ # subscription products together. An empty cart is valid for the
231
+ # product-collection flow, where the customer chooses the product later.
219
232
  product_cart:,
220
233
  # Customers will never see payment methods that are not in this list. However,
221
234
  # adding a method here does not guarantee customers will see it. Availability
@@ -226,7 +239,14 @@ module Dodopayments
226
239
  allowed_payment_method_types: nil,
227
240
  # Billing address information for the session
228
241
  billing_address: nil,
229
- # This field is ingored if adaptive pricing is disabled
242
+ # The currency to charge the customer in.
243
+ #
244
+ # Adaptive pricing must be enabled for the business. The customer then pays in
245
+ # this currency. If you do not set it, the currency comes from the billing
246
+ # country.
247
+ #
248
+ # If adaptive pricing is disabled, the API discards this field. The currency then
249
+ # comes from the product price, or from the billing country.
230
250
  billing_currency: nil,
231
251
  # The URL to redirect the customer if they cancel or go back from the checkout. If
232
252
  # not provided, the back button will not be displayed.
@@ -265,6 +285,9 @@ module Dodopayments
265
285
  metadata: nil,
266
286
  # If true, only zipcode is required when confirm is true; other address fields
267
287
  # remain optional
288
+ #
289
+ # Default is true when `feature_flags.single_page` is true. Otherwise, default is
290
+ # false.
268
291
  minimal_address: nil,
269
292
  # Optional payment method ID to use for this checkout session. Only allowed when
270
293
  # `confirm` is true. If provided, existing customer id must also be provided.
@@ -312,7 +335,7 @@ module Dodopayments
312
335
  mandate_min_amount_inr_paise: T.nilable(Integer),
313
336
  metadata:
314
337
  T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
315
- minimal_address: T::Boolean,
338
+ minimal_address: T.nilable(T::Boolean),
316
339
  payment_method_id: T.nilable(String),
317
340
  product_collection_id: T.nilable(String),
318
341
  return_url: T.nilable(String),
@@ -63,7 +63,8 @@ module Dodopayments
63
63
  sig { returns(T.nilable(String)) }
64
64
  attr_accessor :from
65
65
 
66
- # The address the email reached.
66
+ # The address the email went to. On a failed email this is the address the
67
+ # provider reports as bounced.
67
68
  sig { returns(T.nilable(String)) }
68
69
  attr_accessor :recipient
69
70
 
@@ -111,7 +112,8 @@ module Dodopayments
111
112
  failure_reason: nil,
112
113
  # The address the email was sent from.
113
114
  from: nil,
114
- # The address the email reached.
115
+ # The address the email went to. On a failed email this is the address the
116
+ # provider reports as bounced.
115
117
  recipient: nil,
116
118
  # The subject line as it was sent. Empty until the provider replicates.
117
119
  subject: nil
@@ -12,7 +12,8 @@ module Dodopayments
12
12
  )
13
13
  end
14
14
 
15
- # A permanent failure was recorded, so the same address would be a no-op.
15
+ # A permanent failure was recorded, so a send to the same address delivers
16
+ # nothing. It is false for a suppressed address that a resend can clear.
16
17
  sig { returns(T::Boolean) }
17
18
  attr_accessor :requires_different_address
18
19
 
@@ -28,8 +29,9 @@ module Dodopayments
28
29
  sig { returns(T::Boolean) }
29
30
  attr_accessor :retry_allowed
30
31
 
31
- # A later send of this email reached the provider, so this row is history. To send
32
- # it again would deliver a second copy.
32
+ # A later send of this email replaced this row, so this row is history. A row that
33
+ # never went out needs a later send that reached the provider. A failed row needs
34
+ # a later send that was delivered.
33
35
  sig { returns(T::Boolean) }
34
36
  attr_accessor :superseded
35
37
 
@@ -45,7 +47,8 @@ module Dodopayments
45
47
  ).returns(T.attached_class)
46
48
  end
47
49
  def self.new(
48
- # A permanent failure was recorded, so the same address would be a no-op.
50
+ # A permanent failure was recorded, so a send to the same address delivers
51
+ # nothing. It is false for a suppressed address that a resend can clear.
49
52
  requires_different_address:,
50
53
  # The row was delivered and may be sent again.
51
54
  resend_allowed:,
@@ -53,8 +56,9 @@ module Dodopayments
53
56
  resends_remaining:,
54
57
  # The row failed and may be sent again.
55
58
  retry_allowed:,
56
- # A later send of this email reached the provider, so this row is history. To send
57
- # it again would deliver a second copy.
59
+ # A later send of this email replaced this row, so this row is history. A row that
60
+ # never went out needs a later send that reached the provider. A failed row needs
61
+ # a later send that was delivered.
58
62
  superseded:
59
63
  )
60
64
  end
@@ -33,9 +33,11 @@ module Dodopayments
33
33
  attr_accessor :code
34
34
 
35
35
  # Per-currency options (flat deduction / percentage cap + minimum subtotal).
36
- # Required for `flat` codes (must include a resolvable default); optional
37
- # per-currency caps for `percentage` codes. Per-row invariants are checked in
38
- # `normalize_currency_options`, not via `#[validate(nested)]`.
36
+ # Checkout uses the row for the currency the buyer pays in. For any other currency
37
+ # it converts the default row. Required for `flat` codes (must include a
38
+ # resolvable default); optional per-currency caps for `percentage` codes. Per-row
39
+ # invariants are checked in `normalize_currency_options`, not via
40
+ # `#[validate(nested)]`.
39
41
  sig do
40
42
  returns(
41
43
  T.nilable(
@@ -152,9 +154,11 @@ module Dodopayments
152
154
  # - If omitted, a random 16-character code is generated.
153
155
  code: nil,
154
156
  # Per-currency options (flat deduction / percentage cap + minimum subtotal).
155
- # Required for `flat` codes (must include a resolvable default); optional
156
- # per-currency caps for `percentage` codes. Per-row invariants are checked in
157
- # `normalize_currency_options`, not via `#[validate(nested)]`.
157
+ # Checkout uses the row for the currency the buyer pays in. For any other currency
158
+ # it converts the default row. Required for `flat` codes (must include a
159
+ # resolvable default); optional per-currency caps for `percentage` codes. Per-row
160
+ # invariants are checked in `normalize_currency_options`, not via
161
+ # `#[validate(nested)]`.
158
162
  currency_options: nil,
159
163
  # Who may redeem this discount code. Defaults to `any` (unrestricted). `specific`
160
164
  # starts with zero attached customers (fails closed) until customers are attached
@@ -225,12 +229,13 @@ module Dodopayments
225
229
  )
226
230
  end
227
231
 
228
- # The currency this option applies to.
232
+ # The currency this option applies to. The row applies when the buyer pays in this
233
+ # currency.
229
234
  sig { returns(Dodopayments::Currency::OrSymbol) }
230
235
  attr_accessor :currency
231
236
 
232
- # Whether this row is the default to convert from for unconfigured currencies. At
233
- # most one row per discount may be default.
237
+ # Whether this row is the default to convert from when the buyer pays in a
238
+ # currency that has no row. At most one row per discount may be default.
234
239
  sig { returns(T.nilable(T::Boolean)) }
235
240
  attr_reader :is_default
236
241
 
@@ -264,10 +269,11 @@ module Dodopayments
264
269
  ).returns(T.attached_class)
265
270
  end
266
271
  def self.new(
267
- # The currency this option applies to.
272
+ # The currency this option applies to. The row applies when the buyer pays in this
273
+ # currency.
268
274
  currency:,
269
- # Whether this row is the default to convert from for unconfigured currencies. At
270
- # most one row per discount may be default.
275
+ # Whether this row is the default to convert from when the buyer pays in a
276
+ # currency that has no row. At most one row per discount may be default.
271
277
  is_default: nil,
272
278
  # The most this code discounts in this currency's subunits. For `flat` codes this
273
279
  # is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
@@ -211,12 +211,13 @@ module Dodopayments
211
211
  )
212
212
  end
213
213
 
214
- # The currency this option applies to.
214
+ # The currency this option applies to. The row applies when the buyer pays in this
215
+ # currency.
215
216
  sig { returns(Dodopayments::Currency::OrSymbol) }
216
217
  attr_accessor :currency
217
218
 
218
- # Whether this row is the default to convert from for unconfigured currencies. At
219
- # most one row per discount may be default.
219
+ # Whether this row is the default to convert from when the buyer pays in a
220
+ # currency that has no row. At most one row per discount may be default.
220
221
  sig { returns(T.nilable(T::Boolean)) }
221
222
  attr_reader :is_default
222
223
 
@@ -250,10 +251,11 @@ module Dodopayments
250
251
  ).returns(T.attached_class)
251
252
  end
252
253
  def self.new(
253
- # The currency this option applies to.
254
+ # The currency this option applies to. The row applies when the buyer pays in this
255
+ # currency.
254
256
  currency:,
255
- # Whether this row is the default to convert from for unconfigured currencies. At
256
- # most one row per discount may be default.
257
+ # Whether this row is the default to convert from when the buyer pays in a
258
+ # currency that has no row. At most one row per discount may be default.
257
259
  is_default: nil,
258
260
  # The most this code discounts in this currency's subunits. For `flat` codes this
259
261
  # is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
@@ -0,0 +1,88 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # A moderation category.
6
+ module ModerationCategory
7
+ extend Dodopayments::Internal::Type::Enum
8
+
9
+ TaggedSymbol =
10
+ T.type_alias { T.all(Symbol, Dodopayments::ModerationCategory) }
11
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
12
+
13
+ VIOLENT_CRIMES =
14
+ T.let(:violent_crimes, Dodopayments::ModerationCategory::TaggedSymbol)
15
+ SEX_RELATED_CRIMES =
16
+ T.let(
17
+ :sex_related_crimes,
18
+ Dodopayments::ModerationCategory::TaggedSymbol
19
+ )
20
+ CHILD_SEXUAL_EXPLOITATION =
21
+ T.let(
22
+ :child_sexual_exploitation,
23
+ Dodopayments::ModerationCategory::TaggedSymbol
24
+ )
25
+ SUICIDE_AND_SELF_HARM =
26
+ T.let(
27
+ :suicide_and_self_harm,
28
+ Dodopayments::ModerationCategory::TaggedSymbol
29
+ )
30
+ INDISCRIMINATE_WEAPONS =
31
+ T.let(
32
+ :indiscriminate_weapons,
33
+ Dodopayments::ModerationCategory::TaggedSymbol
34
+ )
35
+ INTELLECTUAL_PROPERTY =
36
+ T.let(
37
+ :intellectual_property,
38
+ Dodopayments::ModerationCategory::TaggedSymbol
39
+ )
40
+ DEFAMATION =
41
+ T.let(:defamation, Dodopayments::ModerationCategory::TaggedSymbol)
42
+ NON_VIOLENT_CRIMES =
43
+ T.let(
44
+ :non_violent_crimes,
45
+ Dodopayments::ModerationCategory::TaggedSymbol
46
+ )
47
+ HATE = T.let(:hate, Dodopayments::ModerationCategory::TaggedSymbol)
48
+ PRIVACY = T.let(:privacy, Dodopayments::ModerationCategory::TaggedSymbol)
49
+ SPECIALIZED_ADVICE =
50
+ T.let(
51
+ :specialized_advice,
52
+ Dodopayments::ModerationCategory::TaggedSymbol
53
+ )
54
+ SEXUAL_CONTENT =
55
+ T.let(:sexual_content, Dodopayments::ModerationCategory::TaggedSymbol)
56
+ NON_CONSENSUAL_INTIMATE_IMAGERY =
57
+ T.let(
58
+ :non_consensual_intimate_imagery,
59
+ Dodopayments::ModerationCategory::TaggedSymbol
60
+ )
61
+ MINOR_CODED_LANGUAGE =
62
+ T.let(
63
+ :minor_coded_language,
64
+ Dodopayments::ModerationCategory::TaggedSymbol
65
+ )
66
+ REAL_PERSON_LIKENESS =
67
+ T.let(
68
+ :real_person_likeness,
69
+ Dodopayments::ModerationCategory::TaggedSymbol
70
+ )
71
+ LIVING_ARTIST_STYLE =
72
+ T.let(
73
+ :living_artist_style,
74
+ Dodopayments::ModerationCategory::TaggedSymbol
75
+ )
76
+ PROMPT_INJECTION =
77
+ T.let(:prompt_injection, Dodopayments::ModerationCategory::TaggedSymbol)
78
+
79
+ sig do
80
+ override.returns(
81
+ T::Array[Dodopayments::ModerationCategory::TaggedSymbol]
82
+ )
83
+ end
84
+ def self.values
85
+ end
86
+ end
87
+ end
88
+ end