fix: the discount code bug in apply for invoice

This commit is contained in:
Mahyargdz
2025-05-25 09:23:29 +03:30
parent 8b467cb832
commit 15c7b841fe
@@ -725,7 +725,7 @@ export class InvoicesService {
if (discount?.user?.id && discount?.user?.id !== userId) throw new BadRequestException(InvoiceMessage.DISCOUNT_NOT_FOR_THIS_USER);
if (discount?.isActive) throw new BadRequestException(InvoiceMessage.DISCOUNT_IS_NOT_ACTIVE);
if (!discount?.isActive) throw new BadRequestException(InvoiceMessage.DISCOUNT_IS_NOT_ACTIVE);
if (discount.endDate && dayjs(discount.endDate).isBefore(dayjs())) throw new BadRequestException(InvoiceMessage.DISCOUNT_EXPIRED);