Class: Dodopayments::Models::DiscountUpdateParams
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Dodopayments::Models::DiscountUpdateParams
- Extended by:
- Internal::Type::RequestParameters::Converter
- Includes:
- Internal::Type::RequestParameters
- Defined in:
- lib/dodopayments/models/discount_update_params.rb,
sig/dodopayments/models/discount_update_params.rbs
Overview
Defined Under Namespace
Modules: CustomerEligibility Classes: CurrencyOption
Constant Summary
Constants included from Internal::Type::RequestParameters
Internal::Type::RequestParameters::Dodopayments
Instance Attribute Summary collapse
-
#amount ⇒ Integer?
If present, update the discount amount in basis points (e.g.,
540=5.4%,10000=100%). -
#code ⇒ String?
If present, update the discount code (uppercase).
-
#currency_options ⇒ Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>?
If present, fully replaces the discount's currency options (replace-set semantics, like
restricted_to). -
#customer_eligibility ⇒ Symbol, ...
If present, update who may redeem this discount.
- #discount_id ⇒ String
- #expires_at ⇒ Time?
-
#metadata ⇒ Hash{Symbol=>String, Float, Boolean}?
Additional metadata for the discount.
- #name ⇒ String?
-
#per_customer_usage_limit ⇒ Integer?
If present, update the per-customer usage limit (double-option: send
nullto clear it back to unlimited). -
#preserve_on_plan_change ⇒ Boolean?
Whether this discount should be preserved when a subscription changes plans.
-
#restricted_to ⇒ Array<String>?
If present, replaces all restricted product IDs with this new set.
-
#starts_at ⇒ Time?
If present, update
starts_at(double-option: sendnullto clear it). -
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for.
-
#type ⇒ Symbol, ...
If present, update the discount type (
percentageorflat). - #usage_limit ⇒ Integer?
Attributes included from Internal::Type::RequestParameters
Instance Method Summary collapse
-
#initialize(currency:, is_default: nil, max_amount_possible: nil, minimum_subtotal: nil) ⇒ Object
constructor
Some parameter documentations has been truncated, see CurrencyOption for more details.
- #to_hash ⇒ {
Methods included from Internal::Type::RequestParameters::Converter
Methods included from Internal::Type::RequestParameters
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(currency:, is_default: nil, max_amount_possible: nil, minimum_subtotal: nil) ⇒ Object
Some parameter documentations has been truncated, see CurrencyOption for more details.
A per-currency discount option (request shape).
max_amount_possible is the most this code discounts in this currency — the
flat deduction for flat codes, or the max-discount cap for percentage codes.
Maps to the DB column of the same name.
|
|
# File 'lib/dodopayments/models/discount_update_params.rb', line 180
|
Instance Attribute Details
#amount ⇒ Integer?
If present, update the discount amount in basis points (e.g., 540 =
5.4%, 10000 = 100%).
Must be at least 1 if provided.
22 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 22 optional :amount, Integer, nil?: true |
#code ⇒ String?
If present, update the discount code (uppercase).
28 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 28 optional :code, String, nil?: true |
#currency_options ⇒ Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>?
If present, fully replaces the discount's currency options (replace-set
semantics, like restricted_to). Send an empty array to clear them.
35 36 37 38 39 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 35 optional :currency_options, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::DiscountUpdateParams::CurrencyOption] }, nil?: true |
#customer_eligibility ⇒ Symbol, ...
If present, update who may redeem this discount. Plain field (not
double-option): the DB column is NOT NULL, so it can never be cleared back to
unset, only changed to another CustomerEligibility value.
47 48 49 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 47 optional :customer_eligibility, enum: -> { Dodopayments::DiscountUpdateParams::CustomerEligibility }, nil?: true |
#discount_id ⇒ String
13 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 13 required :discount_id, String |
#expires_at ⇒ Time?
54 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 54 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String, Float, Boolean}?
Additional metadata for the discount
60 61 62 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 60 optional :metadata, -> { Dodopayments::Internal::Type::HashOf[union: Dodopayments::MetadataItem] }, nil?: true |
#name ⇒ String?
67 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 67 optional :name, String, nil?: true |
#per_customer_usage_limit ⇒ Integer?
If present, update the per-customer usage limit (double-option: send null to
clear it back to unlimited). Must be <= usage_limit (the value in effect after
this patch) when both are set.
75 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 75 optional :per_customer_usage_limit, Integer, nil?: true |
#preserve_on_plan_change ⇒ Boolean?
Whether this discount should be preserved when a subscription changes plans. If not provided, the existing value is kept.
82 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 82 optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean, nil?: true |
#restricted_to ⇒ Array<String>?
If present, replaces all restricted product IDs with this new set. To remove all restrictions, send empty array
89 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 89 optional :restricted_to, Dodopayments::Internal::Type::ArrayOf[String], nil?: true |
#starts_at ⇒ Time?
If present, update starts_at (double-option: send null to clear it).
95 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 95 optional :starts_at, Time, nil?: true |
#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.
103 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 103 optional :subscription_cycles, Integer, nil?: true |
#type ⇒ Symbol, ...
If present, update the discount type (percentage or flat).
109 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 109 optional :type, enum: -> { Dodopayments::DiscountType }, nil?: true |
#usage_limit ⇒ Integer?
114 |
# File 'lib/dodopayments/models/discount_update_params.rb', line 114 optional :usage_limit, Integer, nil?: true |
Instance Method Details
#to_hash ⇒ {
76 |
# File 'sig/dodopayments/models/discount_update_params.rbs', line 76
def to_hash: -> {
|