hvp-shared 6.39.0 → 6.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,48 +1,38 @@
|
|
|
1
|
+
import { ReconciliationStatus } from '../../types/cash-reconciliation.types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* One-shot reconciliation request.
|
|
4
|
+
* Creates a fully closed reconciliation linked to a QVET closing.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
* Most fields are auto-calculated; user provides actualCashInDrawer and optionally
|
|
6
|
-
* cardTerminalTotal and observations.
|
|
7
|
-
*
|
|
8
|
-
* @example POST /api/cash-reconciliations
|
|
6
|
+
* @example POST /api/cash-reconciliations/reconcile
|
|
9
7
|
*/
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export interface ReconcileRequest {
|
|
9
|
+
branchId: string;
|
|
10
|
+
closingNumber: number;
|
|
11
|
+
reportedCashInDrawer: number;
|
|
12
|
+
cardTerminalTotal?: number;
|
|
14
13
|
observations?: string;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* Only observations can be updated after creation.
|
|
16
|
+
* Admin update request.
|
|
17
|
+
* Recalculates derived fields (cashDifference, warnings, etc.) on save.
|
|
20
18
|
*
|
|
21
19
|
* @example PATCH /api/cash-reconciliations/:id
|
|
22
20
|
*/
|
|
23
|
-
export interface
|
|
24
|
-
|
|
21
|
+
export interface AdminUpdateReconciliationRequest {
|
|
22
|
+
reportedCashInDrawer?: number;
|
|
25
23
|
cardTerminalTotal?: number | null;
|
|
24
|
+
observations?: string;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
27
|
* Query parameters for listing reconciliations.
|
|
29
28
|
*
|
|
30
|
-
* @example GET /api/cash-reconciliations?branchId=xxx&status=
|
|
29
|
+
* @example GET /api/cash-reconciliations?branchId=xxx&status=closed&startDate=2026-01-01&endDate=2026-01-31
|
|
31
30
|
*/
|
|
32
31
|
export interface CashReconciliationQueryParams {
|
|
33
32
|
branchId?: string;
|
|
34
|
-
status?:
|
|
33
|
+
status?: ReconciliationStatus;
|
|
35
34
|
startDate?: string;
|
|
36
35
|
endDate?: string;
|
|
37
|
-
closingNumber?: number;
|
|
38
36
|
limit?: number;
|
|
39
37
|
page?: number;
|
|
40
38
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Update branch cash config request.
|
|
43
|
-
*
|
|
44
|
-
* @example PATCH /api/branches/:id/cash-config
|
|
45
|
-
*/
|
|
46
|
-
export interface UpdateBranchCashConfigRequest {
|
|
47
|
-
baseCashAmount: number;
|
|
48
|
-
}
|
|
@@ -1,149 +1,104 @@
|
|
|
1
|
-
import { CashReconciliationWarning, QvetPaymentBreakdown, ReconciliationStatus
|
|
1
|
+
import { CashReconciliationWarning, QvetPaymentBreakdown, ReconciliationStatus } from '../../types/cash-reconciliation.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
3
|
+
* QVET closing data grouped in the reconciliation response.
|
|
4
|
+
* Null when no QVET closing is linked (e.g. zero-closings, orphans).
|
|
5
|
+
*/
|
|
6
|
+
export interface QvetClosingData {
|
|
7
|
+
closingNumber: number;
|
|
8
|
+
closingDate: string | null;
|
|
9
|
+
staffName: string | null;
|
|
10
|
+
payments: QvetPaymentBreakdown | null;
|
|
11
|
+
closingTotal: number | null;
|
|
12
|
+
collectedAmount: number | null;
|
|
13
|
+
dayCollections: number | null;
|
|
14
|
+
cashOut: number | null;
|
|
15
|
+
cardTotal: number | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Full reconciliation record returned by the API.
|
|
6
19
|
*
|
|
7
|
-
* Used for:
|
|
20
|
+
* Used for: detail dialog, history table rows, admin edit.
|
|
8
21
|
*
|
|
9
22
|
* @example GET /api/cash-reconciliations/:id
|
|
23
|
+
* @example GET /api/cash-reconciliations (list — array of these)
|
|
10
24
|
*/
|
|
11
25
|
export interface CashReconciliationResponse {
|
|
12
26
|
id: string;
|
|
13
27
|
branchId: string;
|
|
14
28
|
branchName: string;
|
|
15
|
-
|
|
16
|
-
qvetClosingDate: string;
|
|
17
|
-
qvetPreviousClosingDate: string;
|
|
18
|
-
qvetCashRegister: string;
|
|
19
|
-
qvetStaffName: string;
|
|
20
|
-
qvetPayments: QvetPaymentBreakdown;
|
|
21
|
-
qvetClosingTotal: number;
|
|
22
|
-
qvetCollectedAmount: number;
|
|
23
|
-
qvetDayCollections: number;
|
|
24
|
-
qvetCashOut: number;
|
|
25
|
-
cashInFlows: number;
|
|
26
|
-
cashOutFlows: number;
|
|
29
|
+
status: ReconciliationStatus;
|
|
27
30
|
baseCashAmount: number;
|
|
28
31
|
cashInDrawerStart: number;
|
|
29
32
|
expectedCashInDrawer: number;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
reportedCashInDrawer: number | null;
|
|
34
|
+
cashDifference: number | null;
|
|
35
|
+
qvet: QvetClosingData | null;
|
|
36
|
+
cashTransferAmount: number | null;
|
|
37
|
+
closingCash: number | null;
|
|
34
38
|
cardTerminalTotal: number | null;
|
|
35
|
-
|
|
36
|
-
cardAmountVerifiedPrior: number;
|
|
37
|
-
cardExpectedForThisClosing: number;
|
|
39
|
+
cardTerminalPriorAmount: number | null;
|
|
38
40
|
cardDiscrepancy: number | null;
|
|
39
|
-
status: ReconciliationStatus;
|
|
40
|
-
warnings: CashReconciliationWarning[];
|
|
41
41
|
observations: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
warnings: CashReconciliationWarning[];
|
|
43
|
+
hasWarnings: boolean;
|
|
44
|
+
collaborator: string | null;
|
|
45
|
+
collaboratorName: string;
|
|
46
|
+
createdBy: string | null;
|
|
47
|
+
createdByName: string;
|
|
48
|
+
updatedBy: string | null;
|
|
49
|
+
createdAt: string | null;
|
|
50
|
+
updatedAt: string | null;
|
|
47
51
|
}
|
|
48
52
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Used for: History page table, branch reconciliation page.
|
|
53
|
+
* Pre-closing cash calculation for a branch.
|
|
52
54
|
*
|
|
53
|
-
* @example GET /api/cash-reconciliations
|
|
55
|
+
* @example GET /api/cash-reconciliations/expected-cash/:branchId
|
|
54
56
|
*/
|
|
55
|
-
export interface
|
|
56
|
-
id: string;
|
|
57
|
+
export interface ExpectedCashResponse {
|
|
57
58
|
branchId: string;
|
|
58
59
|
branchName: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
cashDiscrepancy: number;
|
|
65
|
-
cardDiscrepancy: number | null;
|
|
66
|
-
status: ReconciliationStatus;
|
|
67
|
-
warningCount: number;
|
|
68
|
-
reconciledByName: string;
|
|
69
|
-
reconciledAt: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Pending QVET closing that hasn't been reconciled yet.
|
|
73
|
-
*
|
|
74
|
-
* Used for: Pending closings table on branch page.
|
|
75
|
-
*
|
|
76
|
-
* @example GET /api/cash-reconciliations/pending?branchId=xxx
|
|
77
|
-
*/
|
|
78
|
-
export interface PendingClosingResponse {
|
|
79
|
-
closingNumber: number;
|
|
80
|
-
closingDate: string;
|
|
81
|
-
previousClosingDate: string;
|
|
82
|
-
cashRegister: string;
|
|
83
|
-
branch: string;
|
|
84
|
-
staffName: string;
|
|
85
|
-
closingTotal: number;
|
|
86
|
-
collectedAmount: number;
|
|
87
|
-
dayCollections: number;
|
|
88
|
-
cashOut: number;
|
|
89
|
-
payments: QvetPaymentBreakdown;
|
|
60
|
+
baseCashAmount: number;
|
|
61
|
+
cashInDrawerStart: number;
|
|
62
|
+
cashPaymentsSinceLastClosing: number;
|
|
63
|
+
expectedCashInDrawer: number;
|
|
64
|
+
lastClosedAt: string | null;
|
|
90
65
|
}
|
|
91
66
|
/**
|
|
92
|
-
* Dashboard card
|
|
93
|
-
*
|
|
94
|
-
* Used for: Dashboard branch status cards.
|
|
67
|
+
* Dashboard status card for a single branch.
|
|
95
68
|
*
|
|
96
69
|
* @example GET /api/cash-reconciliations/branch-status
|
|
97
70
|
*/
|
|
98
|
-
export interface
|
|
71
|
+
export interface BranchReconciliationStatusResponse {
|
|
99
72
|
branchId: string;
|
|
100
73
|
branchName: string;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
qvetClosingDate: string;
|
|
105
|
-
closingCash: number;
|
|
74
|
+
baseCashAmount: number;
|
|
75
|
+
activeReconciliation: {
|
|
76
|
+
id: string;
|
|
106
77
|
status: ReconciliationStatus;
|
|
107
|
-
|
|
78
|
+
expectedCash: number;
|
|
79
|
+
reportedCashInDrawer: number | null;
|
|
80
|
+
cashDifference: number | null;
|
|
81
|
+
createdAt: string | null;
|
|
108
82
|
} | null;
|
|
109
|
-
|
|
110
|
-
cardTerminalTotal: number | null;
|
|
111
|
-
totalQvetCards: number;
|
|
112
|
-
closingsReconciled: number;
|
|
113
|
-
totalClosingsToday: number;
|
|
114
|
-
};
|
|
115
|
-
cashConfig: BranchCashConfig;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Daily card summary for a branch.
|
|
119
|
-
*
|
|
120
|
-
* Used for: Card terminal verification within reconciliation form.
|
|
121
|
-
*
|
|
122
|
-
* @example GET /api/cash-reconciliations/daily-summary/:branchId/:date
|
|
123
|
-
*/
|
|
124
|
-
export interface DailyCardSummary {
|
|
125
|
-
branchId: string;
|
|
126
|
-
date: string;
|
|
127
|
-
cardTerminalTotal: number | null;
|
|
128
|
-
reconciliations: Array<{
|
|
83
|
+
lastClosed: {
|
|
129
84
|
id: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
totalQvetCardsToday: number;
|
|
136
|
-
cardDiscrepancy: number | null;
|
|
85
|
+
closingCash: number | null;
|
|
86
|
+
closedAt: string | null;
|
|
87
|
+
qvetClosingNumber: number | null;
|
|
88
|
+
hasWarnings: boolean;
|
|
89
|
+
} | null;
|
|
137
90
|
}
|
|
138
91
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* Used for: Settings page, branch cash config listing.
|
|
92
|
+
* QVET closing not yet linked to a reconciliation.
|
|
142
93
|
*
|
|
143
|
-
* @example GET /api/
|
|
94
|
+
* @example GET /api/cash-reconciliations/unlinked-closings/:branchId
|
|
144
95
|
*/
|
|
145
|
-
export interface
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
96
|
+
export interface UnlinkedClosingResponse {
|
|
97
|
+
closingNumber: number;
|
|
98
|
+
closingDate: string;
|
|
99
|
+
previousClosingDate: string;
|
|
100
|
+
cashRegister: string;
|
|
101
|
+
staffName: string;
|
|
102
|
+
closingTotal: number;
|
|
103
|
+
payments: QvetPaymentBreakdown;
|
|
149
104
|
}
|
|
@@ -4,27 +4,21 @@
|
|
|
4
4
|
* Shared types for the cash reconciliation system that verifies
|
|
5
5
|
* QVET cash closings against actual cash and card terminal totals.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
export declare enum ReconciliationWarningSeverity {
|
|
22
|
-
INFO = "info",
|
|
23
|
-
WARNING = "warning",
|
|
24
|
-
ERROR = "error"
|
|
25
|
-
}
|
|
7
|
+
export type ReconciliationStatus = 'open' | 'pending-sync' | 'pending-cards' | 'closed';
|
|
8
|
+
export type ReconciliationWarningSeverity = 'info' | 'warning' | 'error';
|
|
9
|
+
/**
|
|
10
|
+
* Warning codes emitted by the reconciliation service.
|
|
11
|
+
*
|
|
12
|
+
* - CASH_MISMATCH: reported cash differs from expected (> $1 tolerance)
|
|
13
|
+
* - STAFF_MISMATCH: reconciler differs from QVET cashier
|
|
14
|
+
* - STALE_CLOSING: QVET closing is older than 30 minutes
|
|
15
|
+
* - MISSING_CARD_VERIFICATION: QVET has card payments but no terminal total entered
|
|
16
|
+
* - MIGRATED_NO_QVET: historical record migrated without a matching QVET closing
|
|
17
|
+
* - EXPIRED_UNRECONCILED: QVET closing was not reconciled within 24h and was auto-closed by the system
|
|
18
|
+
*/
|
|
19
|
+
export type ReconciliationWarningCode = 'CASH_MISMATCH' | 'STAFF_MISMATCH' | 'STALE_CLOSING' | 'MISSING_CARD_VERIFICATION' | 'MIGRATED_NO_QVET' | 'EXPIRED_UNRECONCILED';
|
|
26
20
|
export interface CashReconciliationWarning {
|
|
27
|
-
code:
|
|
21
|
+
code: string;
|
|
28
22
|
severity: ReconciliationWarningSeverity;
|
|
29
23
|
message: string;
|
|
30
24
|
}
|
|
@@ -6,29 +6,3 @@
|
|
|
6
6
|
* QVET cash closings against actual cash and card terminal totals.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ReconciliationWarningSeverity = exports.ReconciliationWarningCode = exports.ReconciliationStatus = void 0;
|
|
10
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
-
// Enums
|
|
12
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
-
var ReconciliationStatus;
|
|
14
|
-
(function (ReconciliationStatus) {
|
|
15
|
-
ReconciliationStatus["PENDING"] = "pending";
|
|
16
|
-
ReconciliationStatus["RECONCILED"] = "reconciled";
|
|
17
|
-
ReconciliationStatus["DISCREPANCY"] = "discrepancy";
|
|
18
|
-
})(ReconciliationStatus || (exports.ReconciliationStatus = ReconciliationStatus = {}));
|
|
19
|
-
var ReconciliationWarningCode;
|
|
20
|
-
(function (ReconciliationWarningCode) {
|
|
21
|
-
ReconciliationWarningCode["CASH_MISMATCH"] = "CASH_MISMATCH";
|
|
22
|
-
ReconciliationWarningCode["CASH_MINOR_MISMATCH"] = "CASH_MINOR_MISMATCH";
|
|
23
|
-
ReconciliationWarningCode["CARD_MISMATCH"] = "CARD_MISMATCH";
|
|
24
|
-
ReconciliationWarningCode["WRONG_PERSON"] = "WRONG_PERSON";
|
|
25
|
-
ReconciliationWarningCode["LATE_RECONCILIATION"] = "LATE_RECONCILIATION";
|
|
26
|
-
ReconciliationWarningCode["MISSING_CARD_VERIFICATION"] = "MISSING_CARD_VERIFICATION";
|
|
27
|
-
ReconciliationWarningCode["PREVIOUS_UNRECONCILED"] = "PREVIOUS_UNRECONCILED";
|
|
28
|
-
})(ReconciliationWarningCode || (exports.ReconciliationWarningCode = ReconciliationWarningCode = {}));
|
|
29
|
-
var ReconciliationWarningSeverity;
|
|
30
|
-
(function (ReconciliationWarningSeverity) {
|
|
31
|
-
ReconciliationWarningSeverity["INFO"] = "info";
|
|
32
|
-
ReconciliationWarningSeverity["WARNING"] = "warning";
|
|
33
|
-
ReconciliationWarningSeverity["ERROR"] = "error";
|
|
34
|
-
})(ReconciliationWarningSeverity || (exports.ReconciliationWarningSeverity = ReconciliationWarningSeverity = {}));
|