feat: add endpoints to retrieving the default mail options

This commit is contained in:
Ahmed Bouhuolia
2023-12-25 18:21:02 +02:00
parent 657400c671
commit 3c8c3d8253
8 changed files with 181 additions and 0 deletions

View File

@@ -132,6 +132,12 @@ export default class PaymentReceivesController extends BaseController {
this.sendPaymentReceiveByMail.bind(this),
this.handleServiceErrors
);
router.get(
'/:id/mail',
[...this.paymentReceiveValidation],
asyncMiddleware(this.getPaymentDefaultMail.bind(this)),
this.handleServiceErrors
);
return router;
}
@@ -553,6 +559,31 @@ export default class PaymentReceivesController extends BaseController {
}
};
/**
* Retrieves the default mail options of the given payment transaction.
* @param {Request} req
* @param {Response} res
* @param {NextFunction} next
*/
public getPaymentDefaultMail = async (
req: Request,
res: Response,
next: NextFunction
) => {
const { tenantId } = req;
const { id: paymentReceiveId } = req.params;
try {
const data = await this.paymentReceiveApplication.getPaymentDefaultMail(
tenantId,
paymentReceiveId
);
return res.status(200).send({ data });
} catch (error) {
next(error);
}
};
/**
* Handles service errors.
* @param error