@lyxa.ai/marketing 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/index.d.ts +60 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +59 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +7 -0
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +3 -0
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +8 -2
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing-conflict.service.d.ts +1 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing-conflict.service.js +4 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +3 -0
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.js +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js +49 -2
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/index.d.ts +60 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +59 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing-conflict.service.d.ts +5 -0
- package/dist/types/modules/marketing/services/marketing-conflict.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/spend-to-get-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +5 -0
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/package.json +1 -1
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/routers/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/routers/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js +0 -62
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/services/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -24
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js +0 -136
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/validations/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -232
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js +0 -30
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +0 -82
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +0 -73
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
- package/dist/types/events/event-initializations.d.ts +0 -2
- package/dist/types/events/event-initializations.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/services/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/services/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -56
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -241
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
|
@@ -67,7 +67,6 @@ declare const DiscountMarketingValidationSchema: z.ZodObject<{
|
|
|
67
67
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
68
68
|
maxDiscountPerOrder: number;
|
|
69
69
|
pausedAt: Date | null;
|
|
70
|
-
marketingType: MarketingType.DISCOUNT;
|
|
71
70
|
products: {
|
|
72
71
|
product: import("mongoose").Types.ObjectId;
|
|
73
72
|
value?: number | undefined;
|
|
@@ -76,6 +75,7 @@ declare const DiscountMarketingValidationSchema: z.ZodObject<{
|
|
|
76
75
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
77
76
|
isBuy1Get1?: boolean | undefined;
|
|
78
77
|
}[];
|
|
78
|
+
marketingType: MarketingType.DISCOUNT;
|
|
79
79
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
80
80
|
isOnlyForSubscriber: boolean;
|
|
81
81
|
value?: number | undefined;
|
|
@@ -337,7 +337,6 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
337
337
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
338
338
|
maxDiscountPerOrder: number;
|
|
339
339
|
pausedAt: Date | null;
|
|
340
|
-
marketingType: MarketingType.DISCOUNT;
|
|
341
340
|
products: {
|
|
342
341
|
product: import("mongoose").Types.ObjectId;
|
|
343
342
|
value?: number | undefined;
|
|
@@ -346,6 +345,7 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
346
345
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
347
346
|
isBuy1Get1?: boolean | undefined;
|
|
348
347
|
}[];
|
|
348
|
+
marketingType: MarketingType.DISCOUNT;
|
|
349
349
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
350
350
|
isOnlyForSubscriber: boolean;
|
|
351
351
|
value?: number | undefined;
|
|
@@ -399,7 +399,6 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
399
399
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
400
400
|
maxDiscountPerOrder: number;
|
|
401
401
|
pausedAt: Date | null;
|
|
402
|
-
marketingType: MarketingType.DISCOUNT;
|
|
403
402
|
products: {
|
|
404
403
|
product: import("mongoose").Types.ObjectId;
|
|
405
404
|
value?: number | undefined;
|
|
@@ -408,6 +407,7 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
408
407
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
409
408
|
isBuy1Get1?: boolean | undefined;
|
|
410
409
|
}[];
|
|
410
|
+
marketingType: MarketingType.DISCOUNT;
|
|
411
411
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
412
412
|
isOnlyForSubscriber: boolean;
|
|
413
413
|
value?: number | undefined;
|
|
@@ -187,13 +187,13 @@ export declare const BatchCreateProductMarketingsInputSchema: z.ZodObject<{
|
|
|
187
187
|
shop: import("mongoose").Types.ObjectId;
|
|
188
188
|
categories: import("mongoose").Types.ObjectId[];
|
|
189
189
|
isEntireMenu: boolean;
|
|
190
|
-
isBuy1Get1: boolean;
|
|
191
190
|
products: {
|
|
192
191
|
product: import("mongoose").Types.ObjectId;
|
|
193
192
|
value?: number | undefined;
|
|
194
193
|
valueType?: ValueType | null | undefined;
|
|
195
194
|
}[];
|
|
196
195
|
marketingId: import("mongoose").Types.ObjectId;
|
|
196
|
+
isBuy1Get1: boolean;
|
|
197
197
|
value?: number | undefined;
|
|
198
198
|
valueType?: ValueType | undefined;
|
|
199
199
|
isAppliedByCompany?: boolean | undefined;
|
|
@@ -202,8 +202,8 @@ export declare const BatchCreateProductMarketingsInputSchema: z.ZodObject<{
|
|
|
202
202
|
}, {
|
|
203
203
|
shop: string | import("mongoose").Types.ObjectId;
|
|
204
204
|
isEntireMenu: boolean;
|
|
205
|
-
isBuy1Get1: boolean;
|
|
206
205
|
marketingId: string | import("mongoose").Types.ObjectId;
|
|
206
|
+
isBuy1Get1: boolean;
|
|
207
207
|
value?: number | undefined;
|
|
208
208
|
valueType?: ValueType | undefined;
|
|
209
209
|
categories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
|
|
|
18
18
|
input: {
|
|
19
19
|
user: string | import("mongoose").Types.ObjectId;
|
|
20
20
|
shop: string | import("mongoose").Types.ObjectId;
|
|
21
|
-
marketing: string | import("mongoose").Types.ObjectId;
|
|
22
21
|
minimumOrderValue: number;
|
|
22
|
+
marketing: string | import("mongoose").Types.ObjectId;
|
|
23
23
|
targetOrder: number;
|
|
24
24
|
couponValueType: import("@lyxa.ai/core/dist/utilities/enum").ValueType;
|
|
25
25
|
couponValue: number;
|
package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare class PunchMarketingHistoryService {
|
|
|
19
19
|
private createNewHistory;
|
|
20
20
|
applyPunchDiscountToOrder(userId: mongoose.Types.ObjectId, orderId: mongoose.Types.ObjectId): Promise<void>;
|
|
21
21
|
getPunchDiscount(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO>;
|
|
22
|
+
getPunchDiscountForAdjust(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO>;
|
|
22
23
|
getPunchCoupon(user: mongoose.Types.ObjectId, shop: mongoose.Types.ObjectId): Promise<any>;
|
|
23
24
|
returnPunchCoupon(orderId: mongoose.Types.ObjectId): Promise<void>;
|
|
24
25
|
}
|
package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"punch-marketing-history.service.d.ts","sourceRoot":"/","sources":["modules/punch-marketing-history/services/punch-marketing-history.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,s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,GAC9B,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"punch-marketing-history.service.d.ts","sourceRoot":"/","sources":["modules/punch-marketing-history/services/punch-marketing-history.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAElG,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAEN,qBAAqB,IAAI,KAAK,EAK9B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,8BAA8B,IAAI,SAAS,EAC3C,mBAAmB,EACnB,8BAA8B,IAAI,SAAS,EAC3C,MAAM,8CAA8C,CAAC;AAWtD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAO3F,qBACa,4BAA4B;IACxC,OAAO,CAAC,KAAK,CAA6D;IAC1E,OAAO,CAAC,cAAc,CAA+D;IACrF,OAAO,CAAC,UAAU,CAA2D;;IAYhE,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAQrD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAkB5E,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAyB3F,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IAuCzD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IA2BjE,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB5C,oBAAoB,CAChC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAC9B,OAAO,CAAC,MAAM,CAAC;YA6DJ,gBAAgB;IAkDjB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;IA0C3F,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IA+D7E,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IA0DtF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA6C1F,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAkB/E;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|
package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js
CHANGED
|
@@ -172,7 +172,8 @@ let PunchMarketingHistoryService = class PunchMarketingHistoryService {
|
|
|
172
172
|
status: enum_1.PunchMarketingStatus.ACTIVE,
|
|
173
173
|
});
|
|
174
174
|
if (existingHistory) {
|
|
175
|
-
if (order.finance.pricing.subtotal ?? 0
|
|
175
|
+
if ((0, shared_1.roundBaseCurrency)((order.finance.pricing.subtotal ?? 0) - (order.finance.pricing.discount ?? 0)) >=
|
|
176
|
+
existingHistory.minimumOrderValue) {
|
|
176
177
|
const completedAt = existingHistory.targetOrder == existingHistory.completedOrder + 1 ? new Date() : null;
|
|
177
178
|
const couponExpiryDate = completedAt
|
|
178
179
|
? (0, dayjs_1.dayjs)(completedAt).add(existingHistory.couponDurationInDays, 'day').toDate()
|
|
@@ -225,7 +226,8 @@ let PunchMarketingHistoryService = class PunchMarketingHistoryService {
|
|
|
225
226
|
const couponExpiryDate = completedAt
|
|
226
227
|
? (0, dayjs_1.dayjs)(completedAt).add(marketing.couponDurationInDays, 'day').toDate()
|
|
227
228
|
: null;
|
|
228
|
-
if (order.finance.pricing.subtotal ?? 0
|
|
229
|
+
if ((0, shared_1.roundBaseCurrency)((order.finance.pricing.subtotal ?? 0) - (order.finance.pricing.discount ?? 0)) >=
|
|
230
|
+
marketing.minimumOrderValue) {
|
|
229
231
|
const data = {
|
|
230
232
|
user: userId,
|
|
231
233
|
shop: order.shop,
|
|
@@ -320,6 +322,51 @@ let PunchMarketingHistoryService = class PunchMarketingHistoryService {
|
|
|
320
322
|
},
|
|
321
323
|
};
|
|
322
324
|
}
|
|
325
|
+
async getPunchDiscountForAdjust(data) {
|
|
326
|
+
const punchHistory = await this.model.findOne({
|
|
327
|
+
user: data.user,
|
|
328
|
+
shop: data.shop,
|
|
329
|
+
couponExpiryDate: { $gte: new Date() },
|
|
330
|
+
status: enum_1.PunchMarketingStatus.COUPON_USED,
|
|
331
|
+
});
|
|
332
|
+
if (!punchHistory) {
|
|
333
|
+
return {
|
|
334
|
+
isValid: false,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (data.scheduledAt &&
|
|
338
|
+
Boolean(punchHistory.couponExpiryDate) &&
|
|
339
|
+
(0, dayjs_1.dayjs)(punchHistory.couponExpiryDate).isBefore(data.scheduledAt)) {
|
|
340
|
+
return {
|
|
341
|
+
isValid: false,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
let discountAmount = punchHistory.couponValueType == enum_1.ValueType.FIXED
|
|
345
|
+
? punchHistory.couponValue
|
|
346
|
+
: (0, shared_1.roundBaseCurrency)((punchHistory.couponValue / 100) * data.amountBeforeCoupon);
|
|
347
|
+
let secondaryDiscountAmount = punchHistory.couponValueType == enum_1.ValueType.FIXED
|
|
348
|
+
? await (0, currency_1.convertToSecondary)(punchHistory.couponValue)
|
|
349
|
+
: (0, shared_1.roundSecondaryCurrency)((punchHistory.couponValue / 100) * data.secondaryAmountBeforeCoupon);
|
|
350
|
+
if (discountAmount > data.amountBeforeCoupon) {
|
|
351
|
+
discountAmount = data.amountBeforeCoupon;
|
|
352
|
+
}
|
|
353
|
+
if (secondaryDiscountAmount > data.secondaryAmountBeforeCoupon) {
|
|
354
|
+
secondaryDiscountAmount = data.secondaryAmountBeforeCoupon;
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
isValid: true,
|
|
358
|
+
discountAmount,
|
|
359
|
+
secondaryDiscountAmount,
|
|
360
|
+
amountAfterCoupon: Math.max(0, (0, shared_1.roundBaseCurrency)(data.amountBeforeCoupon - discountAmount)),
|
|
361
|
+
secondaryAmountAfterCoupon: Math.max(0, (0, shared_1.roundSecondaryCurrency)(data.secondaryAmountBeforeCoupon - secondaryDiscountAmount)),
|
|
362
|
+
discountCut: {
|
|
363
|
+
companyCut: 0,
|
|
364
|
+
secondaryCompanyCut: 0,
|
|
365
|
+
shopCut: discountAmount,
|
|
366
|
+
secondaryShopCut: secondaryDiscountAmount,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
}
|
|
323
370
|
async getPunchCoupon(user, shop) {
|
|
324
371
|
const punchHistory = await this.model.findOne({
|
|
325
372
|
user: user,
|
package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"punch-marketing-history.service.js","sourceRoot":"/","sources":["modules/punch-marketing-history/services/punch-marketing-history.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAA0E;AAC1E,iDAA4C;AAC5C,yCAAyC;AAGzC,wEAA6G;AAE7G,sE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ACR,iCAAiC,EAAE,IAAI;YACvC,8BAA8B,EAAE,IAAI;SACpC,CAAC;QACF,OAAO,WAAW,CAAC;IACpB,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,OAAgC;QAC9D,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAChC;YACC,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,2BAAoB,CAAC,WAAW;SACxC,EACD;YACC,IAAI,EAAE;gBACL,MAAM,EAAE,2BAAoB,CAAC,SAAS;gBACtC,KAAK,EAAE,IAAI;aACX;SACD,EACD;YACC,GAAG,EAAE,IAAI;YACT,aAAa,EAAE,IAAI;SACnB,CACD,CAAC;IACH,CAAC;CACD,CAAA;AAvaY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;;GACG,4BAA4B,CAuaxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import { notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';\nimport { FilterDTO, PaginatedResponse, DeleteDTO } from '@lyxa.ai/core/dist/utilities/validation';\nimport { createRawDocumentPaginatorObject, PaginatorOptions } from '@lyxa.ai/core/dist/utilities/pagination';\nimport { ModelType } from '@typegoose/typegoose/lib/types';\nimport {\n\tPunchMarketingHistoryModel,\n\tPunchMarketingHistory as Model,\n\tPunchMarketingModel,\n\tPunchMarketing,\n\tRegularOrder,\n\tRegularOrderModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreatePunchMarketingHistoryDTO as CreateDTO,\n\tGetByUserAndShopDTO,\n\tUpdatePunchMarketingHistoryDTO as UpdateDTO,\n} from '@modules/punch-marketing-history/validations';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tCouponType,\n\tMarketingType,\n\tPunchMarketingStatus,\n\tStatus,\n\tValueType,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\nimport { PunchMarketingSchema, PunchMarketingValidationSchema } from '@modules/marketing/validations';\nimport { CouponValidationOutputDTO, ValidateCouponDTO } from '@modules/coupon/validations';\nimport { convertToSecondary } from '@lyxa.ai/core/dist/utilities/currency';\nimport { roundBaseCurrency, roundSecondaryCurrency } from '@lyxa.ai/core/dist/utilities/shared';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport { ChangeStreamOperationTypes } from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\n\n@Service()\nexport class PunchMarketingHistoryService {\n\tprivate model: typeof PunchMarketingHistoryModel & SoftDeleteModel<Model>;\n\tprivate marketingModel: typeof PunchMarketingModel & SoftDeleteModel<PunchMarketing>;\n\tprivate orderModel: typeof RegularOrderModel & SoftDeleteModel<RegularOrder>;\n\n\tconstructor() {\n\t\tthis.model = PunchMarketingHistoryModel as typeof PunchMarketingHistoryModel & SoftDeleteModel<Model>;\n\t\tthis.marketingModel = PunchMarketingModel as typeof PunchMarketingModel & SoftDeleteModel<PunchMarketing>;\n\t\tthis.orderModel = RegularOrderModel as typeof RegularOrderModel & SoftDeleteModel<RegularOrder>;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\treturn await this.model.create(data);\n\t}\n\n\t/**\n\t * Get record by ID\n\t * @param id ID of the record\n\t */\n\tpublic async findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.findOne({\n\t\t\t_id: id,\n\t\t\tdeletedAt: null,\n\t\t});\n\t\tif (!result) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: 'Record not found',\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get records\n\t * @param query Query to find records\n\t */\n\tpublic async find(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>> {\n\t\ttry {\n\t\t\tconst paginate = createRawDocumentPaginatorObject(this.model as ReturnModelType<typeof this.model>);\n\t\t\tconst options: PaginatorOptions<typeof Model> = {\n\t\t\t\tpage: data?.page,\n\t\t\t\tsize: data?.size,\n\t\t\t\tsort: data?.sort,\n\t\t\t\tquery: data?.query,\n\t\t\t\tselect: data?.select,\n\t\t\t\tpopulate: data?.populate,\n\t\t\t};\n\t\t\tconst paginatedResult = await paginate(options);\n\t\t\treturn paginatedResult;\n\t\t} catch (err) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'INTERNAL_SERVER_ERROR',\n\t\t\t\tmessage: `err: ${err}`,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Get Record\n\t * @param UserId ShopId to find records\n\t */\n\tpublic async getByUserAndShop(data: GetByUserAndShopDTO): Promise<any> {\n\t\tlet result = await this.model.findOne({\n\t\t\tuser: data.userId,\n\t\t\tshop: data.shopId,\n\t\t\texpiryDate: { $gt: new Date() },\n\t\t\tcompletedAt: null,\n\t\t\tstatus: PunchMarketingStatus.ACTIVE,\n\t\t});\n\n\t\tif (result) return result;\n\n\t\tconst marketing = await this.marketingModel.findOne({\n\t\t\tmarketingType: MarketingType.PUNCH_MARKETING,\n\t\t\tshop: data.shopId,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lt: new Date() },\n\t\t\t'duration.end': { $gt: new Date() },\n\t\t});\n\n\t\tif (!marketing) notFoundError('No Punch Marketing is Active For This Shop...');\n\n\t\treturn {\n\t\t\tuser: data.userId,\n\t\t\tshop: data.shopId,\n\t\t\tmarketing: marketing!._id,\n\t\t\ttargetOrder: marketing.targetOrders,\n\t\t\tminimumOrderValue: marketing.minimumOrderValue,\n\t\t\tcompletedOrder: 0,\n\t\t\tcouponValueType: marketing.couponValueType,\n\t\t\tcouponValue: marketing.couponValue,\n\t\t\tcouponDurationInDays: marketing.couponDurationInDays,\n\t\t};\n\t}\n\n\t/**\n\t * Update record\n\t * @param id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(id: string, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst record = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\t_id: id,\n\t\t\t\tdeletedAt: null,\n\t\t\t},\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\tif (!record) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: `Record not found`,\n\t\t\t});\n\t\t}\n\n\t\treturn record;\n\t}\n\n\t/**\n\t * Delete record\n\t * @param data Data for delete\n\t */\n\tpublic async deleteById(data: DeleteDTO): Promise<string> {\n\t\tconst { _id, softDelete } = data;\n\n\t\tconst result = await this.model.deleteRecord({ _id, deletedAt: null }, softDelete);\n\t\tif (!result) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: 'Record not found',\n\t\t\t});\n\t\t}\n\n\t\treturn 'Record deleted successfully';\n\t}\n\n\t/**\n\t * Increment punch history for user\n\t * @param userId User ID\n\t * @param orderId Order ID\n\t */\n\tpublic async incrementUserHistory(\n\t\tuserId: mongoose.Types.ObjectId,\n\t\torderId: mongoose.Types.ObjectId\n\t): Promise<string> {\n\t\tconst order = await this.orderModel.findById(orderId);\n\n\t\tif (!order || order.user.toString != userId.toString) {\n\t\t\tnotFoundError('Order not found');\n\t\t}\n\n\t\tconst existingHistory = await this.model.findOne({\n\t\t\tuser: userId,\n\t\t\tshop: order.shop,\n\t\t\texpiryDate: { $gt: new Date() },\n\t\t\tcompletedAt: null,\n\t\t\tstatus: PunchMarketingStatus.ACTIVE,\n\t\t});\n\n\t\tif (existingHistory) {\n\t\t\tif (order.finance.pricing.subtotal ?? 0 >= existingHistory.minimumOrderValue) {\n\t\t\t\tconst completedAt =\n\t\t\t\t\texistingHistory.targetOrder == existingHistory.completedOrder + 1 ? new Date() : null;\n\t\t\t\tconst couponExpiryDate = completedAt\n\t\t\t\t\t? dayjs(completedAt).add(existingHistory.couponDurationInDays, 'day').toDate()\n\t\t\t\t\t: null;\n\t\t\t\tconst status = completedAt ? PunchMarketingStatus.COMPLETED : PunchMarketingStatus.ACTIVE;\n\n\t\t\t\tawait this.model.findByIdAndUpdate(\n\t\t\t\t\texistingHistory._id,\n\t\t\t\t\t{\n\t\t\t\t\t\t$inc: {\n\t\t\t\t\t\t\tcompletedOrder: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcompletedAt,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\tcouponExpiryDate,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tnew: true,\n\t\t\t\t\t\trunValidators: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tawait this.createNewHistory(userId, order);\n\t\t}\n\n\t\tawait publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent({\n\t\t\tuserId,\n\t\t\tshopId: order.shop._id,\n\t\t\toperation: ChangeStreamOperationTypes.UPDATE,\n\t\t});\n\n\t\treturn 'Record updated successfully';\n\t}\n\n\t/**\n\t * Create new history with current punch marketing of the shop\n\t * @param userId User ID\n\t * @param order Order document\n\t */\n\tprivate async createNewHistory(userId: mongoose.Types.ObjectId, order: DocumentType<RegularOrder>) {\n\t\tconst marketing = await this.marketingModel.findOne({\n\t\t\tmarketingType: MarketingType.PUNCH_MARKETING,\n\t\t\tshop: order.shop,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lt: new Date() },\n\t\t\t'duration.end': { $gt: new Date() },\n\t\t});\n\n\t\tif (!marketing) notFoundError('Marketing Not Found');\n\n\t\tconst expiryDate = dayjs().add(marketing.dayLimit, 'day').toDate();\n\t\tconst couponDurationInDays = marketing!.couponDurationInDays;\n\t\tconst couponValue = marketing!.couponValue;\n\t\tconst couponValueType = marketing!.couponValueType;\n\t\tconst targetOrder = marketing!.targetOrders;\n\t\tconst minimumOrderValue = marketing!.minimumOrderValue;\n\t\tconst completedOrder = 1;\n\t\tconst status =\n\t\t\tmarketing!.targetOrders == completedOrder\n\t\t\t\t? PunchMarketingStatus.COMPLETED\n\t\t\t\t: PunchMarketingStatus.ACTIVE;\n\t\tconst completedAt = marketing!.targetOrders == completedOrder ? new Date() : null;\n\t\tconst couponExpiryDate = completedAt\n\t\t\t? dayjs(completedAt).add(marketing!.couponDurationInDays, 'day').toDate()\n\t\t\t: null;\n\n\t\tif (order.finance.pricing.subtotal ?? 0 >= marketing.minimumOrderValue) {\n\t\t\tconst data: CreateDTO = {\n\t\t\t\tuser: userId as mongoose.Types.ObjectId,\n\t\t\t\tshop: order!.shop as mongoose.Types.ObjectId,\n\t\t\t\tmarketing: marketing!._id as mongoose.Types.ObjectId,\n\t\t\t\ttargetOrder,\n\t\t\t\tminimumOrderValue,\n\t\t\t\tcompletedOrder,\n\t\t\t\tstatus,\n\t\t\t\tcouponValueType,\n\t\t\t\tcouponValue,\n\t\t\t\tcouponDurationInDays,\n\t\t\t\texpiryDate,\n\t\t\t\t...(completedAt && { completedAt }),\n\t\t\t\t...(couponExpiryDate && { couponExpiryDate }),\n\t\t\t};\n\t\t\tawait this.create(data);\n\t\t}\n\t}\n\n\tpublic async applyPunchDiscountToOrder(userId: mongoose.Types.ObjectId, orderId: mongoose.Types.ObjectId) {\n\t\tconst order = await this.orderModel.findById(orderId);\n\t\tif (!order) notFoundError('Order not found');\n\n\t\tconst punchHistory = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\tuser: userId,\n\t\t\t\tshop: order.shop,\n\t\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t\t},\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\torder: orderId,\n\t\t\t\t\tstatus: PunchMarketingStatus.COUPON_USED,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\tif (!punchHistory) notFoundError('No valid punch coupon available');\n\n\t\tawait this.orderModel.findByIdAndUpdate(orderId, {\n\t\t\t$push: {\n\t\t\t\tmarketings: punchHistory.marketing,\n\t\t\t},\n\t\t});\n\n\t\tawait publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent({\n\t\t\tuserId,\n\t\t\tshopId: order.shop._id,\n\t\t\toperation: ChangeStreamOperationTypes.DELETE,\n\t\t});\n\t}\n\n\t/**\n\t * Get punch discount\n\t * @param data Data to use for validating discount\n\t */\n\tpublic async getPunchDiscount(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO> {\n\t\tconst punchHistory = await this.model.findOne({\n\t\t\tuser: data.user,\n\t\t\tshop: data.shop,\n\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t});\n\n\t\tif (!punchHistory) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tdata.scheduledAt &&\n\t\t\tBoolean(punchHistory.couponExpiryDate) &&\n\t\t\tdayjs(punchHistory.couponExpiryDate).isBefore(data.scheduledAt)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tlet discountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? punchHistory.couponValue\n\t\t\t\t: roundBaseCurrency((punchHistory.couponValue / 100) * data.amountBeforeCoupon);\n\n\t\tlet secondaryDiscountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? await convertToSecondary(punchHistory.couponValue)\n\t\t\t\t: roundSecondaryCurrency((punchHistory.couponValue / 100) * data.secondaryAmountBeforeCoupon);\n\n\t\tif (discountAmount > data.amountBeforeCoupon) {\n\t\t\tdiscountAmount = data.amountBeforeCoupon;\n\t\t}\n\t\tif (secondaryDiscountAmount > data.secondaryAmountBeforeCoupon) {\n\t\t\tsecondaryDiscountAmount = data.secondaryAmountBeforeCoupon;\n\t\t}\n\n\t\treturn {\n\t\t\tisValid: true,\n\t\t\tdiscountAmount,\n\t\t\tsecondaryDiscountAmount,\n\t\t\tamountAfterCoupon: Math.max(0, roundBaseCurrency(data.amountBeforeCoupon - discountAmount)),\n\t\t\tsecondaryAmountAfterCoupon: Math.max(\n\t\t\t\t0,\n\t\t\t\troundSecondaryCurrency(data.secondaryAmountBeforeCoupon - secondaryDiscountAmount)\n\t\t\t),\n\t\t\tdiscountCut: {\n\t\t\t\tcompanyCut: 0,\n\t\t\t\tsecondaryCompanyCut: 0,\n\t\t\t\tshopCut: discountAmount,\n\t\t\t\tsecondaryShopCut: secondaryDiscountAmount,\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic async getPunchCoupon(user: mongoose.Types.ObjectId, shop: mongoose.Types.ObjectId): Promise<any> {\n\t\tconst punchHistory = await this.model.findOne({\n\t\t\tuser: user,\n\t\t\tshop: shop,\n\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t});\n\t\tif (!punchHistory) return null;\n\n\t\tconst settings = await getLibraries().getCachedSettingsService().getSettings();\n\t\tconst exchangeRate = settings?.currencySetting?.exchangeRate ?? 0;\n\n\t\tconst punchCoupon = {\n\t\t\t_id: null,\n\t\t\tcode: 'punch',\n\t\t\tcouponType: CouponType.INDIVIDUAL_USER,\n\t\t\torderLimitPerUser: 1,\n\t\t\tcreatedBy: null,\n\t\t\tdeletedAt: null,\n\t\t\tvalueType: punchHistory.couponValueType,\n\t\t\tvalue: punchHistory.couponValue,\n\t\t\tmaxDiscountLimit: null,\n\t\t\tduration: {\n\t\t\t\tstart: punchHistory.completedAt,\n\t\t\t\tend: punchHistory.couponExpiryDate,\n\t\t\t},\n\t\t\tshops: [shop],\n\t\t\tspendLimit: null,\n\t\t\ttotalOrderLimit: 1,\n\t\t\tminOrderValue: null,\n\t\t\tforNewUserOnly: false,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\texpirationReason: null,\n\t\t\tcreatedAt: punchHistory.completedAt,\n\t\t\tupdatedAt: punchHistory.completedAt,\n\t\t\tsecondaryCurrencyValue:\n\t\t\t\tpunchHistory.couponValueType === ValueType.FIXED\n\t\t\t\t\t? roundSecondaryCurrency(punchHistory.couponValue * exchangeRate)\n\t\t\t\t\t: null,\n\t\t\tsecondaryCurrencyMaxDiscountLimit: null,\n\t\t\tsecondaryCurrencyMinOrderValue: null,\n\t\t};\n\t\treturn punchCoupon;\n\t}\n\n\tpublic async returnPunchCoupon(orderId: mongoose.Types.ObjectId): Promise<void> {\n\t\tawait this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\torder: orderId,\n\t\t\t\tstatus: PunchMarketingStatus.COUPON_USED,\n\t\t\t},\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t\t\t\torder: null,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport const punchMarketingHistoryService = Container.get(PunchMarketingHistoryService);\n"]}
|
|
1
|
+
{"version":3,"file":"punch-marketing-history.service.js","sourceRoot":"/","sources":["modules/punch-marketing-history/services/punch-marketing-history.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAA0E;AAC1E,iDAA4C;AAC5C,yCAAyC;AAGzC,wEAA6G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AAA;AA3eY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;;GACG,4BAA4B,CA2exC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import { notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';\nimport { FilterDTO, PaginatedResponse, DeleteDTO } from '@lyxa.ai/core/dist/utilities/validation';\nimport { createRawDocumentPaginatorObject, PaginatorOptions } from '@lyxa.ai/core/dist/utilities/pagination';\nimport { ModelType } from '@typegoose/typegoose/lib/types';\nimport {\n\tPunchMarketingHistoryModel,\n\tPunchMarketingHistory as Model,\n\tPunchMarketingModel,\n\tPunchMarketing,\n\tRegularOrder,\n\tRegularOrderModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreatePunchMarketingHistoryDTO as CreateDTO,\n\tGetByUserAndShopDTO,\n\tUpdatePunchMarketingHistoryDTO as UpdateDTO,\n} from '@modules/punch-marketing-history/validations';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tCouponType,\n\tMarketingType,\n\tPunchMarketingStatus,\n\tStatus,\n\tValueType,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\nimport { PunchMarketingSchema, PunchMarketingValidationSchema } from '@modules/marketing/validations';\nimport { CouponValidationOutputDTO, ValidateCouponDTO } from '@modules/coupon/validations';\nimport { convertToSecondary } from '@lyxa.ai/core/dist/utilities/currency';\nimport { roundBaseCurrency, roundSecondaryCurrency } from '@lyxa.ai/core/dist/utilities/shared';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport { ChangeStreamOperationTypes } from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\n\n@Service()\nexport class PunchMarketingHistoryService {\n\tprivate model: typeof PunchMarketingHistoryModel & SoftDeleteModel<Model>;\n\tprivate marketingModel: typeof PunchMarketingModel & SoftDeleteModel<PunchMarketing>;\n\tprivate orderModel: typeof RegularOrderModel & SoftDeleteModel<RegularOrder>;\n\n\tconstructor() {\n\t\tthis.model = PunchMarketingHistoryModel as typeof PunchMarketingHistoryModel & SoftDeleteModel<Model>;\n\t\tthis.marketingModel = PunchMarketingModel as typeof PunchMarketingModel & SoftDeleteModel<PunchMarketing>;\n\t\tthis.orderModel = RegularOrderModel as typeof RegularOrderModel & SoftDeleteModel<RegularOrder>;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\treturn await this.model.create(data);\n\t}\n\n\t/**\n\t * Get record by ID\n\t * @param id ID of the record\n\t */\n\tpublic async findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.findOne({\n\t\t\t_id: id,\n\t\t\tdeletedAt: null,\n\t\t});\n\t\tif (!result) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: 'Record not found',\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get records\n\t * @param query Query to find records\n\t */\n\tpublic async find(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>> {\n\t\ttry {\n\t\t\tconst paginate = createRawDocumentPaginatorObject(this.model as ReturnModelType<typeof this.model>);\n\t\t\tconst options: PaginatorOptions<typeof Model> = {\n\t\t\t\tpage: data?.page,\n\t\t\t\tsize: data?.size,\n\t\t\t\tsort: data?.sort,\n\t\t\t\tquery: data?.query,\n\t\t\t\tselect: data?.select,\n\t\t\t\tpopulate: data?.populate,\n\t\t\t};\n\t\t\tconst paginatedResult = await paginate(options);\n\t\t\treturn paginatedResult;\n\t\t} catch (err) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'INTERNAL_SERVER_ERROR',\n\t\t\t\tmessage: `err: ${err}`,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Get Record\n\t * @param UserId ShopId to find records\n\t */\n\tpublic async getByUserAndShop(data: GetByUserAndShopDTO): Promise<any> {\n\t\tlet result = await this.model.findOne({\n\t\t\tuser: data.userId,\n\t\t\tshop: data.shopId,\n\t\t\texpiryDate: { $gt: new Date() },\n\t\t\tcompletedAt: null,\n\t\t\tstatus: PunchMarketingStatus.ACTIVE,\n\t\t});\n\n\t\tif (result) return result;\n\n\t\tconst marketing = await this.marketingModel.findOne({\n\t\t\tmarketingType: MarketingType.PUNCH_MARKETING,\n\t\t\tshop: data.shopId,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lt: new Date() },\n\t\t\t'duration.end': { $gt: new Date() },\n\t\t});\n\n\t\tif (!marketing) notFoundError('No Punch Marketing is Active For This Shop...');\n\n\t\treturn {\n\t\t\tuser: data.userId,\n\t\t\tshop: data.shopId,\n\t\t\tmarketing: marketing!._id,\n\t\t\ttargetOrder: marketing.targetOrders,\n\t\t\tminimumOrderValue: marketing.minimumOrderValue,\n\t\t\tcompletedOrder: 0,\n\t\t\tcouponValueType: marketing.couponValueType,\n\t\t\tcouponValue: marketing.couponValue,\n\t\t\tcouponDurationInDays: marketing.couponDurationInDays,\n\t\t};\n\t}\n\n\t/**\n\t * Update record\n\t * @param id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(id: string, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst record = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\t_id: id,\n\t\t\t\tdeletedAt: null,\n\t\t\t},\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\tif (!record) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: `Record not found`,\n\t\t\t});\n\t\t}\n\n\t\treturn record;\n\t}\n\n\t/**\n\t * Delete record\n\t * @param data Data for delete\n\t */\n\tpublic async deleteById(data: DeleteDTO): Promise<string> {\n\t\tconst { _id, softDelete } = data;\n\n\t\tconst result = await this.model.deleteRecord({ _id, deletedAt: null }, softDelete);\n\t\tif (!result) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'NOT_FOUND',\n\t\t\t\tmessage: 'Record not found',\n\t\t\t});\n\t\t}\n\n\t\treturn 'Record deleted successfully';\n\t}\n\n\t/**\n\t * Increment punch history for user\n\t * @param userId User ID\n\t * @param orderId Order ID\n\t */\n\tpublic async incrementUserHistory(\n\t\tuserId: mongoose.Types.ObjectId,\n\t\torderId: mongoose.Types.ObjectId\n\t): Promise<string> {\n\t\tconst order = await this.orderModel.findById(orderId);\n\n\t\tif (!order || order.user.toString != userId.toString) {\n\t\t\tnotFoundError('Order not found');\n\t\t}\n\n\t\tconst existingHistory = await this.model.findOne({\n\t\t\tuser: userId,\n\t\t\tshop: order.shop,\n\t\t\texpiryDate: { $gt: new Date() },\n\t\t\tcompletedAt: null,\n\t\t\tstatus: PunchMarketingStatus.ACTIVE,\n\t\t});\n\n\t\tif (existingHistory) {\n\t\t\tif (\n\t\t\t\troundBaseCurrency((order.finance.pricing.subtotal ?? 0) - (order.finance.pricing.discount ?? 0)) >=\n\t\t\t\texistingHistory.minimumOrderValue\n\t\t\t) {\n\t\t\t\tconst completedAt =\n\t\t\t\t\texistingHistory.targetOrder == existingHistory.completedOrder + 1 ? new Date() : null;\n\t\t\t\tconst couponExpiryDate = completedAt\n\t\t\t\t\t? dayjs(completedAt).add(existingHistory.couponDurationInDays, 'day').toDate()\n\t\t\t\t\t: null;\n\t\t\t\tconst status = completedAt ? PunchMarketingStatus.COMPLETED : PunchMarketingStatus.ACTIVE;\n\n\t\t\t\tawait this.model.findByIdAndUpdate(\n\t\t\t\t\texistingHistory._id,\n\t\t\t\t\t{\n\t\t\t\t\t\t$inc: {\n\t\t\t\t\t\t\tcompletedOrder: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcompletedAt,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\tcouponExpiryDate,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tnew: true,\n\t\t\t\t\t\trunValidators: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tawait this.createNewHistory(userId, order);\n\t\t}\n\n\t\tawait publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent({\n\t\t\tuserId,\n\t\t\tshopId: order.shop._id,\n\t\t\toperation: ChangeStreamOperationTypes.UPDATE,\n\t\t});\n\n\t\treturn 'Record updated successfully';\n\t}\n\n\t/**\n\t * Create new history with current punch marketing of the shop\n\t * @param userId User ID\n\t * @param order Order document\n\t */\n\tprivate async createNewHistory(userId: mongoose.Types.ObjectId, order: DocumentType<RegularOrder>) {\n\t\tconst marketing = await this.marketingModel.findOne({\n\t\t\tmarketingType: MarketingType.PUNCH_MARKETING,\n\t\t\tshop: order.shop,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lt: new Date() },\n\t\t\t'duration.end': { $gt: new Date() },\n\t\t});\n\n\t\tif (!marketing) notFoundError('Marketing Not Found');\n\n\t\tconst expiryDate = dayjs().add(marketing.dayLimit, 'day').toDate();\n\t\tconst couponDurationInDays = marketing!.couponDurationInDays;\n\t\tconst couponValue = marketing!.couponValue;\n\t\tconst couponValueType = marketing!.couponValueType;\n\t\tconst targetOrder = marketing!.targetOrders;\n\t\tconst minimumOrderValue = marketing!.minimumOrderValue;\n\t\tconst completedOrder = 1;\n\t\tconst status =\n\t\t\tmarketing!.targetOrders == completedOrder\n\t\t\t\t? PunchMarketingStatus.COMPLETED\n\t\t\t\t: PunchMarketingStatus.ACTIVE;\n\t\tconst completedAt = marketing!.targetOrders == completedOrder ? new Date() : null;\n\t\tconst couponExpiryDate = completedAt\n\t\t\t? dayjs(completedAt).add(marketing!.couponDurationInDays, 'day').toDate()\n\t\t\t: null;\n\n\t\tif (\n\t\t\troundBaseCurrency((order.finance.pricing.subtotal ?? 0) - (order.finance.pricing.discount ?? 0)) >=\n\t\t\tmarketing.minimumOrderValue\n\t\t) {\n\t\t\tconst data: CreateDTO = {\n\t\t\t\tuser: userId as mongoose.Types.ObjectId,\n\t\t\t\tshop: order!.shop as mongoose.Types.ObjectId,\n\t\t\t\tmarketing: marketing!._id as mongoose.Types.ObjectId,\n\t\t\t\ttargetOrder,\n\t\t\t\tminimumOrderValue,\n\t\t\t\tcompletedOrder,\n\t\t\t\tstatus,\n\t\t\t\tcouponValueType,\n\t\t\t\tcouponValue,\n\t\t\t\tcouponDurationInDays,\n\t\t\t\texpiryDate,\n\t\t\t\t...(completedAt && { completedAt }),\n\t\t\t\t...(couponExpiryDate && { couponExpiryDate }),\n\t\t\t};\n\t\t\tawait this.create(data);\n\t\t}\n\t}\n\n\tpublic async applyPunchDiscountToOrder(userId: mongoose.Types.ObjectId, orderId: mongoose.Types.ObjectId) {\n\t\tconst order = await this.orderModel.findById(orderId);\n\t\tif (!order) notFoundError('Order not found');\n\n\t\tconst punchHistory = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\tuser: userId,\n\t\t\t\tshop: order.shop,\n\t\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t\t},\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\torder: orderId,\n\t\t\t\t\tstatus: PunchMarketingStatus.COUPON_USED,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\tif (!punchHistory) notFoundError('No valid punch coupon available');\n\n\t\tawait this.orderModel.findByIdAndUpdate(orderId, {\n\t\t\t$push: {\n\t\t\t\tmarketings: punchHistory.marketing,\n\t\t\t},\n\t\t});\n\n\t\tawait publishSyncUserShopPunchMarketingHistoryWithPunchSectionCacheProcessEvent({\n\t\t\tuserId,\n\t\t\tshopId: order.shop._id,\n\t\t\toperation: ChangeStreamOperationTypes.DELETE,\n\t\t});\n\t}\n\n\t/**\n\t * Get punch discount\n\t * @param data Data to use for validating discount\n\t */\n\tpublic async getPunchDiscount(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO> {\n\t\tconst punchHistory = await this.model.findOne({\n\t\t\tuser: data.user,\n\t\t\tshop: data.shop,\n\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t});\n\n\t\tif (!punchHistory) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tdata.scheduledAt &&\n\t\t\tBoolean(punchHistory.couponExpiryDate) &&\n\t\t\tdayjs(punchHistory.couponExpiryDate).isBefore(data.scheduledAt)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tlet discountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? punchHistory.couponValue\n\t\t\t\t: roundBaseCurrency((punchHistory.couponValue / 100) * data.amountBeforeCoupon);\n\n\t\tlet secondaryDiscountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? await convertToSecondary(punchHistory.couponValue)\n\t\t\t\t: roundSecondaryCurrency((punchHistory.couponValue / 100) * data.secondaryAmountBeforeCoupon);\n\n\t\tif (discountAmount > data.amountBeforeCoupon) {\n\t\t\tdiscountAmount = data.amountBeforeCoupon;\n\t\t}\n\t\tif (secondaryDiscountAmount > data.secondaryAmountBeforeCoupon) {\n\t\t\tsecondaryDiscountAmount = data.secondaryAmountBeforeCoupon;\n\t\t}\n\n\t\treturn {\n\t\t\tisValid: true,\n\t\t\tdiscountAmount,\n\t\t\tsecondaryDiscountAmount,\n\t\t\tamountAfterCoupon: Math.max(0, roundBaseCurrency(data.amountBeforeCoupon - discountAmount)),\n\t\t\tsecondaryAmountAfterCoupon: Math.max(\n\t\t\t\t0,\n\t\t\t\troundSecondaryCurrency(data.secondaryAmountBeforeCoupon - secondaryDiscountAmount)\n\t\t\t),\n\t\t\tdiscountCut: {\n\t\t\t\tcompanyCut: 0,\n\t\t\t\tsecondaryCompanyCut: 0,\n\t\t\t\tshopCut: discountAmount,\n\t\t\t\tsecondaryShopCut: secondaryDiscountAmount,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Get punch discount for adjust order\n\t * @param data Data to use for validating discount\n\t */\n\tpublic async getPunchDiscountForAdjust(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO> {\n\t\tconst punchHistory = await this.model.findOne({\n\t\t\tuser: data.user,\n\t\t\tshop: data.shop,\n\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\tstatus: PunchMarketingStatus.COUPON_USED,\n\t\t});\n\t\tif (!punchHistory) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tdata.scheduledAt &&\n\t\t\tBoolean(punchHistory.couponExpiryDate) &&\n\t\t\tdayjs(punchHistory.couponExpiryDate).isBefore(data.scheduledAt)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t};\n\t\t}\n\n\t\tlet discountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? punchHistory.couponValue\n\t\t\t\t: roundBaseCurrency((punchHistory.couponValue / 100) * data.amountBeforeCoupon);\n\n\t\tlet secondaryDiscountAmount =\n\t\t\tpunchHistory.couponValueType == ValueType.FIXED\n\t\t\t\t? await convertToSecondary(punchHistory.couponValue)\n\t\t\t\t: roundSecondaryCurrency((punchHistory.couponValue / 100) * data.secondaryAmountBeforeCoupon);\n\n\t\tif (discountAmount > data.amountBeforeCoupon) {\n\t\t\tdiscountAmount = data.amountBeforeCoupon;\n\t\t}\n\t\tif (secondaryDiscountAmount > data.secondaryAmountBeforeCoupon) {\n\t\t\tsecondaryDiscountAmount = data.secondaryAmountBeforeCoupon;\n\t\t}\n\n\t\treturn {\n\t\t\tisValid: true,\n\t\t\tdiscountAmount,\n\t\t\tsecondaryDiscountAmount,\n\t\t\tamountAfterCoupon: Math.max(0, roundBaseCurrency(data.amountBeforeCoupon - discountAmount)),\n\t\t\tsecondaryAmountAfterCoupon: Math.max(\n\t\t\t\t0,\n\t\t\t\troundSecondaryCurrency(data.secondaryAmountBeforeCoupon - secondaryDiscountAmount)\n\t\t\t),\n\t\t\tdiscountCut: {\n\t\t\t\tcompanyCut: 0,\n\t\t\t\tsecondaryCompanyCut: 0,\n\t\t\t\tshopCut: discountAmount,\n\t\t\t\tsecondaryShopCut: secondaryDiscountAmount,\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic async getPunchCoupon(user: mongoose.Types.ObjectId, shop: mongoose.Types.ObjectId): Promise<any> {\n\t\tconst punchHistory = await this.model.findOne({\n\t\t\tuser: user,\n\t\t\tshop: shop,\n\t\t\tcouponExpiryDate: { $gte: new Date() },\n\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t});\n\t\tif (!punchHistory) return null;\n\n\t\tconst settings = await getLibraries().getCachedSettingsService().getSettings();\n\t\tconst exchangeRate = settings?.currencySetting?.exchangeRate ?? 0;\n\n\t\tconst punchCoupon = {\n\t\t\t_id: null,\n\t\t\tcode: 'punch',\n\t\t\tcouponType: CouponType.INDIVIDUAL_USER,\n\t\t\torderLimitPerUser: 1,\n\t\t\tcreatedBy: null,\n\t\t\tdeletedAt: null,\n\t\t\tvalueType: punchHistory.couponValueType,\n\t\t\tvalue: punchHistory.couponValue,\n\t\t\tmaxDiscountLimit: null,\n\t\t\tduration: {\n\t\t\t\tstart: punchHistory.completedAt,\n\t\t\t\tend: punchHistory.couponExpiryDate,\n\t\t\t},\n\t\t\tshops: [shop],\n\t\t\tspendLimit: null,\n\t\t\ttotalOrderLimit: 1,\n\t\t\tminOrderValue: null,\n\t\t\tforNewUserOnly: false,\n\t\t\tstatus: Status.ACTIVE,\n\t\t\texpirationReason: null,\n\t\t\tcreatedAt: punchHistory.completedAt,\n\t\t\tupdatedAt: punchHistory.completedAt,\n\t\t\tsecondaryCurrencyValue:\n\t\t\t\tpunchHistory.couponValueType === ValueType.FIXED\n\t\t\t\t\t? roundSecondaryCurrency(punchHistory.couponValue * exchangeRate)\n\t\t\t\t\t: null,\n\t\t\tsecondaryCurrencyMaxDiscountLimit: null,\n\t\t\tsecondaryCurrencyMinOrderValue: null,\n\t\t};\n\t\treturn punchCoupon;\n\t}\n\n\tpublic async returnPunchCoupon(orderId: mongoose.Types.ObjectId): Promise<void> {\n\t\tawait this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\torder: orderId,\n\t\t\t\tstatus: PunchMarketingStatus.COUPON_USED,\n\t\t\t},\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\tstatus: PunchMarketingStatus.COMPLETED,\n\t\t\t\t\torder: null,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport const punchMarketingHistoryService = Container.get(PunchMarketingHistoryService);\n"]}
|
package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ declare const PunchMarketingHistoryValidationSchema: z.ZodObject<{
|
|
|
19
19
|
}, "strict", z.ZodTypeAny, {
|
|
20
20
|
user: import("mongoose").Types.ObjectId;
|
|
21
21
|
shop: import("mongoose").Types.ObjectId;
|
|
22
|
-
marketing: import("mongoose").Types.ObjectId;
|
|
23
22
|
minimumOrderValue: number;
|
|
23
|
+
marketing: import("mongoose").Types.ObjectId;
|
|
24
24
|
targetOrder: number;
|
|
25
25
|
couponValueType: ValueType;
|
|
26
26
|
couponValue: number;
|
|
@@ -34,8 +34,8 @@ declare const PunchMarketingHistoryValidationSchema: z.ZodObject<{
|
|
|
34
34
|
}, {
|
|
35
35
|
user: string | import("mongoose").Types.ObjectId;
|
|
36
36
|
shop: string | import("mongoose").Types.ObjectId;
|
|
37
|
-
marketing: string | import("mongoose").Types.ObjectId;
|
|
38
37
|
minimumOrderValue: number;
|
|
38
|
+
marketing: string | import("mongoose").Types.ObjectId;
|
|
39
39
|
targetOrder: number;
|
|
40
40
|
couponValueType: ValueType;
|
|
41
41
|
couponValue: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6793,6 +6793,65 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
6793
6793
|
};
|
|
6794
6794
|
meta: object;
|
|
6795
6795
|
}>;
|
|
6796
|
+
validatePunchCouponForAdjustOrder: import("@trpc/server").TRPCQueryProcedure<{
|
|
6797
|
+
input: {
|
|
6798
|
+
user: string | import("mongoose").Types.ObjectId;
|
|
6799
|
+
amountBeforeCoupon: number;
|
|
6800
|
+
secondaryAmountBeforeCoupon: number;
|
|
6801
|
+
shop?: string | import("mongoose").Types.ObjectId | undefined;
|
|
6802
|
+
vendor?: string | import("mongoose").Types.ObjectId | undefined;
|
|
6803
|
+
coupon?: string | undefined;
|
|
6804
|
+
scheduledAt?: string | Date | undefined;
|
|
6805
|
+
};
|
|
6806
|
+
output: {
|
|
6807
|
+
message: string;
|
|
6808
|
+
success: boolean;
|
|
6809
|
+
data?: {
|
|
6810
|
+
message?: string | undefined;
|
|
6811
|
+
isValid?: boolean | undefined;
|
|
6812
|
+
amountAfterCoupon?: number | undefined;
|
|
6813
|
+
secondaryAmountAfterCoupon?: number | undefined;
|
|
6814
|
+
discountAmount?: number | undefined;
|
|
6815
|
+
secondaryDiscountAmount?: number | undefined;
|
|
6816
|
+
discountCut?: {
|
|
6817
|
+
companyCut?: number | undefined;
|
|
6818
|
+
secondaryCompanyCut?: number | undefined;
|
|
6819
|
+
shopCut?: number | undefined;
|
|
6820
|
+
secondaryShopCut?: number | undefined;
|
|
6821
|
+
vendorCut?: number | undefined;
|
|
6822
|
+
secondaryVendorCut?: number | undefined;
|
|
6823
|
+
} | undefined;
|
|
6824
|
+
couponDetails?: Record<string, unknown> | undefined;
|
|
6825
|
+
couponInfo?: Record<string, unknown> | undefined;
|
|
6826
|
+
} | {
|
|
6827
|
+
documents: {
|
|
6828
|
+
message?: string | undefined;
|
|
6829
|
+
isValid?: boolean | undefined;
|
|
6830
|
+
amountAfterCoupon?: number | undefined;
|
|
6831
|
+
secondaryAmountAfterCoupon?: number | undefined;
|
|
6832
|
+
discountAmount?: number | undefined;
|
|
6833
|
+
secondaryDiscountAmount?: number | undefined;
|
|
6834
|
+
discountCut?: {
|
|
6835
|
+
companyCut?: number | undefined;
|
|
6836
|
+
secondaryCompanyCut?: number | undefined;
|
|
6837
|
+
shopCut?: number | undefined;
|
|
6838
|
+
secondaryShopCut?: number | undefined;
|
|
6839
|
+
vendorCut?: number | undefined;
|
|
6840
|
+
secondaryVendorCut?: number | undefined;
|
|
6841
|
+
} | undefined;
|
|
6842
|
+
couponDetails?: Record<string, unknown> | undefined;
|
|
6843
|
+
couponInfo?: Record<string, unknown> | undefined;
|
|
6844
|
+
}[];
|
|
6845
|
+
metadata?: {
|
|
6846
|
+
page: number;
|
|
6847
|
+
size: number;
|
|
6848
|
+
totalElements: number;
|
|
6849
|
+
totalPages: number;
|
|
6850
|
+
} | undefined;
|
|
6851
|
+
} | undefined;
|
|
6852
|
+
};
|
|
6853
|
+
meta: object;
|
|
6854
|
+
}>;
|
|
6796
6855
|
validateCouponMutation: import("@trpc/server").TRPCMutationProcedure<{
|
|
6797
6856
|
input: {
|
|
6798
6857
|
user: string | import("mongoose").Types.ObjectId;
|
|
@@ -8464,8 +8523,8 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
8464
8523
|
input: {
|
|
8465
8524
|
user: string | import("mongoose").Types.ObjectId;
|
|
8466
8525
|
shop: string | import("mongoose").Types.ObjectId;
|
|
8467
|
-
marketing: string | import("mongoose").Types.ObjectId;
|
|
8468
8526
|
minimumOrderValue: number;
|
|
8527
|
+
marketing: string | import("mongoose").Types.ObjectId;
|
|
8469
8528
|
targetOrder: number;
|
|
8470
8529
|
couponValueType: import("@lyxa.ai/core/dist/utilities/enum").ValueType;
|
|
8471
8530
|
couponValue: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAwBA,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAJmC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcnE,CAAC;AA0CH,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAC"}
|
|
@@ -5977,6 +5977,65 @@ export declare const couponRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5977
5977
|
};
|
|
5978
5978
|
meta: object;
|
|
5979
5979
|
}>;
|
|
5980
|
+
validatePunchCouponForAdjustOrder: import("@trpc/server").TRPCQueryProcedure<{
|
|
5981
|
+
input: {
|
|
5982
|
+
user: string | mongoose.Types.ObjectId;
|
|
5983
|
+
amountBeforeCoupon: number;
|
|
5984
|
+
secondaryAmountBeforeCoupon: number;
|
|
5985
|
+
shop?: string | mongoose.Types.ObjectId | undefined;
|
|
5986
|
+
vendor?: string | mongoose.Types.ObjectId | undefined;
|
|
5987
|
+
coupon?: string | undefined;
|
|
5988
|
+
scheduledAt?: string | Date | undefined;
|
|
5989
|
+
};
|
|
5990
|
+
output: {
|
|
5991
|
+
message: string;
|
|
5992
|
+
success: boolean;
|
|
5993
|
+
data?: {
|
|
5994
|
+
message?: string | undefined;
|
|
5995
|
+
isValid?: boolean | undefined;
|
|
5996
|
+
amountAfterCoupon?: number | undefined;
|
|
5997
|
+
secondaryAmountAfterCoupon?: number | undefined;
|
|
5998
|
+
discountAmount?: number | undefined;
|
|
5999
|
+
secondaryDiscountAmount?: number | undefined;
|
|
6000
|
+
discountCut?: {
|
|
6001
|
+
companyCut?: number | undefined;
|
|
6002
|
+
secondaryCompanyCut?: number | undefined;
|
|
6003
|
+
shopCut?: number | undefined;
|
|
6004
|
+
secondaryShopCut?: number | undefined;
|
|
6005
|
+
vendorCut?: number | undefined;
|
|
6006
|
+
secondaryVendorCut?: number | undefined;
|
|
6007
|
+
} | undefined;
|
|
6008
|
+
couponDetails?: Record<string, unknown> | undefined;
|
|
6009
|
+
couponInfo?: Record<string, unknown> | undefined;
|
|
6010
|
+
} | {
|
|
6011
|
+
documents: {
|
|
6012
|
+
message?: string | undefined;
|
|
6013
|
+
isValid?: boolean | undefined;
|
|
6014
|
+
amountAfterCoupon?: number | undefined;
|
|
6015
|
+
secondaryAmountAfterCoupon?: number | undefined;
|
|
6016
|
+
discountAmount?: number | undefined;
|
|
6017
|
+
secondaryDiscountAmount?: number | undefined;
|
|
6018
|
+
discountCut?: {
|
|
6019
|
+
companyCut?: number | undefined;
|
|
6020
|
+
secondaryCompanyCut?: number | undefined;
|
|
6021
|
+
shopCut?: number | undefined;
|
|
6022
|
+
secondaryShopCut?: number | undefined;
|
|
6023
|
+
vendorCut?: number | undefined;
|
|
6024
|
+
secondaryVendorCut?: number | undefined;
|
|
6025
|
+
} | undefined;
|
|
6026
|
+
couponDetails?: Record<string, unknown> | undefined;
|
|
6027
|
+
couponInfo?: Record<string, unknown> | undefined;
|
|
6028
|
+
}[];
|
|
6029
|
+
metadata?: {
|
|
6030
|
+
page: number;
|
|
6031
|
+
size: number;
|
|
6032
|
+
totalElements: number;
|
|
6033
|
+
totalPages: number;
|
|
6034
|
+
} | undefined;
|
|
6035
|
+
} | undefined;
|
|
6036
|
+
};
|
|
6037
|
+
meta: object;
|
|
6038
|
+
}>;
|
|
5980
6039
|
validateCouponMutation: import("@trpc/server").TRPCMutationProcedure<{
|
|
5981
6040
|
input: {
|
|
5982
6041
|
user: string | mongoose.Types.ObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAD5vqB,CAAC"}
|
|
@@ -67,6 +67,7 @@ export declare class CouponService {
|
|
|
67
67
|
expired: Array<DocumentType<Model>>;
|
|
68
68
|
}>;
|
|
69
69
|
validateCoupon(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO>;
|
|
70
|
+
validatePunchCouponForAdjustOrder(data: ValidateCouponDTO): Promise<CouponValidationOutputDTO>;
|
|
70
71
|
private isCouponExpired;
|
|
71
72
|
/**
|
|
72
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,EAQf,IAAI,EAOJ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,mCAAmC,EACnC,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,MAAM,yCAAyC,CAAC;AAMjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAS3D,OAAO,EAEN,UAAU,EAKV,MAAM,EACN,SAAS,EACT,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAmB,MAAM,2CAA2C,CAAC;AAoCxF,qBACa,aAAa;IACzB,OAAO,CAAC,KAAK,CAA8C;IAC3D,OAAO,CAAC,eAA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wB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAuBrF,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAiH3D,UAAU,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;IAqB3B,oBAAoB,CAAC,KAAK,EAAE,qBAAqB;;;;;;;;;IAKjD,qBAAqB,CAAC,KAAK,EAAE,4BAA4B;;;;;;;;;CAItE;AAED,eAAO,MAAM,aAAa,eAA+B,CAAC"}
|
|
@@ -66,8 +66,8 @@ export declare const ParticipantSchema: z.ZodObject<{
|
|
|
66
66
|
_id: import("mongoose").Types.ObjectId;
|
|
67
67
|
shop: import("mongoose").Types.ObjectId;
|
|
68
68
|
isEntireMenu: boolean;
|
|
69
|
-
joinedAt: Date;
|
|
70
69
|
products: import("mongoose").Types.ObjectId[];
|
|
70
|
+
joinedAt: Date;
|
|
71
71
|
campaign: import("mongoose").Types.ObjectId;
|
|
72
72
|
isOrderCapacityEnabled: boolean;
|
|
73
73
|
isWithdrawn: boolean;
|
|
@@ -14,6 +14,7 @@ export declare class LimitedTimeOfferParticipantService {
|
|
|
14
14
|
__v: number;
|
|
15
15
|
} & import("@typegoose/typegoose/lib/types").IObjectWithTypegooseFunction)[]>;
|
|
16
16
|
private joinShop;
|
|
17
|
+
private syncShopOrderCapacity;
|
|
17
18
|
private pauseIfLive;
|
|
18
19
|
withdraw(shopId: mongoose.Types.ObjectId): Promise<void>;
|
|
19
20
|
cleanupCampaignMarketings(campaignId: mongoose.Types.ObjectId): Promise<void>;
|