feat: Assign default PDF template automatically

This commit is contained in:
Ahmed Bouhuolia
2024-10-02 18:18:57 +02:00
parent cbc60b3c73
commit b23112bc92
30 changed files with 501 additions and 46 deletions

View File

@@ -0,0 +1,18 @@
import { Service } from 'typedi';
import { IPaymentReceivedState } from '@/interfaces';
@Service()
export class GetPaymentReceivedState {
/**
* Retrieves the current state of the payment received.
* @param {number} tenantId - The ID of the tenant.
* @returns {Promise<IPaymentReceivedState>} - A promise resolving to the payment received state.
*/
public async getPaymentReceivedState(
tenantId: number
): Promise<IPaymentReceivedState> {
return {
defaultTemplateId: 1,
};
}
}

View File

@@ -19,6 +19,7 @@ import { GetPaymentReceivedInvoices } from './GetPaymentReceivedInvoices';
import { PaymentReceiveNotifyBySms } from './PaymentReceivedSmsNotify';
import GetPaymentReceivedPdf from './GetPaymentReceivedPdf';
import { SendPaymentReceiveMailNotification } from './PaymentReceivedMailNotification';
import { GetPaymentReceivedState } from './GetPaymentReceivedState';
@Service()
export class PaymentReceivesApplication {
@@ -49,6 +50,9 @@ export class PaymentReceivesApplication {
@Inject()
private getPaymentReceivePdfService: GetPaymentReceivedPdf;
@Inject()
private getPaymentReceivedStateService: GetPaymentReceivedState;
/**
* Creates a new payment receive.
* @param {number} tenantId
@@ -223,4 +227,10 @@ export class PaymentReceivesApplication {
paymentReceiveId
);
};
public getPaymentReceivedState = (tenantId: number) => {
return this.getPaymentReceivedStateService.getPaymentReceivedState(
tenantId
);
};
}