feat: promotion usage limit (#13760)
* feat: promotion usage limit * fix: update, refactor tests, parallel case * fix: batch update, cleanup unused map * feat: paralel campaign and promotion tests * chore: changesets, fix i18 schema * fix: ui tweaks * chore: refactor --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
5da51064d7
commit
536a3f802c
18 files changed
+1269
-11
No files matched your search
@@ -180,6 +180,10 @@ export interface AdminCreatePromotion {
|
||||
* The application method of the promotion.
|
||||
*/
|
||||
application_method: AdminCreateApplicationMethod
|
||||
/**
|
||||
* The maximum number of times this promotion can be used.
|
||||
*/
|
||||
limit?: number | null
|
||||
/**
|
||||
* The rules of the promotion.
|
||||
*/
|
||||
@@ -221,6 +225,10 @@ export interface AdminUpdatePromotion {
|
||||
* The application method of the promotion.
|
||||
*/
|
||||
application_method?: AdminUpdateApplicationMethod
|
||||
/**
|
||||
* The maximum number of times this promotion can be used.
|
||||
*/
|
||||
limit?: number | null
|
||||
/**
|
||||
* The rules of the promotion.
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,8 @@ export interface BasePromotion {
|
||||
type?: PromotionTypeValues
|
||||
is_automatic?: boolean
|
||||
is_tax_inclusive?: boolean
|
||||
limit?: number | null
|
||||
used?: number
|
||||
application_method?: BaseApplicationMethod
|
||||
rules?: BasePromotionRule[]
|
||||
status?: PromotionStatusValues
|
||||
|
||||
@@ -9,6 +9,7 @@ export type ComputeActions =
|
||||
| AddShippingMethodAdjustment
|
||||
| RemoveShippingMethodAdjustment
|
||||
| CampaignBudgetExceededAction
|
||||
| PromotionLimitExceededAction
|
||||
|
||||
/**
|
||||
* These computed action types can affect a campaign's budget.
|
||||
@@ -41,6 +42,21 @@ export interface CampaignBudgetExceededAction {
|
||||
code: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This action indicates that a promotion usage limit has been exceeded.
|
||||
*/
|
||||
export interface PromotionLimitExceededAction {
|
||||
/**
|
||||
* The type of action.
|
||||
*/
|
||||
action: "promotionLimitExceeded"
|
||||
|
||||
/**
|
||||
* The promotion's code.
|
||||
*/
|
||||
code: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This action indicates that an adjustment must be made to an item. For example, removing $5 off its amount.
|
||||
*/
|
||||
|
||||
@@ -65,6 +65,16 @@ export interface PromotionDTO {
|
||||
*/
|
||||
is_tax_inclusive?: boolean
|
||||
|
||||
/**
|
||||
* The maximum number of times this promotion can be used across all orders.
|
||||
*/
|
||||
limit?: number | null
|
||||
|
||||
/**
|
||||
* The number of times this promotion has been used in completed orders.
|
||||
*/
|
||||
used?: number
|
||||
|
||||
/**
|
||||
* The associated application method.
|
||||
*/
|
||||
@@ -123,6 +133,11 @@ export interface CreatePromotionDTO {
|
||||
*/
|
||||
is_tax_inclusive?: boolean
|
||||
|
||||
/**
|
||||
* The maximum number of times this promotion can be used.
|
||||
*/
|
||||
limit?: number | null
|
||||
|
||||
/**
|
||||
* The associated application method.
|
||||
*/
|
||||
@@ -173,6 +188,11 @@ export interface UpdatePromotionDTO {
|
||||
*/
|
||||
is_tax_inclusive?: boolean
|
||||
|
||||
/**
|
||||
* The maximum number of times this promotion can be used.
|
||||
*/
|
||||
limit?: number | null
|
||||
|
||||
/**
|
||||
* The status of the promotion:
|
||||
*
|
||||
|
||||
@@ -49,6 +49,7 @@ export enum ComputedActions {
|
||||
REMOVE_ITEM_ADJUSTMENT = "removeItemAdjustment",
|
||||
REMOVE_SHIPPING_METHOD_ADJUSTMENT = "removeShippingMethodAdjustment",
|
||||
CAMPAIGN_BUDGET_EXCEEDED = "campaignBudgetExceeded",
|
||||
PROMOTION_LIMIT_EXCEEDED = "promotionLimitExceeded",
|
||||
}
|
||||
|
||||
export enum PromotionActions {
|
||||
|
||||
Reference in new issue
Block a user