feat: wire live Fineract M1 to Central Bank UI and Office 24 journal seed
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m21s
CI/CD Pipeline / Security Scanning (push) Successful in 2m42s
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Verify Deployment / Verify Deployment (push) Has been cancelled
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m21s
CI/CD Pipeline / Security Scanning (push) Successful in 2m42s
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Verify Deployment / Verify Deployment (push) Has been cancelled
Add a read-only money-supply endpoint for Office 24 dashboards, pass Fineract env through deploy scripts, and provide a seed script for the opening Dr 1410 / Cr 2100 journal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -73,6 +73,12 @@ start_svc() {
|
||||
DBIS_EXCHANGE_CONFIG="$DBIS_EXCHANGE_CONFIG" \
|
||||
OMNL_SUPPORTED_CHAINS_CONFIG="$OMNL_SUPPORTED_CHAINS_CONFIG" \
|
||||
OMNL_M2_TOKEN_REGISTRY="$OMNL_M2_TOKEN_REGISTRY" \
|
||||
OMNL_API_KEY="${OMNL_API_KEY:-}" \
|
||||
OMNL_FINERACT_BASE_URL="${OMNL_FINERACT_BASE_URL:-${FINERACT_BASE_URL:-}}" \
|
||||
OMNL_FINERACT_TENANT="${OMNL_FINERACT_TENANT:-${FINERACT_TENANT:-omnl}}" \
|
||||
OMNL_FINERACT_USERNAME="${OMNL_FINERACT_USERNAME:-}" \
|
||||
OMNL_FINERACT_PASSWORD="${OMNL_FINERACT_PASSWORD:-}" \
|
||||
OMNL_PUBLIC_MONEY_SUPPLY="${OMNL_PUBLIC_MONEY_SUPPLY:-1}" \
|
||||
bash -c "$cmd" >"$LOG_DIR/$name.log" 2>&1 &
|
||||
echo $! >"$LOG_DIR/$name.pid"
|
||||
}
|
||||
@@ -94,6 +100,8 @@ sleep 5
|
||||
log "Health checks..."
|
||||
curl -sf "http://127.0.0.1:3011/api/v1/settlement/health" | head -c 200 || true
|
||||
echo
|
||||
curl -sf "http://127.0.0.1:3011/api/v1/settlement/money-supply/public" | head -c 300 || true
|
||||
echo
|
||||
curl -sf "http://127.0.0.1:3012/api/v1/exchange/health" | head -c 200 || true
|
||||
echo
|
||||
curl -sf -o /dev/null -w "frontend=%{http_code}\n" "http://127.0.0.1:$FRONTEND_PORT/central-bank"
|
||||
|
||||
73
scripts/deployment/seed-office-24-opening-journal.mjs
Normal file
73
scripts/deployment/seed-office-24-opening-journal.mjs
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Post Office 24 opening M1 journal to Fineract:
|
||||
* Dr 1410 Due From Head Office
|
||||
* Cr 2100 M1 Central Liabilities
|
||||
*
|
||||
* Requires: OMNL_FINERACT_BASE_URL, OMNL_FINERACT_PASSWORD
|
||||
* Amount: OFFICE24_OPENING_M1_USD (required unless --dry-run)
|
||||
*/
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = path.resolve(__dirname, '../..');
|
||||
const configPath = path.join(repoRoot, 'config/offices/office-24-opening-journal.v1.json');
|
||||
|
||||
const dryRun = process.argv.includes('--dry-run');
|
||||
const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
|
||||
const base = (process.env.OMNL_FINERACT_BASE_URL || process.env.FINERACT_BASE_URL || '').replace(/\/$/, '');
|
||||
const tenant = process.env.OMNL_FINERACT_TENANT || process.env.FINERACT_TENANT || 'omnl';
|
||||
const user =
|
||||
process.env.OMNL_FINERACT_USER?.trim() ||
|
||||
process.env.OMNL_FINERACT_USERNAME?.trim() ||
|
||||
'ali_hospitallers_tenant';
|
||||
const pass = process.env.OMNL_FINERACT_PASSWORD || '';
|
||||
const amountRaw = process.env[cfg.amountEnv] || process.env.OFFICE24_OPENING_M1_USD || '';
|
||||
const amount = parseFloat(amountRaw);
|
||||
|
||||
if (!base || !pass) {
|
||||
console.error('Set OMNL_FINERACT_BASE_URL and OMNL_FINERACT_PASSWORD');
|
||||
process.exit(1);
|
||||
}
|
||||
if (!Number.isFinite(amount) || amount <= 0) {
|
||||
console.error(`Set ${cfg.amountEnv} to a positive USD amount (e.g. export OFFICE24_OPENING_M1_USD=1000000)`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const entry = {
|
||||
officeId: cfg.officeId,
|
||||
transactionDate: new Date().toISOString().slice(0, 10),
|
||||
referenceNumber: cfg.referenceNumber,
|
||||
comments: cfg.comments,
|
||||
debits: [{ glAccountId: parseInt(cfg.debitGlCode, 10), amount }],
|
||||
credits: [{ glAccountId: parseInt(cfg.creditGlCode, 10), amount }],
|
||||
};
|
||||
|
||||
console.log(JSON.stringify({ dryRun, officeId: cfg.officeId, amount, entry }, null, 2));
|
||||
|
||||
if (dryRun) {
|
||||
console.log('Dry run — no journal posted.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const auth = Buffer.from(`${user}:${pass}`).toString('base64');
|
||||
const res = await fetch(`${base}/journalentries`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Basic ${auth}`,
|
||||
'Fineract-Platform-TenantId': tenant,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(entry),
|
||||
});
|
||||
|
||||
const body = await res.text();
|
||||
if (!res.ok) {
|
||||
console.error(`Fineract POST failed (${res.status}): ${body}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('Office 24 opening journal posted:', body);
|
||||
@@ -20,6 +20,12 @@ start() {
|
||||
DBIS_EXCHANGE_CONFIG="$DBIS_EXCHANGE_CONFIG" \
|
||||
OMNL_SUPPORTED_CHAINS_CONFIG="$OMNL_SUPPORTED_CHAINS_CONFIG" \
|
||||
OMNL_M2_TOKEN_REGISTRY="$OMNL_M2_TOKEN_REGISTRY" \
|
||||
OMNL_API_KEY="${OMNL_API_KEY:-}" \
|
||||
OMNL_FINERACT_BASE_URL="${OMNL_FINERACT_BASE_URL:-}" \
|
||||
OMNL_FINERACT_TENANT="${OMNL_FINERACT_TENANT:-omnl}" \
|
||||
OMNL_FINERACT_USERNAME="${OMNL_FINERACT_USERNAME:-}" \
|
||||
OMNL_FINERACT_PASSWORD="${OMNL_FINERACT_PASSWORD:-}" \
|
||||
OMNL_PUBLIC_MONEY_SUPPLY="${OMNL_PUBLIC_MONEY_SUPPLY:-1}" \
|
||||
bash -c "$cmd" >"${LOG_DIR}/${name}.log" 2>&1 &
|
||||
echo $! >"${LOG_DIR}/${name}.pid"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user