Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
78 lines
2.5 KiB
Bash
78 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|
# OMNL Fineract — Discovery: offices, clients, savings/FD/RD products and accounts.
|
|
# Usage: run from repo root; sources omnl-fineract/.env or .env. Outputs JSON to stdout (or set OUT_DIR to write files).
|
|
# Requires: curl, jq (optional, for pretty-print).
|
|
|
|
set -euo pipefail
|
|
REPO_ROOT="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
|
OUT_DIR="${OUT_DIR:-}"
|
|
|
|
# Load OMNL env: prefer omnl-fineract/.env then root .env
|
|
if [ -f "${REPO_ROOT}/omnl-fineract/.env" ]; then
|
|
set +u
|
|
source "${REPO_ROOT}/omnl-fineract/.env" 2>/dev/null || true
|
|
set -u
|
|
elif [ -f "${REPO_ROOT}/.env" ]; then
|
|
set +u
|
|
source "${REPO_ROOT}/.env" 2>/dev/null || true
|
|
set -u
|
|
fi
|
|
|
|
BASE_URL="${OMNL_FINERACT_BASE_URL:-}"
|
|
TENANT="${OMNL_FINERACT_TENANT:-omnl}"
|
|
USER="${OMNL_FINERACT_USER:-app.omnl}"
|
|
PASS="${OMNL_FINERACT_PASSWORD:-}"
|
|
|
|
if [ -z "$BASE_URL" ] || [ -z "$PASS" ]; then
|
|
echo "Set OMNL_FINERACT_BASE_URL and OMNL_FINERACT_PASSWORD (e.g. in omnl-fineract/.env)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
AUTH="${USER}:${PASS}"
|
|
CURL_OPTS=(-s -S -H "Fineract-Platform-TenantId: ${TENANT}" -H "Content-Type: application/json" -u "$AUTH")
|
|
|
|
api_get() {
|
|
curl "${CURL_OPTS[@]}" "${BASE_URL}/${1}"
|
|
}
|
|
|
|
maybe_save() {
|
|
local name="$1"
|
|
local body="$2"
|
|
if [ -n "$OUT_DIR" ] && [ -d "$OUT_DIR" ]; then
|
|
echo "$body" > "${OUT_DIR}/${name}.json"
|
|
fi
|
|
echo "$body"
|
|
}
|
|
|
|
echo "=== Offices ===" >&2
|
|
OFFICES=$(api_get "offices")
|
|
maybe_save "offices" "$OFFICES"
|
|
echo "$OFFICES" | jq '.' 2>/dev/null || echo "$OFFICES"
|
|
|
|
echo "=== Clients ===" >&2
|
|
CLIENTS=$(api_get "clients")
|
|
maybe_save "clients" "$CLIENTS"
|
|
echo "$CLIENTS" | jq '.' 2>/dev/null || echo "$CLIENTS"
|
|
|
|
echo "=== Savings products ===" >&2
|
|
SAVINGS_PRODUCTS=$(api_get "savingsproducts")
|
|
maybe_save "savingsproducts" "$SAVINGS_PRODUCTS"
|
|
echo "$SAVINGS_PRODUCTS" | jq '.' 2>/dev/null || echo "$SAVINGS_PRODUCTS"
|
|
|
|
echo "=== Savings accounts ===" >&2
|
|
SAVINGS_ACCOUNTS=$(api_get "savingsaccounts")
|
|
maybe_save "savingsaccounts" "$SAVINGS_ACCOUNTS"
|
|
echo "$SAVINGS_ACCOUNTS" | jq '.' 2>/dev/null || echo "$SAVINGS_ACCOUNTS"
|
|
|
|
echo "=== Fixed deposit products ===" >&2
|
|
FD_PRODUCTS=$(api_get "fixeddepositproducts")
|
|
maybe_save "fixeddepositproducts" "$FD_PRODUCTS"
|
|
echo "$FD_PRODUCTS" | jq '.' 2>/dev/null || echo "$FD_PRODUCTS"
|
|
|
|
echo "=== Recurring deposit products ===" >&2
|
|
RD_PRODUCTS=$(api_get "recurringdepositproducts")
|
|
maybe_save "recurringdepositproducts" "$RD_PRODUCTS"
|
|
echo "$RD_PRODUCTS" | jq '.' 2>/dev/null || echo "$RD_PRODUCTS"
|
|
|
|
echo "Discovery done. Use OUT_DIR=<dir> to write JSON files." >&2
|