Skip to content

feat(sepay): SePay emulator + fix(resend): Svix webhook delivery - #211

Open
xirothedev wants to merge 4 commits into
vercel-labs:mainfrom
xirothedev:feat/sepay-adapter
Open

feat(sepay): SePay emulator + fix(resend): Svix webhook delivery#211
xirothedev wants to merge 4 commits into
vercel-labs:mainfrom
xirothedev:feat/sepay-adapter

Conversation

@xirothedev

@xirothedev xirothedev commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Combined PR (was #211 + #212). Adds SePay support and fixes Resend webhook delivery; #212 will be closed as folded in.

SePay VietQR payment gateway emulator (new @emulators/sepay)

Stateful SePay emulator for F&B payment flows (VietQR bank transfers):

  • GET /userapi/transactions/list (+filters) and GET /userapi/transactions/:id — SePay userapi wire format, bearer auth
  • POST /userapi/simulate/transaction — test helper: inserts a transaction and fans out real-shaped webhooks (Authorization: Bearer <target key>) to seeded targets, recording delivery attempts
  • GET /img / /qr/img — VietQR PNG generation (EMVCo TLV + CRC16-CCITT, zero-dep QR + PNG)
  • Seed config under sepay:: api_keys, webhook_targets, bank_accounts, transactions; omitted keys auto-generate via generatedSecrets
  • Registered in CLI/registry/docs; port 4014; 10 tests (auth, list/filter/pagination, details+404, simulate→webhook via local http target, reset-restores-seeds, PNG route, CRC16 vector)

Resend webhook delivery (fix)

WebhookDispatcher events were dispatched but nothing was subscribed as resend, so no webhook was ever delivered.

  • resend.webhook_targets: [{ url, signing_secret? }] — registers as owner-resend subscriptions (idempotent by URL)
  • Svix headers: svix-id, svix-timestamp, svix-signature: v1,<base64 HMAC-SHA256> over {id}.{timestamp}.{body}
  • Omitted secrets auto-generate as whsec_<base64> via new prepareSeed hook

Test plan

  • @emulators/sepay: 10/10; @emulators/resend: 25/25 (23 existing + 2 new with live http target + signature verification)
  • turbo run build test lint type-check --filter='./packages/*' — 20/20

- transactions list/details API with bearer auth (userapi wire format)
- POST /userapi/simulate/transaction creates a transaction and fans out
  real-shaped webhooks to seeded targets, recording delivery attempts
- zero-dep VietQR PNG generation (/img) with EMVCo TLV + CRC16-CCITT
- seed config: api_keys, webhook_targets, bank_accounts, transactions;
  omitted keys auto-generate via generatedSecrets
- registered in CLI/registry/docs; 10 tests
WebhookDispatcher events for resend were dispatched but no subscription
was ever registered, so nothing was delivered.

- seed key resend.webhook_targets: [{ url, signing_secret? }]
- targets register as owner-resend subscriptions on startup
- custom header factory emits svix-id/svix-timestamp/svix-signature
  (HMAC-SHA256 over {id}.{timestamp}.{body}, base64, v1,<sig>)
- omitted signing secrets auto-generate as whsec_<base64> via new
  prepareSeed/generatedSecrets hook in the registry entry
- tests: live http target asserts headers + signature verification
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@xirothedev is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/@emulators/sepay/src/qr.ts Outdated
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
@xirothedev xirothedev changed the title feat(sepay): add SePay VietQR payment gateway emulator feat(sepay): SePay emulator + fix(resend): Svix webhook delivery Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant