feat: validate the payment not delivered on make payment receive.

This commit is contained in:
a.bouhuolia
2020-12-19 13:44:02 +02:00
parent 920875d7d9
commit cc47314a62
8 changed files with 286 additions and 163 deletions

View File

@@ -339,7 +339,18 @@ export default class PaymentReceivesController extends BaseController {
errors: [{ type: 'INVALID_PAYMENT_AMOUNT', code: 1000 }],
});
}
console.log(error.errorType);
if (error.errorType === 'INVOICES_NOT_DELIVERED_YET') {
return res.boom.badRequest(null, {
errors: [{
type: 'INVOICES_NOT_DELIVERED_YET', code: 200,
data: {
not_delivered_invoices_ids: error.payload.notDeliveredInvoices.map(
(invoice) => invoice.id
)
}
}],
});
}
}
next(error);
}