Add NATS account-balance SoT and statement review for customers, CS, and sales
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Internal billing now uses verae.billing.* request-reply and pubs. zappier-account-balance tracks prepaid, credits, usage, and payments. Portal, admin, CS, and sales all review the same statement. Independent Forgejo repos stay split via push-module-repos.
This commit is contained in:
parent
a1a5b957fd
commit
ac38676645
135 changed files with 3078 additions and 130 deletions
|
|
@ -17,7 +17,42 @@ test('sales-pricing health', async () => {
|
|||
try {
|
||||
const r = await fetch(`http://127.0.0.1:${port}/health`);
|
||||
assert.equal((await r.json()).role, 'zappier-sales-pricing');
|
||||
const home = await fetch(`http://127.0.0.1:${port}/`);
|
||||
assert.equal(home.status, 200);
|
||||
} finally {
|
||||
child.kill('SIGTERM');
|
||||
}
|
||||
});
|
||||
|
||||
test('sales review via account-balance HTTP', async () => {
|
||||
const booksPort = 18016;
|
||||
const salesPort = 18017;
|
||||
const books = spawn(process.execPath, ['src/server.js'], {
|
||||
cwd: path.join(root, '..', 'zappier-account-balance'),
|
||||
env: { ...process.env, PORT: String(booksPort) },
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
const sales = spawn(process.execPath, ['src/server.js'], {
|
||||
cwd: root,
|
||||
env: {
|
||||
...process.env,
|
||||
PORT: String(salesPort),
|
||||
ACCOUNT_BALANCE_URL: `http://127.0.0.1:${booksPort}`,
|
||||
},
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
try {
|
||||
await fetch(`http://127.0.0.1:${booksPort}/adjust`, {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ customerId: 'c-sales', cents: 300, reason: 'promo', agent: 'sales' }),
|
||||
});
|
||||
const st = await (await fetch(`http://127.0.0.1:${salesPort}/review/c-sales`)).json();
|
||||
assert.equal(st.prepaidCents, 300);
|
||||
assert.equal(st.source, 'account-balance');
|
||||
} finally {
|
||||
sales.kill('SIGTERM');
|
||||
books.kill('SIGTERM');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue