Good day! I am writing in Java. There is the following logic: the complete payment chain is as follows:
- check
- payment (data from item 1 are taken)
- status check (data from item 2 are taken)
- cancel (optional).
The following errors may occur from the service provider:
- disconnection at stage 1-2
- Payment hangs in the status of "Processing" for 10-20 minutes ...
In case of a break in step 1, retry request is needed.
In the event of a break in stage 2, it is necessary to poll the status for about 20 minutes.
+ Validation of responses received in case of successful responses.
Tell me how to better organize the code, what patterns to pay attention to?