Recently completed a project for handling credit card processing. One of the difficulties I faced was handling the delay / possible failure of notification messages. The most complex example was:
- an external system sending the request for payment
- my system turning that request into a request to the payment gateway
- sending the user to the gateway
- waiting for the user to perform payment
- the user returning back to my system but being held until the system receives notification of success/failure
- Sending the user back to the external system depending on failure
Even more difficult was the fact that upon failure to send the notification the gateway attempts to send the notification every 15 minutes for a number of hours.
I solved it using a database record of pending transactions and then detecting success and failure from the return plus a timed delay listener for the notification and transaction handling...
Reasonably difficult!
But this must have been solved a gazillion times before so what is the best practice?
I can see my future is going to be writing the handling between all of these systems and managing the time delays and possible network failures so I want to be following the best practices.
Book / article recommendations would be great.
Thanks in advance!