The payment code is the code you least want to try for the first time on a live phone. A fake provider that speaks the same states will catch the bugs that matter.
Same states, smaller money
The test double should return pending, paid, failed, and duplicate, because those are the branches the screen and the ledger use. A double that only returns success tests the decoration. Keep amounts in the smallest unit you store, and assert the invoice total rather than a string on the page.
The callback is a request
Post the callback payload at the real URL in the test client, including a duplicate delivery. The handler should mark one invoice paid and ignore the second. If the test only calls the service function, you will miss the authentication and the content type.
One live test, on purpose
Before launch, do one small live payment on a number you control and refund it or let it stand as a recorded test. Check the receipt, the portal status, and the email. Then turn the test keys off.
What to do this week
- Cover pending, paid, failed, and duplicate in tests.
- Hit the callback URL, not only the service.
- Run one small live payment and read the receipt.