Class: Dodopayments::Models::DiscountUpdateParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/dodopayments/models/discount_update_params.rb

Overview

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

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, expires_at: nil, metadata: nil, name: nil, preserve_on_plan_change: nil, restricted_to: 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).

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

    Additional metadata for the discount

  • name (String, nil) (defaults to: nil)
  • 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.

  • 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. Currently only ‘percentage` is supported.

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


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

Instance Attribute Details

#amountInteger?

If present, update the discount amount in **basis points** (e.g., ‘540` = `5.4%`, `10000` = `100%`).

Must be at least 1 if provided.

Returns:

  • (Integer, nil)


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

optional :amount, Integer, nil?: true

#codeString?

If present, update the discount code (uppercase).

Returns:

  • (String, nil)


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

optional :code, String, nil?: true

#discount_idString

Returns:

  • (String)


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

required :discount_id, String

#expires_atTime?

Returns:

  • (Time, nil)


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

optional :expires_at, Time, nil?: true

#metadataHash{Symbol=>String}?

Additional metadata for the discount

Returns:

  • (Hash{Symbol=>String}, nil)


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

optional :metadata, Dodopayments::Internal::Type::HashOf[String], nil?: true

#nameString?

Returns:

  • (String, nil)


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

optional :name, String, nil?: true

#preserve_on_plan_changeBoolean?

Whether this discount should be preserved when a subscription changes plans. If not provided, the existing value is kept.

Returns:

  • (Boolean, nil)


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

optional :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean, nil?: true

#restricted_toArray<String>?

If present, replaces all restricted product IDs with this new set. To remove all restrictions, send empty array

Returns:

  • (Array<String>, nil)


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

optional :restricted_to, Dodopayments::Internal::Type::ArrayOf[String], nil?: true

#subscription_cyclesInteger?

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.

Returns:

  • (Integer, nil)


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

optional :subscription_cycles, Integer, nil?: true

#typeSymbol, ...

If present, update the discount type. Currently only ‘percentage` is supported.

Returns:



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

optional :type, enum: -> { Dodopayments::DiscountType }, nil?: true

#usage_limitInteger?

Returns:

  • (Integer, nil)


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

optional :usage_limit, Integer, nil?: true