Created
October 14, 2025 13:06
-
-
Save tamimibrahim17/ee45851f4cc0022b9564e3cfbabee09e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| flowchart TD | |
| A["Job Started"] --> B["Get Order from Shopify API"] | |
| B --> C{"Order Retrieved?"} | |
| C -- No --> D["Return - Exit Job"] | |
| C -- Yes --> E["Get Store by Location ID"] | |
| E --> F{"Store Found?"} | |
| F -- No --> G["Log Error: Store Not Found"] | |
| G --> H["Throw Exception"] | |
| F -- Yes --> I["Check if Order is Active"] | |
| I --> J{"Order Active?"} | |
| J -- No --> K["Log: Order Cancelled/Paid"] | |
| K --> L["Return - Exit Job"] | |
| J -- Yes --> M["Calculate Payable Amount"] | |
| M --> N["Apply Decimal Rounding if Needed"] | |
| N --> O["Set Cache: Order Active"] | |
| O --> P["Initialize SafePayService"] | |
| P --> Q{"Protocol Running?"} | |
| Q -- No --> R["Stop & Restart Protocol"] | |
| Q -- Yes --> T["Open SafePay Session"] | |
| R --> T | |
| T --> U{"Session Opened?"} | |
| U -- No --> V["Log Error: Failed to Open"] | |
| U -- Yes --> W["Begin Deposit"] | |
| W --> X{"Deposit Started?"} | |
| X L_X_Y_0@-- No --> Y["Log Error: Deposit Not Started"] | |
| Y --> Z["Close Session"] | |
| Z --> AA["Throw Exception"] | |
| X -- Yes --> BB["Log: Deposit Started"] | |
| BB --> CC["Initialize Deposit Monitoring"] | |
| CC --> DD["Start 6-minute Timer"] | |
| DD --> EE["Check Deposit Status"] | |
| EE --> FF{"Deposit Check Success?"} | |
| FF -- No --> GG["Increment Error Counter"] | |
| GG --> HH{"Error Count > 10?"} | |
| HH -- Yes --> II["Break Loop - End timer"] | |
| HH -- No --> JJ["Wait 1 Second"] | |
| JJ --> KK{"Time Remaining?"} | |
| KK -- Yes --> EE | |
| KK -- No --> LL["Get Final Deposit Amount"] | |
| FF -- Yes --> MM["Update Deposited Amount"] | |
| MM --> NN{"Deposited >= Payable?"} | |
| NN -- Yes --> OO["End Timer - Break Loop"] | |
| NN -- No --> JJ | |
| OO --> LL | |
| II --> LL | |
| LL --> PP{"Deposit Retrieved?"} | |
| PP -- No --> QQ["Log Error: Deposit Not Retrieved"] | |
| PP -- Yes --> RR["Check Deposit vs Payable"] | |
| QQ --> RR | |
| RR --> SS{"Deposited >= Payable?"} | |
| SS -- No --> TT["Log: Deposit Timed Out"] | |
| SS -- Yes --> UU["Calculate Dispenseable Amount"] | |
| TT --> VV["Log: Deposit Successful"] | |
| UU --> WW["Set Shopify Transaction"] | |
| WW --> XX["Log: Payment Successful"] | |
| VV --> YY["Check Dispenseable Amount"] | |
| XX --> YY | |
| YY --> ZZ{"Dispenseable > 0?"} | |
| ZZ -- No --> AAA["Close Session"] | |
| ZZ -- Yes --> BBB["Simulate Dispense"] | |
| BBB --> CCC{"Simulate Success?"} | |
| CCC -- No --> DDD["Log Error: Simulate Failed"] | |
| DDD --> EEE{"Dispensed > 0?"} | |
| EEE -- Yes --> FFF["Dispense All & Close"] | |
| EEE -- No --> GGG["Close Session"] | |
| FFF --> HHH["Return - Exit Job"] | |
| GGG --> HHH | |
| CCC -- Yes --> III["Execute Dispense"] | |
| III --> JJJ{"Dispense Success?"} | |
| JJJ -- No --> KKK["Log Error: Dispense Failed"] | |
| JJJ -- Yes --> LLL["Log: Dispense Successful"] | |
| KKK --> AAA | |
| LLL --> AAA | |
| AAA --> MMM["Clear Cache: Order Active"] | |
| MMM --> NNN["Job Completed"] | |
| OOO["Job Failed"] --> PPP["Clear Cache: Order Active"] | |
| PPP --> QQQ["Get Store ID from Cache"] | |
| QQQ --> RRR{"Store ID Available?"} | |
| RRR -- No --> SSS["Log Error & Exit"] | |
| RRR -- Yes --> TTT["Initialize SafePayService"] | |
| TTT --> UUU["End Deposit"] | |
| UUU --> VVV["Close Session"] | |
| VVV --> WWW["Log Failure Details"] | |
| A:::processNode | |
| B:::processNode | |
| C:::decisionNode | |
| E:::processNode | |
| F:::decisionNode | |
| G:::errorNode | |
| H:::errorNode | |
| J:::decisionNode | |
| M:::processNode | |
| O:::processNode | |
| P:::processNode | |
| Q:::decisionNode | |
| T:::processNode | |
| U:::decisionNode | |
| V:::errorNode | |
| W:::processNode | |
| X:::decisionNode | |
| Y:::errorNode | |
| AA:::errorNode | |
| BB:::successNode | |
| CC:::processNode | |
| EE:::processNode | |
| FF:::decisionNode | |
| HH:::decisionNode | |
| KK:::decisionNode | |
| LL:::processNode | |
| MM:::processNode | |
| NN:::decisionNode | |
| PP:::decisionNode | |
| RR:::processNode | |
| SS:::decisionNode | |
| UU:::processNode | |
| WW:::processNode | |
| XX:::successNode | |
| YY:::processNode | |
| ZZ:::decisionNode | |
| AAA:::processNode | |
| BBB:::processNode | |
| CCC:::decisionNode | |
| DDD:::errorNode | |
| EEE:::decisionNode | |
| FFF:::errorNode | |
| GGG:::errorNode | |
| III:::processNode | |
| JJJ:::decisionNode | |
| KKK:::errorNode | |
| LLL:::successNode | |
| MMM:::processNode | |
| NNN:::successNode | |
| RRR:::decisionNode | |
| SSS:::errorNode | |
| WWW:::errorNode | |
| classDef errorNode fill:#ffcccc,stroke:#ff0000,stroke-width:2px | |
| classDef successNode fill:#ccffcc,stroke:#00ff00,stroke-width:2px | |
| classDef processNode fill:#cceeff,stroke:#0066cc,stroke-width:2px | |
| classDef decisionNode fill:#ffffcc,stroke:#cccc00,stroke-width:2px | |
| L_X_Y_0@{ animation: none } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment