dodopayments 2.9.1 → 2.10.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 +15 -0
- data/README.md +1 -1
- data/lib/dodopayments/internal/transport/base_client.rb +2 -0
- data/lib/dodopayments/internal/type/union.rb +21 -7
- data/lib/dodopayments/models/abandoned_checkout_detected_webhook_event.rb +4 -16
- data/lib/dodopayments/models/abandoned_checkout_recovered_webhook_event.rb +4 -16
- data/lib/dodopayments/models/checkout_session_request.rb +15 -2
- data/lib/dodopayments/models/credit_added_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_balance_low_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_deducted_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_expired_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_manual_adjustment_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_overage_charged_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_rolled_over_webhook_event.rb +4 -16
- data/lib/dodopayments/models/credit_rollover_forfeited_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_accepted_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_cancelled_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_challenged_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_expired_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_lost_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_opened_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dispute_won_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +4 -16
- data/lib/dodopayments/models/dunning_started_webhook_event.rb +4 -16
- data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +4 -16
- data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +4 -16
- data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +4 -16
- data/lib/dodopayments/models/license_key_created_webhook_event.rb +4 -16
- data/lib/dodopayments/models/payment.rb +153 -3
- data/lib/dodopayments/models/payment_cancelled_webhook_event.rb +4 -16
- data/lib/dodopayments/models/payment_create_params.rb +15 -3
- data/lib/dodopayments/models/payment_create_response.rb +14 -3
- data/lib/dodopayments/models/payment_failed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/payment_processing_webhook_event.rb +4 -16
- data/lib/dodopayments/models/payment_succeeded_webhook_event.rb +4 -16
- data/lib/dodopayments/models/payout_list_response.rb +6 -3
- data/lib/dodopayments/models/price.rb +20 -48
- data/lib/dodopayments/models/product.rb +3 -3
- data/lib/dodopayments/models/product_create_params.rb +3 -3
- data/lib/dodopayments/models/product_item_req.rb +42 -1
- data/lib/dodopayments/models/product_update_params.rb +3 -3
- data/lib/dodopayments/models/refund_failed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/refund_succeeded_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription.rb +153 -5
- data/lib/dodopayments/models/subscription_active_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_create_params.rb +15 -3
- data/lib/dodopayments/models/subscription_create_response.rb +14 -3
- data/lib/dodopayments/models/subscription_expired_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_failed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_list_response.rb +36 -5
- data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +21 -49
- data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +4 -16
- data/lib/dodopayments/models/subscription_update_payment_method_params.rb +12 -30
- data/lib/dodopayments/models/subscription_updated_webhook_event.rb +4 -16
- data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +41 -39
- data/lib/dodopayments/models/unwrap_webhook_event.rb +41 -39
- data/lib/dodopayments/models/update_subscription_plan_req.rb +17 -6
- data/lib/dodopayments/models/webhook_event_type.rb +3 -0
- data/lib/dodopayments/models/webhook_payload.rb +52 -143
- data/lib/dodopayments/resources/checkout_sessions.rb +8 -4
- data/lib/dodopayments/resources/payments.rb +4 -2
- data/lib/dodopayments/resources/subscriptions.rb +12 -6
- data/lib/dodopayments/version.rb +1 -1
- data/rbi/dodopayments/models/abandoned_checkout_detected_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/checkout_session_request.rbi +14 -0
- data/rbi/dodopayments/models/credit_added_webhook_event.rbi +4 -29
- data/rbi/dodopayments/models/credit_balance_low_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/credit_deducted_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/credit_expired_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/credit_manual_adjustment_webhook_event.rbi +4 -39
- data/rbi/dodopayments/models/credit_overage_charged_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/credit_rolled_over_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/credit_rollover_forfeited_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/dispute_accepted_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/dispute_cancelled_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/dispute_challenged_webhook_event.rbi +4 -34
- data/rbi/dodopayments/models/dispute_expired_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/dispute_lost_webhook_event.rbi +4 -29
- data/rbi/dodopayments/models/dispute_opened_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/dispute_won_webhook_event.rbi +4 -29
- data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +4 -39
- data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/license_key_created_webhook_event.rbi +4 -34
- data/rbi/dodopayments/models/payment.rbi +170 -2
- data/rbi/dodopayments/models/payment_cancelled_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/payment_create_params.rbi +14 -2
- data/rbi/dodopayments/models/payment_create_response.rbi +12 -2
- data/rbi/dodopayments/models/payment_failed_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/payment_processing_webhook_event.rbi +4 -34
- data/rbi/dodopayments/models/payment_succeeded_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/price.rbi +18 -90
- data/rbi/dodopayments/models/product_item_req.rbi +74 -3
- data/rbi/dodopayments/models/refund_failed_webhook_event.rbi +4 -31
- data/rbi/dodopayments/models/refund_succeeded_webhook_event.rbi +4 -33
- data/rbi/dodopayments/models/subscription.rbi +173 -4
- data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_create_params.rbi +14 -2
- data/rbi/dodopayments/models/subscription_create_response.rbi +12 -2
- data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_list_response.rbi +67 -4
- data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +4 -40
- data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +18 -123
- data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +12 -96
- data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +4 -36
- data/rbi/dodopayments/models/update_subscription_plan_req.rbi +18 -8
- data/rbi/dodopayments/models/webhook_event_type.rbi +15 -0
- data/rbi/dodopayments/models/webhook_payload.rbi +46 -466
- data/rbi/dodopayments/resources/checkout_sessions.rbi +12 -0
- data/rbi/dodopayments/resources/payments.rbi +6 -1
- data/rbi/dodopayments/resources/subscriptions.rbi +22 -9
- data/sig/dodopayments/models/abandoned_checkout_detected_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
- data/sig/dodopayments/models/credit_added_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_balance_low_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_deducted_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_expired_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_manual_adjustment_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_overage_charged_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_rolled_over_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/credit_rollover_forfeited_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_accepted_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_cancelled_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_challenged_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_expired_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_lost_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_opened_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dispute_won_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/dunning_started_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/license_key_created_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/payment.rbs +97 -0
- data/sig/dodopayments/models/payment_cancelled_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/payment_create_params.rbs +5 -0
- data/sig/dodopayments/models/payment_create_response.rbs +5 -0
- data/sig/dodopayments/models/payment_failed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/payment_processing_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/payment_succeeded_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/price.rbs +15 -45
- data/sig/dodopayments/models/product_item_req.rbs +27 -3
- data/sig/dodopayments/models/refund_failed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/refund_succeeded_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription.rbs +97 -0
- data/sig/dodopayments/models/subscription_active_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
- data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
- data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_list_response.rbs +24 -0
- data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +15 -45
- data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +8 -48
- data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +4 -14
- data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
- data/sig/dodopayments/models/webhook_event_type.rbs +6 -0
- data/sig/dodopayments/models/webhook_payload.rbs +50 -213
- data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
- data/sig/dodopayments/resources/payments.rbs +1 -0
- data/sig/dodopayments/resources/subscriptions.rbs +3 -0
- metadata +2 -2
|
@@ -134,14 +134,18 @@ module Dodopayments
|
|
|
134
134
|
sig { returns(T.nilable(T::Array[Dodopayments::CustomFieldResponse])) }
|
|
135
135
|
attr_accessor :custom_field_responses
|
|
136
136
|
|
|
137
|
-
#
|
|
137
|
+
# DEPRECATED: Use discounts[].cycles_remaining instead.
|
|
138
138
|
sig { returns(T.nilable(Integer)) }
|
|
139
139
|
attr_accessor :discount_cycles_remaining
|
|
140
140
|
|
|
141
|
-
#
|
|
141
|
+
# DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
|
|
142
142
|
sig { returns(T.nilable(String)) }
|
|
143
143
|
attr_accessor :discount_id
|
|
144
144
|
|
|
145
|
+
# All stacked discounts applied, ordered by position
|
|
146
|
+
sig { returns(T.nilable(T::Array[Dodopayments::Subscription::Discount])) }
|
|
147
|
+
attr_accessor :discounts
|
|
148
|
+
|
|
145
149
|
# Timestamp when the subscription will expire
|
|
146
150
|
sig { returns(T.nilable(Time)) }
|
|
147
151
|
attr_accessor :expires_at
|
|
@@ -202,6 +206,8 @@ module Dodopayments
|
|
|
202
206
|
T.nilable(T::Array[Dodopayments::CustomFieldResponse::OrHash]),
|
|
203
207
|
discount_cycles_remaining: T.nilable(Integer),
|
|
204
208
|
discount_id: T.nilable(String),
|
|
209
|
+
discounts:
|
|
210
|
+
T.nilable(T::Array[Dodopayments::Subscription::Discount::OrHash]),
|
|
205
211
|
expires_at: T.nilable(Time),
|
|
206
212
|
payment_method_id: T.nilable(String),
|
|
207
213
|
scheduled_change:
|
|
@@ -268,10 +274,12 @@ module Dodopayments
|
|
|
268
274
|
cancelled_at: nil,
|
|
269
275
|
# Customer's responses to custom fields collected during checkout
|
|
270
276
|
custom_field_responses: nil,
|
|
271
|
-
#
|
|
277
|
+
# DEPRECATED: Use discounts[].cycles_remaining instead.
|
|
272
278
|
discount_cycles_remaining: nil,
|
|
273
|
-
#
|
|
279
|
+
# DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
|
|
274
280
|
discount_id: nil,
|
|
281
|
+
# All stacked discounts applied, ordered by position
|
|
282
|
+
discounts: nil,
|
|
275
283
|
# Timestamp when the subscription will expire
|
|
276
284
|
expires_at: nil,
|
|
277
285
|
# Saved payment method id used for recurring charges
|
|
@@ -322,6 +330,8 @@ module Dodopayments
|
|
|
322
330
|
T.nilable(T::Array[Dodopayments::CustomFieldResponse]),
|
|
323
331
|
discount_cycles_remaining: T.nilable(Integer),
|
|
324
332
|
discount_id: T.nilable(String),
|
|
333
|
+
discounts:
|
|
334
|
+
T.nilable(T::Array[Dodopayments::Subscription::Discount]),
|
|
325
335
|
expires_at: T.nilable(Time),
|
|
326
336
|
payment_method_id: T.nilable(String),
|
|
327
337
|
scheduled_change: T.nilable(Dodopayments::ScheduledPlanChange),
|
|
@@ -331,6 +341,165 @@ module Dodopayments
|
|
|
331
341
|
end
|
|
332
342
|
def to_hash
|
|
333
343
|
end
|
|
344
|
+
|
|
345
|
+
class Discount < Dodopayments::Internal::Type::BaseModel
|
|
346
|
+
OrHash =
|
|
347
|
+
T.type_alias do
|
|
348
|
+
T.any(
|
|
349
|
+
Dodopayments::Subscription::Discount,
|
|
350
|
+
Dodopayments::Internal::AnyHash
|
|
351
|
+
)
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# The discount amount (basis points for percentage, USD cents for flat)
|
|
355
|
+
sig { returns(Integer) }
|
|
356
|
+
attr_accessor :amount
|
|
357
|
+
|
|
358
|
+
# The business this discount belongs to
|
|
359
|
+
sig { returns(String) }
|
|
360
|
+
attr_accessor :business_id
|
|
361
|
+
|
|
362
|
+
# The discount code
|
|
363
|
+
sig { returns(String) }
|
|
364
|
+
attr_accessor :code
|
|
365
|
+
|
|
366
|
+
# Timestamp when the discount was created
|
|
367
|
+
sig { returns(Time) }
|
|
368
|
+
attr_accessor :created_at
|
|
369
|
+
|
|
370
|
+
# The unique discount ID
|
|
371
|
+
sig { returns(String) }
|
|
372
|
+
attr_accessor :discount_id
|
|
373
|
+
|
|
374
|
+
# Additional metadata
|
|
375
|
+
sig { returns(T::Hash[Symbol, String]) }
|
|
376
|
+
attr_accessor :metadata
|
|
377
|
+
|
|
378
|
+
# Position of this discount in the stack (0-based)
|
|
379
|
+
sig { returns(Integer) }
|
|
380
|
+
attr_accessor :position
|
|
381
|
+
|
|
382
|
+
# Whether this discount should be preserved when a subscription changes plans
|
|
383
|
+
sig { returns(T::Boolean) }
|
|
384
|
+
attr_accessor :preserve_on_plan_change
|
|
385
|
+
|
|
386
|
+
# List of product IDs to which this discount is restricted
|
|
387
|
+
sig { returns(T::Array[String]) }
|
|
388
|
+
attr_accessor :restricted_to
|
|
389
|
+
|
|
390
|
+
# How many times this discount has been used
|
|
391
|
+
sig { returns(Integer) }
|
|
392
|
+
attr_accessor :times_used
|
|
393
|
+
|
|
394
|
+
# The type of discount
|
|
395
|
+
sig { returns(Dodopayments::DiscountType::TaggedSymbol) }
|
|
396
|
+
attr_accessor :type
|
|
397
|
+
|
|
398
|
+
# Remaining billing cycles for this discount on this subscription (None for
|
|
399
|
+
# one-time payments)
|
|
400
|
+
sig { returns(T.nilable(Integer)) }
|
|
401
|
+
attr_accessor :cycles_remaining
|
|
402
|
+
|
|
403
|
+
# Optional date/time after which discount is expired
|
|
404
|
+
sig { returns(T.nilable(Time)) }
|
|
405
|
+
attr_accessor :expires_at
|
|
406
|
+
|
|
407
|
+
# Name for the Discount
|
|
408
|
+
sig { returns(T.nilable(String)) }
|
|
409
|
+
attr_accessor :name
|
|
410
|
+
|
|
411
|
+
# Number of subscription billing cycles this discount is valid for
|
|
412
|
+
sig { returns(T.nilable(Integer)) }
|
|
413
|
+
attr_accessor :subscription_cycles
|
|
414
|
+
|
|
415
|
+
# Usage limit for this discount, if any
|
|
416
|
+
sig { returns(T.nilable(Integer)) }
|
|
417
|
+
attr_accessor :usage_limit
|
|
418
|
+
|
|
419
|
+
# Response struct for a discount with its position in a stack and optional
|
|
420
|
+
# cycle-tracking information (for subscriptions).
|
|
421
|
+
sig do
|
|
422
|
+
params(
|
|
423
|
+
amount: Integer,
|
|
424
|
+
business_id: String,
|
|
425
|
+
code: String,
|
|
426
|
+
created_at: Time,
|
|
427
|
+
discount_id: String,
|
|
428
|
+
metadata: T::Hash[Symbol, String],
|
|
429
|
+
position: Integer,
|
|
430
|
+
preserve_on_plan_change: T::Boolean,
|
|
431
|
+
restricted_to: T::Array[String],
|
|
432
|
+
times_used: Integer,
|
|
433
|
+
type: Dodopayments::DiscountType::OrSymbol,
|
|
434
|
+
cycles_remaining: T.nilable(Integer),
|
|
435
|
+
expires_at: T.nilable(Time),
|
|
436
|
+
name: T.nilable(String),
|
|
437
|
+
subscription_cycles: T.nilable(Integer),
|
|
438
|
+
usage_limit: T.nilable(Integer)
|
|
439
|
+
).returns(T.attached_class)
|
|
440
|
+
end
|
|
441
|
+
def self.new(
|
|
442
|
+
# The discount amount (basis points for percentage, USD cents for flat)
|
|
443
|
+
amount:,
|
|
444
|
+
# The business this discount belongs to
|
|
445
|
+
business_id:,
|
|
446
|
+
# The discount code
|
|
447
|
+
code:,
|
|
448
|
+
# Timestamp when the discount was created
|
|
449
|
+
created_at:,
|
|
450
|
+
# The unique discount ID
|
|
451
|
+
discount_id:,
|
|
452
|
+
# Additional metadata
|
|
453
|
+
metadata:,
|
|
454
|
+
# Position of this discount in the stack (0-based)
|
|
455
|
+
position:,
|
|
456
|
+
# Whether this discount should be preserved when a subscription changes plans
|
|
457
|
+
preserve_on_plan_change:,
|
|
458
|
+
# List of product IDs to which this discount is restricted
|
|
459
|
+
restricted_to:,
|
|
460
|
+
# How many times this discount has been used
|
|
461
|
+
times_used:,
|
|
462
|
+
# The type of discount
|
|
463
|
+
type:,
|
|
464
|
+
# Remaining billing cycles for this discount on this subscription (None for
|
|
465
|
+
# one-time payments)
|
|
466
|
+
cycles_remaining: nil,
|
|
467
|
+
# Optional date/time after which discount is expired
|
|
468
|
+
expires_at: nil,
|
|
469
|
+
# Name for the Discount
|
|
470
|
+
name: nil,
|
|
471
|
+
# Number of subscription billing cycles this discount is valid for
|
|
472
|
+
subscription_cycles: nil,
|
|
473
|
+
# Usage limit for this discount, if any
|
|
474
|
+
usage_limit: nil
|
|
475
|
+
)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
sig do
|
|
479
|
+
override.returns(
|
|
480
|
+
{
|
|
481
|
+
amount: Integer,
|
|
482
|
+
business_id: String,
|
|
483
|
+
code: String,
|
|
484
|
+
created_at: Time,
|
|
485
|
+
discount_id: String,
|
|
486
|
+
metadata: T::Hash[Symbol, String],
|
|
487
|
+
position: Integer,
|
|
488
|
+
preserve_on_plan_change: T::Boolean,
|
|
489
|
+
restricted_to: T::Array[String],
|
|
490
|
+
times_used: Integer,
|
|
491
|
+
type: Dodopayments::DiscountType::TaggedSymbol,
|
|
492
|
+
cycles_remaining: T.nilable(Integer),
|
|
493
|
+
expires_at: T.nilable(Time),
|
|
494
|
+
name: T.nilable(String),
|
|
495
|
+
subscription_cycles: T.nilable(Integer),
|
|
496
|
+
usage_limit: T.nilable(Integer)
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
end
|
|
500
|
+
def to_hash
|
|
501
|
+
end
|
|
502
|
+
end
|
|
334
503
|
end
|
|
335
504
|
end
|
|
336
505
|
end
|
|
@@ -27,11 +27,7 @@ module Dodopayments
|
|
|
27
27
|
attr_accessor :timestamp
|
|
28
28
|
|
|
29
29
|
# The event type
|
|
30
|
-
sig
|
|
31
|
-
returns(
|
|
32
|
-
Dodopayments::SubscriptionActiveWebhookEvent::Type::TaggedSymbol
|
|
33
|
-
)
|
|
34
|
-
end
|
|
30
|
+
sig { returns(Symbol) }
|
|
35
31
|
attr_accessor :type
|
|
36
32
|
|
|
37
33
|
sig do
|
|
@@ -39,7 +35,7 @@ module Dodopayments
|
|
|
39
35
|
business_id: String,
|
|
40
36
|
data: Dodopayments::Subscription::OrHash,
|
|
41
37
|
timestamp: Time,
|
|
42
|
-
type:
|
|
38
|
+
type: Symbol
|
|
43
39
|
).returns(T.attached_class)
|
|
44
40
|
end
|
|
45
41
|
def self.new(
|
|
@@ -50,7 +46,7 @@ module Dodopayments
|
|
|
50
46
|
# The timestamp of when the event occurred
|
|
51
47
|
timestamp:,
|
|
52
48
|
# The event type
|
|
53
|
-
type:
|
|
49
|
+
type: :"subscription.active"
|
|
54
50
|
)
|
|
55
51
|
end
|
|
56
52
|
|
|
@@ -60,40 +56,12 @@ module Dodopayments
|
|
|
60
56
|
business_id: String,
|
|
61
57
|
data: Dodopayments::Subscription,
|
|
62
58
|
timestamp: Time,
|
|
63
|
-
type:
|
|
64
|
-
Dodopayments::SubscriptionActiveWebhookEvent::Type::TaggedSymbol
|
|
59
|
+
type: Symbol
|
|
65
60
|
}
|
|
66
61
|
)
|
|
67
62
|
end
|
|
68
63
|
def to_hash
|
|
69
64
|
end
|
|
70
|
-
|
|
71
|
-
# The event type
|
|
72
|
-
module Type
|
|
73
|
-
extend Dodopayments::Internal::Type::Enum
|
|
74
|
-
|
|
75
|
-
TaggedSymbol =
|
|
76
|
-
T.type_alias do
|
|
77
|
-
T.all(Symbol, Dodopayments::SubscriptionActiveWebhookEvent::Type)
|
|
78
|
-
end
|
|
79
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
80
|
-
|
|
81
|
-
SUBSCRIPTION_ACTIVE =
|
|
82
|
-
T.let(
|
|
83
|
-
:"subscription.active",
|
|
84
|
-
Dodopayments::SubscriptionActiveWebhookEvent::Type::TaggedSymbol
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
sig do
|
|
88
|
-
override.returns(
|
|
89
|
-
T::Array[
|
|
90
|
-
Dodopayments::SubscriptionActiveWebhookEvent::Type::TaggedSymbol
|
|
91
|
-
]
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
def self.values
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
65
|
end
|
|
98
66
|
end
|
|
99
67
|
end
|
|
@@ -27,11 +27,7 @@ module Dodopayments
|
|
|
27
27
|
attr_accessor :timestamp
|
|
28
28
|
|
|
29
29
|
# The event type
|
|
30
|
-
sig
|
|
31
|
-
returns(
|
|
32
|
-
Dodopayments::SubscriptionCancelledWebhookEvent::Type::TaggedSymbol
|
|
33
|
-
)
|
|
34
|
-
end
|
|
30
|
+
sig { returns(Symbol) }
|
|
35
31
|
attr_accessor :type
|
|
36
32
|
|
|
37
33
|
sig do
|
|
@@ -39,7 +35,7 @@ module Dodopayments
|
|
|
39
35
|
business_id: String,
|
|
40
36
|
data: Dodopayments::Subscription::OrHash,
|
|
41
37
|
timestamp: Time,
|
|
42
|
-
type:
|
|
38
|
+
type: Symbol
|
|
43
39
|
).returns(T.attached_class)
|
|
44
40
|
end
|
|
45
41
|
def self.new(
|
|
@@ -50,7 +46,7 @@ module Dodopayments
|
|
|
50
46
|
# The timestamp of when the event occurred
|
|
51
47
|
timestamp:,
|
|
52
48
|
# The event type
|
|
53
|
-
type:
|
|
49
|
+
type: :"subscription.cancelled"
|
|
54
50
|
)
|
|
55
51
|
end
|
|
56
52
|
|
|
@@ -60,40 +56,12 @@ module Dodopayments
|
|
|
60
56
|
business_id: String,
|
|
61
57
|
data: Dodopayments::Subscription,
|
|
62
58
|
timestamp: Time,
|
|
63
|
-
type:
|
|
64
|
-
Dodopayments::SubscriptionCancelledWebhookEvent::Type::TaggedSymbol
|
|
59
|
+
type: Symbol
|
|
65
60
|
}
|
|
66
61
|
)
|
|
67
62
|
end
|
|
68
63
|
def to_hash
|
|
69
64
|
end
|
|
70
|
-
|
|
71
|
-
# The event type
|
|
72
|
-
module Type
|
|
73
|
-
extend Dodopayments::Internal::Type::Enum
|
|
74
|
-
|
|
75
|
-
TaggedSymbol =
|
|
76
|
-
T.type_alias do
|
|
77
|
-
T.all(Symbol, Dodopayments::SubscriptionCancelledWebhookEvent::Type)
|
|
78
|
-
end
|
|
79
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
80
|
-
|
|
81
|
-
SUBSCRIPTION_CANCELLED =
|
|
82
|
-
T.let(
|
|
83
|
-
:"subscription.cancelled",
|
|
84
|
-
Dodopayments::SubscriptionCancelledWebhookEvent::Type::TaggedSymbol
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
sig do
|
|
88
|
-
override.returns(
|
|
89
|
-
T::Array[
|
|
90
|
-
Dodopayments::SubscriptionCancelledWebhookEvent::Type::TaggedSymbol
|
|
91
|
-
]
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
def self.values
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
65
|
end
|
|
98
66
|
end
|
|
99
67
|
end
|
|
@@ -57,10 +57,16 @@ module Dodopayments
|
|
|
57
57
|
sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
|
|
58
58
|
attr_accessor :billing_currency
|
|
59
59
|
|
|
60
|
-
#
|
|
60
|
+
# DEPRECATED: Use discount_codes instead. Cannot be used together with
|
|
61
|
+
# discount_codes.
|
|
61
62
|
sig { returns(T.nilable(String)) }
|
|
62
63
|
attr_accessor :discount_code
|
|
63
64
|
|
|
65
|
+
# Stacked discount codes to apply, in order of application. Max 20. Cannot be used
|
|
66
|
+
# together with discount_code.
|
|
67
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
68
|
+
attr_accessor :discount_codes
|
|
69
|
+
|
|
64
70
|
# Override merchant default 3DS behaviour for this subscription
|
|
65
71
|
sig { returns(T.nilable(T::Boolean)) }
|
|
66
72
|
attr_accessor :force_3ds
|
|
@@ -163,6 +169,7 @@ module Dodopayments
|
|
|
163
169
|
T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
|
|
164
170
|
billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
|
|
165
171
|
discount_code: T.nilable(String),
|
|
172
|
+
discount_codes: T.nilable(T::Array[String]),
|
|
166
173
|
force_3ds: T.nilable(T::Boolean),
|
|
167
174
|
mandate_min_amount_inr_paise: T.nilable(Integer),
|
|
168
175
|
metadata: T::Hash[Symbol, String],
|
|
@@ -202,8 +209,12 @@ module Dodopayments
|
|
|
202
209
|
# Fix the currency in which the end customer is billed. If Dodo Payments cannot
|
|
203
210
|
# support that currency for this transaction, it will not proceed
|
|
204
211
|
billing_currency: nil,
|
|
205
|
-
#
|
|
212
|
+
# DEPRECATED: Use discount_codes instead. Cannot be used together with
|
|
213
|
+
# discount_codes.
|
|
206
214
|
discount_code: nil,
|
|
215
|
+
# Stacked discount codes to apply, in order of application. Max 20. Cannot be used
|
|
216
|
+
# together with discount_code.
|
|
217
|
+
discount_codes: nil,
|
|
207
218
|
# Override merchant default 3DS behaviour for this subscription
|
|
208
219
|
force_3ds: nil,
|
|
209
220
|
# Override the merchant-level mandate floor (in INR paise) for INR e-mandates on
|
|
@@ -264,6 +275,7 @@ module Dodopayments
|
|
|
264
275
|
T.nilable(T::Array[Dodopayments::PaymentMethodTypes::OrSymbol]),
|
|
265
276
|
billing_currency: T.nilable(Dodopayments::Currency::OrSymbol),
|
|
266
277
|
discount_code: T.nilable(String),
|
|
278
|
+
discount_codes: T.nilable(T::Array[String]),
|
|
267
279
|
force_3ds: T.nilable(T::Boolean),
|
|
268
280
|
mandate_min_amount_inr_paise: T.nilable(Integer),
|
|
269
281
|
metadata: T::Hash[Symbol, String],
|
|
@@ -46,10 +46,15 @@ module Dodopayments
|
|
|
46
46
|
sig { returns(T.nilable(String)) }
|
|
47
47
|
attr_accessor :client_secret
|
|
48
48
|
|
|
49
|
-
#
|
|
49
|
+
# DEPRECATED: Use discount_ids instead. Returns the first discount's ID if
|
|
50
|
+
# present.
|
|
50
51
|
sig { returns(T.nilable(String)) }
|
|
51
52
|
attr_accessor :discount_id
|
|
52
53
|
|
|
54
|
+
# All stacked discount IDs applied, in order of application
|
|
55
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
56
|
+
attr_accessor :discount_ids
|
|
57
|
+
|
|
53
58
|
# Expiry timestamp of the payment link
|
|
54
59
|
sig { returns(T.nilable(Time)) }
|
|
55
60
|
attr_accessor :expires_on
|
|
@@ -80,6 +85,7 @@ module Dodopayments
|
|
|
80
85
|
subscription_id: String,
|
|
81
86
|
client_secret: T.nilable(String),
|
|
82
87
|
discount_id: T.nilable(String),
|
|
88
|
+
discount_ids: T.nilable(T::Array[String]),
|
|
83
89
|
expires_on: T.nilable(Time),
|
|
84
90
|
one_time_product_cart:
|
|
85
91
|
T.nilable(
|
|
@@ -107,8 +113,11 @@ module Dodopayments
|
|
|
107
113
|
# Client secret used to load Dodo checkout SDK NOTE : Dodo checkout SDK will be
|
|
108
114
|
# coming soon
|
|
109
115
|
client_secret: nil,
|
|
110
|
-
#
|
|
116
|
+
# DEPRECATED: Use discount_ids instead. Returns the first discount's ID if
|
|
117
|
+
# present.
|
|
111
118
|
discount_id: nil,
|
|
119
|
+
# All stacked discount IDs applied, in order of application
|
|
120
|
+
discount_ids: nil,
|
|
112
121
|
# Expiry timestamp of the payment link
|
|
113
122
|
expires_on: nil,
|
|
114
123
|
# One time products associated with the purchase of subscription
|
|
@@ -129,6 +138,7 @@ module Dodopayments
|
|
|
129
138
|
subscription_id: String,
|
|
130
139
|
client_secret: T.nilable(String),
|
|
131
140
|
discount_id: T.nilable(String),
|
|
141
|
+
discount_ids: T.nilable(T::Array[String]),
|
|
132
142
|
expires_on: T.nilable(Time),
|
|
133
143
|
one_time_product_cart:
|
|
134
144
|
T.nilable(
|
|
@@ -27,11 +27,7 @@ module Dodopayments
|
|
|
27
27
|
attr_accessor :timestamp
|
|
28
28
|
|
|
29
29
|
# The event type
|
|
30
|
-
sig
|
|
31
|
-
returns(
|
|
32
|
-
Dodopayments::SubscriptionExpiredWebhookEvent::Type::TaggedSymbol
|
|
33
|
-
)
|
|
34
|
-
end
|
|
30
|
+
sig { returns(Symbol) }
|
|
35
31
|
attr_accessor :type
|
|
36
32
|
|
|
37
33
|
sig do
|
|
@@ -39,7 +35,7 @@ module Dodopayments
|
|
|
39
35
|
business_id: String,
|
|
40
36
|
data: Dodopayments::Subscription::OrHash,
|
|
41
37
|
timestamp: Time,
|
|
42
|
-
type:
|
|
38
|
+
type: Symbol
|
|
43
39
|
).returns(T.attached_class)
|
|
44
40
|
end
|
|
45
41
|
def self.new(
|
|
@@ -50,7 +46,7 @@ module Dodopayments
|
|
|
50
46
|
# The timestamp of when the event occurred
|
|
51
47
|
timestamp:,
|
|
52
48
|
# The event type
|
|
53
|
-
type:
|
|
49
|
+
type: :"subscription.expired"
|
|
54
50
|
)
|
|
55
51
|
end
|
|
56
52
|
|
|
@@ -60,40 +56,12 @@ module Dodopayments
|
|
|
60
56
|
business_id: String,
|
|
61
57
|
data: Dodopayments::Subscription,
|
|
62
58
|
timestamp: Time,
|
|
63
|
-
type:
|
|
64
|
-
Dodopayments::SubscriptionExpiredWebhookEvent::Type::TaggedSymbol
|
|
59
|
+
type: Symbol
|
|
65
60
|
}
|
|
66
61
|
)
|
|
67
62
|
end
|
|
68
63
|
def to_hash
|
|
69
64
|
end
|
|
70
|
-
|
|
71
|
-
# The event type
|
|
72
|
-
module Type
|
|
73
|
-
extend Dodopayments::Internal::Type::Enum
|
|
74
|
-
|
|
75
|
-
TaggedSymbol =
|
|
76
|
-
T.type_alias do
|
|
77
|
-
T.all(Symbol, Dodopayments::SubscriptionExpiredWebhookEvent::Type)
|
|
78
|
-
end
|
|
79
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
80
|
-
|
|
81
|
-
SUBSCRIPTION_EXPIRED =
|
|
82
|
-
T.let(
|
|
83
|
-
:"subscription.expired",
|
|
84
|
-
Dodopayments::SubscriptionExpiredWebhookEvent::Type::TaggedSymbol
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
sig do
|
|
88
|
-
override.returns(
|
|
89
|
-
T::Array[
|
|
90
|
-
Dodopayments::SubscriptionExpiredWebhookEvent::Type::TaggedSymbol
|
|
91
|
-
]
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
def self.values
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
65
|
end
|
|
98
66
|
end
|
|
99
67
|
end
|
|
@@ -27,11 +27,7 @@ module Dodopayments
|
|
|
27
27
|
attr_accessor :timestamp
|
|
28
28
|
|
|
29
29
|
# The event type
|
|
30
|
-
sig
|
|
31
|
-
returns(
|
|
32
|
-
Dodopayments::SubscriptionFailedWebhookEvent::Type::TaggedSymbol
|
|
33
|
-
)
|
|
34
|
-
end
|
|
30
|
+
sig { returns(Symbol) }
|
|
35
31
|
attr_accessor :type
|
|
36
32
|
|
|
37
33
|
sig do
|
|
@@ -39,7 +35,7 @@ module Dodopayments
|
|
|
39
35
|
business_id: String,
|
|
40
36
|
data: Dodopayments::Subscription::OrHash,
|
|
41
37
|
timestamp: Time,
|
|
42
|
-
type:
|
|
38
|
+
type: Symbol
|
|
43
39
|
).returns(T.attached_class)
|
|
44
40
|
end
|
|
45
41
|
def self.new(
|
|
@@ -50,7 +46,7 @@ module Dodopayments
|
|
|
50
46
|
# The timestamp of when the event occurred
|
|
51
47
|
timestamp:,
|
|
52
48
|
# The event type
|
|
53
|
-
type:
|
|
49
|
+
type: :"subscription.failed"
|
|
54
50
|
)
|
|
55
51
|
end
|
|
56
52
|
|
|
@@ -60,40 +56,12 @@ module Dodopayments
|
|
|
60
56
|
business_id: String,
|
|
61
57
|
data: Dodopayments::Subscription,
|
|
62
58
|
timestamp: Time,
|
|
63
|
-
type:
|
|
64
|
-
Dodopayments::SubscriptionFailedWebhookEvent::Type::TaggedSymbol
|
|
59
|
+
type: Symbol
|
|
65
60
|
}
|
|
66
61
|
)
|
|
67
62
|
end
|
|
68
63
|
def to_hash
|
|
69
64
|
end
|
|
70
|
-
|
|
71
|
-
# The event type
|
|
72
|
-
module Type
|
|
73
|
-
extend Dodopayments::Internal::Type::Enum
|
|
74
|
-
|
|
75
|
-
TaggedSymbol =
|
|
76
|
-
T.type_alias do
|
|
77
|
-
T.all(Symbol, Dodopayments::SubscriptionFailedWebhookEvent::Type)
|
|
78
|
-
end
|
|
79
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
80
|
-
|
|
81
|
-
SUBSCRIPTION_FAILED =
|
|
82
|
-
T.let(
|
|
83
|
-
:"subscription.failed",
|
|
84
|
-
Dodopayments::SubscriptionFailedWebhookEvent::Type::TaggedSymbol
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
sig do
|
|
88
|
-
override.returns(
|
|
89
|
-
T::Array[
|
|
90
|
-
Dodopayments::SubscriptionFailedWebhookEvent::Type::TaggedSymbol
|
|
91
|
-
]
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
def self.values
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
65
|
end
|
|
98
66
|
end
|
|
99
67
|
end
|