Skip to content

Deposit Product Versioning

Immutable product versions with flag snapshots for audit, compliance, and safe product evolution.

Overview

Deposit product versioning allows administrators to create immutable snapshots of product configuration (flags) at a point in time. This ensures:

  • Audit trail — Every flag change is captured as a new version
  • Account stability — Existing accounts can be pinned to the version they were created under
  • Safe rollout — New flag values can be tested as DRAFT before activation
  • Regulatory compliance — Historical product terms are preserved forever

Version Lifecycle

DRAFT → APPROVED → ACTIVE → RETIRED

              (new version activated)
StatusDescription
DRAFTNewly created version, not yet approved
APPROVEDReviewed and approved, ready for activation
ACTIVECurrently live version for this product
RETIREDPreviously active version, superseded by newer one
REJECTEDVersion was rejected during review

How It Works

Creating a Version

When you create a new version, the system:

  1. Calls resolve_deposit_product_flags(product_id) to get current effective flags
  2. Stores the complete flag JSON as an immutable snapshot in flag_snapshot
  3. Records effective date, expiry date, and change summary
  4. Sets status to DRAFT

Activating a Version

When you activate a version:

  1. The currently ACTIVE version (if any) is set to RETIRED
  2. The selected version is set to ACTIVE
  3. The product's product_version field is updated

Account Binding

Each deposit account has an optional product_version_id column:

  • NULL — Account uses live/current product flags (default)
  • Set — Account is pinned to a specific version's flag snapshot

The function resolve_deposit_account_flags(account_id) handles this:

sql
-- If account has a pinned version, use its snapshot
IF v_version_id IS NOT NULL THEN
  RETURN flag_snapshot FROM deposit_product_version WHERE version_id = v_version_id;
END IF;

-- Otherwise, resolve live flags
RETURN resolve_deposit_product_flags(v_product_id);

Flag Groups Managed by Versioning

All flag groups are captured in the version snapshot:

GroupExample Flags
LIMITSDAILY_DEPOSIT_LIMIT, MAX_WITHDRAWAL_PER_TXN, MONTHLY_TXN_COUNT_LIMIT
OVERDRAFTOVERDRAFT_ALLOWED, MAX_OVERDRAFT_LIMIT, ALLOW_NEGATIVE_BALANCE
ACCESSATM_ACCESS, MOBILE_BANKING, CHECKBOOK_AVAILABLE
KYCREQUIRES_KYC, BIOMETRIC_REQUIRED, KYC_LEVEL
INTERESTINTEREST_BEARING, COMPOUNDING_ENABLED, DAYS_IN_YEAR
TRANSACTION_POLICYALLOW_BACK_DATED_TRANSACTIONS, MAX_BACKDATE_DAYS
AML_MONITORINGAML_DAILY_DEPOSIT_THRESHOLD, AML_ENABLE_NOTIFICATIONS
MATURITYAUTO_RENEWAL_MAX_COUNT

API Endpoints

MethodPathPermissionDescription
POST/deposit-accounts/product-versionsMANAGE_DEPOSIT_PRODUCTCreate new version
PUT/deposit-accounts/product-versions/activateMANAGE_DEPOSIT_PRODUCTActivate a version
GET/deposit-accounts/product-versions?deposit_product_id=XVIEW_DEPOSIT_PRODUCTList all versions

Frontend

The DepositProductVersionHistory component provides:

  • Version history table with status chips
  • Create version dialog (version number, label, effective date, change summary)
  • One-click activation with automatic retirement of previous version
  • Flag snapshot viewer to inspect exact flag values at any point in time

Best Practices

  1. Always create a version before changing flags — This preserves the previous state
  2. Use meaningful version numbers — e.g. 1.0, 1.1, 2.0 (semver style)
  3. Write change summaries — Document what changed and why
  4. Pin long-term accounts — For FDs and regulatory products, pin accounts to their creation version
  5. Review before activating — Use the DRAFT → APPROVED workflow for oversight

PinkApple ERP by Stat Solutions Network