A small change in the payment accounting service needs to be reviewed. The feature accepts a payment, updates local storage, and starts background notification sending after a successful commit. It is expected that: 1) the transaction status changes only after a confirmed write to storage; 2) if notification sending fails, the payment itself remains successfully written; 3) a repeated call with the same paymentId does not create a second record. Runtime environment: Java 21, standard library, run without additional dependencies. Build and testing are done with plain javac/java in a single process.
Java 21, standard library only; execution via javac/java; no external dependencies; single-process review scenario
Use line comments to explain the problem, its impact, the fix and how to test it.