dodopayments 2.29.0 → 2.30.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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -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 +12 -1
  8. data/lib/dodopayments/models/checkout_session_preview_response.rb +86 -4
  9. data/lib/dodopayments/models/checkout_session_request.rb +4 -1
  10. data/lib/dodopayments/models/customers/email_log_item.rb +3 -2
  11. data/lib/dodopayments/models/customers/email_policies.rb +4 -3
  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.rb +14 -0
  28. data/lib/dodopayments/resources/checkout_sessions.rb +2 -2
  29. data/lib/dodopayments/resources/moderation.rb +81 -0
  30. data/lib/dodopayments/resources/payouts/breakup/details.rb +4 -4
  31. data/lib/dodopayments/version.rb +1 -1
  32. data/lib/dodopayments.rb +10 -0
  33. data/rbi/dodopayments/client.rbi +3 -0
  34. data/rbi/dodopayments/models/balance_ledger_entry.rbi +15 -0
  35. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +15 -0
  36. data/rbi/dodopayments/models/checkout_session_flags.rbi +17 -0
  37. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +130 -6
  38. data/rbi/dodopayments/models/checkout_session_request.rbi +6 -0
  39. data/rbi/dodopayments/models/customers/email_log_item.rbi +4 -2
  40. data/rbi/dodopayments/models/customers/email_policies.rbi +6 -4
  41. data/rbi/dodopayments/models/discount_create_params.rbi +18 -12
  42. data/rbi/dodopayments/models/discount_update_params.rbi +8 -6
  43. data/rbi/dodopayments/models/moderation_category.rbi +88 -0
  44. data/rbi/dodopayments/models/moderation_category_provenance.rbi +184 -0
  45. data/rbi/dodopayments/models/moderation_category_scores.rbi +171 -0
  46. data/rbi/dodopayments/models/moderation_decision.rbi +27 -0
  47. data/rbi/dodopayments/models/moderation_provenance.rbi +28 -0
  48. data/rbi/dodopayments/models/moderation_retrieve_usage_params.rbi +32 -0
  49. data/rbi/dodopayments/models/moderation_retrieve_usage_response.rbi +104 -0
  50. data/rbi/dodopayments/models/moderation_screen_params.rbi +68 -0
  51. data/rbi/dodopayments/models/moderation_screen_response.rbi +135 -0
  52. data/rbi/dodopayments/models/payment.rbi +30 -2
  53. data/rbi/dodopayments/models/payment_list_response.rbi +24 -0
  54. data/rbi/dodopayments/models/payouts/breakup/detail_list_response.rbi +8 -6
  55. data/rbi/dodopayments/models/payouts/breakup_retrieve_response.rbi +19 -2
  56. data/rbi/dodopayments/models.rbi +16 -0
  57. data/rbi/dodopayments/resources/checkout_sessions.rbi +6 -0
  58. data/rbi/dodopayments/resources/discounts.rbi +5 -3
  59. data/rbi/dodopayments/resources/moderation.rbi +64 -0
  60. data/rbi/dodopayments/resources/payouts/breakup/details.rbi +4 -4
  61. data/sig/dodopayments/client.rbs +2 -0
  62. data/sig/dodopayments/models/balance_ledger_entry.rbs +6 -0
  63. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +6 -0
  64. data/sig/dodopayments/models/checkout_session_flags.rbs +7 -0
  65. data/sig/dodopayments/models/checkout_session_preview_response.rbs +52 -0
  66. data/sig/dodopayments/models/moderation_category.rbs +46 -0
  67. data/sig/dodopayments/models/moderation_category_provenance.rbs +100 -0
  68. data/sig/dodopayments/models/moderation_category_scores.rbs +100 -0
  69. data/sig/dodopayments/models/moderation_decision.rbs +15 -0
  70. data/sig/dodopayments/models/moderation_provenance.rbs +14 -0
  71. data/sig/dodopayments/models/moderation_retrieve_usage_params.rbs +15 -0
  72. data/sig/dodopayments/models/moderation_retrieve_usage_response.rbs +42 -0
  73. data/sig/dodopayments/models/moderation_screen_params.rbs +32 -0
  74. data/sig/dodopayments/models/moderation_screen_response.rbs +65 -0
  75. data/sig/dodopayments/models/payment.rbs +10 -0
  76. data/sig/dodopayments/models/payment_list_response.rbs +10 -0
  77. data/sig/dodopayments/models.rbs +14 -0
  78. data/sig/dodopayments/resources/moderation.rbs +18 -0
  79. metadata +32 -2
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Resources
5
+ class Moderation
6
+ # Shows how many billable screens you made and how close you are to your next
7
+ # charge.
8
+ #
9
+ # **Billing.** A billable screen is a live-mode screen that returns a verdict.
10
+ # Dodo Payments charges $0.30 for each full block of 1000 billable screens and
11
+ # debits the fee from your balance. Each full block is charged within one hour.
12
+ # Screens that do not fill a block stay unbilled until they do. Errors and
13
+ # test-mode screens are free and are not counted.
14
+ #
15
+ # @overload retrieve_usage(request_options: {})
16
+ #
17
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
18
+ #
19
+ # @return [Dodopayments::Models::ModerationRetrieveUsageResponse]
20
+ #
21
+ # @see Dodopayments::Models::ModerationRetrieveUsageParams
22
+ def retrieve_usage(params = {})
23
+ @client.request(
24
+ method: :get,
25
+ path: "moderation/usage",
26
+ model: Dodopayments::Models::ModerationRetrieveUsageResponse,
27
+ options: params[:request_options]
28
+ )
29
+ end
30
+
31
+ # Some parameter documentations has been truncated, see
32
+ # {Dodopayments::Models::ModerationScreenParams} for more details.
33
+ #
34
+ # Screens text, an image, or both, and returns a verdict: `allow`, `flag` or
35
+ # `deny`. The API is fail-closed: do not generate when you get no verdict.
36
+ #
37
+ # **Pricing.** Dodo Payments charges $0.30 per 1000 billable screens and debits
38
+ # the fee from your balance. A billable screen is a live-mode screen that returns
39
+ # a verdict. Errors and test-mode screens are free.
40
+ #
41
+ # **429.** Honour `Retry-After` and retry. A 429 is a throughput limit, not a
42
+ # verdict.
43
+ #
44
+ # **Test mode** returns mock verdicts and never calls the model. The default
45
+ # verdict is `allow`. Put one of these strings in `text` to select another
46
+ # outcome: `dodo_mock_flag` (`flag`), `dodo_mock_deny` (`deny`),
47
+ # `dodo_mock_overloaded` (429) or `dodo_mock_not_ready` (503).
48
+ #
49
+ # @overload screen(image: nil, request_id: nil, text: nil, request_options: {})
50
+ #
51
+ # @param image [String, nil] The image to screen, as base64, with or without a `data:image/...;base64,` prefi
52
+ #
53
+ # @param request_id [String, nil] Your identifier for this screen, up to 128 characters, with no control character
54
+ #
55
+ # @param text [String, nil] The text to screen, up to 8000 characters.
56
+ #
57
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Dodopayments::Models::ModerationScreenResponse]
60
+ #
61
+ # @see Dodopayments::Models::ModerationScreenParams
62
+ def screen(params = {})
63
+ parsed, options = Dodopayments::ModerationScreenParams.dump_request(params)
64
+ @client.request(
65
+ method: :post,
66
+ path: "moderation/screen",
67
+ body: parsed,
68
+ model: Dodopayments::Models::ModerationScreenResponse,
69
+ options: options
70
+ )
71
+ end
72
+
73
+ # @api private
74
+ #
75
+ # @param client [Dodopayments::Client]
76
+ def initialize(client:)
77
+ @client = client
78
+ end
79
+ end
80
+ end
81
+ end
@@ -5,10 +5,10 @@ module Dodopayments
5
5
  class Payouts
