Discount class

A discount can be applied to a cart for promotional purposes.

Annotations
  • @JsonSerializable()

Constructors

Discount({required String id, required String code, required bool isDynamic, String? ruleId, DiscountRule? rule, required bool isDisabled, String? parentDiscountId, Discount? parentDiscount, required String startsAt, String? endsAt, String? validDuration, List<Region>? regions, int? usageLimit, required int usageCount, required String createdAt, required String updatedAt, String? deletedAt, Map<String, dynamic>? metadata})
Discount.fromJson(Map<String, dynamic> json)
factory

Properties

code String
A unique code for the discount - this will be used by the customer to apply the discount
getter/setter pair
createdAt String
The date with timezone at which the resource was created.
getter/setter pair
deletedAt String?
The date with timezone at which the resource was deleted.
getter/setter pair
endsAt String?
The time at which the discount can no longer be used.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String
The discount's ID
getter/setter pair
isDisabled bool
Whether the Discount has been disabled. Disabled discounts cannot be applied to carts
getter/setter pair
isDynamic bool
A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts
getter/setter pair
metadata Map<String, dynamic>?
An optional key-value map with additional details
getter/setter pair
parentDiscount Discount?
The details of the parent discount that this discount was created from.
getter/setter pair
parentDiscountId String?
The Discount that the discount was created from. This will always be a dynamic discount
getter/setter pair
regions List<Region>?
The details of the regions in which the Discount can be used.
getter/setter pair
rule DiscountRule?
The details of the discount rule that defines how the discount will be applied to a cart..
getter/setter pair
ruleId String?
The ID of the discount rule that defines how the discount will be applied to a cart.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startsAt String
The time at which the discount can be used.
getter/setter pair
updatedAt String
The date with timezone at which the resource was updated.
getter/setter pair
usageCount int
The number of times a discount has been used.
getter/setter pair
usageLimit int?
The maximum number of times that a discount can be used.
getter/setter pair
validDuration String?
Duration the discount runs between
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited