Class: Dodopayments::Models::Subscription::Discount
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Dodopayments::Models::Subscription::Discount
- Defined in:
- lib/dodopayments/models/subscription.rb
Instance Attribute Summary collapse
-
#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.
-
#cycles_remaining ⇒ Integer?
Remaining billing cycles for this discount on this subscription (None for one-time payments).
-
#discount_id ⇒ String
The unique discount ID.
-
#expires_at ⇒ Time?
Optional date/time after which discount is expired.
-
#metadata ⇒ Hash{Symbol=>String}
Additional metadata.
-
#name ⇒ String?
Name for the Discount.
-
#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.
-
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for.
-
#times_used ⇒ Integer
How many times this discount has been used.
-
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The type of discount.
-
#usage_limit ⇒ Integer?
Usage limit for this discount, if any.
Instance Method Summary collapse
-
#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
constructor
Some parameter documentations has been truncated, see Discount for more details.
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::Subscription::Discount for more details.
Response struct for a discount with its position in a stack and optional cycle-tracking information (for subscriptions).
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/dodopayments/models/subscription.rb', line 301 class Discount < Dodopayments::Internal::Type::BaseModel # @!attribute amount # The discount amount (basis points for percentage, USD cents for flat) # # @return [Integer] required :amount, Integer # @!attribute business_id # The business this discount belongs to # # @return [String] required :business_id, String # @!attribute code # The discount code # # @return [String] required :code, String # @!attribute created_at # Timestamp when the discount was created # # @return [Time] required :created_at, Time # @!attribute discount_id # The unique discount ID # # @return [String] required :discount_id, String # @!attribute metadata # Additional metadata # # @return [Hash{Symbol=>String}] required :metadata, Dodopayments::Internal::Type::HashOf[String] # @!attribute position # Position of this discount in the stack (0-based) # # @return [Integer] required :position, Integer # @!attribute preserve_on_plan_change # Whether this discount should be preserved when a subscription changes plans # # @return [Boolean] required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean # @!attribute restricted_to # List of product IDs to which this discount is restricted # # @return [Array<String>] required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String] # @!attribute times_used # How many times this discount has been used # # @return [Integer] required :times_used, Integer # @!attribute type # The type of discount # # @return [Symbol, Dodopayments::Models::DiscountType] required :type, enum: -> { Dodopayments::DiscountType } # @!attribute cycles_remaining # Remaining billing cycles for this discount on this subscription (None for # one-time payments) # # @return [Integer, nil] optional :cycles_remaining, Integer, nil?: true # @!attribute expires_at # Optional date/time after which discount is expired # # @return [Time, nil] optional :expires_at, Time, nil?: true # @!attribute name # Name for the Discount # # @return [String, nil] optional :name, String, nil?: true # @!attribute subscription_cycles # Number of subscription billing cycles this discount is valid for # # @return [Integer, nil] optional :subscription_cycles, Integer, nil?: true # @!attribute usage_limit # Usage limit for this discount, if any # # @return [Integer, nil] optional :usage_limit, Integer, nil?: true # @!method 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) # Some parameter documentations has been truncated, see # {Dodopayments::Models::Subscription::Discount} for more details. # # Response struct for a discount with its position in a stack and optional # cycle-tracking information (for subscriptions). # # @param amount [Integer] The discount amount (basis points for percentage, USD cents for flat) # # @param business_id [String] The business this discount belongs to # # @param code [String] The discount code # # @param created_at [Time] Timestamp when the discount was created # # @param discount_id [String] The unique discount ID # # @param metadata [Hash{Symbol=>String}] Additional metadata # # @param position [Integer] Position of this discount in the stack (0-based) # # @param preserve_on_plan_change [Boolean] Whether this discount should be preserved when a subscription changes plans # # @param restricted_to [Array<String>] List of product IDs to which this discount is restricted # # @param times_used [Integer] How many times this discount has been used # # @param type [Symbol, Dodopayments::Models::DiscountType] The type of discount # # @param cycles_remaining [Integer, nil] Remaining billing cycles for this discount on this subscription (None for one-ti # # @param expires_at [Time, nil] Optional date/time after which discount is expired # # @param name [String, nil] Name for the Discount # # @param subscription_cycles [Integer, nil] Number of subscription billing cycles this discount is valid for # # @param usage_limit [Integer, nil] Usage limit for this discount, if any end |
Instance Attribute Details
#amount ⇒ Integer
The discount amount (basis points for percentage, USD cents for flat)
306 |
# File 'lib/dodopayments/models/subscription.rb', line 306 required :amount, Integer |
#business_id ⇒ String
The business this discount belongs to
312 |
# File 'lib/dodopayments/models/subscription.rb', line 312 required :business_id, String |
#code ⇒ String
The discount code
318 |
# File 'lib/dodopayments/models/subscription.rb', line 318 required :code, String |
#created_at ⇒ Time
Timestamp when the discount was created
324 |
# File 'lib/dodopayments/models/subscription.rb', line 324 required :created_at, Time |
#cycles_remaining ⇒ Integer?
Remaining billing cycles for this discount on this subscription (None for one-time payments)
373 |
# File 'lib/dodopayments/models/subscription.rb', line 373 optional :cycles_remaining, Integer, nil?: true |
#discount_id ⇒ String
The unique discount ID
330 |
# File 'lib/dodopayments/models/subscription.rb', line 330 required :discount_id, String |
#expires_at ⇒ Time?
Optional date/time after which discount is expired
379 |
# File 'lib/dodopayments/models/subscription.rb', line 379 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String}
Additional metadata
336 |
# File 'lib/dodopayments/models/subscription.rb', line 336 required :metadata, Dodopayments::Internal::Type::HashOf[String] |
#name ⇒ String?
Name for the Discount
385 |
# File 'lib/dodopayments/models/subscription.rb', line 385 optional :name, String, nil?: true |
#position ⇒ Integer
Position of this discount in the stack (0-based)
342 |
# File 'lib/dodopayments/models/subscription.rb', line 342 required :position, Integer |
#preserve_on_plan_change ⇒ Boolean
Whether this discount should be preserved when a subscription changes plans
348 |
# File 'lib/dodopayments/models/subscription.rb', line 348 required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean |
#restricted_to ⇒ Array<String>
List of product IDs to which this discount is restricted
354 |
# File 'lib/dodopayments/models/subscription.rb', line 354 required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String] |
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for
391 |
# File 'lib/dodopayments/models/subscription.rb', line 391 optional :subscription_cycles, Integer, nil?: true |
#times_used ⇒ Integer
How many times this discount has been used
360 |
# File 'lib/dodopayments/models/subscription.rb', line 360 required :times_used, Integer |
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The type of discount
366 |
# File 'lib/dodopayments/models/subscription.rb', line 366 required :type, enum: -> { Dodopayments::DiscountType } |
#usage_limit ⇒ Integer?
Usage limit for this discount, if any
397 |
# File 'lib/dodopayments/models/subscription.rb', line 397 optional :usage_limit, Integer, nil?: true |