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:

  • 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.

  • 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 82

Instance Attribute Details

#amountInteger?

If present, update the discount amount:

  • If ‘discount_type` is `percentage`, this represents **basis points** (e.g., `540` = `5.4%`).

  • Otherwise, this represents **USD cents** (e.g., ‘100` = `$1.00`).

Must be at least 1 if provided.

Returns:

  • (Integer, nil)


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

optional :amount, Integer, nil?: true

#codeString?

If present, update the discount code (uppercase).

Returns:

  • (String, nil)


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

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)


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

optional :expires_at, Time, nil?: true

#metadataHash{Symbol=>String}?

Additional metadata for the discount

Returns:

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


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

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

#nameString?

Returns:

  • (String, nil)


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

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)


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

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)


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

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)


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

optional :subscription_cycles, Integer, nil?: true

#typeSymbol, ...

If present, update the discount type.

Returns:



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

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

#usage_limitInteger?

Returns:

  • (Integer, nil)


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

optional :usage_limit, Integer, nil?: true