dodopayments 2.20.0 → 2.21.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 +16 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/checkout_session_preview_response.rb +41 -4
- data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +4 -2
- data/lib/dodopayments/models/discount.rb +95 -3
- data/lib/dodopayments/models/discount_create_params.rb +110 -3
- data/lib/dodopayments/models/discount_list_params.rb +7 -2
- data/lib/dodopayments/models/discount_type.rb +1 -0
- data/lib/dodopayments/models/discount_update_params.rb +108 -3
- data/lib/dodopayments/models/payment.rb +162 -1
- data/lib/dodopayments/models/payment_list_params.rb +163 -1
- data/lib/dodopayments/models/payment_method_types.rb +0 -1
- data/lib/dodopayments/models/price.rb +19 -1
- data/lib/dodopayments/models/subscription.rb +11 -1
- data/lib/dodopayments/models/subscription_create_response.rb +10 -1
- data/lib/dodopayments/models/subscription_list_params.rb +12 -1
- data/lib/dodopayments/models/subscription_list_response.rb +11 -1
- data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +40 -0
- data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +4 -1
- data/lib/dodopayments/models/unwrap_webhook_event.rb +4 -1
- data/lib/dodopayments/models/webhook_event_type.rb +1 -0
- data/lib/dodopayments/models.rb +3 -0
- data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -1
- data/lib/dodopayments/resources/discounts.rb +24 -5
- data/lib/dodopayments/resources/payments.rb +3 -1
- data/lib/dodopayments/resources/subscriptions.rb +6 -1
- data/lib/dodopayments/resources/webhooks.rb +2 -2
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +1 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +47 -5
- data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +6 -2
- data/rbi/dodopayments/models/discount.rbi +151 -2
- data/rbi/dodopayments/models/discount_create_params.rbi +197 -2
- data/rbi/dodopayments/models/discount_list_params.rbi +6 -2
- data/rbi/dodopayments/models/discount_type.rbi +1 -0
- data/rbi/dodopayments/models/discount_update_params.rbi +193 -2
- data/rbi/dodopayments/models/payment.rbi +365 -0
- data/rbi/dodopayments/models/payment_list_params.rbi +327 -0
- data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
- data/rbi/dodopayments/models/price.rbi +20 -0
- data/rbi/dodopayments/models/subscription.rbi +15 -3
- data/rbi/dodopayments/models/subscription_create_response.rbi +13 -3
- data/rbi/dodopayments/models/subscription_list_params.rbi +11 -0
- data/rbi/dodopayments/models/subscription_list_response.rbi +15 -3
- data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +67 -0
- data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
- data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
- data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
- data/rbi/dodopayments/models.rbi +3 -0
- data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +3 -1
- data/rbi/dodopayments/resources/discounts.rbi +57 -3
- data/rbi/dodopayments/resources/payments.rbi +3 -0
- data/rbi/dodopayments/resources/subscriptions.rbi +3 -0
- data/rbi/dodopayments/resources/webhooks.rbi +2 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +18 -3
- data/sig/dodopayments/models/discount.rbs +69 -0
- data/sig/dodopayments/models/discount_create_params.rbs +69 -0
- data/sig/dodopayments/models/discount_type.rbs +2 -1
- data/sig/dodopayments/models/discount_update_params.rbs +69 -0
- data/sig/dodopayments/models/payment.rbs +145 -0
- data/sig/dodopayments/models/payment_list_params.rbs +308 -0
- data/sig/dodopayments/models/payment_method_types.rbs +0 -2
- data/sig/dodopayments/models/price.rbs +10 -0
- data/sig/dodopayments/models/subscription.rbs +8 -3
- data/sig/dodopayments/models/subscription_create_response.rbs +8 -3
- data/sig/dodopayments/models/subscription_list_params.rbs +7 -0
- data/sig/dodopayments/models/subscription_list_response.rbs +8 -3
- data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +35 -0
- data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
- data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
- data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
- data/sig/dodopayments/models.rbs +2 -0
- data/sig/dodopayments/resources/discounts.rbs +8 -0
- data/sig/dodopayments/resources/payments.rbs +1 -0
- data/sig/dodopayments/resources/subscriptions.rbs +1 -0
- data/sig/dodopayments/resources/webhooks.rbs +2 -0
- metadata +5 -2
|
@@ -28,6 +28,29 @@ module Dodopayments
|
|
|
28
28
|
sig { returns(T.nilable(String)) }
|
|
29
29
|
attr_accessor :code
|
|
30
30
|
|
|
31
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
32
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
33
|
+
sig do
|
|
34
|
+
returns(
|
|
35
|
+
T.nilable(
|
|
36
|
+
T::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
attr_accessor :currency_options
|
|
41
|
+
|
|
42
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
43
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
44
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
45
|
+
sig do
|
|
46
|
+
returns(
|
|
47
|
+
T.nilable(
|
|
48
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
attr_accessor :customer_eligibility
|
|
53
|
+
|
|
31
54
|
sig { returns(T.nilable(Time)) }
|
|
32
55
|
attr_accessor :expires_at
|
|
33
56
|
|
|
@@ -42,6 +65,12 @@ module Dodopayments
|
|
|
42
65
|
sig { returns(T.nilable(String)) }
|
|
43
66
|
attr_accessor :name
|
|
44
67
|
|
|
68
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
69
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
70
|
+
# this patch) when both are set.
|
|
71
|
+
sig { returns(T.nilable(Integer)) }
|
|
72
|
+
attr_accessor :per_customer_usage_limit
|
|
73
|
+
|
|
45
74
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
46
75
|
# not provided, the existing value is kept.
|
|
47
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
@@ -52,13 +81,17 @@ module Dodopayments
|
|
|
52
81
|
sig { returns(T.nilable(T::Array[String])) }
|
|
53
82
|
attr_accessor :restricted_to
|
|
54
83
|
|
|
84
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
85
|
+
sig { returns(T.nilable(Time)) }
|
|
86
|
+
attr_accessor :starts_at
|
|
87
|
+
|
|
55
88
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
56
89
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
57
90
|
# related to the subscription.
|
|
58
91
|
sig { returns(T.nilable(Integer)) }
|
|
59
92
|
attr_accessor :subscription_cycles
|
|
60
93
|
|
|
61
|
-
# If present, update the discount type
|
|
94
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
62
95
|
sig { returns(T.nilable(Dodopayments::DiscountType::OrSymbol)) }
|
|
63
96
|
attr_accessor :type
|
|
64
97
|
|
|
@@ -70,12 +103,24 @@ module Dodopayments
|
|
|
70
103
|
discount_id: String,
|
|
71
104
|
amount: T.nilable(Integer),
|
|
72
105
|
code: T.nilable(String),
|
|
106
|
+
currency_options:
|
|
107
|
+
T.nilable(
|
|
108
|
+
T::Array[
|
|
109
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption::OrHash
|
|
110
|
+
]
|
|
111
|
+
),
|
|
112
|
+
customer_eligibility:
|
|
113
|
+
T.nilable(
|
|
114
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
115
|
+
),
|
|
73
116
|
expires_at: T.nilable(Time),
|
|
74
117
|
metadata:
|
|
75
118
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
76
119
|
name: T.nilable(String),
|
|
120
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
77
121
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
78
122
|
restricted_to: T.nilable(T::Array[String]),
|
|
123
|
+
starts_at: T.nilable(Time),
|
|
79
124
|
subscription_cycles: T.nilable(Integer),
|
|
80
125
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
81
126
|
usage_limit: T.nilable(Integer),
|
|
@@ -91,21 +136,34 @@ module Dodopayments
|
|
|
91
136
|
amount: nil,
|
|
92
137
|
# If present, update the discount code (uppercase).
|
|
93
138
|
code: nil,
|
|
139
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
140
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
141
|
+
currency_options: nil,
|
|
142
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
143
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
144
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
145
|
+
customer_eligibility: nil,
|
|
94
146
|
expires_at: nil,
|
|
95
147
|
# Additional metadata for the discount
|
|
96
148
|
metadata: nil,
|
|
97
149
|
name: nil,
|
|
150
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
151
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
152
|
+
# this patch) when both are set.
|
|
153
|
+
per_customer_usage_limit: nil,
|
|
98
154
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
99
155
|
# not provided, the existing value is kept.
|
|
100
156
|
preserve_on_plan_change: nil,
|
|
101
157
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
102
158
|
# restrictions, send empty array
|
|
103
159
|
restricted_to: nil,
|
|
160
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
161
|
+
starts_at: nil,
|
|
104
162
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
105
163
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
106
164
|
# related to the subscription.
|
|
107
165
|
subscription_cycles: nil,
|
|
108
|
-
# If present, update the discount type
|
|
166
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
109
167
|
type: nil,
|
|
110
168
|
usage_limit: nil,
|
|
111
169
|
request_options: {}
|
|
@@ -118,12 +176,22 @@ module Dodopayments
|
|
|
118
176
|
discount_id: String,
|
|
119
177
|
amount: T.nilable(Integer),
|
|
120
178
|
code: T.nilable(String),
|
|
179
|
+
currency_options:
|
|
180
|
+
T.nilable(
|
|
181
|
+
T::Array[Dodopayments::DiscountUpdateParams::CurrencyOption]
|
|
182
|
+
),
|
|
183
|
+
customer_eligibility:
|
|
184
|
+
T.nilable(
|
|
185
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
186
|
+
),
|
|
121
187
|
expires_at: T.nilable(Time),
|
|
122
188
|
metadata:
|
|
123
189
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
124
190
|
name: T.nilable(String),
|
|
191
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
125
192
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
126
193
|
restricted_to: T.nilable(T::Array[String]),
|
|
194
|
+
starts_at: T.nilable(Time),
|
|
127
195
|
subscription_cycles: T.nilable(Integer),
|
|
128
196
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
129
197
|
usage_limit: T.nilable(Integer),
|
|
@@ -133,6 +201,129 @@ module Dodopayments
|
|
|
133
201
|
end
|
|
134
202
|
def to_hash
|
|
135
203
|
end
|
|
204
|
+
|
|
205
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
206
|
+
OrHash =
|
|
207
|
+
T.type_alias do
|
|
208
|
+
T.any(
|
|
209
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption,
|
|
210
|
+
Dodopayments::Internal::AnyHash
|
|
211
|
+
)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# The currency this option applies to.
|
|
215
|
+
sig { returns(Dodopayments::Currency::OrSymbol) }
|
|
216
|
+
attr_accessor :currency
|
|
217
|
+
|
|
218
|
+
# Whether this row is the default to convert from for unconfigured currencies. At
|
|
219
|
+
# most one row per discount may be default.
|
|
220
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
221
|
+
attr_reader :is_default
|
|
222
|
+
|
|
223
|
+
sig { params(is_default: T::Boolean).void }
|
|
224
|
+
attr_writer :is_default
|
|
225
|
+
|
|
226
|
+
# The most this code discounts in this currency's subunits. For `flat` codes this
|
|
227
|
+
# is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
|
|
228
|
+
# if provided.
|
|
229
|
+
sig { returns(T.nilable(Integer)) }
|
|
230
|
+
attr_accessor :max_amount_possible
|
|
231
|
+
|
|
232
|
+
# Eligible-cart threshold in this currency's subunits (0 = no minimum).
|
|
233
|
+
sig { returns(T.nilable(Integer)) }
|
|
234
|
+
attr_reader :minimum_subtotal
|
|
235
|
+
|
|
236
|
+
sig { params(minimum_subtotal: Integer).void }
|
|
237
|
+
attr_writer :minimum_subtotal
|
|
238
|
+
|
|
239
|
+
# A per-currency discount option (request shape).
|
|
240
|
+
#
|
|
241
|
+
# `max_amount_possible` is the most this code discounts in this currency — the
|
|
242
|
+
# flat deduction for `flat` codes, or the max-discount cap for `percentage` codes.
|
|
243
|
+
# Maps to the DB column of the same name.
|
|
244
|
+
sig do
|
|
245
|
+
params(
|
|
246
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
247
|
+
is_default: T::Boolean,
|
|
248
|
+
max_amount_possible: T.nilable(Integer),
|
|
249
|
+
minimum_subtotal: Integer
|
|
250
|
+
).returns(T.attached_class)
|
|
251
|
+
end
|
|
252
|
+
def self.new(
|
|
253
|
+
# The currency this option applies to.
|
|
254
|
+
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
|
+
is_default: nil,
|
|
258
|
+
# The most this code discounts in this currency's subunits. For `flat` codes this
|
|
259
|
+
# is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
|
|
260
|
+
# if provided.
|
|
261
|
+
max_amount_possible: nil,
|
|
262
|
+
# Eligible-cart threshold in this currency's subunits (0 = no minimum).
|
|
263
|
+
minimum_subtotal: nil
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
sig do
|
|
268
|
+
override.returns(
|
|
269
|
+
{
|
|
270
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
271
|
+
is_default: T::Boolean,
|
|
272
|
+
max_amount_possible: T.nilable(Integer),
|
|
273
|
+
minimum_subtotal: Integer
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
end
|
|
277
|
+
def to_hash
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
282
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
283
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
284
|
+
module CustomerEligibility
|
|
285
|
+
extend Dodopayments::Internal::Type::Enum
|
|
286
|
+
|
|
287
|
+
TaggedSymbol =
|
|
288
|
+
T.type_alias do
|
|
289
|
+
T.all(
|
|
290
|
+
Symbol,
|
|
291
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility
|
|
292
|
+
)
|
|
293
|
+
end
|
|
294
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
295
|
+
|
|
296
|
+
ANY =
|
|
297
|
+
T.let(
|
|
298
|
+
:any,
|
|
299
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
300
|
+
)
|
|
301
|
+
FIRST_TIME =
|
|
302
|
+
T.let(
|
|
303
|
+
:first_time,
|
|
304
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
305
|
+
)
|
|
306
|
+
EXISTING =
|
|
307
|
+
T.let(
|
|
308
|
+
:existing,
|
|
309
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
310
|
+
)
|
|
311
|
+
SPECIFIC =
|
|
312
|
+
T.let(
|
|
313
|
+
:specific,
|
|
314
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
sig do
|
|
318
|
+
override.returns(
|
|
319
|
+
T::Array[
|
|
320
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::TaggedSymbol
|
|
321
|
+
]
|
|
322
|
+
)
|
|
323
|
+
end
|
|
324
|
+
def self.values
|
|
325
|
+
end
|
|
326
|
+
end
|
|
136
327
|
end
|
|
137
328
|
end
|
|
138
329
|
end
|