Class: Dodopayments::Models::DiscountCreateParams::CurrencyOption

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/discount_create_params.rb,
sig/dodopayments/models/discount_create_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(amount:, type:, 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, usage_limit: nil, request_options: {}) ⇒ Object

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



149
150
151
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
# File 'lib/dodopayments/models/discount_create_params.rb', line 149

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::DiscountCreateParams::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.



154
# File 'lib/dodopayments/models/discount_create_params.rb', line 154

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.



161
# File 'lib/dodopayments/models/discount_create_params.rb', line 161

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.



169
# File 'lib/dodopayments/models/discount_create_params.rb', line 169

optional :max_amount_possible, Integer, nil?: true

#minimum_subtotalInteger?

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



175
# File 'lib/dodopayments/models/discount_create_params.rb', line 175

optional :minimum_subtotal, Integer

Instance Method Details

#to_hash{



124
# File 'sig/dodopayments/models/discount_create_params.rbs', line 124

def to_hash: -> {