The program keeps one record per order. On the normal path, the record moves through three states:
- Claimed and sending
- In Coupa, waiting for approval
- Ordered: number saved, comment sent or queued
When Coupa does not say yes, the record lands in one of these:
Refused
Coupa said the data is wrong. One comment on the order. A person fixes it, then the integration team sends it again.
Not sent
The program could not get into Coupa, so nothing was created. It tries again. After 5 tries, the integration team is told.
Unknown
No clear answer after 5 tries. The comment says it may be in Coupa, and asks a person to check before anyone sends it again.
Before it creates anything, the program claims the order, and the database lets only one run do that. If Coupa’s answer is lost, the next round asks Coupa first, by the saved title. If Coupa holds two requests with that title, the program stops and tells a person.
Known limit: a Coupa create slower than 60 seconds could be made twice. A real build needs a timeout on every Coupa call, and a duplicate check on Coupa’s side.