(feat): Integration And Push - #8
Merged
Merged
Conversation
☐ VPS deployment: Docker Compose on Contabo, env vars, HTTPS ☐ Smoke test: create merchant → plan → subscribe → bill → charge → webhook → gym app shows active ☐ Recovery test: force failure → transfer VA issued → simulate push → reconcile → active ☐ payment_uncertain test: timeout → freeze → verify → resolves ☐ Hard bug fixes from integration ☐ Proration end-to-end: upgrade mid-cycle → correct charge fires ☐ Two-merchant isolation proof: same instance, fully isolated data ☐ billing_lag_seconds metric: log time from next_bill_date to charge_attempt created ☐ queue_depth log: consumer lag on billing partition every 60s ☐ recovery_rate metric: past_due healed / total past_due ☐ Integration test: full billing cycle (create → bill → heal) ☐ Integration test: payment_uncertain → verify pass → active (tests): All tests green, connected with the server bash scripts, integration tests and unit tests NOTES ----- Deployment fixed - HTTPS was never actually wired up despite a valid cert sitting on disk — nginx only had a port-80 block, and that block was proxying to the wrong app (an unrelated ship-cli project sharing the box). Fixed both; https://somba.ddns.net now correctly terminates TLS and routes to Somba. - Docker port mismatch: PORT env var was used for both the host-side publish port and leaked into the container, so uvicorn bound to the wrong port internally — app was unreachable. Fixed. - The scheduler wasn't running at all — only the API server was in docker-compose.yml. Nothing was ever billing, delivering webhooks, or reconciling in production. Added it as a proper service. - Nomba LIVE credentials are live and verified working, including the parent/sub-account header split your hackathon email specified (auth uses the parent account, resource calls use the sub-account — the client mixed these up before). Real bugs found and fixed (via actual deployment, not local tests) 1. Two competing billing-sweep implementations shared one lock; only the dead-end one was scheduled — subscriptions would never have been charged automatically. 2. Two schema-drift bugs: customers and webhook_deliveries tables were missing columns the ORM models expected (migrations never wrote them). Added a permanent regression test that diffs every migration against the live models. 3. Subscriptions never advanced their billing period after a successful charge — the most serious one. Every subscription would've been billed again the very next day, and the second charge would have crashed outright on a DB constraint. Fixed, with a regression test proving two consecutive billing cycles now work. 4. ChargeAttempt.order_reference collided on retries — any second attempt on the same intent (a retry, or reprocessing an "uncertain" charge) crashed with a UniqueViolation. Fixed. 5. VA (virtual account) creation was never actually wired up — the recovery engine's "transfer" path just emitted an event; nothing ever called Nomba to issue the account. Now it does, using the correct (undocumented-in-the-obvious-place) parent-account endpoint variant for sub-accounts — confirmed against live Nomba, real VA numbers get issued. 6. Fixed a bug in my own test script (reused a hardcoded fake transaction ID across runs, which tripped Somba's real duplicate-detection). Webhook — tested as requested Stood up a real echo receiver, drove a real delivery through the deployed emitter, and independently recomputed the HMAC-SHA256 signature against the merchant's secret — byte-for-byte match. Signing and delivery are solid. TESTS ----- To run it yourself bash scripts/live/run_all.sh # full suite bash scripts/live/02_recovery_test.sh # any script individually
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
☐ VPS deployment: Docker Compose on Contabo, env vars, HTTPS ☐ Smoke test: create merchant → plan → subscribe → bill → charge → webhook → gym app shows active ☐ Recovery test: force failure → transfer VA issued → simulate push → reconcile → active ☐ payment_uncertain test: timeout → freeze → verify → resolves ☐ Hard bug fixes from integration
☐ Proration end-to-end: upgrade mid-cycle → correct charge fires ☐ Two-merchant isolation proof: same instance, fully isolated data ☐ billing_lag_seconds metric: log time from next_bill_date to charge_attempt created ☐ queue_depth log: consumer lag on billing partition every 60s ☐ recovery_rate metric: past_due healed / total past_due ☐ Integration test: full billing cycle (create → bill → heal) ☐ Integration test: payment_uncertain → verify pass → active
(tests): All tests green, connected with the server bash scripts, integration tests and unit tests
NOTES
Deployment fixed
Real bugs found and fixed (via actual deployment, not local tests)
Webhook — tested as requested
Stood up a real echo receiver, drove a real delivery through the deployed emitter, and independently recomputed the HMAC-SHA256 signature against the merchant's secret — byte-for-byte match. Signing and
delivery are solid.
TESTS
To run it yourself
bash scripts/live/run_all.sh # full suite
bash scripts/live/02_recovery_test.sh # any script individually