6
6
  class Breakup
7
7
  class Details
8
- # Returns paginated individual balance ledger entries for a payout, with each
9
- # entry's amount pro-rated into the payout's currency. Supports pagination via
10
- # `page_size` (default 10, max 100) and `page_number` (default 0) query
11
- # parameters.
8
+ # Returns paginated individual balance ledger entries for a payout. Each entry is
9
+ # converted into the payout's currency at the rate the payout settled at. Supports
10
+ # pagination via `page_size` (default 10, max 100) and `page_number` (default 0)
11
+ # query parameters.
12
12
  #
13
13
  # @overload list(payout_id, page_number: nil, page_size: nil, request_options: {})
14
14
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.29.0"
4
+ VERSION = "2.30.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -270,6 +270,15 @@ require_relative "dodopayments/models/meter_retrieve_params"
270
270
  require_relative "dodopayments/models/meter_unarchive_params"
271
271
  require_relative "dodopayments/models/misc_list_supported_countries_params"
272
272
  require_relative "dodopayments/models/misc_list_supported_countries_response"
273
+ require_relative "dodopayments/models/moderation_category"
274
+ require_relative "dodopayments/models/moderation_category_provenance"
275
+ require_relative "dodopayments/models/moderation_category_scores"
276
+ require_relative "dodopayments/models/moderation_decision"
277
+ require_relative "dodopayments/models/moderation_provenance"
278
+ require_relative "dodopayments/models/moderation_retrieve_usage_params"
279
+ require_relative "dodopayments/models/moderation_retrieve_usage_response"
280
+ require_relative "dodopayments/models/moderation_screen_params"
281
+ require_relative "dodopayments/models/moderation_screen_response"
273
282
  require_relative "dodopayments/models/new_customer"
