chore(examples): refresh complete integration example#159
Open
Jayking40 wants to merge 2 commits intoCalloraOrg:mainfrom
Open
chore(examples): refresh complete integration example#159Jayking40 wants to merge 2 commits intoCalloraOrg:mainfrom
Jayking40 wants to merge 2 commits intoCalloraOrg:mainfrom
Conversation
|
@Jayking40 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
resolve the conflicts |
Contributor
Author
|
Conflict resolved |
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.
chore(examples): refresh complete-integration example
Summary
Rewrites examples/complete-integration.ts to reflect the billing, vault, and gateway subsystems currently supported by the backend. The previous example only demonstrated health checks and PostgreSQL-backed billing idempotency. The refreshed version exercises every in-memory service end-to-end — vault creation, funding, API gateway proxy with rate limiting and billing, usage event recording, and revenue settlement — all without requiring a database or Stellar node.
Changes
https://github.com/CalloraOrg/callora-contracts)Testing
PASS src/tests/complete-integration.test.ts Complete Integration — Vault + Billing + Gateway + Settlement ✓ health check returns ok (128 ms) ✓ creates a vault, funds it, and queries the balance (98 ms) ✓ rejects duplicate vault creation for same user and network (24 ms) ✓ returns 404 for vault balance when vault does not exist (14 ms) ✓ proxies a request through the gateway, deducts credit, and records usage (42 ms) ✓ returns 401 when API key is missing (18 ms) ✓ returns 402 when consumer has insufficient balance (16 ms) ✓ returns 429 when rate limited (10 ms) ✓ settles revenue after enough usage accumulates (106 ms) ✓ settlement skips when below minimum payout threshold (3 ms) ✓ end-to-end: vault → gateway → settlement lifecycle (99 ms)
Tests: 11 passed, 11 total
No existing tests were modified or broken. Pre-existing failures (Prisma generated client, pg-mem type mismatches, Node.js version incompatibility with ESLint 10) remain unchanged.
Security / data-integrity notes
Closes #157