fix: validate payment made entries ids exists.

fix: retrieve payment made and receive details.
This commit is contained in:
Ahmed Bouhuolia
2020-11-04 00:23:58 +02:00
parent 083a2dfbc5
commit 1738a333c7
6 changed files with 132 additions and 38 deletions

View File

@@ -198,13 +198,16 @@ export default class BillsPayments extends BaseController {
const { id: billPaymentId } = req.params;
try {
const { billPayment, payableBills } = await this.billPaymentService.getBillPayment(tenantId, billPaymentId);
const {
billPayment,
payableBills,
paymentMadeBills,
} = await this.billPaymentService.getBillPayment(tenantId, billPaymentId);
return res.status(200).send({
bill_payment: {
...this.transfromToResponse({ ...billPayment }),
payable_bills: payableBills,
},
bill_payment: this.transfromToResponse({ ...billPayment }),
payable_bills: this.transfromToResponse([ ...payableBills ]),
payment_bills: this.transfromToResponse([ ...paymentMadeBills ]),
});
} catch (error) {
next(error);