refactor cart
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user