hvp-shared 6.38.0 → 6.40.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.
@@ -0,0 +1,2 @@
1
+ export * from './requests';
2
+ export * from './responses';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
18
+ __exportStar(require("./responses"), exports);
@@ -0,0 +1,38 @@
1
+ import { ReconciliationStatus } from '../../types/cash-reconciliation.types';
2
+ /**
3
+ * One-shot reconciliation request.
4
+ * Creates a fully closed reconciliation linked to a QVET closing.
5
+ *
6
+ * @example POST /api/cash-reconciliations/reconcile
7
+ */
8
+ export interface ReconcileRequest {
9
+ branchId: string;
10
+ closingNumber: number;
11
+ reportedCashInDrawer: number;
12
+ cardTerminalTotal?: number;
13
+ observations?: string;
14
+ }
15
+ /**
16
+ * Admin update request.
17
+ * Recalculates derived fields (cashDifference, warnings, etc.) on save.
18
+ *
19
+ * @example PATCH /api/cash-reconciliations/:id
20
+ */
21
+ export interface AdminUpdateReconciliationRequest {
22
+ reportedCashInDrawer?: number;
23
+ cardTerminalTotal?: number | null;
24
+ observations?: string;
25
+ }
26
+ /**
27
+ * Query parameters for listing reconciliations.
28
+ *
29
+ * @example GET /api/cash-reconciliations?branchId=xxx&status=closed&startDate=2026-01-01&endDate=2026-01-31
30
+ */
31
+ export interface CashReconciliationQueryParams {
32
+ branchId?: string;
33
+ status?: ReconciliationStatus;
34
+ startDate?: string;
35
+ endDate?: string;
36
+ limit?: number;
37
+ page?: number;
38
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,104 @@
1
+ import { CashReconciliationWarning, QvetPaymentBreakdown, ReconciliationStatus } from '../../types/cash-reconciliation.types';
2
+ /**
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.
19
+ *
20
+ * Used for: detail dialog, history table rows, admin edit.
21
+ *
22
+ * @example GET /api/cash-reconciliations/:id
23
+ * @example GET /api/cash-reconciliations (list — array of these)
24
+ */
25
+ export interface CashReconciliationResponse {
26
+ id: string;
27
+ branchId: string;
28
+ branchName: string;
29
+ status: ReconciliationStatus;
30
+ baseCashAmount: number;
31
+ cashInDrawerStart: number;
32
+ expectedCashInDrawer: number;
33
+ reportedCashInDrawer: number | null;
34
+ cashDifference: number | null;
35
+ qvet: QvetClosingData | null;
36
+ cashTransferAmount: number | null;
37
+ closingCash: number | null;
38
+ cardTerminalTotal: number | null;
39
+ cardTerminalPriorAmount: number | null;
40
+ cardDiscrepancy: number | null;
41
+ observations: string;
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;
51
+ }
52
+ /**
53
+ * Pre-closing cash calculation for a branch.
54
+ *
55
+ * @example GET /api/cash-reconciliations/expected-cash/:branchId
56
+ */
57
+ export interface ExpectedCashResponse {
58
+ branchId: string;
59
+ branchName: string;
60
+ baseCashAmount: number;
61
+ cashInDrawerStart: number;
62
+ cashPaymentsSinceLastClosing: number;
63
+ expectedCashInDrawer: number;
64
+ lastClosedAt: string | null;
65
+ }
66
+ /**
67
+ * Dashboard status card for a single branch.
68
+ *
69
+ * @example GET /api/cash-reconciliations/branch-status
70
+ */
71
+ export interface BranchReconciliationStatusResponse {
72
+ branchId: string;
73
+ branchName: string;
74
+ baseCashAmount: number;
75
+ activeReconciliation: {
76
+ id: string;
77
+ status: ReconciliationStatus;
78
+ expectedCash: number;
79
+ reportedCashInDrawer: number | null;
80
+ cashDifference: number | null;
81
+ createdAt: string | null;
82
+ } | null;
83
+ lastClosed: {
84
+ id: string;
85
+ closingCash: number | null;
86
+ closedAt: string | null;
87
+ qvetClosingNumber: number | null;
88
+ hasWarnings: boolean;
89
+ } | null;
90
+ }
91
+ /**
92
+ * QVET closing not yet linked to a reconciliation.
93
+ *
94
+ * @example GET /api/cash-reconciliations/unlinked-closings/:branchId
95
+ */
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;
104
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,3 +7,4 @@ export * from './catalog-item';
7
7
  export * from './order-planning';
8
8
  export * from './qvet';
9
9
  export * from './stock-calculation';
10
+ export * from './cash-reconciliation';
@@ -23,3 +23,4 @@ __exportStar(require("./catalog-item"), exports);
23
23
  __exportStar(require("./order-planning"), exports);
24
24
  __exportStar(require("./qvet"), exports);
25
25
  __exportStar(require("./stock-calculation"), exports);
26
+ __exportStar(require("./cash-reconciliation"), exports);
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Cash Reconciliation Types
3
+ *
4
+ * Shared types for the cash reconciliation system that verifies
5
+ * QVET cash closings against actual cash and card terminal totals.
6
+ */
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
+ */
18
+ export type ReconciliationWarningCode = 'CASH_MISMATCH' | 'STAFF_MISMATCH' | 'STALE_CLOSING' | 'MISSING_CARD_VERIFICATION' | 'MIGRATED_NO_QVET';
19
+ export interface CashReconciliationWarning {
20
+ code: string;
21
+ severity: ReconciliationWarningSeverity;
22
+ message: string;
23
+ }
24
+ export interface QvetPaymentBreakdown {
25
+ cash: number;
26
+ debitCard: number;
27
+ creditCard: number;
28
+ amex: number;
29
+ transfer: number;
30
+ other: number;
31
+ }
32
+ /**
33
+ * Branch cash configuration for base cash amounts.
34
+ * Stored as a sub-document in the Branch model.
35
+ */
36
+ export interface BranchCashConfig {
37
+ baseCashAmount: number;
38
+ updatedBy?: string;
39
+ updatedAt?: string;
40
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Cash Reconciliation Types
4
+ *
5
+ * Shared types for the cash reconciliation system that verifies
6
+ * QVET cash closings against actual cash and card terminal totals.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,3 +11,4 @@ export * from './catalog-item.types';
11
11
  export * from './qvet.types';
12
12
  export * from './background-job.types';
13
13
  export * from './payroll-v2.types';
14
+ export * from './cash-reconciliation.types';
@@ -27,3 +27,4 @@ __exportStar(require("./catalog-item.types"), exports);
27
27
  __exportStar(require("./qvet.types"), exports);
28
28
  __exportStar(require("./background-job.types"), exports);
29
29
  __exportStar(require("./payroll-v2.types"), exports);
30
+ __exportStar(require("./cash-reconciliation.types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.38.0",
3
+ "version": "6.40.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",