Class: Dodopayments::Models::Discount
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Dodopayments::Models::Discount
- Defined in:
- lib/dodopayments/models/discount.rb,
sig/dodopayments/models/discount.rbs
Overview
Instance Attribute Summary collapse
-
#amount ⇒ Integer
The discount amount in basis points (e.g., 540 => 5.4%).
-
#business_id ⇒ String
The business this discount belongs to.
-
#code ⇒ String
The discount code (up to 16 chars).
-
#created_at ⇒ Time
Timestamp when the discount is created.
-
#discount_id ⇒ String
The unique discount ID.
-
#expires_at ⇒ Time?
Optional date/time after which discount is expired.
-
#metadata ⇒ Hash{Symbol=>String, Float, Boolean}
Arbitrary key-value metadata.
-
#name ⇒ String?
Name for the Discount.
-
#preserve_on_plan_change ⇒ Boolean
Whether this discount should be preserved when a subscription changes plans.
-
#restricted_to ⇒ Array<String>
List of product IDs to which this discount is restricted.
-
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for.
-
#times_used ⇒ Integer
How many times this discount has been used.
-
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The type of discount.
-
#usage_limit ⇒ Integer?
Usage limit for this discount, if any.
Instance Method Summary collapse
-
#initialize(amount:, business_id:, code:, created_at:, discount_id:, metadata:, preserve_on_plan_change:, restricted_to:, times_used:, type:, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil) ⇒ Object
constructor
Some parameter documentations has been truncated, see Discount for more details.
- #to_hash ⇒ {
Methods inherited from Internal::Type::BaseModel
==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml
Methods included from Internal::Type::Converter
#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(amount:, business_id:, code:, created_at:, discount_id:, metadata:, preserve_on_plan_change:, restricted_to:, times_used:, type:, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil) ⇒ Object
Some parameter documentations has been truncated, see Dodopayments::Models::Discount for more details.
|
|
# File 'lib/dodopayments/models/discount.rb', line 94
|
Instance Attribute Details
#amount ⇒ Integer
The discount amount in basis points (e.g., 540 => 5.4%).
11 |
# File 'lib/dodopayments/models/discount.rb', line 11 required :amount, Integer |
#business_id ⇒ String
The business this discount belongs to.
17 |
# File 'lib/dodopayments/models/discount.rb', line 17 required :business_id, String |
#code ⇒ String
The discount code (up to 16 chars).
23 |
# File 'lib/dodopayments/models/discount.rb', line 23 required :code, String |
#created_at ⇒ Time
Timestamp when the discount is created
29 |
# File 'lib/dodopayments/models/discount.rb', line 29 required :created_at, Time |
#discount_id ⇒ String
The unique discount ID
35 |
# File 'lib/dodopayments/models/discount.rb', line 35 required :discount_id, String |
#expires_at ⇒ Time?
Optional date/time after which discount is expired.
72 |
# File 'lib/dodopayments/models/discount.rb', line 72 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String, Float, Boolean}
Arbitrary key-value metadata. Values can be string, integer, number, or boolean.
41 |
# File 'lib/dodopayments/models/discount.rb', line 41 required :metadata, -> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] } |
#name ⇒ String?
Name for the Discount
78 |
# File 'lib/dodopayments/models/discount.rb', line 78 optional :name, String, nil?: true |
#preserve_on_plan_change ⇒ Boolean
Whether this discount should be preserved when a subscription changes plans. Default: false (discount is removed on plan change)
48 |
# File 'lib/dodopayments/models/discount.rb', line 48 required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean |
#restricted_to ⇒ Array<String>
List of product IDs to which this discount is restricted.
54 |
# File 'lib/dodopayments/models/discount.rb', line 54 required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String] |
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for. If not provided, the discount will be applied indefinitely to all recurring payments related to the subscription.
86 |
# File 'lib/dodopayments/models/discount.rb', line 86 optional :subscription_cycles, Integer, nil?: true |
#times_used ⇒ Integer
How many times this discount has been used.
60 |
# File 'lib/dodopayments/models/discount.rb', line 60 required :times_used, Integer |
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The type of discount. Currently only percentage is supported.
66 |
# File 'lib/dodopayments/models/discount.rb', line 66 required :type, enum: -> { Dodopayments::DiscountType } |
#usage_limit ⇒ Integer?
Usage limit for this discount, if any.
92 |
# File 'lib/dodopayments/models/discount.rb', line 92 optional :usage_limit, Integer, nil?: true |
Instance Method Details
#to_hash ⇒ {
67 |
# File 'sig/dodopayments/models/discount.rbs', line 67
def to_hash: -> {
|