#!/usr/bin/env bash # OMNL / HYBX — Run recommended onboarding for PT. CAKRA INVESTAMA INTERNATIONAL: # 1) Office (idempotent) # 2) Tenant GL accounts (idempotent; skip with SKIP_GL=1) # 3) Corporate client + NPWP + contact (idempotent) # 4) Staff + Office Admin user (idempotent; needs password or CAKRA_GENERATE_PASSWORD=1) # # Usage (repo root): # OMNL_CAKRA_ADMIN_PASSWORD='…' bash scripts/omnl/omnl-cakra-onboarding-complete.sh # CAKRA_GENERATE_PASSWORD=1 bash scripts/omnl/omnl-cakra-onboarding-complete.sh # SKIP_USER=1 bash scripts/omnl/omnl-cakra-onboarding-complete.sh # office + client + GL only # # Banking rails and AML/FATCA/CRS are not Fineract core fields — see: # scripts/omnl/data/pt-cakra-investama-sidecar.json set -euo pipefail REPO_ROOT="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}" SKIP_GL="${SKIP_GL:-0}" SKIP_USER="${SKIP_USER:-0}" echo "=== 1. Office (PT CAKRA) ===" >&2 bash "${REPO_ROOT}/scripts/omnl/omnl-office-create-pt-cakra-investama.sh" if [ "$SKIP_GL" != "1" ]; then echo "=== 2. GL accounts (tenant-wide, idempotent) ===" >&2 bash "${REPO_ROOT}/scripts/omnl/omnl-gl-accounts-create.sh" || true fi echo "=== 3. Client (corporate + NPWP + contact) ===" >&2 bash "${REPO_ROOT}/scripts/omnl/omnl-client-create-pt-cakra-investama.sh" if [ "$SKIP_USER" != "1" ]; then echo "=== 4. User (bpramukantoro @ CAKRA office) ===" >&2 if ! bash "${REPO_ROOT}/scripts/omnl/omnl-user-cakra-office-create.sh"; then echo "WARNING: User API step failed; staff may still exist — see script stderr for STAFF_ID and UI steps." >&2 [ "${STRICT_ONBOARDING:-0}" = "1" ] && exit 1 fi else echo "=== 4. User step skipped (SKIP_USER=1) ===" >&2 fi echo "=== Done ===" >&2 echo "Sidecar JSON: ${REPO_ROOT}/scripts/omnl/data/pt-cakra-investama-sidecar.json" >&2