refactor cart

This commit is contained in:
2025-12-15 23:07:50 +03:30
parent fea123f61e
commit 3e4a4eebe4
13 changed files with 494 additions and 414 deletions
@@ -162,6 +162,7 @@ export class CouponService {
code: string,
restId: string,
orderAmount: number,
userPhone: string,
): Promise<{
valid: boolean;
coupon?: Coupon;
@@ -179,6 +180,14 @@ export class CouponService {
};
}
if (coupon.userPhone) {
if (userPhone !== coupon.userPhone) {
return {
valid: false,
message: CouponMessage.COUPON_RESTRICTED_TO_USER,
};
}
}
// Check if coupon is active
if (!coupon.isActive) {
return {