Skip to content

Add comprehensive tests for credential issuance and verification, Stripe webhook handling, and fake Supabase implementation - #198

Merged
Prudentdev-xyz merged 1 commit into
Orbit-xyz:mainfrom
Petrelid:feat/hybrid-billing-credentials-merkle-migrations-131-132-156-157
Oct 18, 2026
Merged

Prudentdev-xyz merged 1 commit into
Orbit-xyz:mainfrom
Petrelid:feat/hybrid-billing-credentials-merkle-migrations-131-132-156-157

Conversation

@Petrelid

Copy link
Copy Markdown
Contributor

Smmary

What each issue does:

  • Closes backend: implement automated Stripe and fiat onramp webhook integration for hybrid billing #131 Stripe: POST /webhooks/stripe checks the Stripe-Signature header itself, without adding the Stripe SDK. Each event ID is recorded before processing, so replays and duplicate deliveries are acknowledged but change nothing. If processing fails, the ID is released so Stripe's retry goes through. An older event never overwrites newer data. Each event is linked to a merchant by their Stripe Connect account or an orbit_merchant_id metadata key. GET /billing/unified-summary combines MRR and subscriber counts from USDC and Stripe. Non-USD fiat is listed per currency rather than converted.
  • Closes backend: build verifiable credential generator for privacy-preserving tier verification #132 Credentials: these are Ed25519-signed tokens. sub is a keyed hash of the wallet that differs per merchant, so services of different merchants can't link the same subscriber. Verification checks the signature, the expiry, the revocation list (in memory and in the database) and that the subscription is still active. Cancelling a subscription revokes its credentials straight away. credential-verifier.js is the open-source helper: it has no dependencies and works offline using the public keys from /credentials/jwks.
  • Closes contract: implement gas-efficient Merkle tree proof verification for large-scale payroll distributions #156 Merkle payroll: the leaf is SHA256(recipient || amount) as specified, and pairs are hashed in sorted order. Because the claim call has no leaf index, the "already claimed" flag is stored per leaf hash rather than as a bitmap. I added reclaim_merkle_payroll so the sender can recover unclaimed funds after expiry; otherwise they would be locked forever.
  • Closes backend: build zero-downtime database migration runner and schema versioning guard #157 Migrations: each migration runs in its own transaction. Applied versions are stored in schema_migrations with a SHA-256 checksum and run time, and a lock stops two deploys migrating at once. The three npm run migrate:* commands are added. When DATABASE_URL is set, the server refuses to start if a migration is pending, was edited after being applied, or isn't in this build; without it, the check is skipped with a warning. The existing NNN-name.sql files are already in schema.sql, so the runner ignores them. The new tables ship both as timestamped migrations and appended to schema.sql.

…ipe webhook handling, and fake Supabase implementation

- Implement tests for credential generation, signature verification, and revocation in `credentials.test.js`.
- Create a mock Supabase client in `fakeSupabase.js` to facilitate testing.
- Add tests for Stripe billing integration, including signature verification and webhook event handling in `stripe-billing.test.js`.
- Ensure tests cover various scenarios including subscription status changes, event processing, and error handling.
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Petrelid is attempting to deploy a commit to the Abdqoharr Olayiwola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Petrelid 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! 🚀

Learn more about application limits

@Prudentdev-xyz
Prudentdev-xyz merged commit f200e8f into Orbit-xyz:main Oct 18, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment