chore: add queue for the discount invalidation

This commit is contained in:
mahyargdz
2025-04-19 16:16:37 +03:30
parent 53aaef4c81
commit 1567d61aca
6 changed files with 142 additions and 5 deletions
@@ -584,6 +584,8 @@ export class InvoicesService {
if (!discount) throw new BadRequestException(InvoiceMessage.INVALID_DISCOUNT_CODE);
if (discount.endDate && dayjs(discount.endDate).isBefore(dayjs())) throw new BadRequestException(InvoiceMessage.DISCOUNT_EXPIRED);
if (!invoice.originalPrice) invoice.originalPrice = new Decimal(invoice.totalPrice);
let discountAmount: Decimal;