Class: Dodopayments::Models::Payment::Discount
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- Dodopayments::Models::Payment::Discount
- Defined in:
- lib/dodopayments/models/payment.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(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil) ⇒ Object
constructor
Some parameter documentations has been truncated, see Dodopayments::Models::Payment 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(billing:, brand_id:, business_id:, created_at:, currency:, customer:, digital_products_delivered:, disputes:, metadata:, payment_id:, refunds:, settlement_amount:, settlement_currency:, total_amount:, card_holder_name: nil, card_issuing_country: nil, card_last_four: nil, card_network: nil, card_type: nil, checkout_session_id: nil, custom_field_responses: nil, discount_id: nil, discounts: nil, error_code: nil, error_message: nil, invoice_id: nil, invoice_url: nil, payment_link: nil, payment_method: nil, payment_method_type: nil, product_cart: nil, refund_status: nil, settlement_tax: nil, status: nil, subscription_id: nil, tax: nil, updated_at: nil) ⇒ Object
Some parameter documentations has been truncated, see Dodopayments::Models::Payment for more details.
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 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/dodopayments/models/payment.rb', line 324 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::Payment::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)
329 |
# File 'lib/dodopayments/models/payment.rb', line 329 required :amount, Integer |
#business_id ⇒ String
The business this discount belongs to
335 |
# File 'lib/dodopayments/models/payment.rb', line 335 required :business_id, String |
#code ⇒ String
The discount code
341 |
# File 'lib/dodopayments/models/payment.rb', line 341 required :code, String |
#created_at ⇒ Time
Timestamp when the discount was created
347 |
# File 'lib/dodopayments/models/payment.rb', line 347 required :created_at, Time |
#cycles_remaining ⇒ Integer?
Remaining billing cycles for this discount on this subscription (None for one-time payments)
396 |
# File 'lib/dodopayments/models/payment.rb', line 396 optional :cycles_remaining, Integer, nil?: true |
#discount_id ⇒ String
The unique discount ID
353 |
# File 'lib/dodopayments/models/payment.rb', line 353 required :discount_id, String |
#expires_at ⇒ Time?
Optional date/time after which discount is expired
402 |
# File 'lib/dodopayments/models/payment.rb', line 402 optional :expires_at, Time, nil?: true |
#metadata ⇒ Hash{Symbol=>String}
Additional metadata
359 |
# File 'lib/dodopayments/models/payment.rb', line 359 required :metadata, Dodopayments::Internal::Type::HashOf[String] |
#name ⇒ String?
Name for the Discount
408 |
# File 'lib/dodopayments/models/payment.rb', line 408 optional :name, String, nil?: true |
#position ⇒ Integer
Position of this discount in the stack (0-based)
365 |
# File 'lib/dodopayments/models/payment.rb', line 365 required :position, Integer |
#preserve_on_plan_change ⇒ Boolean
Whether this discount should be preserved when a subscription changes plans
371 |
# File 'lib/dodopayments/models/payment.rb', line 371 required :preserve_on_plan_change, Dodopayments::Internal::Type::Boolean |
#restricted_to ⇒ Array<String>
List of product IDs to which this discount is restricted
377 |
# File 'lib/dodopayments/models/payment.rb', line 377 required :restricted_to, Dodopayments::Internal::Type::ArrayOf[String] |
#subscription_cycles ⇒ Integer?
Number of subscription billing cycles this discount is valid for
414 |
# File 'lib/dodopayments/models/payment.rb', line 414 optional :subscription_cycles, Integer, nil?: true |
#times_used ⇒ Integer
How many times this discount has been used
383 |
# File 'lib/dodopayments/models/payment.rb', line 383 required :times_used, Integer |
#type ⇒ Symbol, Dodopayments::Models::DiscountType
The type of discount
389 |
# File 'lib/dodopayments/models/payment.rb', line 389 required :type, enum: -> { Dodopayments::DiscountType } |
#usage_limit ⇒ Integer?
Usage limit for this discount, if any
420 |
# File 'lib/dodopayments/models/payment.rb', line 420 optional :usage_limit, Integer, nil?: true |