Dynamic Coupon Schema
Data Model
The dynamic coupon schema defines the structure of a coupon that can be dynamically generated by the system. The schema includes the following fields:
Attribute | Type | Description |
---|---|---|
couponCode | String | A unique code for the coupon. |
customerId | String | The customer ID associated with the coupon. |
creationDate | String | The date on which the coupon was created. |
expiryDate | String | The date on which the coupon expires. |
discountType | String | The type of discount offered by the coupon (e.g., percentage, fixed amount). |
discount | Number | The value of the discount offered by the coupon. |
discountPect | Number | The percentage of discount offered by the coupon. |
discountItem | Number | The number of items that are eligible for the discount. |
freeItem | String | The item that is eligible for a free offer. |
skuIds | Array | An array of SKU IDs that the coupon is applicable for. |
conditions | Array | An array of conditions that must be met to use the coupon. |
campaign | String | The name of the campaign that the coupon belongs to. |
title | String | The title of the coupon. |
desc | String | A description of the coupon. |
enabled | Boolean | A flag indicating whether the coupon is enabled or disabled. |
redeemed | Boolean | A flag indicating whether the coupon has been redeemed or not. |
format | String | The format of the coupon code. |
timestamps | Object | A flag that indicates whether to include timestamp fields (createdAt, updatedAt) in the schema. |
Example
{
couponCode: "ABC123",
customerId: "123456",
creationDate: "2023-03-11",
expiryDate: "2023-04-11",
discountType: "percentage",
discount: 20,
discountPect: 0,
discountItem: 0,
freeItem: "",
skuIds: ["sku123", "sku456"],
conditions: [{parameter:"payment.amount", compare:"greater", value:"1000"],
campaign: "MarchPromotion",
title: "Get 20% off on your order",
desc: "Use coupon code ABC123 to get a discount of 20% on your order",
enabled: true,
redeemed: false,
format: "COUPON-$*$",
createdAt: "2023-03-11T09:22:00.000Z",
updatedAt: "2023-03-11T09:22:00.000Z"
}
Summary
In this example, the coupon offers a discount of 20% on orders containing SKUs sku123 and sku456. The coupon can only be used if the order value is equal to or greater than 1000. The coupon code is ABC123, and it is valid from March 11, 2023, to April 11, 2023. The coupon belongs to the MarchPromotion campaign, and the title and description provide information on how to use the coupon. The coupon is currently enabled and has not yet been redeemed.