docs: Standard Readme update for production board pack
This commit is contained in:
parent
c75fa5f5fe
commit
1d0db82ccf
1 changed files with 20 additions and 40 deletions
60
README.md
60
README.md
|
|
@ -2,62 +2,42 @@
|
|||
|
||||
[](https://github.com/RichardLitt/standard-readme)
|
||||
|
||||
NATS/HTTP facade for customer prepaid balances over edge BusinessStore (D006).
|
||||
Durable JetStream consumer applying VERAE_BILLING usage into the shared customer ledger.
|
||||
|
||||
**Forgejo:** https://git.georgelambert.org/marchon/zappier-account-balance
|
||||
**Catalog:** https://zapier.georgelambert.org/packages/zappier-account-balance/README.pdf
|
||||
## Table of Contents
|
||||
|
||||
Under decision **D006**, this package is a **facade**, not a competing system of record. Lab SoT is zappier-edge `billing.db` (`customers.balance_cents` + `usage_entries`); multi-host SoT becomes **libSQL** later. `books.json` is no longer written as SoT.
|
||||
- [Background](#background)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
|
||||
Zapier cloud never connects here. zappier-edge, customer-service, sales-pricing, and accounting-export do.
|
||||
## Background
|
||||
|
||||
Consumes stream VERAE_BILLING (subjects verae.billing.usage.>) on the private Verae NATS edge.
|
||||
Writes usage_entries and prepaid balance drawdowns into billing.db (SoT for portal/CS/sales statements).
|
||||
Job-complete events stay on core NATS — not JetStream.
|
||||
|
||||
|
||||
**Co-contributors:** Grok (xAI), George Lambert, Scott "R00tPiG Security" Lindsey — Verae Inc. ([verae.com](https://verae.com)).
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
git clone ssh://git@git.georgelambert.org:2223/marchon/zappier-account-balance.git
|
||||
cd zappier-account-balance
|
||||
npm install
|
||||
npm ci
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
EDGE_URL=http://127.0.0.1:3040 \
|
||||
BILLING_DB=/opt/verae/zappier-edge/billing.db \
|
||||
EDGE_ENV_FILE=./.env.edge \
|
||||
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
|
||||
NATS_URL=nats://nats.verae.ai:4222 node src/server.js
|
||||
```
|
||||
|
||||
Statement JSON: `{ customerId, prepaidCents, credits[], usage[], payments[], source }`.
|
||||
`balance.get` / `statement.get` read `billing.db` (fallback: edge `/admin/api/statement/:id`).
|
||||
`balance.adjust` proxies to edge `POST /admin/api/credits` (fallback: `sudo -u verae-zapier` sqlite write).
|
||||
`usage.recorded` is a no-op; edge meter already appends `usage_entries`.
|
||||
|
||||
## 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 (ignored by facade) |
|
||||
| `verae.billing.payment.recorded` | pub | portal reload, invoice paid |
|
||||
| `verae.billing.credit.applied` | pub | CS |
|
||||
|
||||
Queue group: `account-balance`.
|
||||
|
||||
## Background
|
||||
|
||||
D006 freeze: edge BusinessStore is the authoritative meter/balance writer on the single-host lab. This service keeps the historical NATS/HTTP surface so callers do not break while prepaid moves to libSQL.
|
||||
|
||||
## Contributing
|
||||
|
||||
Questions: open an issue at https://git.georgelambert.org/marchon/zappier-account-balance/issues. Pull requests are accepted.
|
||||
Questions: open an issue on the project Forgejo/GitHub remote, or contact Verae engineering.
|
||||
PRs are accepted when they include tests and do not leak secrets.
|
||||
|
||||
## License
|
||||
|
||||
UNLICENSED © George Lambert
|
||||
UNLICENSED © Verae Inc. (verae.com)
|
||||
|
|
|
|||
Loading…
Reference in a new issue