NATS account balance source of truth
Find a file
2026-09-11 17:16:31 -04:00
src Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00
test Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00
NATS.md Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00
package-lock.json Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00
package.json Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00
README.md Initial import of zappier-account-balance from zapier monorepo 2026-09-11 17:16:31 -04:00

zappier-account-balance

Source of truth for customer prepaid balances (persisted books.json). Internal traffic is NATS request-reply; HTTP is health plus a fallback. zappier-edge balanceCents is a cache of this book.

Forgejo: https://git.georgelambert.org/marchon/zappier-account-balance
Catalog: https://zapier.georgelambert.org/packages/zappier-account-balance/README.pdf

Zapier cloud never connects here. zappier-edge, customer-service, sales-pricing, and accounting-export do.

Subjects

Subject Kind Who
verae.billing.statement.get request-reply portal, CS, sales, admin
verae.billing.balance.get request-reply anyone internal
verae.billing.balance.adjust request-reply CS credits, portal reload
verae.billing.usage.recorded pub zappier-edge meter
verae.billing.payment.recorded pub portal reload, invoice paid
verae.billing.credit.applied pub CS

Queue group: account-balance.

Run

NATS_URL=nats://127.0.0.1:4222 PORT=3010 npm start
curl http://127.0.0.1:3010/health
curl http://127.0.0.1:3010/statement/cust_1

Statement JSON: { customerId, prepaidCents, credits[], usage[], payments[] }.