@fiado/type-kit 3.610.0 → 3.612.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.
Files changed (78) hide show
  1. package/_test_/unit/gsfConnector/gsfMessages.test.ts +233 -0
  2. package/_test_/unit/loanCredit/customerReadDtos.test.ts +22 -0
  3. package/_test_/unit/retailLoan/contract.test.ts +5 -0
  4. package/bin/gsfConnector/constants/GsfPatterns.d.ts +15 -0
  5. package/bin/gsfConnector/constants/GsfPatterns.js +18 -0
  6. package/bin/gsfConnector/constants/GsfPaymentOperations.d.ts +6 -0
  7. package/bin/gsfConnector/constants/GsfPaymentOperations.js +16 -0
  8. package/bin/gsfConnector/dtos/GsfAddress.d.ts +13 -0
  9. package/bin/gsfConnector/dtos/GsfAddress.js +81 -0
  10. package/bin/gsfConnector/dtos/GsfCreateCreditMessage.d.ts +17 -0
  11. package/bin/gsfConnector/dtos/GsfCreateCreditMessage.js +78 -0
  12. package/bin/gsfConnector/dtos/GsfCreditTerms.d.ts +17 -0
  13. package/bin/gsfConnector/dtos/GsfCreditTerms.js +71 -0
  14. package/bin/gsfConnector/dtos/GsfCustomer.d.ts +15 -0
  15. package/bin/gsfConnector/dtos/GsfCustomer.js +80 -0
  16. package/bin/gsfConnector/dtos/GsfExpectedState.d.ts +8 -0
  17. package/bin/gsfConnector/dtos/GsfExpectedState.js +38 -0
  18. package/bin/gsfConnector/dtos/GsfPayment.d.ts +16 -0
  19. package/bin/gsfConnector/dtos/GsfPayment.js +75 -0
  20. package/bin/gsfConnector/dtos/GsfPaymentMessage.d.ts +16 -0
  21. package/bin/gsfConnector/dtos/GsfPaymentMessage.js +74 -0
  22. package/bin/gsfConnector/dtos/GsfScheduleInstallment.d.ts +9 -0
  23. package/bin/gsfConnector/dtos/GsfScheduleInstallment.js +60 -0
  24. package/bin/gsfConnector/enums/GsfOperationEnum.d.ts +11 -0
  25. package/bin/gsfConnector/enums/GsfOperationEnum.js +15 -0
  26. package/bin/gsfConnector/enums/GsfPaymentChannelEnum.d.ts +11 -0
  27. package/bin/gsfConnector/enums/GsfPaymentChannelEnum.js +15 -0
  28. package/bin/gsfConnector/enums/GsfPaymentKindEnum.d.ts +11 -0
  29. package/bin/gsfConnector/enums/GsfPaymentKindEnum.js +15 -0
  30. package/bin/gsfConnector/enums/GsfPaymentPeriodicityEnum.d.ts +6 -0
  31. package/bin/gsfConnector/enums/GsfPaymentPeriodicityEnum.js +10 -0
  32. package/bin/gsfConnector/index.d.ts +17 -0
  33. package/bin/gsfConnector/index.js +37 -0
  34. package/bin/gsfConnector/validators/IsGsfCalendarDate.d.ts +6 -0
  35. package/bin/gsfConnector/validators/IsGsfCalendarDate.js +29 -0
  36. package/bin/gsfConnector/validators/IsGsfPaymentKindForOperation.d.ts +6 -0
  37. package/bin/gsfConnector/validators/IsGsfPaymentKindForOperation.js +31 -0
  38. package/bin/gsfConnector/validators/IsGsfPrepaymentScheduleProvided.d.ts +6 -0
  39. package/bin/gsfConnector/validators/IsGsfPrepaymentScheduleProvided.js +28 -0
  40. package/bin/index.d.ts +1 -0
  41. package/bin/index.js +3 -2
  42. package/bin/loanCredit/dtos/responses/LoanCustomerCreditDocument.d.ts +9 -0
  43. package/bin/loanCredit/dtos/responses/LoanCustomerCreditDocument.js +2 -0
  44. package/bin/loanCredit/dtos/responses/LoanCustomerCreditDocumentUrl.d.ts +9 -0
  45. package/bin/loanCredit/dtos/responses/LoanCustomerCreditDocumentUrl.js +2 -0
  46. package/bin/loanCredit/index.d.ts +2 -0
  47. package/bin/loanCredit/index.js +2 -0
  48. package/bin/retailLoan/dtos/MyDocument.d.ts +2 -1
  49. package/bin/retailLoan/enums/MyDocumentGroupIdEnum.d.ts +2 -1
  50. package/bin/retailLoan/enums/MyDocumentGroupIdEnum.js +1 -0
  51. package/bin/retailLoan/enums/MyDocumentKindEnum.d.ts +2 -1
  52. package/bin/retailLoan/enums/MyDocumentKindEnum.js +1 -0
  53. package/package.json +1 -1
  54. package/src/gsfConnector/constants/GsfPatterns.ts +21 -0
  55. package/src/gsfConnector/constants/GsfPaymentOperations.ts +17 -0
  56. package/src/gsfConnector/dtos/GsfAddress.ts +60 -0
  57. package/src/gsfConnector/dtos/GsfCreateCreditMessage.ts +60 -0
  58. package/src/gsfConnector/dtos/GsfCreditTerms.ts +55 -0
  59. package/src/gsfConnector/dtos/GsfCustomer.ts +60 -0
  60. package/src/gsfConnector/dtos/GsfExpectedState.ts +25 -0
  61. package/src/gsfConnector/dtos/GsfPayment.ts +57 -0
  62. package/src/gsfConnector/dtos/GsfPaymentMessage.ts +58 -0
  63. package/src/gsfConnector/dtos/GsfScheduleInstallment.ts +41 -0
  64. package/src/gsfConnector/enums/GsfOperationEnum.ts +11 -0
  65. package/src/gsfConnector/enums/GsfPaymentChannelEnum.ts +11 -0
  66. package/src/gsfConnector/enums/GsfPaymentKindEnum.ts +11 -0
  67. package/src/gsfConnector/enums/GsfPaymentPeriodicityEnum.ts +6 -0
  68. package/src/gsfConnector/index.ts +24 -0
  69. package/src/gsfConnector/validators/IsGsfCalendarDate.ts +19 -0
  70. package/src/gsfConnector/validators/IsGsfPaymentKindForOperation.ts +21 -0
  71. package/src/gsfConnector/validators/IsGsfPrepaymentScheduleProvided.ts +18 -0
  72. package/src/index.ts +1 -0
  73. package/src/loanCredit/dtos/responses/LoanCustomerCreditDocument.ts +10 -0
  74. package/src/loanCredit/dtos/responses/LoanCustomerCreditDocumentUrl.ts +10 -0
  75. package/src/loanCredit/index.ts +2 -0
  76. package/src/retailLoan/dtos/MyDocument.ts +2 -1
  77. package/src/retailLoan/enums/MyDocumentGroupIdEnum.ts +1 -0
  78. package/src/retailLoan/enums/MyDocumentKindEnum.ts +1 -0