274
283
  require_relative "dodopayments/models/on_demand_subscription"
275
284
  require_relative "dodopayments/models/one_time_product_cart_item"
@@ -441,6 +450,7 @@ require_relative "dodopayments/resources/license_keys"
441
450
  require_relative "dodopayments/resources/licenses"
442
451
  require_relative "dodopayments/resources/meters"
443
452
  require_relative "dodopayments/resources/misc"
453
+ require_relative "dodopayments/resources/moderation"
444
454
  require_relative "dodopayments/resources/payments"
445
455
  require_relative "dodopayments/resources/payouts"
446
456
  require_relative "dodopayments/resources/payouts/breakup"
@@ -101,6 +101,9 @@ module Dodopayments
101
101
  sig { returns(Dodopayments::Resources::ProductCollections) }
102
102
  attr_reader :product_collections
103
103
 
104
+ sig { returns(Dodopayments::Resources::Moderation) }
105
+ attr_reader :moderation
106
+
104
107
  # @api private
105
108
  sig { override.returns(T::Hash[String, String]) }
106
109
  private def auth_headers
@@ -253,6 +253,21 @@ module Dodopayments
253
253
  :deflection_fees_reversal,
254
254
  Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
255
255
  )
256
+ RESERVE_HOLD =
257
+ T.let(
258
+ :reserve_hold,
259
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
260
+ )
261
+ RESERVE_RELEASE =
262
+ T.let(
263
+ :reserve_release,
264
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
265
+ )
266
+ MODERATION_FEES =
267
+ T.let(
268
+ :moderation_fees,
269
+ Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
270
+ )
256
271
 
257
272
  sig do
258
273
  override.returns(
@@ -1045,6 +1045,21 @@ module Dodopayments
1045
1045
  :deflection_fees_reversal,
1046
1046
  Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1047
1047
  )
