dodopayments 2.28.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/lib/dodopayments/client.rb +4 -0
- data/lib/dodopayments/models/balance_ledger_entry.rb +7 -0
- data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +7 -0
- data/lib/dodopayments/models/checkout_session_flags.rb +30 -1
- data/lib/dodopayments/models/checkout_session_preview_response.rb +86 -4
- data/lib/dodopayments/models/checkout_session_request.rb +4 -1
- data/lib/dodopayments/models/customers/email_failure_code.rb +1 -0
- data/lib/dodopayments/models/customers/email_log_item.rb +4 -12
- data/lib/dodopayments/models/customers/email_policies.rb +14 -1
- data/lib/dodopayments/models/discount_create_params.rb +11 -8
- data/lib/dodopayments/models/discount_update_params.rb +6 -5
- data/lib/dodopayments/models/moderation_category.rb +31 -0
- data/lib/dodopayments/models/moderation_category_provenance.rb +150 -0
- data/lib/dodopayments/models/moderation_category_scores.rb +150 -0
- data/lib/dodopayments/models/moderation_decision.rb +18 -0
- data/lib/dodopayments/models/moderation_provenance.rb +18 -0
- data/lib/dodopayments/models/moderation_retrieve_usage_params.rb +14 -0
- data/lib/dodopayments/models/moderation_retrieve_usage_response.rb +61 -0
- data/lib/dodopayments/models/moderation_screen_params.rb +44 -0
- data/lib/dodopayments/models/moderation_screen_response.rb +99 -0
- data/lib/dodopayments/models/payment.rb +25 -3
- data/lib/dodopayments/models/payment_list_response.rb +21 -1
- data/lib/dodopayments/models/payouts/breakup/detail_list_response.rb +5 -4
- data/lib/dodopayments/models/payouts/breakup_retrieve_response.rb +17 -1
- data/lib/dodopayments/models.rb +14 -0
- data/lib/dodopayments/resources/checkout_sessions.rb +2 -2
- data/lib/dodopayments/resources/moderation.rb +81 -0
- data/lib/dodopayments/resources/payouts/breakup/details.rb +4 -4
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +10 -0
- data/rbi/dodopayments/client.rbi +3 -0
- data/rbi/dodopayments/models/balance_ledger_entry.rbi +35 -0
- data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +35 -0
- data/rbi/dodopayments/models/checkout_session_flags.rbi +48 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +130 -6
- data/rbi/dodopayments/models/checkout_session_request.rbi +6 -0
- data/rbi/dodopayments/models/customers/email_failure_code.rbi +5 -0
- data/rbi/dodopayments/models/customers/email_log_item.rbi +4 -12
- data/rbi/dodopayments/models/customers/email_policies.rbi +15 -3
- data/rbi/dodopayments/models/discount_create_params.rbi +18 -12
- data/rbi/dodopayments/models/discount_update_params.rbi +8 -6
- data/rbi/dodopayments/models/moderation_category.rbi +88 -0
- data/rbi/dodopayments/models/moderation_category_provenance.rbi +184 -0
- data/rbi/dodopayments/models/moderation_category_scores.rbi +171 -0
- data/rbi/dodopayments/models/moderation_decision.rbi +27 -0
- data/rbi/dodopayments/models/moderation_provenance.rbi +28 -0
- data/rbi/dodopayments/models/moderation_retrieve_usage_params.rbi +32 -0
- data/rbi/dodopayments/models/moderation_retrieve_usage_response.rbi +104 -0
- data/rbi/dodopayments/models/moderation_screen_params.rbi +68 -0
- data/rbi/dodopayments/models/moderation_screen_response.rbi +135 -0
- data/rbi/dodopayments/models/payment.rbi +30 -2
- data/rbi/dodopayments/models/payment_list_response.rbi +24 -0
- data/rbi/dodopayments/models/payouts/breakup/detail_list_response.rbi +8 -6
- data/rbi/dodopayments/models/payouts/breakup_retrieve_response.rbi +19 -2
- data/rbi/dodopayments/models.rbi +16 -0
- data/rbi/dodopayments/resources/checkout_sessions.rbi +6 -0
- data/rbi/dodopayments/resources/discounts.rbi +5 -3
- data/rbi/dodopayments/resources/moderation.rbi +64 -0
- data/rbi/dodopayments/resources/payouts/breakup/details.rbi +4 -4
- data/sig/dodopayments/client.rbs +2 -0
- data/sig/dodopayments/models/balance_ledger_entry.rbs +14 -0
- data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +14 -0
- data/sig/dodopayments/models/checkout_session_flags.rbs +14 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +52 -0
- data/sig/dodopayments/models/customers/email_failure_code.rbs +2 -0
- data/sig/dodopayments/models/customers/email_log_item.rbs +0 -5
- data/sig/dodopayments/models/customers/email_policies.rbs +8 -3
- data/sig/dodopayments/models/moderation_category.rbs +46 -0
- data/sig/dodopayments/models/moderation_category_provenance.rbs +100 -0
- data/sig/dodopayments/models/moderation_category_scores.rbs +100 -0
- data/sig/dodopayments/models/moderation_decision.rbs +15 -0
- data/sig/dodopayments/models/moderation_provenance.rbs +14 -0
- data/sig/dodopayments/models/moderation_retrieve_usage_params.rbs +15 -0
- data/sig/dodopayments/models/moderation_retrieve_usage_response.rbs +42 -0
- data/sig/dodopayments/models/moderation_screen_params.rbs +32 -0
- data/sig/dodopayments/models/moderation_screen_response.rbs +65 -0
- data/sig/dodopayments/models/payment.rbs +10 -0
- data/sig/dodopayments/models/payment_list_response.rbs +10 -0
- data/sig/dodopayments/models.rbs +14 -0
- data/sig/dodopayments/resources/moderation.rbs +18 -0
- 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
|
|
9
|
-
#
|
|
10
|
-
# `page_size` (default 10, max 100) and `page_number` (default 0)
|
|
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
|
#
|
data/lib/dodopayments/version.rb
CHANGED
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"
|
data/rbi/dodopayments/client.rbi
CHANGED
|
@@ -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
|
|
@@ -233,6 +233,41 @@ module Dodopayments
|
|
|
233
233
|
:ethoca_fees_reversal,
|
|
234
234
|
Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
|
|
235
235
|
)
|
|
236
|
+
VISA_RDR_FEE =
|
|
237
|
+
T.let(
|
|
238
|
+
:visa_rdr_fee,
|
|
239
|
+
Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
|
|
240
|
+
)
|
|
241
|
+
DISPUTE_FEES_REVERSAL =
|
|
242
|
+
T.let(
|
|
243
|
+
:dispute_fees_reversal,
|
|
244
|
+
Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
|
|
245
|
+
)
|
|
246
|
+
DEFLECTION_FEES =
|
|
247
|
+
T.let(
|
|
248
|
+
:deflection_fees,
|
|
249
|
+
Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
|
|
250
|
+
)
|
|
251
|
+
DEFLECTION_FEES_REVERSAL =
|
|
252
|
+
T.let(
|
|
253
|
+
:deflection_fees_reversal,
|
|
254
|
+
Dodopayments::BalanceLedgerEntry::EventType::TaggedSymbol
|
|
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
|
+
)
|
|
236
271
|
|
|
237
272
|
sig do
|
|
238
273
|
override.returns(
|
|
@@ -1025,6 +1025,41 @@ module Dodopayments
|
|
|
1025
1025
|
:ethoca_fees_reversal,
|
|
1026
1026
|
Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
|
|
1027
1027
|
)
|
|
1028
|
+
VISA_RDR_FEE =
|
|
1029
|
+
T.let(
|
|
1030
|
+
:visa_rdr_fee,
|
|
1031
|
+
Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
|
|
1032
|
+
)
|
|
1033
|
+
DISPUTE_FEES_REVERSAL =
|
|
1034
|
+
T.let(
|
|
1035
|
+
:dispute_fees_reversal,
|
|
1036
|
+
Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
|
|
1037
|
+
)
|
|
1038
|
+
DEFLECTION_FEES =
|
|
1039
|
+
T.let(
|
|
1040
|
+
:deflection_fees,
|
|
1041
|
+
Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
|
|
1042
|
+
)
|
|
1043
|
+
DEFLECTION_FEES_REVERSAL =
|
|
1044
|
+
T.let(
|
|
1045
|
+
:deflection_fees_reversal,
|
|
1046
|
+
Dodopayments::BalanceRetrieveLedgerParams::EventType::TaggedSymbol
|
|
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
|
+
)
|
|
1028
1063
|
|
|
1029
1064
|
sig do
|
|
1030
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
|
#
|
|
@@ -147,6 +157,23 @@ module Dodopayments
|
|
|
147
157
|
sig { params(require_phone_number: T::Boolean).void }
|
|
148
158
|
attr_writer :require_phone_number
|
|
149
159
|
|
|
160
|
+
# If true, the customer must give a tax id to check out as a business. A tax id is
|
|
161
|
+
# the GST number in India, or the VAT number in the EU. You must also set
|
|
162
|
+
# `allow_tax_id` to true.
|
|
163
|
+
#
|
|
164
|
+
# On the checkout page, this field does not change checkout for a customer who
|
|
165
|
+
# buys as an individual.
|
|
166
|
+
#
|
|
167
|
+
# A `confirm: true` request skips the checkout page. The request must contain
|
|
168
|
+
# `tax_id`.
|
|
169
|
+
#
|
|
170
|
+
# Default is false
|
|
171
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
172
|
+
attr_reader :require_tax_id
|
|
173
|
+
|
|
174
|
+
sig { params(require_tax_id: T::Boolean).void }
|
|
175
|
+
attr_writer :require_tax_id
|
|
176
|
+
|
|
150
177
|
# If true, the session uses the single-page checkout flow: the page initializes
|
|
151
178
|
# the payment at load time and confirms it in place, with no separate payment
|
|
152
179
|
# page.
|
|
@@ -176,7 +203,9 @@ module Dodopayments
|
|
|
176
203
|
allow_tax_id: T::Boolean,
|
|
177
204
|
always_create_new_customer: T::Boolean,
|
|
178
205
|
redirect_immediately: T::Boolean,
|
|
206
|
+
require_cardholder_name: T::Boolean,
|
|
179
207
|
require_phone_number: T::Boolean,
|
|
208
|
+
require_tax_id: T::Boolean,
|
|
180
209
|
single_page: T::Boolean
|
|
181
210
|
).returns(T.attached_class)
|
|
182
211
|
end
|
|
@@ -227,11 +256,28 @@ module Dodopayments
|
|
|
227
256
|
#
|
|
228
257
|
# Default is false
|
|
229
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,
|
|
230
264
|
# If true, the customer must provide a phone number to complete checkout. Requires
|
|
231
265
|
# `allow_phone_number_collection` to also be true.
|
|
232
266
|
#
|
|
233
267
|
# Default is false
|
|
234
268
|
require_phone_number: nil,
|
|
269
|
+
# If true, the customer must give a tax id to check out as a business. A tax id is
|
|
270
|
+
# the GST number in India, or the VAT number in the EU. You must also set
|
|
271
|
+
# `allow_tax_id` to true.
|
|
272
|
+
#
|
|
273
|
+
# On the checkout page, this field does not change checkout for a customer who
|
|
274
|
+
# buys as an individual.
|
|
275
|
+
#
|
|
276
|
+
# A `confirm: true` request skips the checkout page. The request must contain
|
|
277
|
+
# `tax_id`.
|
|
278
|
+
#
|
|
279
|
+
# Default is false
|
|
280
|
+
require_tax_id: nil,
|
|
235
281
|
# If true, the session uses the single-page checkout flow: the page initializes
|
|
236
282
|
# the payment at load time and confirms it in place, with no separate payment
|
|
237
283
|
# page.
|
|
@@ -260,7 +306,9 @@ module Dodopayments
|
|
|
260
306
|
allow_tax_id: T::Boolean,
|
|
261
307
|
always_create_new_customer: T::Boolean,
|
|
262
308
|
redirect_immediately: T::Boolean,
|
|
309
|
+
require_cardholder_name: T::Boolean,
|
|
263
310
|
require_phone_number: T::Boolean,
|
|
311
|
+
require_tax_id: T::Boolean,
|
|
264
312
|
single_page: T::Boolean
|
|
265
313
|
}
|
|
266
314
|
)
|
|
@@ -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
|
|
@@ -56,6 +56,11 @@ module Dodopayments
|
|
|
56
56
|
:send_failed,
|
|
57
57
|
Dodopayments::Customers::EmailFailureCode::TaggedSymbol
|
|
58
58
|
)
|
|
59
|
+
TEST_MODE_QUOTA_SPENT =
|
|
60
|
+
T.let(
|
|
61
|
+
:test_mode_quota_spent,
|
|
62
|
+
Dodopayments::Customers::EmailFailureCode::TaggedSymbol
|
|
63
|
+
)
|
|
59
64
|
|
|
60
65
|
sig do
|
|
61
66
|
override.returns(
|
|
@@ -63,12 +63,8 @@ module Dodopayments
|
|
|
63
63
|
sig { returns(T.nilable(String)) }
|
|
64
64
|
attr_accessor :from
|
|
65
65
|
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
sig { returns(T.nilable(String)) }
|
|
69
|
-
attr_accessor :intended_recipient
|
|
70
|
-
|
|
71
|
-
# 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.
|
|
72
68
|
sig { returns(T.nilable(String)) }
|
|
73
69
|
attr_accessor :recipient
|
|
74
70
|
|
|
@@ -89,7 +85,6 @@ module Dodopayments
|
|
|
89
85
|
T.nilable(Dodopayments::Customers::EmailFailureCode::OrSymbol),
|
|
90
86
|
failure_reason: T.nilable(String),
|
|
91
87
|
from: T.nilable(String),
|
|
92
|
-
intended_recipient: T.nilable(String),
|
|
93
88
|
recipient: T.nilable(String),
|
|
94
89
|
subject: T.nilable(String)
|
|
95
90
|
).returns(T.attached_class)
|
|
@@ -117,10 +112,8 @@ module Dodopayments
|
|
|
117
112
|
failure_reason: nil,
|
|
118
113
|
# The address the email was sent from.
|
|
119
114
|
from: nil,
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
intended_recipient: nil,
|
|
123
|
-
# 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.
|
|
124
117
|
recipient: nil,
|
|
125
118
|
# The subject line as it was sent. Empty until the provider replicates.
|
|
126
119
|
subject: nil
|
|
@@ -143,7 +136,6 @@ module Dodopayments
|
|
|
143
136
|
),
|
|
144
137
|
failure_reason: T.nilable(String),
|
|
145
138
|
from: T.nilable(String),
|
|
146
|
-
intended_recipient: T.nilable(String),
|
|
147
139
|
recipient: T.nilable(String),
|
|
148
140
|
subject: T.nilable(String)
|
|
149
141
|
}
|
|
@@ -28,6 +28,12 @@ module Dodopayments
|
|
|
28
28
|
sig { returns(T::Boolean) }
|
|
29
29
|
attr_accessor :retry_allowed
|
|
30
30
|
|
|
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.
|
|
34
|
+
sig { returns(T::Boolean) }
|
|
35
|
+
attr_accessor :superseded
|
|
36
|
+
|
|
31
37
|
# What the merchant may do with one row. The server decides; the client never
|
|
32
38
|
# derives eligibility itself.
|
|
33
39
|
sig do
|
|
@@ -35,7 +41,8 @@ module Dodopayments
|
|
|
35
41
|
requires_different_address: T::Boolean,
|
|
36
42
|
resend_allowed: T::Boolean,
|
|
37
43
|
resends_remaining: Integer,
|
|
38
|
-
retry_allowed: T::Boolean
|
|
44
|
+
retry_allowed: T::Boolean,
|
|
45
|
+
superseded: T::Boolean
|
|
39
46
|
).returns(T.attached_class)
|
|
40
47
|
end
|
|
41
48
|
def self.new(
|
|
@@ -46,7 +53,11 @@ module Dodopayments
|
|
|
46
53
|
# How many sends are left in this email's chain.
|
|
47
54
|
resends_remaining:,
|
|
48
55
|
# The row failed and may be sent again.
|
|
49
|
-
retry_allowed
|
|
56
|
+
retry_allowed:,
|
|
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.
|
|
60
|
+
superseded:
|
|
50
61
|
)
|
|
51
62
|
end
|
|
52
63
|
|
|
@@ -56,7 +67,8 @@ module Dodopayments
|
|
|
56
67
|
requires_different_address: T::Boolean,
|
|
57
68
|
resend_allowed: T::Boolean,
|
|
58
69
|
resends_remaining: Integer,
|
|
59
|
-
retry_allowed: T::Boolean
|
|
70
|
+
retry_allowed: T::Boolean,
|
|
71
|
+
superseded: T::Boolean
|
|
60
72
|
}
|
|
61
73
|
)
|
|
62
74
|
end
|