Class: Dodopayments::Models::DiscountDetail

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/discount_detail.rb

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:, business_id:, code:, created_at:, discount_id:, metadata:, position:, preserve_on_plan_change:, restricted_to:, times_used:, type:, cycles_remaining: nil, expires_at: nil, name: nil, subscription_cycles: nil, usage_limit: nil) ⇒ Object

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

Response struct for a discount with its position in a stack and optional cycle-tracking information (for subscriptions).

Parameters:

  • amount (Integer)

    The discount amount (basis points for percentage, USD cents for flat)

  • business_id (String)

    The business this discount belongs to

  • code (String)

    The discount code

  • created_at (Time)

    Timestamp when the discount was created

  • discount_id (String)

    The unique discount ID

  • metadata (Hash{Symbol=>String})

    Additional metadata

  • position (Integer)

    Position of this discount in the stack (0-based)

  • preserve_on_plan_change (Boolean)

    Whether this discount should be preserved when a subscription changes plans

  • restricted_to (Array<String>)

    List of product IDs to which this discount is restricted

  • times_used (Integer)

    How many times this discount has been used

  • type (Symbol, Dodopayments::Models::DiscountType)

    The type of discount

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

    Remaining billing cycles for this discount on this subscription (None for one-ti

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

    Optional date/time after which discount is expired

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

    Name for the Discount

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

    Number of subscription billing cycles this discount is valid for

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

    Usage limit for this discount, if any



# File 'lib/dodopayments/models/discount_detail.rb', line 103

Instance Attribute Details

#amountInteger

The discount amount (basis points for percentage, USD cents for flat)

Returns:

  • (Integer)


10
# File 'lib/dodopayments/models/discount_detail.rb', line 10

required :amount, Integer

#business_idString

The business this discount belongs to

Returns:

  • (String)


16
# File 'lib/dodopayments/models/discount_detail.rb', line 16

required :business_id, String

#codeString

The discount code

Returns:

  • (String)


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

required :code, String

#created_atTime

Timestamp when the discount was created

Returns:

  • (Time)


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

required :created_at, Time

#cycles_remainingInteger?

Remaining billing cycles for this discount on this subscription (None for one-time payments)

Returns:

  • (Integer, nil)


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

optional :cycles_remaining, Integer, nil?: true

#discount_idString

The unique discount ID

Returns:

  • (String)


34
# File 'lib/dodopayments/models/discount_detail.rb', line 34

required :discount_id, String

#expires_atTime?

Optional date/time after which discount is expired

Returns:

  • (Time, nil)


83
# File 'lib/dodopayments/models/discount_detail.rb', line 83

optional :expires_at, Time, nil?: true

#metadataHash{Symbol=>String}

Additional metadata

Returns:

  • (Hash{Symbol=>String})


40
# File 'lib/dodopayments/models/discount_detail.rb', line 40

required :metadata, Dodopayments::Internal::Type::HashOf[String]

#nameString?

Name for the Discount

Returns:

  • (String, nil)


89
# File 'lib/dodopayments/models/discount_detail.rb', line 89

optional :name, String, nil?: true

#positionInteger

Position of this discount in the stack (0-based)

Returns:

  • (Integer)


46
# File 'lib/dodopayments/models/discount_detail.rb', line 46

required :position, Integer

#preserve_on_plan_changeBoolean

Whether this discount should be preserved when a subscription changes plans

Returns:

  • (Boolean)


52
# File 'lib/dodopayments/models/discount_detail.rb', line 52

required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean

#restricted_toArray<String>

List of product IDs to which this discount is restricted

Returns:

  • (Array<String>)


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

required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String]

#subscription_cyclesInteger?

Number of subscription billing cycles this discount is valid for

Returns:

  • (Integer, nil)


95
# File 'lib/dodopayments/models/discount_detail.rb', line 95

optional :subscription_cycles, Integer, nil?: true

#times_usedInteger

How many times this discount has been used

Returns:

  • (Integer)


64
# File 'lib/dodopayments/models/discount_detail.rb', line 64

required :times_used, Integer

#typeSymbol, Dodopayments::Models::DiscountType

The type of discount



70
# File 'lib/dodopayments/models/discount_detail.rb', line 70

required :type, enum: -> { Dodopayments::DiscountType }

#usage_limitInteger?

Usage limit for this discount, if any

Returns:

  • (Integer, nil)


101
# File 'lib/dodopayments/models/discount_detail.rb', line 101

optional :usage_limit, Integer, nil?: true