1048
+ RESERVE_HOLD =
1049
+ T.let(
1050
+ :reserve_hold,
1051
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1052
+ )
1053
+ RESERVE_RELEASE =
1054
+ T.let(
1055
+ :reserve_release,
1056
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1057
+ )
1058
+ MODERATION_FEES =
1059
+ T.let(
1060
+ :moderation_fees,
1061
+ Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
1062
+ )
1048
1063
 
1049
1064
  sig do
1050
1065
  override.returns(
@@ -137,6 +137,16 @@ module Dodopayments
137
137
  sig { params(redirect_immediately: T::Boolean).void }
138
138
  attr_writer :redirect_immediately
139
139
 
140
+ # If true, the customer must give the name on the card to pay by card. The
141
+ # checkout page enforces this. Other payment methods ignore it.
142
+ #
143
+ # Default is false
144
+ sig { returns(T.nilable(T::Boolean)) }
145
+ attr_reader :require_cardholder_name
146
+
147
+ sig { params(require_cardholder_name: T::Boolean).void }
148
+ attr_writer :require_cardholder_name
149
+
140
150
  # If true, the customer must provide a phone number to complete checkout. Requires
141
151
  # `allow_phone_number_collection` to also be true.
142
152
  #
@@ -193,6 +203,7 @@ module Dodopayments
193
203
  allow_tax_id: T::Boolean,
194
204
  always_create_new_customer: T::Boolean,
195
205
  redirect_immediately: T::Boolean,
206
+ require_cardholder_name: T::Boolean,
196
207
  require_phone_number: T::Boolean,
197
208
  require_tax_id: T::Boolean,
198
209
  single_page: T::Boolean
@@ -245,6 +256,11 @@ module Dodopayments
245
256
  #
246
257
  # Default is false
247
258
  redirect_immediately: nil,
259
+ # If true, the customer must give the name on the card to pay by card. The
260
+ # checkout page enforces this. Other payment methods ignore it.
261
+ #
262
+ # Default is false
263
+ require_cardholder_name: nil,
248
264
  # If true, the customer must provide a phone number to complete checkout. Requires
249
265
  # `allow_phone_number_collection` to also be true.
250
266
  #
@@ -290,6 +306,7 @@ module Dodopayments
290
306
  allow_tax_id: T::Boolean,
291
307
  always_create_new_customer: T::Boolean,
292
308
  redirect_immediately: T::Boolean,
309
+ require_cardholder_name: T::Boolean,
293
310
  require_phone_number: T::Boolean,
294
311
  require_tax_id: T::Boolean,
295
312
  single_page: T::Boolean
@@ -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
 
@@ -216,6 +219,9 @@ module Dodopayments
216
219
  ).returns(T.attached_class)
217
220
  end
218
221
  def self.new(
222
+ # The products of the checkout. A cart holds at most 20 of them, one-time and
223
+ # subscription products together. An empty cart is valid for the
224
+ # product-collection flow, where the customer chooses the product later.
219
225
  product_cart:,
220
226
  # Customers will never see payment methods that are not in this list. However,
221
227
  # adding a method here does not guarantee customers will see it. Availability
@@ -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
@@ -28,8 +28,9 @@ module Dodopayments
28
28
  sig { returns(T::Boolean) }
29
29
  attr_accessor :retry_allowed
30
30
 
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.
31
+ # A later send of this email replaced this row, so this row is history. A row that
32
+ # never went out needs a later send that reached the provider. A failed row needs
33
+ # a later send that was delivered.
33
34
  sig { returns(T::Boolean) }
34
35
  attr_accessor :superseded
35
36
 
@@ -53,8 +54,9 @@ module Dodopayments
53
54
  resends_remaining:,
54
55
  # The row failed and may be sent again.
55
56
  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.
57
+ # A later send of this email replaced this row, so this row is history. A row that
58
+ # never went out needs a later send that reached the provider. A failed row needs
59
+ # a later send that was delivered.
58
60
  superseded:
59
61
  )
60
62
  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