The order approval service changed the logic for persisting and starting the external notification. After the PR, behavior diverged from expectations: on failures, entries appear in an inappropriate state, and repeated processing of the same order started to work unstably.
You need to review the changes in OrderApprovalService and OrderRecord.
Behavior requirements:
approve method accepts orderId and amount;approve for the same orderId and different amount must be treated as different entries in history;history() snapshot must return all saved records in the order they were added.OrderApprovalService, passing a NotificationGateway that always throws an exception.approve("A-100", 150).history() after the exception.approve("A-100", 150)
approve("A-100", 300)
history() with the expected history.approve call must end with an exception, and the record must not be committed to history;orderId but different amount, both records must be present in history;history() must not hide the second record just because the order identifier matches.NotificationGateway.sendApproved models an external side effect that must occur as part of a successful approvalUse line comments to explain the problem, its impact, the fix and how to test it.