@@ -0,0 +1,11 @@
1
+ /** Para qué se aplicó un pago en el sistema de origen. */
2
+ export enum GsfPaymentKindEnum {
3
+ /** Cuota del periodo. */
4
+ INSTALLMENT = 'INSTALLMENT',
5
+ /** Cuotas futuras cubiertas tal cual: la tabla no cambia. */
6
+ ADVANCE = 'ADVANCE',
7
+ /** Abono a capital: baja las cuotas restantes. */
8
+ PREPAYMENT = 'PREPAYMENT',
9
+ /** Liquidación del crédito. */
10
+ SETTLEMENT = 'SETTLEMENT',
11
+ }
@@ -0,0 +1,6 @@
1
+ /** Periodicidad de las cuotas del crédito. */
2
+ export enum GsfPaymentPeriodicityEnum {
3
+ WEEKLY = 'WEEKLY',
4
+ BIWEEKLY = 'BIWEEKLY',
5
+ MONTHLY = 'MONTHLY',
6
+ }
@@ -0,0 +1,24 @@
1
+ // Enums
2
+ export * from './enums/GsfOperationEnum';
3
+ export * from './enums/GsfPaymentKindEnum';
4
+ export * from './enums/GsfPaymentChannelEnum';
5
+ export * from './enums/GsfPaymentPeriodicityEnum';
6
+
7
+ // Constants
8
+ export * from './constants/GsfPatterns';
9
+ export * from './constants/GsfPaymentOperations';
10
+
11
+ // Validators
12
+ export * from './validators/IsGsfCalendarDate';
13
+ export * from './validators/IsGsfPaymentKindForOperation';
14
+ export * from './validators/IsGsfPrepaymentScheduleProvided';
15
+
16
+ // DTOs del mensaje de GsfSyncQueue.fifo
17
+ export * from './dtos/GsfAddress';
18
+ export * from './dtos/GsfCustomer';
19
+ export * from './dtos/GsfScheduleInstallment';
20
+ export * from './dtos/GsfCreditTerms';
21
+ export * from './dtos/GsfPayment';
22
+ export * from './dtos/GsfExpectedState';
23
+ export * from './dtos/GsfCreateCreditMessage';
24
+ export * from './dtos/GsfPaymentMessage';
@@ -0,0 +1,19 @@
1
+ import { ValidatorConstraint, ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
2
+ import { GSF_DATE_PATTERN } from '../constants/GsfPatterns';
3
+
4
+ /** `YYYY-MM-DD` de un día que existe: rechaza `2026-02-30` o `2026-13-01`, que el patrón solo no detecta. */
5
+ @ValidatorConstraint({ name: 'isGsfCalendarDate', async: false })
6
+ export class IsGsfCalendarDate implements ValidatorConstraintInterface {
7
+ validate(value: unknown, _args: ValidationArguments): boolean {
8
+ if (typeof value !== 'string' || !GSF_DATE_PATTERN.test(value)) {
9
+ return false;
10
+ }
11
+ const [year, month, day] = value.split('-').map(Number);
12
+ const date = new Date(Date.UTC(year, month - 1, day));
13
+ return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
14
+ }
15
+
16
+ defaultMessage(args: ValidationArguments): string {
17
+ return `${args.property} debe ser una fecha YYYY-MM-DD que exista`;
18
+ }
19
+ }
@@ -0,0 +1,21 @@
1
+ import { ValidatorConstraint, ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
2
+ import { GSF_PAYMENT_KINDS_BY_OPERATION, GSF_PAYMENT_OPERATIONS, GsfPaymentOperation } from '../constants/GsfPaymentOperations';
3
+
4
+ /** La clase del pago tiene que corresponder a la operación del mensaje: un abono solo viaja como abono. */
5
+ @ValidatorConstraint({ name: 'isGsfPaymentKindForOperation', async: false })
6
+ export class IsGsfPaymentKindForOperation implements ValidatorConstraintInterface {
7
+ validate(value: unknown, args: ValidationArguments): boolean {
8
+ const operation = (args.object as { operation?: unknown }).operation;
9
+ // Sin operación válida el error ya lo marca `operation`. Se compara contra la lista para que
10
+ // `constructor` o `__proto__` no lean el prototipo del mapa.
11
+ if (!GSF_PAYMENT_OPERATIONS.includes(operation as GsfPaymentOperation)) {
12
+ return true;
13
+ }
14
+ const kind = (value as { kind?: unknown } | null | undefined)?.kind;
15
+ return GSF_PAYMENT_KINDS_BY_OPERATION[operation as GsfPaymentOperation].includes(kind as never);
16
+ }
17
+
18
+ defaultMessage(args: ValidationArguments): string {
19
+ return `${args.property}.kind no corresponde a la operación del mensaje`;
20
+ }
21
+ }
@@ -0,0 +1,18 @@
1
+ import { ValidatorConstraint, ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
2
+ import { GsfOperationEnum } from '../enums/GsfOperationEnum';
3
+
4
+ /** Un abono a capital trae la tabla recalculada: sin ella no hay contra qué comparar la reestructura de GSF. */
5
+ @ValidatorConstraint({ name: 'isGsfPrepaymentScheduleProvided', async: false })
6
+ export class IsGsfPrepaymentScheduleProvided implements ValidatorConstraintInterface {
7
+ validate(value: unknown, args: ValidationArguments): boolean {
8
+ if ((args.object as { operation?: unknown }).operation !== GsfOperationEnum.APPLY_PREPAYMENT) {
9
+ return true;
10
+ }
11
+ const schedule = (value as { schedule?: unknown } | null | undefined)?.schedule;
12
+ return Array.isArray(schedule) && schedule.length > 0;
13
+ }
14
+
15
+ defaultMessage(args: ValidationArguments): string {
16
+ return `${args.property}.schedule es obligatorio en APPLY_PREPAYMENT`;
17
+ }
18
+ }
package/src/index.ts CHANGED
@@ -80,6 +80,7 @@ export * as AiEngine from './aiEngine';
80
80
  export * as Sentry from './sentry';
81
81
  export * as CreditStatements from './credit-statements';
82
82
  export * as CirculoCredito from './circuloCredito';
83
+ export * as GsfConnector from './gsfConnector';
83
84
  export * as MilestoneBusiness from './milestone-business';
84
85
  export * as Mdm from './mdm';
85
86
  export * as MessagesConnector from './messagesConnector';
@@ -0,0 +1,10 @@
1
+ import { ContractTypeEnum } from '../../enums/ContractTypeEnum';
2
+
3
+ /** Documento del ciclo de vida de un crédito, visto por su acreditado. */
4
+ export interface LoanCustomerCreditDocument {
5
+ documentType: ContractTypeEnum;
6
+ /** Llave del documento: el paymentId en un comprobante, el periodo `YYYY-MM` en un estado de cuenta. */
7
+ documentKey: string;
8
+ /** ISO-8601; `null` mientras el PDF no se haya generado. */
9
+ generatedAt: string | null;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { ContractTypeEnum } from '../../enums/ContractTypeEnum';
2
+
3
+ /** Enlace prefirmado y temporal del PDF de un documento del ciclo de vida. `expiresAt` en ISO-8601. */
4
+ export interface LoanCustomerCreditDocumentUrl {
5
+ creditId: string;
6
+ documentType: ContractTypeEnum;
7
+ documentKey: string;
8
+ url: string;
9
+ expiresAt: string;
10
+ }
@@ -51,6 +51,8 @@ export * from './dtos/responses/LoanPaymentListItem';
51
51
  export * from './dtos/responses/LoanContractDownloadUrl';
52
52
  export * from './dtos/responses/LoanContractPreview';
53
53
  export * from './dtos/responses/LoanContractResponse';
54
+ export * from './dtos/responses/LoanCustomerCreditDocument';
55
+ export * from './dtos/responses/LoanCustomerCreditDocumentUrl';
54
56
  export * from './dtos/responses/OriginateLoanCreditResponse';
55
57
  export * from './dtos/responses/QuoteLoanCreditResponse';
56
58
  export * from './dtos/responses/SignLoanCreditResponse';
@@ -5,7 +5,8 @@ import { MyDocumentStatusEnum } from '../enums/MyDocumentStatusEnum';
5
5
 
6
6
  /**
7
7
  * Un documento del crédito. `documentRef` sigue la convención del módulo de la app:
8
- * `doc-contract-<contractId>` para contratos y `doc-stmt-YYYY-MM` para estados de cuenta.
8
+ * `doc-contract-<contractId>` para contratos, `doc-stmt-YYYY-MM` para estados de cuenta y
9
+ * `doc-receipt-<paymentId>` para comprobantes de pago.
9
10
  */
10
11
  export interface MyDocument {
11
12
  documentRef: string;
@@ -2,4 +2,5 @@
2
2
  export enum MyDocumentGroupIdEnum {
3
3
  CONTRACT = 'contract',
4
4
  MONTHLY = 'monthly',
5
+ PAYMENT_RECEIPTS = 'receipts',
5
6
  }
@@ -1,4 +1,5 @@
1
1
  export enum MyDocumentKindEnum {
2
2
  CONTRACT = 'CONTRACT',
3
3
  MONTHLY_STATEMENT = 'MONTHLY_STATEMENT',
4
+ PAYMENT_RECEIPT = 'PAYMENT_RECEIPT',
4
5
  }