sinfactura-types 1.6.2 → 1.6.4
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.
- package/dist/cash.d.ts +5 -0
- package/dist/payment.d.ts +109 -106
- package/package.json +1 -1
package/dist/cash.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ declare global {
|
|
|
9
9
|
outcome?: number;
|
|
10
10
|
balance?: number;
|
|
11
11
|
subject?: string;
|
|
12
|
+
currency?: string;
|
|
13
|
+
currencyValue?: number;
|
|
14
|
+
currencyValueAt?: number;
|
|
15
|
+
balanceByCurrency?: Record<string, number>;
|
|
16
|
+
incomeByCurrency?: Record<string, number>;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
export {};
|
package/dist/payment.d.ts
CHANGED
|
@@ -1,107 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
declare global {
|
|
2
|
+
/**
|
|
3
|
+
* WebSocket broadcast payload for the `payment_received` action.
|
|
4
|
+
*
|
|
5
|
+
* Fired by the API when a "money received" event is persisted across any
|
|
6
|
+
* of three sources (MP webhook, Stripe webhook, MP movements poller).
|
|
7
|
+
* Receivers (FE) should:
|
|
8
|
+
* 1. Render an immediate snackbar toast using `total` + `currency` + `payerName`.
|
|
9
|
+
* 2. Invalidate RTK Query tags `PaymentReceived` + `PaymentReceivedUnlinked`
|
|
10
|
+
* so the canonical row is refetched from `GET /payments/received`.
|
|
11
|
+
*/
|
|
12
|
+
type PaymentReceivedSource = "mp" | "stripe" | "mp_movement";
|
|
13
|
+
interface PaymentReceivedWsPayload {
|
|
14
|
+
source: PaymentReceivedSource;
|
|
15
|
+
paymentId: string;
|
|
16
|
+
total: number;
|
|
17
|
+
currency: string;
|
|
18
|
+
payerName?: string;
|
|
19
|
+
paidAt: number;
|
|
20
|
+
customerId?: string;
|
|
21
|
+
orderId?: string;
|
|
22
|
+
invoiceId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* REST shape of a payment row returned by `GET /payments/received` (api#902).
|
|
26
|
+
*
|
|
27
|
+
* Distinct from `PaymentReceivedWsPayload` (api#880, the WS broadcast):
|
|
28
|
+
* - This carries denormalized labels (customerName, orderCode, invoiceCode)
|
|
29
|
+
* attached server-side at response time so the FE doesn't N+1 fetch.
|
|
30
|
+
* - The WS broadcast is the lean live-tail event; this is the canonical row.
|
|
31
|
+
*/
|
|
32
|
+
interface PaymentReceived {
|
|
33
|
+
paymentId: string;
|
|
34
|
+
source: PaymentReceivedSource;
|
|
35
|
+
total: number;
|
|
36
|
+
currency: string;
|
|
37
|
+
currencyValue?: number;
|
|
38
|
+
currencyValueAt?: number;
|
|
39
|
+
payerName?: string;
|
|
40
|
+
payerEmail?: string;
|
|
41
|
+
payerCuit?: string;
|
|
42
|
+
paidAt: number;
|
|
43
|
+
customerId?: string;
|
|
44
|
+
customerName?: string;
|
|
45
|
+
orderId?: string;
|
|
46
|
+
orderCode?: string;
|
|
47
|
+
invoiceId?: string;
|
|
48
|
+
invoiceCode?: string;
|
|
49
|
+
accountId?: string;
|
|
50
|
+
linkedAt?: number;
|
|
51
|
+
linkSource?: "auto" | "manual";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Confidence tier for a link suggestion (api#904).
|
|
55
|
+
*
|
|
56
|
+
* Mapped from heuristic match strength:
|
|
57
|
+
* - 'Alta': customer CUIT/email exact OR order amount-exact + ±24h
|
|
58
|
+
* - 'Media': order amount ±5% within ±7d
|
|
59
|
+
* - 'Baja': reserved for future broader heuristics (currently unused)
|
|
60
|
+
*/
|
|
61
|
+
export type LinkSuggestionConfidence = "Alta" | "Media" | "Baja";
|
|
62
|
+
/**
|
|
63
|
+
* One ranked customer candidate for a payment's link dialog (api#904).
|
|
64
|
+
* The FE renders the chip with `fullName`, the confidence badge, and the
|
|
65
|
+
* `reason` text verbatim.
|
|
66
|
+
*/
|
|
67
|
+
interface CustomerCandidate {
|
|
68
|
+
customerId: string;
|
|
69
|
+
fullName: string;
|
|
70
|
+
cuit?: string;
|
|
71
|
+
email?: string;
|
|
72
|
+
confidence: LinkSuggestionConfidence;
|
|
73
|
+
reason: string;
|
|
74
|
+
score: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One ranked order candidate for a payment's link dialog (api#904).
|
|
78
|
+
* `orderCode` is currently identical to `orderId` (no separate short code
|
|
79
|
+
* field on Order today); kept as a distinct field for forward-compat with
|
|
80
|
+
* a future Order.code rollout.
|
|
81
|
+
*
|
|
82
|
+
* `currency` is always 'ARS' in v1 (the storage currency for SINFACTURA's
|
|
83
|
+
* Argentine tenants); USD-priced orders surface their ARS-equivalent total.
|
|
84
|
+
* `total` is therefore in ARS regardless of how the order was originally
|
|
85
|
+
* priced; FE may derive USD display from `Order.currency` (the FX rate)
|
|
86
|
+
* if needed.
|
|
87
|
+
*/
|
|
88
|
+
interface OrderCandidate {
|
|
89
|
+
orderId: string;
|
|
90
|
+
orderCode: string;
|
|
91
|
+
customerId: string;
|
|
92
|
+
customerName: string;
|
|
93
|
+
total: number;
|
|
94
|
+
currency: string;
|
|
95
|
+
dated: number;
|
|
96
|
+
confidence: LinkSuggestionConfidence;
|
|
97
|
+
reason: string;
|
|
98
|
+
score: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Response shape of `GET /payments/{source}/{paymentId}/link-suggestions`.
|
|
102
|
+
* Both arrays may be empty when no signal — FE renders "Sin sugerencias
|
|
103
|
+
* automáticas" and falls back to manual customer / order search inputs.
|
|
104
|
+
*/
|
|
105
|
+
interface LinkSuggestionsResponse {
|
|
106
|
+
customers: CustomerCandidate[];
|
|
107
|
+
orders: OrderCandidate[];
|
|
108
|
+
}
|
|
107
109
|
}
|
|
110
|
+
export {};
|