Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

1 export type PaymentStatus = 'READY' | 'DISPATCHING' | 'UNKNOWN' | 'BANK_ACCEPTED' | 'SETTLED' | 'BANK_REJECTED';
2 export type EvidenceKind = 'ACCEPTED' | 'SETTLED' | 'REJECTED';
3 export type AppliedProof = { evidenceId: string; digest: string };
4 export interface PaymentSnapshot {
5 id: string;
6 status: PaymentStatus;
7 amountMinor: string;
8 currency: string;
9 version: number;
10 bankReference?: string | null;
11 appliedProofs: readonly AppliedProof[];
12 }
13 /** Only the trusted server-side bank adapter may fill verifiedBy after verifying the external response. */
14 export interface VerifiedBankEvidence {
15 evidenceId: string;
16 kind: EvidenceKind;
17 paymentId: string;
18 amountMinor: string;
19 currency: string;
20 bankReference?: string;
21 verifiedBy: string;
22 observedAt: string;
23 definitive?: boolean;
24 }
25 export class ReconciliationError extends Error { constructor(code: string, message: string); code: string; }
26 export function applyVerifiedBankEvidence(payment: PaymentSnapshot, proof: VerifiedBankEvidence): {
27 payment: PaymentSnapshot;
28 changed: boolean;
29 reason: 'DUPLICATE_EVIDENCE' | 'APPLIED';
30 };
31 export function mayAutomaticallyDispatch(status: PaymentStatus): boolean;
32 export function hasFinalBankOutcome(status: PaymentStatus): boolean;