@fiado/type-kit 3.492.0 → 3.493.1
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/_test_/unit/remittance/RemittanceUnitellerSnapshot.test.ts +75 -0
- package/_test_/unit/retailWizard/creditPromotionBonusContract.test.ts +10 -0
- package/bin/remittance/dtos/RemittanceUnitellerSnapshot.d.ts +37 -0
- package/bin/remittance/dtos/RemittanceUnitellerSnapshot.js +2 -0
- package/bin/remittance/dtos/index.d.ts +1 -0
- package/bin/remittance/dtos/index.js +1 -0
- package/bin/retailWizard/dtos/WizardCreditPromotionBonus.d.ts +3 -0
- package/package.json +1 -1
- package/src/remittance/dtos/RemittanceUnitellerSnapshot.ts +41 -0
- package/src/remittance/dtos/index.ts +1 -0
- package/src/retailWizard/dtos/WizardCreditPromotionBonus.ts +3 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
RemittanceMonthlySection,
|
|
3
|
+
RemittanceOrphanRow,
|
|
4
|
+
RemittancePoolBalanceSection,
|
|
5
|
+
RemittanceSnapshotSection,
|
|
6
|
+
RemittanceUnitellerSnapshot,
|
|
7
|
+
} from "../../../src/remittance/dtos/RemittanceUnitellerSnapshot";
|
|
8
|
+
|
|
9
|
+
// Interfaces TypeScript puros sin class-validator — el valor del test es:
|
|
10
|
+
// (a) compile-time check de que la shape es la esperada (si cambia, falla build)
|
|
11
|
+
// (b) fixture canonico que docs el shape para consumers (fiado-dashboard).
|
|
12
|
+
// Si el consolidator server-side produce algo que no matchea esto, falla el type-check en el dashboard.
|
|
13
|
+
|
|
14
|
+
describe("RemittanceUnitellerSnapshot shape", () => {
|
|
15
|
+
const emptySection: RemittanceSnapshotSection = {
|
|
16
|
+
ok: 0, soloFiado: 0, soloUniteller: 0,
|
|
17
|
+
diffMonto: 0, diffFx: 0, diffCost: 0, diffRate: 0,
|
|
18
|
+
totalMontoUsd: 0,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const poolBalance: RemittancePoolBalanceSection = {
|
|
22
|
+
balanceUsd: 125428.75,
|
|
23
|
+
reportedBalanceUsd: 125430.5,
|
|
24
|
+
diffUsd: -1.75,
|
|
25
|
+
asOf: "2026-10-02",
|
|
26
|
+
staleness: "FRESH",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const orphan: RemittanceOrphanRow = {
|
|
30
|
+
txIdentifier: "5649809531",
|
|
31
|
+
statementDate: "2026-10-02",
|
|
32
|
+
reportType: "TX_DETAILS",
|
|
33
|
+
amountUsd: 500,
|
|
34
|
+
processingFee: 3,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const monthlySection: RemittanceMonthlySection = {
|
|
38
|
+
envios: emptySection,
|
|
39
|
+
cancels: emptySection,
|
|
40
|
+
itemsUrl: "https://admin-dashboard.fiado.online/conciliacion/pago-confiado/uniteller?mes=2026-10",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const snapshot: RemittanceUnitellerSnapshot = {
|
|
44
|
+
calculatedAt: "2026-10-02T19:00:00.000Z",
|
|
45
|
+
envios: emptySection,
|
|
46
|
+
cancels: emptySection,
|
|
47
|
+
poolBalance,
|
|
48
|
+
orphans: [orphan],
|
|
49
|
+
byMonth: { "2026-10": monthlySection },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
it("estructura canonica con todos los campos required", () => {
|
|
53
|
+
expect(snapshot.calculatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/);
|
|
54
|
+
expect(snapshot.envios).toBe(emptySection);
|
|
55
|
+
expect(snapshot.cancels).toBe(emptySection);
|
|
56
|
+
expect(snapshot.poolBalance).toBe(poolBalance);
|
|
57
|
+
expect(snapshot.orphans).toHaveLength(1);
|
|
58
|
+
expect(snapshot.byMonth["2026-10"]).toBe(monthlySection);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("itemsUrl es opcional en RemittanceMonthlySection", () => {
|
|
62
|
+
const withoutUrl: RemittanceMonthlySection = { envios: emptySection, cancels: emptySection };
|
|
63
|
+
expect(withoutUrl.itemsUrl).toBeUndefined();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("staleness acepta los 3 valores del union", () => {
|
|
67
|
+
const states: Array<RemittancePoolBalanceSection["staleness"]> = ["FRESH", "STALE", "MISSING"];
|
|
68
|
+
expect(states).toEqual(["FRESH", "STALE", "MISSING"]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("reportType acepta los 3 valores del union", () => {
|
|
72
|
+
const types: Array<RemittanceOrphanRow["reportType"]> = ["TX_DETAILS", "CANCEL_TX", "VOID_TX"];
|
|
73
|
+
expect(types).toEqual(["TX_DETAILS", "CANCEL_TX", "VOID_TX"]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -13,6 +13,16 @@ describe('bono de crédito en el contrato del wizard', () => {
|
|
|
13
13
|
expect(session.creditPromotionBonus?.status).toBe('RESERVED');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
it('el bono RESERVED lleva el instante en que entró en reserva', () => {
|
|
17
|
+
const bonus: WizardCreditPromotionBonus = {
|
|
18
|
+
promotionId: 'promo-1',
|
|
19
|
+
amountCents: 5_000,
|
|
20
|
+
status: LoanOfferings.PromotionBonusStatusEnum.RESERVED,
|
|
21
|
+
pendingSince: '2026-10-02T15:00:00.000Z',
|
|
22
|
+
};
|
|
23
|
+
expect(bonus.pendingSince).toBe('2026-10-02T15:00:00.000Z');
|
|
24
|
+
});
|
|
25
|
+
|
|
16
26
|
it('la sesión sin bono resuelto lo omite o lo manda null', () => {
|
|
17
27
|
const absent: Pick<WizardSession, 'creditPromotionBonus'> = {};
|
|
18
28
|
const nulled: Pick<WizardSession, 'creditPromotionBonus'> = { creditPromotionBonus: null };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface RemittanceSnapshotSection {
|
|
2
|
+
ok: number;
|
|
3
|
+
soloFiado: number;
|
|
4
|
+
soloUniteller: number;
|
|
5
|
+
diffMonto: number;
|
|
6
|
+
diffFx: number;
|
|
7
|
+
diffCost: number;
|
|
8
|
+
diffRate: number;
|
|
9
|
+
totalMontoUsd: number;
|
|
10
|
+
}
|
|
11
|
+
export interface RemittancePoolBalanceSection {
|
|
12
|
+
balanceUsd: number;
|
|
13
|
+
reportedBalanceUsd: number;
|
|
14
|
+
diffUsd: number;
|
|
15
|
+
asOf: string;
|
|
16
|
+
staleness: "FRESH" | "STALE" | "MISSING";
|
|
17
|
+
}
|
|
18
|
+
export interface RemittanceOrphanRow {
|
|
19
|
+
txIdentifier: string;
|
|
20
|
+
statementDate: string;
|
|
21
|
+
reportType: "TX_DETAILS" | "CANCEL_TX" | "VOID_TX";
|
|
22
|
+
amountUsd: number;
|
|
23
|
+
processingFee: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RemittanceMonthlySection {
|
|
26
|
+
envios: RemittanceSnapshotSection;
|
|
27
|
+
cancels: RemittanceSnapshotSection;
|
|
28
|
+
itemsUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RemittanceUnitellerSnapshot {
|
|
31
|
+
calculatedAt: string;
|
|
32
|
+
envios: RemittanceSnapshotSection;
|
|
33
|
+
cancels: RemittanceSnapshotSection;
|
|
34
|
+
poolBalance: RemittancePoolBalanceSection;
|
|
35
|
+
orphans: RemittanceOrphanRow[];
|
|
36
|
+
byMonth: Record<string, RemittanceMonthlySection>;
|
|
37
|
+
}
|
|
@@ -69,3 +69,4 @@ __exportStar(require("./RemittanceFavoriteItem"), exports);
|
|
|
69
69
|
__exportStar(require("./RemittanceFavoriteListResponse"), exports);
|
|
70
70
|
__exportStar(require("./RemittanceBackofficeCancelCloseRequest"), exports);
|
|
71
71
|
__exportStar(require("./RemittanceBackofficeCancelCloseResponse"), exports);
|
|
72
|
+
__exportStar(require("./RemittanceUnitellerSnapshot"), exports);
|
|
@@ -5,4 +5,7 @@ export interface WizardCreditPromotionBonus {
|
|
|
5
5
|
amountCents: number;
|
|
6
6
|
/** `RESERVED` = en proceso; los otros tres son terminales. */
|
|
7
7
|
status: PromotionBonusStatusEnum;
|
|
8
|
+
/** ISO 8601 del instante en que el bono entró en RESERVED por primera vez.
|
|
9
|
+
* Lo sella el wizard una vez y no cambia después. */
|
|
10
|
+
pendingSince?: string;
|
|
8
11
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface RemittanceSnapshotSection {
|
|
2
|
+
ok: number;
|
|
3
|
+
soloFiado: number;
|
|
4
|
+
soloUniteller: number;
|
|
5
|
+
diffMonto: number;
|
|
6
|
+
diffFx: number;
|
|
7
|
+
diffCost: number;
|
|
8
|
+
diffRate: number;
|
|
9
|
+
totalMontoUsd: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RemittancePoolBalanceSection {
|
|
13
|
+
balanceUsd: number;
|
|
14
|
+
reportedBalanceUsd: number;
|
|
15
|
+
diffUsd: number;
|
|
16
|
+
asOf: string; // YYYY-MM-DD | "N/A"
|
|
17
|
+
staleness: "FRESH" | "STALE" | "MISSING";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface RemittanceOrphanRow {
|
|
21
|
+
txIdentifier: string;
|
|
22
|
+
statementDate: string; // YYYY-MM-DD
|
|
23
|
+
reportType: "TX_DETAILS" | "CANCEL_TX" | "VOID_TX";
|
|
24
|
+
amountUsd: number;
|
|
25
|
+
processingFee: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RemittanceMonthlySection {
|
|
29
|
+
envios: RemittanceSnapshotSection;
|
|
30
|
+
cancels: RemittanceSnapshotSection;
|
|
31
|
+
itemsUrl?: string; // opcional — link a la vista de detalle
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RemittanceUnitellerSnapshot {
|
|
35
|
+
calculatedAt: string; // ISO UTC
|
|
36
|
+
envios: RemittanceSnapshotSection;
|
|
37
|
+
cancels: RemittanceSnapshotSection;
|
|
38
|
+
poolBalance: RemittancePoolBalanceSection;
|
|
39
|
+
orphans: RemittanceOrphanRow[];
|
|
40
|
+
byMonth: Record<string, RemittanceMonthlySection>; // key = "YYYY-MM"
|
|
41
|
+
}
|
|
@@ -6,4 +6,7 @@ export interface WizardCreditPromotionBonus {
|
|
|
6
6
|
amountCents: number;
|
|
7
7
|
/** `RESERVED` = en proceso; los otros tres son terminales. */
|
|
8
8
|
status: PromotionBonusStatusEnum;
|
|
9
|
+
/** ISO 8601 del instante en que el bono entró en RESERVED por primera vez.
|
|
10
|
+
* Lo sella el wizard una vez y no cambia después. */
|
|
11
|
+
pendingSince?: string;
|
|
9
12
|
}
|