dodopayments 2.20.1 → 2.22.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 +30 -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 +4 -2
- data/lib/dodopayments/models/payment_list_params.rb +169 -3
- data/lib/dodopayments/models/payment_method_types.rb +0 -1
- data/lib/dodopayments/models/payout_created_webhook_event.rb +188 -0
- data/lib/dodopayments/models/payout_failed_webhook_event.rb +188 -0
- data/lib/dodopayments/models/payout_in_progress_webhook_event.rb +188 -0
- data/lib/dodopayments/models/payout_on_hold_webhook_event.rb +188 -0
- data/lib/dodopayments/models/payout_success_webhook_event.rb +188 -0
- 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_response.rb +11 -1
- data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +11 -1
- data/lib/dodopayments/models/unwrap_webhook_event.rb +11 -1
- data/lib/dodopayments/models/webhook_event_type.rb +1 -1
- data/lib/dodopayments/models/webhook_payload.rb +160 -3
- data/lib/dodopayments/models.rb +10 -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 +7 -2
- data/lib/dodopayments/resources/webhooks.rb +2 -2
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +5 -0
- data/rbi/dodopayments/models/checkout_session_preview_response.rbi +33 -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 +6 -2
- data/rbi/dodopayments/models/payment_list_params.rbi +331 -2
- data/rbi/dodopayments/models/payment_method_types.rbi +0 -1
- data/rbi/dodopayments/models/payout_created_webhook_event.rbi +270 -0
- data/rbi/dodopayments/models/payout_failed_webhook_event.rbi +270 -0
- data/rbi/dodopayments/models/payout_in_progress_webhook_event.rbi +272 -0
- data/rbi/dodopayments/models/payout_on_hold_webhook_event.rbi +270 -0
- data/rbi/dodopayments/models/payout_success_webhook_event.rbi +270 -0
- 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_response.rbi +15 -3
- data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +5 -0
- data/rbi/dodopayments/models/unwrap_webhook_event.rbi +5 -0
- data/rbi/dodopayments/models/webhook_event_type.rbi +2 -5
- data/rbi/dodopayments/models/webhook_payload.rbi +213 -0
- data/rbi/dodopayments/models.rbi +11 -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 +5 -1
- data/rbi/dodopayments/resources/webhooks.rbi +10 -0
- data/sig/dodopayments/models/checkout_session_preview_response.rbs +13 -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_list_params.rbs +308 -0
- data/sig/dodopayments/models/payment_method_types.rbs +0 -2
- data/sig/dodopayments/models/payout_created_webhook_event.rbs +137 -0
- data/sig/dodopayments/models/payout_failed_webhook_event.rbs +137 -0
- data/sig/dodopayments/models/payout_in_progress_webhook_event.rbs +137 -0
- data/sig/dodopayments/models/payout_on_hold_webhook_event.rbs +137 -0
- data/sig/dodopayments/models/payout_success_webhook_event.rbs +137 -0
- 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_response.rbs +8 -3
- data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +5 -0
- data/sig/dodopayments/models/unwrap_webhook_event.rbs +5 -0
- data/sig/dodopayments/models/webhook_event_type.rbs +2 -2
- data/sig/dodopayments/models/webhook_payload.rbs +108 -0
- data/sig/dodopayments/models.rbs +10 -0
- data/sig/dodopayments/resources/discounts.rbs +8 -0
- data/sig/dodopayments/resources/payments.rbs +1 -0
- data/sig/dodopayments/resources/webhooks.rbs +10 -0
- metadata +17 -2
|
@@ -20,6 +20,7 @@ module Dodopayments
|
|
|
20
20
|
Dodopayments::WebhookPayload::Data::Refund,
|
|
21
21
|
Dodopayments::WebhookPayload::Data::Dispute,
|
|
22
22
|
Dodopayments::WebhookPayload::Data::LicenseKey,
|
|
23
|
+
Dodopayments::WebhookPayload::Data::Payout,
|
|
23
24
|
Dodopayments::WebhookPayload::Data::CreditLedgerEntry,
|
|
24
25
|
Dodopayments::WebhookPayload::Data::CreditBalanceLow,
|
|
25
26
|
Dodopayments::WebhookPayload::Data::AbandonedCheckout,
|
|
@@ -49,6 +50,7 @@ module Dodopayments
|
|
|
49
50
|
Dodopayments::WebhookPayload::Data::Refund::OrHash,
|
|
50
51
|
Dodopayments::WebhookPayload::Data::Dispute::OrHash,
|
|
51
52
|
Dodopayments::WebhookPayload::Data::LicenseKey::OrHash,
|
|
53
|
+
Dodopayments::WebhookPayload::Data::Payout::OrHash,
|
|
52
54
|
Dodopayments::WebhookPayload::Data::CreditLedgerEntry::OrHash,
|
|
53
55
|
Dodopayments::WebhookPayload::Data::CreditBalanceLow::OrHash,
|
|
54
56
|
Dodopayments::WebhookPayload::Data::AbandonedCheckout::OrHash,
|
|
@@ -82,6 +84,7 @@ module Dodopayments
|
|
|
82
84
|
Dodopayments::WebhookPayload::Data::Refund,
|
|
83
85
|
Dodopayments::WebhookPayload::Data::Dispute,
|
|
84
86
|
Dodopayments::WebhookPayload::Data::LicenseKey,
|
|
87
|
+
Dodopayments::WebhookPayload::Data::Payout,
|
|
85
88
|
Dodopayments::WebhookPayload::Data::CreditLedgerEntry,
|
|
86
89
|
Dodopayments::WebhookPayload::Data::CreditBalanceLow,
|
|
87
90
|
Dodopayments::WebhookPayload::Data::AbandonedCheckout,
|
|
@@ -108,6 +111,7 @@ module Dodopayments
|
|
|
108
111
|
Dodopayments::WebhookPayload::Data::Refund,
|
|
109
112
|
Dodopayments::WebhookPayload::Data::Dispute,
|
|
110
113
|
Dodopayments::WebhookPayload::Data::LicenseKey,
|
|
114
|
+
Dodopayments::WebhookPayload::Data::Payout,
|
|
111
115
|
Dodopayments::WebhookPayload::Data::CreditLedgerEntry,
|
|
112
116
|
Dodopayments::WebhookPayload::Data::CreditBalanceLow,
|
|
113
117
|
Dodopayments::WebhookPayload::Data::AbandonedCheckout,
|
|
@@ -222,6 +226,215 @@ module Dodopayments
|
|
|
222
226
|
end
|
|
223
227
|
end
|
|
224
228
|
|
|
229
|
+
class Payout < Dodopayments::Internal::Type::BaseModel
|
|
230
|
+
OrHash =
|
|
231
|
+
T.type_alias do
|
|
232
|
+
T.any(
|
|
233
|
+
Dodopayments::WebhookPayload::Data::Payout,
|
|
234
|
+
Dodopayments::Internal::AnyHash
|
|
235
|
+
)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# The total amount of the payout.
|
|
239
|
+
sig { returns(Integer) }
|
|
240
|
+
attr_accessor :amount
|
|
241
|
+
|
|
242
|
+
# The unique identifier of the business associated with the payout.
|
|
243
|
+
sig { returns(String) }
|
|
244
|
+
attr_accessor :business_id
|
|
245
|
+
|
|
246
|
+
# The total value of chargebacks associated with the payout.
|
|
247
|
+
sig { returns(Integer) }
|
|
248
|
+
attr_accessor :chargebacks
|
|
249
|
+
|
|
250
|
+
# The timestamp when the payout was created, in UTC.
|
|
251
|
+
sig { returns(Time) }
|
|
252
|
+
attr_accessor :created_at
|
|
253
|
+
|
|
254
|
+
# The currency of the payout, represented as an ISO 4217 currency code.
|
|
255
|
+
sig { returns(Dodopayments::Currency::OrSymbol) }
|
|
256
|
+
attr_accessor :currency
|
|
257
|
+
|
|
258
|
+
# The fee charged for processing the payout.
|
|
259
|
+
sig { returns(Integer) }
|
|
260
|
+
attr_accessor :fee
|
|
261
|
+
|
|
262
|
+
sig { returns(Symbol) }
|
|
263
|
+
attr_accessor :payload_type
|
|
264
|
+
|
|
265
|
+
# The payment method used for the payout (e.g., bank transfer, card, etc.).
|
|
266
|
+
sig { returns(String) }
|
|
267
|
+
attr_accessor :payment_method
|
|
268
|
+
|
|
269
|
+
# The unique identifier of the payout.
|
|
270
|
+
sig { returns(String) }
|
|
271
|
+
attr_accessor :payout_id
|
|
272
|
+
|
|
273
|
+
# The total value of refunds associated with the payout.
|
|
274
|
+
sig { returns(Integer) }
|
|
275
|
+
attr_accessor :refunds
|
|
276
|
+
|
|
277
|
+
# The current status of the payout.
|
|
278
|
+
sig do
|
|
279
|
+
returns(
|
|
280
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::OrSymbol
|
|
281
|
+
)
|
|
282
|
+
end
|
|
283
|
+
attr_accessor :status
|
|
284
|
+
|
|
285
|
+
# The tax applied to the payout.
|
|
286
|
+
sig { returns(Integer) }
|
|
287
|
+
attr_accessor :tax
|
|
288
|
+
|
|
289
|
+
# The timestamp when the payout was last updated, in UTC.
|
|
290
|
+
sig { returns(Time) }
|
|
291
|
+
attr_accessor :updated_at
|
|
292
|
+
|
|
293
|
+
# The name of the payout recipient or purpose.
|
|
294
|
+
sig { returns(T.nilable(String)) }
|
|
295
|
+
attr_accessor :name
|
|
296
|
+
|
|
297
|
+
# The URL of the document associated with the payout.
|
|
298
|
+
sig { returns(T.nilable(String)) }
|
|
299
|
+
attr_accessor :payout_document_url
|
|
300
|
+
|
|
301
|
+
# Any additional remarks or notes associated with the payout.
|
|
302
|
+
sig { returns(T.nilable(String)) }
|
|
303
|
+
attr_accessor :remarks
|
|
304
|
+
|
|
305
|
+
sig do
|
|
306
|
+
params(
|
|
307
|
+
amount: Integer,
|
|
308
|
+
business_id: String,
|
|
309
|
+
chargebacks: Integer,
|
|
310
|
+
created_at: Time,
|
|
311
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
312
|
+
fee: Integer,
|
|
313
|
+
payment_method: String,
|
|
314
|
+
payout_id: String,
|
|
315
|
+
refunds: Integer,
|
|
316
|
+
status:
|
|
317
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::OrSymbol,
|
|
318
|
+
tax: Integer,
|
|
319
|
+
updated_at: Time,
|
|
320
|
+
name: T.nilable(String),
|
|
321
|
+
payout_document_url: T.nilable(String),
|
|
322
|
+
remarks: T.nilable(String),
|
|
323
|
+
payload_type: Symbol
|
|
324
|
+
).returns(T.attached_class)
|
|
325
|
+
end
|
|
326
|
+
def self.new(
|
|
327
|
+
# The total amount of the payout.
|
|
328
|
+
amount:,
|
|
329
|
+
# The unique identifier of the business associated with the payout.
|
|
330
|
+
business_id:,
|
|
331
|
+
# The total value of chargebacks associated with the payout.
|
|
332
|
+
chargebacks:,
|
|
333
|
+
# The timestamp when the payout was created, in UTC.
|
|
334
|
+
created_at:,
|
|
335
|
+
# The currency of the payout, represented as an ISO 4217 currency code.
|
|
336
|
+
currency:,
|
|
337
|
+
# The fee charged for processing the payout.
|
|
338
|
+
fee:,
|
|
339
|
+
# The payment method used for the payout (e.g., bank transfer, card, etc.).
|
|
340
|
+
payment_method:,
|
|
341
|
+
# The unique identifier of the payout.
|
|
342
|
+
payout_id:,
|
|
343
|
+
# The total value of refunds associated with the payout.
|
|
344
|
+
refunds:,
|
|
345
|
+
# The current status of the payout.
|
|
346
|
+
status:,
|
|
347
|
+
# The tax applied to the payout.
|
|
348
|
+
tax:,
|
|
349
|
+
# The timestamp when the payout was last updated, in UTC.
|
|
350
|
+
updated_at:,
|
|
351
|
+
# The name of the payout recipient or purpose.
|
|
352
|
+
name: nil,
|
|
353
|
+
# The URL of the document associated with the payout.
|
|
354
|
+
payout_document_url: nil,
|
|
355
|
+
# Any additional remarks or notes associated with the payout.
|
|
356
|
+
remarks: nil,
|
|
357
|
+
payload_type: :Payout
|
|
358
|
+
)
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
sig do
|
|
362
|
+
override.returns(
|
|
363
|
+
{
|
|
364
|
+
amount: Integer,
|
|
365
|
+
business_id: String,
|
|
366
|
+
chargebacks: Integer,
|
|
367
|
+
created_at: Time,
|
|
368
|
+
currency: Dodopayments::Currency::OrSymbol,
|
|
369
|
+
fee: Integer,
|
|
370
|
+
payload_type: Symbol,
|
|
371
|
+
payment_method: String,
|
|
372
|
+
payout_id: String,
|
|
373
|
+
refunds: Integer,
|
|
374
|
+
status:
|
|
375
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::OrSymbol,
|
|
376
|
+
tax: Integer,
|
|
377
|
+
updated_at: Time,
|
|
378
|
+
name: T.nilable(String),
|
|
379
|
+
payout_document_url: T.nilable(String),
|
|
380
|
+
remarks: T.nilable(String)
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
end
|
|
384
|
+
def to_hash
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
# The current status of the payout.
|
|
388
|
+
module Status
|
|
389
|
+
extend Dodopayments::Internal::Type::Enum
|
|
390
|
+
|
|
391
|
+
TaggedSymbol =
|
|
392
|
+
T.type_alias do
|
|
393
|
+
T.all(
|
|
394
|
+
Symbol,
|
|
395
|
+
Dodopayments::WebhookPayload::Data::Payout::Status
|
|
396
|
+
)
|
|
397
|
+
end
|
|
398
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
399
|
+
|
|
400
|
+
NOT_INITIATED =
|
|
401
|
+
T.let(
|
|
402
|
+
:not_initiated,
|
|
403
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
404
|
+
)
|
|
405
|
+
IN_PROGRESS =
|
|
406
|
+
T.let(
|
|
407
|
+
:in_progress,
|
|
408
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
409
|
+
)
|
|
410
|
+
ON_HOLD =
|
|
411
|
+
T.let(
|
|
412
|
+
:on_hold,
|
|
413
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
414
|
+
)
|
|
415
|
+
FAILED =
|
|
416
|
+
T.let(
|
|
417
|
+
:failed,
|
|
418
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
419
|
+
)
|
|
420
|
+
SUCCESS =
|
|
421
|
+
T.let(
|
|
422
|
+
:success,
|
|
423
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
sig do
|
|
427
|
+
override.returns(
|
|
428
|
+
T::Array[
|
|
429
|
+
Dodopayments::WebhookPayload::Data::Payout::Status::TaggedSymbol
|
|
430
|
+
]
|
|
431
|
+
)
|
|
432
|
+
end
|
|
433
|
+
def self.values
|
|
434
|
+
end
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
|
|
225
438
|
class CreditLedgerEntry < Dodopayments::Models::CreditEntitlements::CreditLedgerEntry
|
|
226
439
|
OrHash =
|
|
227
440
|
T.type_alias do
|
data/rbi/dodopayments/models.rbi
CHANGED
|
@@ -381,10 +381,21 @@ module Dodopayments
|
|
|
381
381
|
PaymentSucceededWebhookEvent =
|
|
382
382
|
Dodopayments::Models::PaymentSucceededWebhookEvent
|
|
383
383
|
|
|
384
|
+
PayoutCreatedWebhookEvent = Dodopayments::Models::PayoutCreatedWebhookEvent
|
|
385
|
+
|
|
386
|
+
PayoutFailedWebhookEvent = Dodopayments::Models::PayoutFailedWebhookEvent
|
|
387
|
+
|
|
388
|
+
PayoutInProgressWebhookEvent =
|
|
389
|
+
Dodopayments::Models::PayoutInProgressWebhookEvent
|
|
390
|
+
|
|
384
391
|
PayoutListParams = Dodopayments::Models::PayoutListParams
|
|
385
392
|
|
|
393
|
+
PayoutOnHoldWebhookEvent = Dodopayments::Models::PayoutOnHoldWebhookEvent
|
|
394
|
+
|
|
386
395
|
Payouts = Dodopayments::Models::Payouts
|
|
387
396
|
|
|
397
|
+
PayoutSuccessWebhookEvent = Dodopayments::Models::PayoutSuccessWebhookEvent
|
|
398
|
+
|
|
388
399
|
Price = Dodopayments::Models::Price
|
|
389
400
|
|
|
390
401
|
Product = Dodopayments::Models::Product
|
|
@@ -134,7 +134,9 @@ module Dodopayments
|
|
|
134
134
|
customer_id,
|
|
135
135
|
# Path param: Credit Entitlement ID
|
|
136
136
|
credit_entitlement_id:,
|
|
137
|
-
# Body param: Amount to credit or debit
|
|
137
|
+
# Body param: Amount to credit or debit. Bounded to a `NUMERIC(38,28)` column, so
|
|
138
|
+
# the integer part must have fewer than 10 digits (< 10^10); larger values
|
|
139
|
+
# previously reached the DB and failed with a 22003 overflow surfaced as a 500.
|
|
138
140
|
amount:,
|
|
139
141
|
# Body param: Entry type: credit or debit
|
|
140
142
|
entry_type:,
|
|
@@ -10,11 +10,23 @@ module Dodopayments
|
|
|
10
10
|
amount: Integer,
|
|
11
11
|
type: Dodopayments::DiscountType::OrSymbol,
|
|
12
12
|
code: T.nilable(String),
|
|
13
|
+
currency_options:
|
|
14
|
+
T.nilable(
|
|
15
|
+
T::Array[
|
|
16
|
+
Dodopayments::DiscountCreateParams::CurrencyOption::OrHash
|
|
17
|
+
]
|
|
18
|
+
),
|
|
19
|
+
customer_eligibility:
|
|
20
|
+
T.nilable(
|
|
21
|
+
Dodopayments::DiscountCreateParams::CustomerEligibility::OrSymbol
|
|
22
|
+
),
|
|
13
23
|
expires_at: T.nilable(Time),
|
|
14
24
|
metadata: T::Hash[Symbol, Dodopayments::MetadataItem::Variants],
|
|
15
25
|
name: T.nilable(String),
|
|
26
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
16
27
|
preserve_on_plan_change: T::Boolean,
|
|
17
28
|
restricted_to: T.nilable(T::Array[String]),
|
|
29
|
+
starts_at: T.nilable(Time),
|
|
18
30
|
subscription_cycles: T.nilable(Integer),
|
|
19
31
|
usage_limit: T.nilable(Integer),
|
|
20
32
|
request_options: Dodopayments::RequestOptions::OrHash
|
|
@@ -26,23 +38,38 @@ module Dodopayments
|
|
|
26
38
|
#
|
|
27
39
|
# Must be at least 1.
|
|
28
40
|
amount:,
|
|
29
|
-
# The discount type
|
|
41
|
+
# The discount type: `percentage` or `flat` (`flat_per_unit` stays blocked).
|
|
30
42
|
type:,
|
|
31
43
|
# Optionally supply a code (will be uppercased).
|
|
32
44
|
#
|
|
33
45
|
# - Must be at least 3 characters if provided.
|
|
34
46
|
# - If omitted, a random 16-character code is generated.
|
|
35
47
|
code: nil,
|
|
48
|
+
# Per-currency options (flat deduction / percentage cap + minimum subtotal).
|
|
49
|
+
# Required for `flat` codes (must include a resolvable default); optional
|
|
50
|
+
# per-currency caps for `percentage` codes. Per-row invariants are checked in
|
|
51
|
+
# `normalize_currency_options`, not via `#[validate(nested)]`.
|
|
52
|
+
currency_options: nil,
|
|
53
|
+
# Who may redeem this discount code. Defaults to `any` (unrestricted). `specific`
|
|
54
|
+
# starts with zero attached customers (fails closed) until customers are attached
|
|
55
|
+
# via `POST /discounts/{id}/customers`.
|
|
56
|
+
customer_eligibility: nil,
|
|
36
57
|
# When the discount expires, if ever.
|
|
37
58
|
expires_at: nil,
|
|
38
59
|
# Additional metadata for the discount
|
|
39
60
|
metadata: nil,
|
|
40
61
|
name: nil,
|
|
62
|
+
# Maximum number of times a single customer may redeem this discount. Must be
|
|
63
|
+
# `<= usage_limit` when both are set.
|
|
64
|
+
per_customer_usage_limit: nil,
|
|
41
65
|
# Whether this discount should be preserved when a subscription changes plans.
|
|
42
66
|
# Default: false (discount is removed on plan change)
|
|
43
67
|
preserve_on_plan_change: nil,
|
|
44
68
|
# List of product IDs to restrict usage (if any).
|
|
45
69
|
restricted_to: nil,
|
|
70
|
+
# When the discount becomes active, if scheduled for the future. NULL = active
|
|
71
|
+
# immediately. Must be strictly before `expires_at` when both are set.
|
|
72
|
+
starts_at: nil,
|
|
46
73
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
47
74
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
48
75
|
# related to the subscription.
|
|
@@ -73,12 +100,24 @@ module Dodopayments
|
|
|
73
100
|
discount_id: String,
|
|
74
101
|
amount: T.nilable(Integer),
|
|
75
102
|
code: T.nilable(String),
|
|
103
|
+
currency_options:
|
|
104
|
+
T.nilable(
|
|
105
|
+
T::Array[
|
|
106
|
+
Dodopayments::DiscountUpdateParams::CurrencyOption::OrHash
|
|
107
|
+
]
|
|
108
|
+
),
|
|
109
|
+
customer_eligibility:
|
|
110
|
+
T.nilable(
|
|
111
|
+
Dodopayments::DiscountUpdateParams::CustomerEligibility::OrSymbol
|
|
112
|
+
),
|
|
76
113
|
expires_at: T.nilable(Time),
|
|
77
114
|
metadata:
|
|
78
115
|
T.nilable(T::Hash[Symbol, Dodopayments::MetadataItem::Variants]),
|
|
79
116
|
name: T.nilable(String),
|
|
117
|
+
per_customer_usage_limit: T.nilable(Integer),
|
|
80
118
|
preserve_on_plan_change: T.nilable(T::Boolean),
|
|
81
119
|
restricted_to: T.nilable(T::Array[String]),
|
|
120
|
+
starts_at: T.nilable(Time),
|
|
82
121
|
subscription_cycles: T.nilable(Integer),
|
|
83
122
|
type: T.nilable(Dodopayments::DiscountType::OrSymbol),
|
|
84
123
|
usage_limit: T.nilable(Integer),
|
|
@@ -95,21 +134,34 @@ module Dodopayments
|
|
|
95
134
|
amount: nil,
|
|
96
135
|
# If present, update the discount code (uppercase).
|
|
97
136
|
code: nil,
|
|
137
|
+
# If present, fully replaces the discount's currency options (replace-set
|
|
138
|
+
# semantics, like `restricted_to`). Send an empty array to clear them.
|
|
139
|
+
currency_options: nil,
|
|
140
|
+
# If present, update who may redeem this discount. Plain field (not
|
|
141
|
+
# double-option): the DB column is `NOT NULL`, so it can never be cleared back to
|
|
142
|
+
# unset, only changed to another `CustomerEligibility` value.
|
|
143
|
+
customer_eligibility: nil,
|
|
98
144
|
expires_at: nil,
|
|
99
145
|
# Additional metadata for the discount
|
|
100
146
|
metadata: nil,
|
|
101
147
|
name: nil,
|
|
148
|
+
# If present, update the per-customer usage limit (double-option: send `null` to
|
|
149
|
+
# clear it back to unlimited). Must be `<= usage_limit` (the value in effect after
|
|
150
|
+
# this patch) when both are set.
|
|
151
|
+
per_customer_usage_limit: nil,
|
|
102
152
|
# Whether this discount should be preserved when a subscription changes plans. If
|
|
103
153
|
# not provided, the existing value is kept.
|
|
104
154
|
preserve_on_plan_change: nil,
|
|
105
155
|
# If present, replaces all restricted product IDs with this new set. To remove all
|
|
106
156
|
# restrictions, send empty array
|
|
107
157
|
restricted_to: nil,
|
|
158
|
+
# If present, update `starts_at` (double-option: send `null` to clear it).
|
|
159
|
+
starts_at: nil,
|
|
108
160
|
# Number of subscription billing cycles this discount is valid for. If not
|
|
109
161
|
# provided, the discount will be applied indefinitely to all recurring payments
|
|
110
162
|
# related to the subscription.
|
|
111
163
|
subscription_cycles: nil,
|
|
112
|
-
# If present, update the discount type
|
|
164
|
+
# If present, update the discount type (`percentage` or `flat`).
|
|
113
165
|
type: nil,
|
|
114
166
|
usage_limit: nil,
|
|
115
167
|
request_options: {}
|
|
@@ -133,7 +185,9 @@ module Dodopayments
|
|
|
133
185
|
)
|
|
134
186
|
end
|
|
135
187
|
def list(
|
|
136
|
-
# Filter by active status
|
|
188
|
+
# Filter by active status. `true` = currently redeemable (started, not expired,
|
|
189
|
+
# not usage-exhausted). `false` = not currently redeemable (expired,
|
|
190
|
+
# usage-exhausted, or pending a future `starts_at`).
|
|
137
191
|
active: nil,
|
|
138
192
|
# Filter by discount code (partial match, case-insensitive)
|
|
139
193
|
code: nil,
|
|
@@ -112,6 +112,7 @@ module Dodopayments
|
|
|
112
112
|
brand_id: String,
|
|
113
113
|
created_at_gte: Time,
|
|
114
114
|
created_at_lte: Time,
|
|
115
|
+
currency: Dodopayments::PaymentListParams::Currency::OrSymbol,
|
|
115
116
|
customer_id: String,
|
|
116
117
|
page_number: Integer,
|
|
117
118
|
page_size: Integer,
|
|
@@ -132,9 +133,12 @@ module Dodopayments
|
|
|
132
133
|
created_at_gte: nil,
|
|
133
134
|
# Get events created before this time
|
|
134
135
|
created_at_lte: nil,
|
|
136
|
+
# Filter by currency
|
|
137
|
+
currency: nil,
|
|
135
138
|
# Filter by customer id
|
|
136
139
|
customer_id: nil,
|
|
137
|
-
# Page number default is 0
|
|
140
|
+
# Page number default is 0. Capped to bound OFFSET-based deep pagination, which
|
|
141
|
+
# forces Postgres to scan and discard every preceding row.
|
|
138
142
|
page_number: nil,
|
|
139
143
|
# Page size default is 10 max is 100
|
|
140
144
|
page_size: nil,
|
|
@@ -173,6 +173,11 @@ module Dodopayments
|
|
|
173
173
|
Dodopayments::PaymentFailedWebhookEvent,
|
|
174
174
|
Dodopayments::PaymentProcessingWebhookEvent,
|
|
175
175
|
Dodopayments::PaymentSucceededWebhookEvent,
|
|
176
|
+
Dodopayments::PayoutCreatedWebhookEvent,
|
|
177
|
+
Dodopayments::PayoutFailedWebhookEvent,
|
|
178
|
+
Dodopayments::PayoutInProgressWebhookEvent,
|
|
179
|
+
Dodopayments::PayoutOnHoldWebhookEvent,
|
|
180
|
+
Dodopayments::PayoutSuccessWebhookEvent,
|
|
176
181
|
Dodopayments::RefundFailedWebhookEvent,
|
|
177
182
|
Dodopayments::RefundSucceededWebhookEvent,
|
|
178
183
|
Dodopayments::SubscriptionActiveWebhookEvent,
|
|
@@ -229,6 +234,11 @@ module Dodopayments
|
|
|
229
234
|
Dodopayments::PaymentFailedWebhookEvent,
|
|
230
235
|
Dodopayments::PaymentProcessingWebhookEvent,
|
|
231
236
|
Dodopayments::PaymentSucceededWebhookEvent,
|
|
237
|
+
Dodopayments::PayoutCreatedWebhookEvent,
|
|
238
|
+
Dodopayments::PayoutFailedWebhookEvent,
|
|
239
|
+
Dodopayments::PayoutInProgressWebhookEvent,
|
|
240
|
+
Dodopayments::PayoutOnHoldWebhookEvent,
|
|
241
|
+
Dodopayments::PayoutSuccessWebhookEvent,
|
|
232
242
|
Dodopayments::RefundFailedWebhookEvent,
|
|
233
243
|
Dodopayments::RefundSucceededWebhookEvent,
|
|
234
244
|
Dodopayments::SubscriptionActiveWebhookEvent,
|
|
@@ -13,7 +13,9 @@ module Dodopayments
|
|
|
13
13
|
tax_id_business_name: String?,
|
|
14
14
|
tax_id_err_msg: String?,
|
|
15
15
|
tax_id_format_name: String?,
|
|
16
|
-
total_tax: Integer
|
|
16
|
+
total_tax: Integer?,
|
|
17
|
+
trial_amount: Integer?,
|
|
18
|
+
trial_period_days: Integer?
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
class CheckoutSessionPreviewResponse < Dodopayments::Internal::Type::BaseModel
|
|
@@ -41,6 +43,10 @@ module Dodopayments
|
|
|
41
43
|
|
|
42
44
|
attr_accessor total_tax: Integer?
|
|
43
45
|
|
|
46
|
+
attr_accessor trial_amount: Integer?
|
|
47
|
+
|
|
48
|
+
attr_accessor trial_period_days: Integer?
|
|
49
|
+
|
|
44
50
|
def initialize: (
|
|
45
51
|
billing_country: Dodopayments::Models::country_code,
|
|
46
52
|
currency: Dodopayments::Models::currency,
|
|
@@ -53,7 +59,9 @@ module Dodopayments
|
|
|
53
59
|
?tax_id_business_name: String?,
|
|
54
60
|
?tax_id_err_msg: String?,
|
|
55
61
|
?tax_id_format_name: String?,
|
|
56
|
-
?total_tax: Integer
|
|
62
|
+
?total_tax: Integer?,
|
|
63
|
+
?trial_amount: Integer?,
|
|
64
|
+
?trial_period_days: Integer?
|
|
57
65
|
) -> void
|
|
58
66
|
|
|
59
67
|
def to_hash: -> {
|
|
@@ -68,7 +76,9 @@ module Dodopayments
|
|
|
68
76
|
tax_id_business_name: String?,
|
|
69
77
|
tax_id_err_msg: String?,
|
|
70
78
|
tax_id_format_name: String?,
|
|
71
|
-
total_tax: Integer
|
|
79
|
+
total_tax: Integer?,
|
|
80
|
+
trial_amount: Integer?,
|
|
81
|
+
trial_period_days: Integer?
|
|
72
82
|
}
|
|
73
83
|
|
|
74
84
|
type current_breakup =
|
|
@@ -6,14 +6,18 @@ module Dodopayments
|
|
|
6
6
|
business_id: String,
|
|
7
7
|
code: String,
|
|
8
8
|
created_at: Time,
|
|
9
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
9
10
|
discount_id: String,
|
|
10
11
|
metadata: Dodopayments::Models::metadata,
|
|
11
12
|
preserve_on_plan_change: bool,
|
|
12
13
|
restricted_to: ::Array[String],
|
|
13
14
|
times_used: Integer,
|
|
14
15
|
type: Dodopayments::Models::discount_type,
|
|
16
|
+
currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
15
17
|
expires_at: Time?,
|
|
16
18
|
name: String?,
|
|
19
|
+
per_customer_usage_limit: Integer?,
|
|
20
|
+
starts_at: Time?,
|
|
17
21
|
subscription_cycles: Integer?,
|
|
18
22
|
usage_limit: Integer?
|
|
19
23
|
}
|
|
@@ -27,6 +31,8 @@ module Dodopayments
|
|
|
27
31
|
|
|
28
32
|
attr_accessor created_at: Time
|
|
29
33
|
|
|
34
|
+
attr_accessor customer_eligibility: Dodopayments::Models::Discount::customer_eligibility
|
|
35
|
+
|
|
30
36
|
attr_accessor discount_id: String
|
|
31
37
|
|
|
32
38
|
attr_accessor metadata: Dodopayments::Models::metadata
|
|
@@ -39,10 +45,20 @@ module Dodopayments
|
|
|
39
45
|
|
|
40
46
|
attr_accessor type: Dodopayments::Models::discount_type
|
|
41
47
|
|
|
48
|
+
attr_reader currency_options: ::Array[Dodopayments::Discount::CurrencyOption]?
|
|
49
|
+
|
|
50
|
+
def currency_options=: (
|
|
51
|
+
::Array[Dodopayments::Discount::CurrencyOption]
|
|
52
|
+
) -> ::Array[Dodopayments::Discount::CurrencyOption]
|
|
53
|
+
|
|
42
54
|
attr_accessor expires_at: Time?
|
|
43
55
|
|
|
44
56
|
attr_accessor name: String?
|
|
45
57
|
|
|
58
|
+
attr_accessor per_customer_usage_limit: Integer?
|
|
59
|
+
|
|
60
|
+
attr_accessor starts_at: Time?
|
|
61
|
+
|
|
46
62
|
attr_accessor subscription_cycles: Integer?
|
|
47
63
|
|
|
48
64
|
attr_accessor usage_limit: Integer?
|
|
@@ -52,14 +68,18 @@ module Dodopayments
|
|
|
52
68
|
business_id: String,
|
|
53
69
|
code: String,
|
|
54
70
|
created_at: Time,
|
|
71
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
55
72
|
discount_id: String,
|
|
56
73
|
metadata: Dodopayments::Models::metadata,
|
|
57
74
|
preserve_on_plan_change: bool,
|
|
58
75
|
restricted_to: ::Array[String],
|
|
59
76
|
times_used: Integer,
|
|
60
77
|
type: Dodopayments::Models::discount_type,
|
|
78
|
+
?currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
61
79
|
?expires_at: Time?,
|
|
62
80
|
?name: String?,
|
|
81
|
+
?per_customer_usage_limit: Integer?,
|
|
82
|
+
?starts_at: Time?,
|
|
63
83
|
?subscription_cycles: Integer?,
|
|
64
84
|
?usage_limit: Integer?
|
|
65
85
|
) -> void
|
|
@@ -69,17 +89,66 @@ module Dodopayments
|
|
|
69
89
|
business_id: String,
|
|
70
90
|
code: String,
|
|
71
91
|
created_at: Time,
|
|
92
|
+
customer_eligibility: Dodopayments::Models::Discount::customer_eligibility,
|
|
72
93
|
discount_id: String,
|
|
73
94
|
metadata: Dodopayments::Models::metadata,
|
|
74
95
|
preserve_on_plan_change: bool,
|
|
75
96
|
restricted_to: ::Array[String],
|
|
76
97
|
times_used: Integer,
|
|
77
98
|
type: Dodopayments::Models::discount_type,
|
|
99
|
+
currency_options: ::Array[Dodopayments::Discount::CurrencyOption],
|
|
78
100
|
expires_at: Time?,
|
|
79
101
|
name: String?,
|
|
102
|
+
per_customer_usage_limit: Integer?,
|
|
103
|
+
starts_at: Time?,
|
|
80
104
|
subscription_cycles: Integer?,
|
|
81
105
|
usage_limit: Integer?
|
|
82
106
|
}
|
|
107
|
+
|
|
108
|
+
type customer_eligibility = :any | :first_time | :existing | :specific
|
|
109
|
+
|
|
110
|
+
module CustomerEligibility
|
|
111
|
+
extend Dodopayments::Internal::Type::Enum
|
|
112
|
+
|
|
113
|
+
ANY: :any
|
|
114
|
+
FIRST_TIME: :first_time
|
|
115
|
+
EXISTING: :existing
|
|
116
|
+
SPECIFIC: :specific
|
|
117
|
+
|
|
118
|
+
def self?.values: -> ::Array[Dodopayments::Models::Discount::customer_eligibility]
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
type currency_option =
|
|
122
|
+
{
|
|
123
|
+
currency: Dodopayments::Models::currency,
|
|
124
|
+
is_default: bool,
|
|
125
|
+
minimum_subtotal: Integer,
|
|
126
|
+
max_amount_possible: Integer?
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
class CurrencyOption < Dodopayments::Internal::Type::BaseModel
|
|
130
|
+
attr_accessor currency: Dodopayments::Models::currency
|
|
131
|
+
|
|
132
|
+
attr_accessor is_default: bool
|
|
133
|
+
|
|
134
|
+
attr_accessor minimum_subtotal: Integer
|
|
135
|
+
|
|
136
|
+
attr_accessor max_amount_possible: Integer?
|
|
137
|
+
|
|
138
|
+
def initialize: (
|
|
139
|
+
currency: Dodopayments::Models::currency,
|
|
140
|
+
is_default: bool,
|
|
141
|
+
minimum_subtotal: Integer,
|
|
142
|
+
?max_amount_possible: Integer?
|
|
143
|
+
) -> void
|
|
144
|
+
|
|
145
|
+
def to_hash: -> {
|
|
146
|
+
currency: Dodopayments::Models::currency,
|
|
147
|
+
is_default: bool,
|
|
148
|
+
minimum_subtotal: Integer,
|
|
149
|
+
max_amount_possible: Integer?
|
|
150
|
+
}
|
|
151
|
+
end
|
|
83
152
|
end
|
|
84
153
|
end
|
|
85
154
|
end
|