feat: send mail notifications of sale receipts

This commit is contained in:
Ahmed Bouhuolia
2023-12-24 21:49:59 +02:00
parent f0e15d43d3
commit b6d99b1d4b
5 changed files with 231 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import {
IPaginationMeta,
ISaleReceipt,
ISalesReceiptsFilter,
SaleReceiptMailOpts,
} from '@/interfaces';
import { EditSaleReceipt } from './EditSaleReceipt';
import { GetSaleReceipt } from './GetSaleReceipt';
@@ -13,6 +14,7 @@ import { GetSaleReceipts } from './GetSaleReceipts';
import { CloseSaleReceipt } from './CloseSaleReceipt';
import { SaleReceiptsPdf } from './SaleReceiptsPdfService';
import { SaleReceiptNotifyBySms } from './SaleReceiptNotifyBySms';
import { SaleReceiptMailNotification } from './SaleReceiptMailNotification';
@Service()
export class SaleReceiptApplication {
@@ -40,6 +42,9 @@ export class SaleReceiptApplication {
@Inject()
private saleReceiptNotifyBySmsService: SaleReceiptNotifyBySms;
@Inject()
private saleReceiptNotifyByMailService: SaleReceiptMailNotification;
/**
* Creates a new sale receipt with associated entries.
* @param {number} tenantId
@@ -166,4 +171,21 @@ export class SaleReceiptApplication {
saleReceiptId
);
}
/**
* Sends the receipt mail of the given sale receipt.
* @param {number} tenantId
* @param {number} saleReceiptId
*/
public sendSaleReceiptMail(
tenantId: number,
saleReceiptId: number,
messageOpts: SaleReceiptMailOpts
) {
return this.saleReceiptNotifyByMailService.triggerMail(
tenantId,
saleReceiptId,
messageOpts
);
}
}