Steps to Reproduce:
- Create an order
- Add an order line, quantity=2, unit price=$37.5 (Details probably don't matter)
- Open the order
- Create an invoice
- Add an invoice line related to the po line
- Approve the invoice
- Pay the invoice
- Close the order
The order closes.
The order fails to close. The request to mod-orders returns a 422 error:
The issue comes from OpenToClosedEncumbranceStrategy in mod-orders. When an order is closed and the only linked encumbrance is released, getOrderEncumbrances() returns an empty list and createOrUpdateEncumbrances() fails in createOrUpdateOrderTransactionSummary() because it assumes it can get an order id from the list of encumbrances.
The error message comes from mod-orders calling mod-finance with a null id.
It is possible the issue was introduced by
MODORDERS-482 with the implementation change in TransactionSummariesService#createOrUpdateOrderTransactionSummary.