Class: Dodopayments::Models::DiscountUpdateParams::CurrencyOption

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/discount_update_params.rb,
sig/dodopayments/models/discount_update_params.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

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(discount_id:, amount: nil, code: nil, currency_options: nil, customer_eligibility: nil, expires_at: nil, metadata: nil, name: nil, per_customer_usage_limit: nil, preserve_on_plan_change: nil, restricted_to: nil, starts_at: nil, subscription_cycles: nil, type: nil, usage_limit: nil, request_options: {}) ⇒ Object

Some parameter documentations has been truncated, see Dodopayments::Models::DiscountUpdateParams for more details.

Parameters:

  • discount_id (String)
  • amount (Integer, nil) (defaults to: nil)

    If present, update the discount amount in basis points (e.g., 540 = 5.4%

  • code (String, nil) (defaults to: nil)

    If present, update the discount code (uppercase).

  • currency_options (Array<Dodopayments::Models::DiscountUpdateParams::CurrencyOption>, nil) (defaults to: nil)

    If present, fully replaces the discount's currency options (replace-set

  • customer_eligibility (Symbol, Dodopayments::Models::DiscountUpdateParams::CustomerEligibility, nil) (defaults to: nil)

    If present, update who may redeem this discount. Plain field (not

  • expires_at (Time, nil) (defaults to: nil)
  • metadata (Hash{Symbol=>String, Float, Boolean}, nil) (defaults to: nil)

    Additional metadata for the discount

  • name (String, nil) (defaults to: nil)
  • per_customer_usage_limit (Integer, nil) (defaults to: nil)

    If present, update the per-customer usage limit (double-option: send

  • preserve_on_plan_change (Boolean, nil) (defaults to: nil)

    Whether this discount should be preserved when a subscription changes plans.

  • restricted_to (Array<String>, nil) (defaults to: nil)

    If present, replaces all restricted product IDs with this new set.

  • starts_at (Time, nil) (defaults to: nil)

    If present, update starts_at (double-option: send null to clear it).

  • subscription_cycles (Integer, nil) (defaults to: nil)

    Number of subscription billing cycles this discount is valid for.

  • type (Symbol, Dodopayments::Models::DiscountType, nil) (defaults to: nil)

    If present, update the discount type (percentage or flat).

  • usage_limit (Integer, nil) (defaults to: nil)
  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/dodopayments/models/discount_update_params.rb', line 152

class CurrencyOption < Dodopayments::Internal::Type::BaseModel
  # @!attribute currency
  #   The currency this option applies to.
  #
  #   @return [Symbol, Dodopayments::Models::Currency]
  required :currency, enum: -> { Dodopayments::Currency }

  # @!attribute is_default
  #   Whether this row is the default to convert from for unconfigured currencies. At
  #   most one row per discount may be default.
  #
  #   @return [Boolean, nil]
  optional :is_default, Dodopayments::Internal::Type::Boolean

  # @!attribute max_amount_possible
  #   The most this code discounts in this currency's subunits. For `flat` codes this
  #   is the deduction; for `percentage` codes it is the max-discount cap. Must be > 0
  #   if provided.
  #
  #   @return [Integer, nil]
  optional :max_amount_possible, Integer, nil?: true

  # @!attribute minimum_subtotal
  #   Eligible-cart threshold in this currency's subunits (0 = no minimum).
  #
  #   @return [Integer, nil]
  optional :minimum_subtotal, Integer

  # @!method initialize(currency:, is_default: nil, max_amount_possible: nil, minimum_subtotal: nil)
  #   Some parameter documentations has been truncated, see
  #   {Dodopayments::Models::DiscountUpdateParams::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.
  #
  #   @param currency [Symbol, Dodopayments::Models::Currency] The currency this option applies to.
  #
  #   @param is_default [Boolean] Whether this row is the default to convert from for unconfigured
  #
  #   @param max_amount_possible [Integer, nil] The most this code discounts in this currency's subunits. For `flat` codes
  #
  #   @param minimum_subtotal [Integer] Eligible-cart threshold in this currency's subunits (0 = no minimum).
end

Instance Attribute Details

#currencySymbol, Dodopayments::Models::Currency

The currency this option applies to.

Parameters:

  • value (Dodopayments::Models::currency)

Returns:



157
# File 'lib/dodopayments/models/discount_update_params.rb', line 157

required :currency, enum: -> { Dodopayments::Currency }

#is_defaultBoolean?

Whether this row is the default to convert from for unconfigured currencies. At most one row per discount may be default.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


164
# File 'lib/dodopayments/models/discount_update_params.rb', line 164

optional :is_default, Dodopayments::Internal::Type::Boolean

#max_amount_possibleInteger?

The most this code discounts in this currency's subunits. For flat codes this is the deduction; for percentage codes it is the max-discount cap. Must be > 0 if provided.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


172
# File 'lib/dodopayments/models/discount_update_params.rb', line 172

optional :max_amount_possible, Integer, nil?: true

#minimum_subtotalInteger?

Eligible-cart threshold in this currency's subunits (0 = no minimum).

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


178
# File 'lib/dodopayments/models/discount_update_params.rb', line 178

optional :minimum_subtotal, Integer

Instance Method Details

#to_hash{

Returns:

  • ({)


123
# File 'sig/dodopayments/models/discount_update_params.rbs', line 123

def to_hash: -> {