Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
phase-3-banking-reconciliation
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | export type StatementInput={sourceId:string;amountIrr:number;date:string;reference:string};export type BankTransaction=Readonly<StatementInput&{tenantId:string;accountId:string;reference:string}>;export function ingestStatement(tenantId:string,accountId:string,rows:StatementInput[]){const errors:string[]=[];const seen=new Set<string>();const txns:BankTransaction[]=[];for(const [i,r] of rows.entries()){if(!r.sourceId||seen.has(r.sourceId))errors.push(`row ${i+1}: duplicate/missing source id`);seen.add(r.sourceId);if(!Number.isSafeInteger(r.amountIrr))errors.push(`row ${i+1}: invalid amount`);if(!/^\d{4}-\d{2}-\d{2}$/.test(r.date)||Number.isNaN(Date.parse(r.date+'T00:00:00Z')))errors.push(`row ${i+1}: invalid date`);txns.push(Object.freeze({...r,tenantId,accountId,reference:r.reference.trim().toUpperCase()}))}return errors.length?{ok:false as const,errors}:{ok:true as const,transactions:Object.freeze(txns)}} |