Good day! I am writing in Java. There is the following logic: the complete payment chain is as follows:

  1. check
  2. payment (data from item 1 are taken)
  3. status check (data from item 2 are taken)
  4. 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?

  • The developers who know Zen are not the ones who know where and which pattern to apply, but those who know where to do without them - rjhdby
  • Architect left? So, for the answers to such questions money is paid =) - vp_arth

1 answer 1

Begins pattern "Chain of Responsibilities"