@fiado/type-kit 3.451.0 → 3.453.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,35 @@
1
+ import 'reflect-metadata';
2
+ import { DisputeRefundType, DisputeRefundStatus } from '../../../src/transaction';
3
+
4
+ describe('DisputeRefundType', () => {
5
+ it('expone REFUND, REVERSAL', () => {
6
+ expect(DisputeRefundType.REFUND).toBe('REFUND');
7
+ expect(DisputeRefundType.REVERSAL).toBe('REVERSAL');
8
+ });
9
+
10
+ it('no tiene valores de más', () => {
11
+ expect(Object.values(DisputeRefundType).sort()).toEqual(['REFUND', 'REVERSAL'].sort());
12
+ });
13
+ });
14
+
15
+ describe('DisputeRefundStatus', () => {
16
+ const expected = [
17
+ 'PENDING_AUTHORIZATION',
18
+ 'PENDING_MANUAL_EXECUTION',
19
+ 'EXECUTED',
20
+ 'FAILED',
21
+ 'CANCELLED',
22
+ ];
23
+
24
+ it('expone los 5 estados del ciclo de vida', () => {
25
+ expect(DisputeRefundStatus.PENDING_AUTHORIZATION).toBe('PENDING_AUTHORIZATION');
26
+ expect(DisputeRefundStatus.PENDING_MANUAL_EXECUTION).toBe('PENDING_MANUAL_EXECUTION');
27
+ expect(DisputeRefundStatus.EXECUTED).toBe('EXECUTED');
28
+ expect(DisputeRefundStatus.FAILED).toBe('FAILED');
29
+ expect(DisputeRefundStatus.CANCELLED).toBe('CANCELLED');
30
+ });
31
+
32
+ it('no tiene valores de más', () => {
33
+ expect(Object.values(DisputeRefundStatus).sort()).toEqual(expected.sort());
34
+ });
35
+ });
@@ -21,6 +21,8 @@ describe('Refund DTOs', () => {
21
21
  refundCase: {
22
22
  pathType: RefundPathTypeEnum.DICTAMEN_PROCEDE,
23
23
  caseFolio: 'FOLIO-001',
24
+ folioId: 'e8b34db9-11cc-4d7a-b6c9-7f2a91b8c001',
25
+ folioEventId: '9a41c3d0-f78b-4d54-9c62-1e8d5f2b7003',
24
26
  originalTransactionId: 'TX-123',
25
27
  originalAmount: 1000,
26
28
  originalChannel: 'SPEI_IN',
@@ -75,4 +77,31 @@ describe('Refund DTOs', () => {
75
77
  expect(confirmRequest.speiTrackingKey).toBe('SPE-TRACK-001');
76
78
  expect(confirmRequest.executedAt).toBe('2026-09-17T22:00:00Z');
77
79
  });
80
+
81
+ it('AuthorizeRefundRequest expone folioId y folioEventId como campos requeridos de refundCase', () => {
82
+ const req: AuthorizeRefundRequest = {
83
+ idempotencyKey: 'k',
84
+ directoryId: 'd',
85
+ peopleId: 'p',
86
+ productCatalogId: 'MEX_REFUND_PCF',
87
+ operation: 'ADD',
88
+ amount: { total: 100, currencyId: 'MXN' },
89
+ refundChannel: RefundChannelEnum.INTERNAL_PCF,
90
+ refundCase: {
91
+ pathType: RefundPathTypeEnum.DICTAMEN_PROCEDE,
92
+ caseFolio: 'F',
93
+ folioId: 'uuid-folio',
94
+ folioEventId: 'uuid-event',
95
+ originalTransactionId: null,
96
+ originalAmount: 100,
97
+ originalChannel: 'PCF_P2P',
98
+ },
99
+ approval: { makerUserId: 'm', checkerUserId: null, minuteS3Key: null },
100
+ reason: 'r',
101
+ evidence: { dictamenS3Key: null, incidentReportS3Key: null, objectionFormS3Key: null },
102
+ pldOverrideMinuteS3Key: null,
103
+ };
104
+ expect(req.refundCase.folioId).toBe('uuid-folio');
105
+ expect(req.refundCase.folioEventId).toBe('uuid-event');
106
+ });
78
107
  });
@@ -19,6 +19,25 @@ export interface AuthorizeRefundRequest {
19
19
  refundCase: {
20
20
  pathType: RefundPathTypeEnum;
21
21
  caseFolio: string;
22
+ /**
23
+ * UUID del registro `DisputeOrFraudLog` que originó el reintegro (fuente
24
+ * autoritativa del folio). El BO lo persiste en el ledger como
25
+ * `PagoConfiadoTx_GT.disputeOrFraudLogId` para cerrar el vínculo con la
26
+ * reclamación (antes del rediseño quedaba en "ND").
27
+ */
28
+ folioId: string;
29
+ /**
30
+ * UUID del evento R27 específico dentro de `DisputeOrFraudLog.statusHistory[]`
31
+ * que autoriza este reintegro. Preserva el ligado inmutable evento↔movimiento
32
+ * en `DisputeRefund_GT.folioEventId`: un folio que reingresa (103) tras un
33
+ * dictamen no procedente y genera un segundo refund puede tener 2 entradas
34
+ * en `DisputeRefund_GT`, cada una apuntando a su evento R27 propio.
35
+ *
36
+ * Lo obtiene el Dashboard del response de `disputes-business` al firmar el
37
+ * dictamen (`lastEvent.eventId`). Es inmutable — no se recalcula ni se
38
+ * reasigna una vez enviado.
39
+ */
40
+ folioEventId: string;
22
41
  originalTransactionId: string | null;
23
42
  originalAmount: number;
24
43
  /**
@@ -0,0 +1,68 @@
1
+ import { RefundChannelEnum } from '../enums/RefundChannelEnum';
2
+ import { DisputeRefundType } from '../enums/DisputeRefundType';
3
+ import { DisputeRefundStatus } from '../enums/DisputeRefundStatus';
4
+ /**
5
+ * Registro canónico de un movimiento de dinero (REFUND o REVERSAL) ligado a
6
+ * un folio R27 de reclamación. Es el shape 1:1 de una fila de la tabla DDB
7
+ * `DisputeRefund_GT`.
8
+ *
9
+ * Modelo:
10
+ * - Un folio R27 puede tener 0, 1 o 2 filas en DisputeRefund_GT.
11
+ * - 1 fila `type=REFUND` cuando el reintegro se ejecutó.
12
+ * - 2 filas (REFUND + REVERSAL) cuando el reintegro fue revertido por
13
+ * dictamen tardío que confirmó 2FA original (Circular 12/2018
14
+ * Disposición 35.a Banxico).
15
+ * - `folioEventId` apunta al evento R27 específico (no solo al folio)
16
+ * para preservar el ligado inmutable cuando un folio reingresa (103)
17
+ * tras un dictamen no procedente.
18
+ * - `relatedRefundId` solo aplica cuando `type=REVERSAL` — apunta al `id`
19
+ * del REFUND que se está revirtiendo.
20
+ * - `txId` es `null` durante `PENDING_AUTHORIZATION`; se popula al crear
21
+ * la tx en el ledger (`PagoConfiadoTx_GT`).
22
+ */
23
+ export interface DisputeRefundRecord {
24
+ id: string;
25
+ folioId: string;
26
+ folioEventId: string;
27
+ type: DisputeRefundType;
28
+ channel: RefundChannelEnum;
29
+ status: DisputeRefundStatus;
30
+ relatedRefundId: string | null;
31
+ txId: string | null;
32
+ amount: number;
33
+ currencyId: 'MXN';
34
+ caseFolio: string;
35
+ targetDirectoryId: string;
36
+ manualExecution: DisputeRefundManualExecution | null;
37
+ approval: DisputeRefundApproval;
38
+ reason: string | null;
39
+ createdAt: number;
40
+ updatedAt: number;
41
+ failureReason: string | null;
42
+ }
43
+ /**
44
+ * Metadatos específicos del canal SPEI_OUT_MANUAL. `null` cuando el canal es
45
+ * INTERNAL_PCF (transferencia intra-wallet sin salida SPEI).
46
+ */
47
+ export interface DisputeRefundManualExecution {
48
+ targetClabe: string | null;
49
+ targetBankId: string | null;
50
+ targetName: string | null;
51
+ instructionS3Key: string | null;
52
+ confirmedTrackingKey: string | null;
53
+ confirmedAt: number | null;
54
+ confirmedByUserId: string | null;
55
+ }
56
+ /**
57
+ * Cadena de aprobación heredada de Política SP1 §10:
58
+ * L1 ($5,000 MXN) → requiere checker.
59
+ * L2 ($50,000 MXN) → requiere checker + minuta firmada.
60
+ * `pldOverrideMinuteS3Key` cubre el caso en que el titular está en lista
61
+ * negra PLD y el reintegro procede solo con acta de comité.
62
+ */
63
+ export interface DisputeRefundApproval {
64
+ makerUserId: string;
65
+ checkerUserId: string | null;
66
+ minuteS3Key: string | null;
67
+ pldOverrideMinuteS3Key: string | null;
68
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export declare enum DisputeRefundStatus {
2
+ PENDING_AUTHORIZATION = "PENDING_AUTHORIZATION",
3
+ PENDING_MANUAL_EXECUTION = "PENDING_MANUAL_EXECUTION",
4
+ EXECUTED = "EXECUTED",
5
+ FAILED = "FAILED",
6
+ CANCELLED = "CANCELLED"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisputeRefundStatus = void 0;
4
+ var DisputeRefundStatus;
5
+ (function (DisputeRefundStatus) {
6
+ DisputeRefundStatus["PENDING_AUTHORIZATION"] = "PENDING_AUTHORIZATION";
7
+ DisputeRefundStatus["PENDING_MANUAL_EXECUTION"] = "PENDING_MANUAL_EXECUTION";
8
+ DisputeRefundStatus["EXECUTED"] = "EXECUTED";
9
+ DisputeRefundStatus["FAILED"] = "FAILED";
10
+ DisputeRefundStatus["CANCELLED"] = "CANCELLED";
11
+ })(DisputeRefundStatus || (exports.DisputeRefundStatus = DisputeRefundStatus = {}));
@@ -0,0 +1,4 @@
1
+ export declare enum DisputeRefundType {
2
+ REFUND = "REFUND",
3
+ REVERSAL = "REVERSAL"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisputeRefundType = void 0;
4
+ var DisputeRefundType;
5
+ (function (DisputeRefundType) {
6
+ DisputeRefundType["REFUND"] = "REFUND";
7
+ DisputeRefundType["REVERSAL"] = "REVERSAL";
8
+ })(DisputeRefundType || (exports.DisputeRefundType = DisputeRefundType = {}));
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @deprecated Use `DisputeRefundStatus` en su lugar. Este enum tiene scope
3
+ * estrecho (solo canal SPEI_OUT_MANUAL, sin estados de autorización previa,
4
+ * sin failure state) y se retira junto con la tabla `RefundManualExecution_GT`
5
+ * en el cleanup que sigue a la migración de código a `DisputeRefund_GT`.
6
+ */
1
7
  export declare enum RefundManualExecutionStatus {
2
8
  PENDING_MANUAL_EXECUTION = "PENDING_MANUAL_EXECUTION",
3
9
  EXECUTED = "EXECUTED",
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefundManualExecutionStatus = void 0;
4
+ /**
5
+ * @deprecated Use `DisputeRefundStatus` en su lugar. Este enum tiene scope
6
+ * estrecho (solo canal SPEI_OUT_MANUAL, sin estados de autorización previa,
7
+ * sin failure state) y se retira junto con la tabla `RefundManualExecution_GT`
8
+ * en el cleanup que sigue a la migración de código a `DisputeRefund_GT`.
9
+ */
4
10
  var RefundManualExecutionStatus;
5
11
  (function (RefundManualExecutionStatus) {
6
12
  RefundManualExecutionStatus["PENDING_MANUAL_EXECUTION"] = "PENDING_MANUAL_EXECUTION";
@@ -17,6 +17,7 @@ export * from './dtos/ActivityProblemGetResponse';
17
17
  export * from './dtos/AuthorizeRefundRequest';
18
18
  export * from './dtos/ReverseRefundRequest';
19
19
  export * from './dtos/ConfirmManualExecutionRequest';
20
+ export * from './dtos/DisputeRefundRecord';
20
21
  export * from './dtos/internal/BaseProviderTransaction';
21
22
  export * from './dtos/internal/BaseProviderTransactionQueryParams';
22
23
  export * from './dtos/internal/CentralPaymentsQueryParams';
@@ -39,3 +40,5 @@ export * from './enums/ActivityProblemStatusEnum';
39
40
  export * from './enums/RefundChannelEnum';
40
41
  export * from './enums/RefundPathTypeEnum';
41
42
  export * from './enums/RefundManualExecutionStatus';
43
+ export * from './enums/DisputeRefundType';
44
+ export * from './enums/DisputeRefundStatus';
@@ -34,6 +34,7 @@ __exportStar(require("./dtos/ActivityProblemGetResponse"), exports);
34
34
  __exportStar(require("./dtos/AuthorizeRefundRequest"), exports);
35
35
  __exportStar(require("./dtos/ReverseRefundRequest"), exports);
36
36
  __exportStar(require("./dtos/ConfirmManualExecutionRequest"), exports);
37
+ __exportStar(require("./dtos/DisputeRefundRecord"), exports);
37
38
  __exportStar(require("./dtos/internal/BaseProviderTransaction"), exports);
38
39
  __exportStar(require("./dtos/internal/BaseProviderTransactionQueryParams"), exports);
39
40
  __exportStar(require("./dtos/internal/CentralPaymentsQueryParams"), exports);
@@ -57,3 +58,5 @@ __exportStar(require("./enums/ActivityProblemStatusEnum"), exports);
57
58
  __exportStar(require("./enums/RefundChannelEnum"), exports);
58
59
  __exportStar(require("./enums/RefundPathTypeEnum"), exports);
59
60
  __exportStar(require("./enums/RefundManualExecutionStatus"), exports);
61
+ __exportStar(require("./enums/DisputeRefundType"), exports);
62
+ __exportStar(require("./enums/DisputeRefundStatus"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.451.0",
3
+ "version": "3.453.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -17,6 +17,25 @@ export interface AuthorizeRefundRequest {
17
17
  refundCase: {
18
18
  pathType: RefundPathTypeEnum;
19
19
  caseFolio: string;
20
+ /**
21
+ * UUID del registro `DisputeOrFraudLog` que originó el reintegro (fuente
22
+ * autoritativa del folio). El BO lo persiste en el ledger como
23
+ * `PagoConfiadoTx_GT.disputeOrFraudLogId` para cerrar el vínculo con la
24
+ * reclamación (antes del rediseño quedaba en "ND").
25
+ */
26
+ folioId: string;
27
+ /**
28
+ * UUID del evento R27 específico dentro de `DisputeOrFraudLog.statusHistory[]`
29
+ * que autoriza este reintegro. Preserva el ligado inmutable evento↔movimiento
30
+ * en `DisputeRefund_GT.folioEventId`: un folio que reingresa (103) tras un
31
+ * dictamen no procedente y genera un segundo refund puede tener 2 entradas
32
+ * en `DisputeRefund_GT`, cada una apuntando a su evento R27 propio.
33
+ *
34
+ * Lo obtiene el Dashboard del response de `disputes-business` al firmar el
35
+ * dictamen (`lastEvent.eventId`). Es inmutable — no se recalcula ni se
36
+ * reasigna una vez enviado.
37
+ */
38
+ folioEventId: string;
20
39
  originalTransactionId: string | null;
21
40
  originalAmount: number;
22
41
  /**
@@ -0,0 +1,71 @@
1
+ import { RefundChannelEnum } from '../enums/RefundChannelEnum';
2
+ import { DisputeRefundType } from '../enums/DisputeRefundType';
3
+ import { DisputeRefundStatus } from '../enums/DisputeRefundStatus';
4
+
5
+ /**
6
+ * Registro canónico de un movimiento de dinero (REFUND o REVERSAL) ligado a
7
+ * un folio R27 de reclamación. Es el shape 1:1 de una fila de la tabla DDB
8
+ * `DisputeRefund_GT`.
9
+ *
10
+ * Modelo:
11
+ * - Un folio R27 puede tener 0, 1 o 2 filas en DisputeRefund_GT.
12
+ * - 1 fila `type=REFUND` cuando el reintegro se ejecutó.
13
+ * - 2 filas (REFUND + REVERSAL) cuando el reintegro fue revertido por
14
+ * dictamen tardío que confirmó 2FA original (Circular 12/2018
15
+ * Disposición 35.a Banxico).
16
+ * - `folioEventId` apunta al evento R27 específico (no solo al folio)
17
+ * para preservar el ligado inmutable cuando un folio reingresa (103)
18
+ * tras un dictamen no procedente.
19
+ * - `relatedRefundId` solo aplica cuando `type=REVERSAL` — apunta al `id`
20
+ * del REFUND que se está revirtiendo.
21
+ * - `txId` es `null` durante `PENDING_AUTHORIZATION`; se popula al crear
22
+ * la tx en el ledger (`PagoConfiadoTx_GT`).
23
+ */
24
+ export interface DisputeRefundRecord {
25
+ id: string;
26
+ folioId: string;
27
+ folioEventId: string;
28
+ type: DisputeRefundType;
29
+ channel: RefundChannelEnum;
30
+ status: DisputeRefundStatus;
31
+ relatedRefundId: string | null;
32
+ txId: string | null;
33
+ amount: number;
34
+ currencyId: 'MXN';
35
+ caseFolio: string;
36
+ targetDirectoryId: string;
37
+ manualExecution: DisputeRefundManualExecution | null;
38
+ approval: DisputeRefundApproval;
39
+ reason: string | null;
40
+ createdAt: number;
41
+ updatedAt: number;
42
+ failureReason: string | null;
43
+ }
44
+
45
+ /**
46
+ * Metadatos específicos del canal SPEI_OUT_MANUAL. `null` cuando el canal es
47
+ * INTERNAL_PCF (transferencia intra-wallet sin salida SPEI).
48
+ */
49
+ export interface DisputeRefundManualExecution {
50
+ targetClabe: string | null;
51
+ targetBankId: string | null;
52
+ targetName: string | null;
53
+ instructionS3Key: string | null;
54
+ confirmedTrackingKey: string | null;
55
+ confirmedAt: number | null;
56
+ confirmedByUserId: string | null;
57
+ }
58
+
59
+ /**
60
+ * Cadena de aprobación heredada de Política SP1 §10:
61
+ * L1 ($5,000 MXN) → requiere checker.
62
+ * L2 ($50,000 MXN) → requiere checker + minuta firmada.
63
+ * `pldOverrideMinuteS3Key` cubre el caso en que el titular está en lista
64
+ * negra PLD y el reintegro procede solo con acta de comité.
65
+ */
66
+ export interface DisputeRefundApproval {
67
+ makerUserId: string;
68
+ checkerUserId: string | null;
69
+ minuteS3Key: string | null;
70
+ pldOverrideMinuteS3Key: string | null;
71
+ }
@@ -0,0 +1,7 @@
1
+ export enum DisputeRefundStatus {
2
+ PENDING_AUTHORIZATION = "PENDING_AUTHORIZATION",
3
+ PENDING_MANUAL_EXECUTION = "PENDING_MANUAL_EXECUTION",
4
+ EXECUTED = "EXECUTED",
5
+ FAILED = "FAILED",
6
+ CANCELLED = "CANCELLED",
7
+ }
@@ -0,0 +1,4 @@
1
+ export enum DisputeRefundType {
2
+ REFUND = "REFUND",
3
+ REVERSAL = "REVERSAL",
4
+ }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @deprecated Use `DisputeRefundStatus` en su lugar. Este enum tiene scope
3
+ * estrecho (solo canal SPEI_OUT_MANUAL, sin estados de autorización previa,
4
+ * sin failure state) y se retira junto con la tabla `RefundManualExecution_GT`
5
+ * en el cleanup que sigue a la migración de código a `DisputeRefund_GT`.
6
+ */
1
7
  export enum RefundManualExecutionStatus {
2
8
  PENDING_MANUAL_EXECUTION = "PENDING_MANUAL_EXECUTION",
3
9
  EXECUTED = "EXECUTED",
@@ -18,6 +18,7 @@ export * from './dtos/ActivityProblemGetResponse';
18
18
  export * from './dtos/AuthorizeRefundRequest';
19
19
  export * from './dtos/ReverseRefundRequest';
20
20
  export * from './dtos/ConfirmManualExecutionRequest';
21
+ export * from './dtos/DisputeRefundRecord';
21
22
 
22
23
  export * from './dtos/internal/BaseProviderTransaction';
23
24
  export * from './dtos/internal/BaseProviderTransactionQueryParams';
@@ -44,3 +45,5 @@ export * from './enums/ActivityProblemStatusEnum';
44
45
  export * from './enums/RefundChannelEnum';
45
46
  export * from './enums/RefundPathTypeEnum';
46
47
  export * from './enums/RefundManualExecutionStatus';
48
+ export * from './enums/DisputeRefundType';
49
+ export * from './enums/DisputeRefundStatus';