@fiado/type-kit 3.8.0 → 3.9.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.
- package/bin/benefitCenter/dtos/AuthorizeBenefitsMarketplaceTransactionRequest.d.ts +35 -0
- package/bin/benefitCenter/dtos/AuthorizeBenefitsMarketplaceTransactionRequest.js +95 -0
- package/bin/benefitCenter/dtos/BenefitPaymentRequest.d.ts +31 -0
- package/bin/benefitCenter/dtos/BenefitPaymentRequest.js +83 -0
- package/bin/benefitCenter/dtos/BenefitPaymentResponse.d.ts +23 -0
- package/bin/benefitCenter/dtos/BenefitPaymentResponse.js +15 -0
- package/bin/benefitCenter/dtos/FavoriteDetailResponse.d.ts +40 -0
- package/bin/benefitCenter/dtos/FavoriteDetailResponse.js +27 -0
- package/bin/benefitCenter/dtos/FavoriteItem.d.ts +21 -0
- package/bin/benefitCenter/dtos/FavoriteItem.js +10 -0
- package/bin/benefitCenter/dtos/FavoriteListResponse.d.ts +4 -0
- package/bin/benefitCenter/dtos/FavoriteListResponse.js +6 -0
- package/bin/benefitCenter/dtos/FavoriteReorderRequest.d.ts +13 -0
- package/bin/benefitCenter/dtos/FavoriteReorderRequest.js +42 -0
- package/bin/benefitCenter/dtos/FavoriteUpdateRequest.d.ts +15 -0
- package/bin/benefitCenter/dtos/FavoriteUpdateRequest.js +42 -0
- package/bin/benefitCenter/dtos/FavoriteUpsertContext.d.ts +24 -0
- package/bin/benefitCenter/dtos/FavoriteUpsertContext.js +18 -0
- package/bin/benefitCenter/dtos/FavoriteValidationResult.d.ts +34 -0
- package/bin/benefitCenter/dtos/FavoriteValidationResult.js +25 -0
- package/bin/benefitCenter/enums/BenefitPaymentErrorCodeEnum.d.ts +17 -0
- package/bin/benefitCenter/enums/BenefitPaymentErrorCodeEnum.js +21 -0
- package/bin/benefitCenter/enums/BenefitPaymentStatusEnum.d.ts +12 -0
- package/bin/benefitCenter/enums/BenefitPaymentStatusEnum.js +16 -0
- package/bin/benefitCenter/enums/FavoriteDisabledReasonEnum.d.ts +15 -0
- package/bin/benefitCenter/enums/FavoriteDisabledReasonEnum.js +19 -0
- package/bin/benefitCenter/index.d.ts +13 -0
- package/bin/benefitCenter/index.js +15 -0
- package/package.json +1 -1
- package/src/benefitCenter/dtos/AuthorizeBenefitsMarketplaceTransactionRequest.ts +92 -0
- package/src/benefitCenter/dtos/BenefitPaymentRequest.ts +78 -0
- package/src/benefitCenter/dtos/BenefitPaymentResponse.ts +28 -0
- package/src/benefitCenter/dtos/FavoriteDetailResponse.ts +43 -0
- package/src/benefitCenter/dtos/FavoriteItem.ts +25 -0
- package/src/benefitCenter/dtos/FavoriteListResponse.ts +5 -0
- package/src/benefitCenter/dtos/FavoriteReorderRequest.ts +32 -0
- package/src/benefitCenter/dtos/FavoriteUpdateRequest.ts +35 -0
- package/src/benefitCenter/dtos/FavoriteUpsertContext.ts +26 -0
- package/src/benefitCenter/dtos/FavoriteValidationResult.ts +37 -0
- package/src/benefitCenter/enums/BenefitPaymentErrorCodeEnum.ts +17 -0
- package/src/benefitCenter/enums/BenefitPaymentStatusEnum.ts +12 -0
- package/src/benefitCenter/enums/FavoriteDisabledReasonEnum.ts +15 -0
- package/src/benefitCenter/index.ts +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BenefitPaymentErrorCodeEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Códigos canónicos de error del pago. Cada conector mapea sus errores internos
|
|
6
|
+
* a esta lista antes de devolverle al marketplace. Solo se popula cuando
|
|
7
|
+
* `status === REJECTED` (o `PENDING` si el conector quiere comunicar la causa
|
|
8
|
+
* de la espera).
|
|
9
|
+
*
|
|
10
|
+
* Lista canónica documentada en doc Fase 2 §6.5.
|
|
11
|
+
*/
|
|
12
|
+
var BenefitPaymentErrorCodeEnum;
|
|
13
|
+
(function (BenefitPaymentErrorCodeEnum) {
|
|
14
|
+
BenefitPaymentErrorCodeEnum["LEAF_NOT_FOUND"] = "LEAF_NOT_FOUND";
|
|
15
|
+
BenefitPaymentErrorCodeEnum["LEAF_DISABLED"] = "LEAF_DISABLED";
|
|
16
|
+
BenefitPaymentErrorCodeEnum["LEAF_NOT_VISIBLE"] = "LEAF_NOT_VISIBLE";
|
|
17
|
+
BenefitPaymentErrorCodeEnum["PRODUCT_NOT_FOUND"] = "PRODUCT_NOT_FOUND";
|
|
18
|
+
BenefitPaymentErrorCodeEnum["PROVIDER_REJECTED"] = "PROVIDER_REJECTED";
|
|
19
|
+
BenefitPaymentErrorCodeEnum["PROVIDER_TIMEOUT"] = "PROVIDER_TIMEOUT";
|
|
20
|
+
BenefitPaymentErrorCodeEnum["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
|
21
|
+
})(BenefitPaymentErrorCodeEnum || (exports.BenefitPaymentErrorCodeEnum = BenefitPaymentErrorCodeEnum = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado del pago devuelto por el marketplace al procesador.
|
|
3
|
+
*
|
|
4
|
+
* Lo decide el conector (STP, Multicomm, donaciones, etc.) en su `/pay/standard`;
|
|
5
|
+
* el marketplace lo reenvía sin transformar. APPROVED dispara el upsert in-process
|
|
6
|
+
* del favorito (ver doc Fase 2 §4.3); REJECTED y PENDING no.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum BenefitPaymentStatusEnum {
|
|
9
|
+
APPROVED = "APPROVED",
|
|
10
|
+
REJECTED = "REJECTED",
|
|
11
|
+
PENDING = "PENDING"
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BenefitPaymentStatusEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Estado del pago devuelto por el marketplace al procesador.
|
|
6
|
+
*
|
|
7
|
+
* Lo decide el conector (STP, Multicomm, donaciones, etc.) en su `/pay/standard`;
|
|
8
|
+
* el marketplace lo reenvía sin transformar. APPROVED dispara el upsert in-process
|
|
9
|
+
* del favorito (ver doc Fase 2 §4.3); REJECTED y PENDING no.
|
|
10
|
+
*/
|
|
11
|
+
var BenefitPaymentStatusEnum;
|
|
12
|
+
(function (BenefitPaymentStatusEnum) {
|
|
13
|
+
BenefitPaymentStatusEnum["APPROVED"] = "APPROVED";
|
|
14
|
+
BenefitPaymentStatusEnum["REJECTED"] = "REJECTED";
|
|
15
|
+
BenefitPaymentStatusEnum["PENDING"] = "PENDING";
|
|
16
|
+
})(BenefitPaymentStatusEnum || (exports.BenefitPaymentStatusEnum = BenefitPaymentStatusEnum = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Razón por la que un favorito quedó deshabilitado (`disabled === true`).
|
|
3
|
+
*
|
|
4
|
+
* - `USER` solo aparece como motivo de deshabilitación (soft delete del usuario);
|
|
5
|
+
* nunca aparece como `reason` en el response del endpoint de validación.
|
|
6
|
+
* - Las otras 4 razones describen por qué el favorito no es usable contra el
|
|
7
|
+
* catálogo actual y SÍ pueden aparecer en el `ValidationResult.reason`.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum FavoriteDisabledReasonEnum {
|
|
10
|
+
USER = "USER",
|
|
11
|
+
LEAF_NOT_FOUND = "LEAF_NOT_FOUND",
|
|
12
|
+
LEAF_DISABLED = "LEAF_DISABLED",
|
|
13
|
+
LEAF_NOT_VISIBLE = "LEAF_NOT_VISIBLE",
|
|
14
|
+
PRODUCT_NOT_FOUND = "PRODUCT_NOT_FOUND"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FavoriteDisabledReasonEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Razón por la que un favorito quedó deshabilitado (`disabled === true`).
|
|
6
|
+
*
|
|
7
|
+
* - `USER` solo aparece como motivo de deshabilitación (soft delete del usuario);
|
|
8
|
+
* nunca aparece como `reason` en el response del endpoint de validación.
|
|
9
|
+
* - Las otras 4 razones describen por qué el favorito no es usable contra el
|
|
10
|
+
* catálogo actual y SÍ pueden aparecer en el `ValidationResult.reason`.
|
|
11
|
+
*/
|
|
12
|
+
var FavoriteDisabledReasonEnum;
|
|
13
|
+
(function (FavoriteDisabledReasonEnum) {
|
|
14
|
+
FavoriteDisabledReasonEnum["USER"] = "USER";
|
|
15
|
+
FavoriteDisabledReasonEnum["LEAF_NOT_FOUND"] = "LEAF_NOT_FOUND";
|
|
16
|
+
FavoriteDisabledReasonEnum["LEAF_DISABLED"] = "LEAF_DISABLED";
|
|
17
|
+
FavoriteDisabledReasonEnum["LEAF_NOT_VISIBLE"] = "LEAF_NOT_VISIBLE";
|
|
18
|
+
FavoriteDisabledReasonEnum["PRODUCT_NOT_FOUND"] = "PRODUCT_NOT_FOUND";
|
|
19
|
+
})(FavoriteDisabledReasonEnum || (exports.FavoriteDisabledReasonEnum = FavoriteDisabledReasonEnum = {}));
|
|
@@ -7,6 +7,9 @@ export * from "./enums/BannerStatusEnum";
|
|
|
7
7
|
export * from "./enums/BannerLocaleEnum";
|
|
8
8
|
export * from "./enums/BannerScreenEnum";
|
|
9
9
|
export * from "./enums/BannerTemplateVariantEnum";
|
|
10
|
+
export * from "./enums/FavoriteDisabledReasonEnum";
|
|
11
|
+
export * from "./enums/BenefitPaymentStatusEnum";
|
|
12
|
+
export * from "./enums/BenefitPaymentErrorCodeEnum";
|
|
10
13
|
export * from "./dtos/BenefitItem";
|
|
11
14
|
export * from "./dtos/BenefitListResponse";
|
|
12
15
|
export * from "./dtos/BenefitSummary";
|
|
@@ -39,3 +42,13 @@ export * from "./dtos/BannerUpdateRequest";
|
|
|
39
42
|
export * from "./dtos/BannerTemplateThemeRequest";
|
|
40
43
|
export * from "./dtos/BannerTemplateRequest";
|
|
41
44
|
export * from "./dtos/PublicVerifyReferenceRequest";
|
|
45
|
+
export * from "./dtos/FavoriteItem";
|
|
46
|
+
export * from "./dtos/FavoriteListResponse";
|
|
47
|
+
export * from "./dtos/FavoriteValidationResult";
|
|
48
|
+
export * from "./dtos/FavoriteDetailResponse";
|
|
49
|
+
export * from "./dtos/FavoriteUpdateRequest";
|
|
50
|
+
export * from "./dtos/FavoriteReorderRequest";
|
|
51
|
+
export * from "./dtos/BenefitPaymentRequest";
|
|
52
|
+
export * from "./dtos/BenefitPaymentResponse";
|
|
53
|
+
export * from "./dtos/AuthorizeBenefitsMarketplaceTransactionRequest";
|
|
54
|
+
export * from "./dtos/FavoriteUpsertContext";
|
|
@@ -24,6 +24,9 @@ __exportStar(require("./enums/BannerStatusEnum"), exports);
|
|
|
24
24
|
__exportStar(require("./enums/BannerLocaleEnum"), exports);
|
|
25
25
|
__exportStar(require("./enums/BannerScreenEnum"), exports);
|
|
26
26
|
__exportStar(require("./enums/BannerTemplateVariantEnum"), exports);
|
|
27
|
+
__exportStar(require("./enums/FavoriteDisabledReasonEnum"), exports);
|
|
28
|
+
__exportStar(require("./enums/BenefitPaymentStatusEnum"), exports);
|
|
29
|
+
__exportStar(require("./enums/BenefitPaymentErrorCodeEnum"), exports);
|
|
27
30
|
//DTOs
|
|
28
31
|
__exportStar(require("./dtos/BenefitItem"), exports);
|
|
29
32
|
__exportStar(require("./dtos/BenefitListResponse"), exports);
|
|
@@ -58,3 +61,15 @@ __exportStar(require("./dtos/BannerUpdateRequest"), exports);
|
|
|
58
61
|
__exportStar(require("./dtos/BannerTemplateThemeRequest"), exports);
|
|
59
62
|
__exportStar(require("./dtos/BannerTemplateRequest"), exports);
|
|
60
63
|
__exportStar(require("./dtos/PublicVerifyReferenceRequest"), exports);
|
|
64
|
+
//Favorites (v3.8.1)
|
|
65
|
+
__exportStar(require("./dtos/FavoriteItem"), exports);
|
|
66
|
+
__exportStar(require("./dtos/FavoriteListResponse"), exports);
|
|
67
|
+
__exportStar(require("./dtos/FavoriteValidationResult"), exports);
|
|
68
|
+
__exportStar(require("./dtos/FavoriteDetailResponse"), exports);
|
|
69
|
+
__exportStar(require("./dtos/FavoriteUpdateRequest"), exports);
|
|
70
|
+
__exportStar(require("./dtos/FavoriteReorderRequest"), exports);
|
|
71
|
+
//Phase 2 — Payments + favorite upsert context (v3.9.0)
|
|
72
|
+
__exportStar(require("./dtos/BenefitPaymentRequest"), exports);
|
|
73
|
+
__exportStar(require("./dtos/BenefitPaymentResponse"), exports);
|
|
74
|
+
__exportStar(require("./dtos/AuthorizeBenefitsMarketplaceTransactionRequest"), exports);
|
|
75
|
+
__exportStar(require("./dtos/FavoriteUpsertContext"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsLatitude,
|
|
3
|
+
IsLongitude,
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsNumber,
|
|
6
|
+
IsObject,
|
|
7
|
+
IsOptional,
|
|
8
|
+
IsPositive,
|
|
9
|
+
IsString,
|
|
10
|
+
Length,
|
|
11
|
+
MaxLength,
|
|
12
|
+
} from "class-validator";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Request del endpoint nuevo `POST /authorizeBenefitsMarketplaceTransaction`
|
|
16
|
+
* en `transaction-processor-business` (PublicController). Lo invoca la app
|
|
17
|
+
* para todos los flujos del Centro de Beneficios.
|
|
18
|
+
*
|
|
19
|
+
* NO se reusa `AuthorizePaymentTransactionRequest` ni similares: este DTO
|
|
20
|
+
* es dedicado, sin sub-objetos opcionales, con los campos del Centro como
|
|
21
|
+
* ciudadanos de primera clase.
|
|
22
|
+
*
|
|
23
|
+
* Los endpoints `authorize*Transaction` actuales del procesador no se tocan
|
|
24
|
+
* y siguen recibiendo su tráfico legacy. Ver doc Fase 2 §5.1.
|
|
25
|
+
*/
|
|
26
|
+
export class AuthorizeBenefitsMarketplaceTransactionRequest {
|
|
27
|
+
/**
|
|
28
|
+
* Reusa entradas existentes en `ProductCatalog_GT` del procesador
|
|
29
|
+
* (`MEX_TOPUP`, `MEX_SERVICE_PAYMENT`, …). No se agregan entradas nuevas
|
|
30
|
+
* en Fase 2 (ver doc §10).
|
|
31
|
+
*/
|
|
32
|
+
@IsString()
|
|
33
|
+
@IsNotEmpty()
|
|
34
|
+
@MaxLength(64)
|
|
35
|
+
productCatalogId!: string;
|
|
36
|
+
|
|
37
|
+
/** Idempotency key — viaja end-to-end (procesador → marketplace → conector). */
|
|
38
|
+
@IsString()
|
|
39
|
+
@IsNotEmpty()
|
|
40
|
+
@MaxLength(64)
|
|
41
|
+
transactionNumber!: string;
|
|
42
|
+
|
|
43
|
+
@IsNumber()
|
|
44
|
+
@IsPositive()
|
|
45
|
+
amount!: number;
|
|
46
|
+
|
|
47
|
+
/** ISO numeric (3 chars). Ej: "484" (MXN), "840" (USD). */
|
|
48
|
+
@IsString()
|
|
49
|
+
@Length(3, 3)
|
|
50
|
+
currencyId!: string;
|
|
51
|
+
|
|
52
|
+
// Campos del Centro de Beneficios — first-class, no opcionales
|
|
53
|
+
|
|
54
|
+
@IsString()
|
|
55
|
+
@IsNotEmpty()
|
|
56
|
+
@MaxLength(64)
|
|
57
|
+
benefitId!: string;
|
|
58
|
+
|
|
59
|
+
@IsString()
|
|
60
|
+
@IsNotEmpty()
|
|
61
|
+
@MaxLength(256)
|
|
62
|
+
leafId!: string;
|
|
63
|
+
|
|
64
|
+
@IsString()
|
|
65
|
+
@IsNotEmpty()
|
|
66
|
+
@MaxLength(64)
|
|
67
|
+
productId!: string;
|
|
68
|
+
|
|
69
|
+
@IsString()
|
|
70
|
+
@IsNotEmpty()
|
|
71
|
+
@MaxLength(128)
|
|
72
|
+
reference!: string;
|
|
73
|
+
|
|
74
|
+
/** Decide a qué conector apuntar dentro del marketplace. */
|
|
75
|
+
@IsString()
|
|
76
|
+
@IsNotEmpty()
|
|
77
|
+
@MaxLength(128)
|
|
78
|
+
moduleName!: string;
|
|
79
|
+
|
|
80
|
+
/** Inputs dinámicos del leaf — opcionales según el servicio. */
|
|
81
|
+
@IsOptional()
|
|
82
|
+
@IsObject()
|
|
83
|
+
inputs?: Record<string, string | number | boolean>;
|
|
84
|
+
|
|
85
|
+
@IsOptional()
|
|
86
|
+
@IsLatitude()
|
|
87
|
+
latitude?: number;
|
|
88
|
+
|
|
89
|
+
@IsOptional()
|
|
90
|
+
@IsLongitude()
|
|
91
|
+
longitude?: number;
|
|
92
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsLatitude,
|
|
3
|
+
IsLongitude,
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsNumber,
|
|
6
|
+
IsObject,
|
|
7
|
+
IsOptional,
|
|
8
|
+
IsPositive,
|
|
9
|
+
IsString,
|
|
10
|
+
MaxLength,
|
|
11
|
+
} from "class-validator";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Request del endpoint privado `POST /pay/{moduleName}` del marketplace
|
|
15
|
+
* (`benefits-marketplace-business`). Lo invoca el procesador desde
|
|
16
|
+
* `IBenefitsMarketplaceApi.pay(...)` cuando entra una transacción por el
|
|
17
|
+
* endpoint `authorizeBenefitsMarketplaceTransaction`.
|
|
18
|
+
*
|
|
19
|
+
* Es el MISMO contrato que reciben los conectores en su `POST /pay/standard`
|
|
20
|
+
* — el marketplace lo reenvía sin transformar (sin mappers legacy).
|
|
21
|
+
*
|
|
22
|
+
* Ver doc Fase 2 §4.1 y §8.1.
|
|
23
|
+
*/
|
|
24
|
+
export class BenefitPaymentRequest {
|
|
25
|
+
@IsString()
|
|
26
|
+
@IsNotEmpty()
|
|
27
|
+
@MaxLength(64)
|
|
28
|
+
directoryId!: string;
|
|
29
|
+
|
|
30
|
+
@IsString()
|
|
31
|
+
@IsNotEmpty()
|
|
32
|
+
@MaxLength(64)
|
|
33
|
+
benefitId!: string;
|
|
34
|
+
|
|
35
|
+
@IsString()
|
|
36
|
+
@IsNotEmpty()
|
|
37
|
+
@MaxLength(256)
|
|
38
|
+
leafId!: string;
|
|
39
|
+
|
|
40
|
+
@IsString()
|
|
41
|
+
@IsNotEmpty()
|
|
42
|
+
@MaxLength(64)
|
|
43
|
+
productId!: string;
|
|
44
|
+
|
|
45
|
+
@IsString()
|
|
46
|
+
@IsNotEmpty()
|
|
47
|
+
@MaxLength(128)
|
|
48
|
+
reference!: string;
|
|
49
|
+
|
|
50
|
+
@IsNumber()
|
|
51
|
+
@IsPositive()
|
|
52
|
+
amount!: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Idempotency key del pago (la genera el procesador y la usa el conector
|
|
56
|
+
* para no re-cobrar si el request se repite).
|
|
57
|
+
*/
|
|
58
|
+
@IsString()
|
|
59
|
+
@IsNotEmpty()
|
|
60
|
+
@MaxLength(64)
|
|
61
|
+
transactionNumber!: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Inputs dinámicos del leaf (definidos por su `inputSchema`). Opcionales
|
|
65
|
+
* según el servicio.
|
|
66
|
+
*/
|
|
67
|
+
@IsOptional()
|
|
68
|
+
@IsObject()
|
|
69
|
+
inputs?: Record<string, string | number | boolean>;
|
|
70
|
+
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsLatitude()
|
|
73
|
+
latitude?: number;
|
|
74
|
+
|
|
75
|
+
@IsOptional()
|
|
76
|
+
@IsLongitude()
|
|
77
|
+
longitude?: number;
|
|
78
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BenefitPaymentErrorCodeEnum } from "../enums/BenefitPaymentErrorCodeEnum";
|
|
2
|
+
import { BenefitPaymentStatusEnum } from "../enums/BenefitPaymentStatusEnum";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Respuesta uniforme del marketplace al procesador, devuelta por el endpoint
|
|
6
|
+
* `POST /pay/{moduleName}`. La emite el marketplace tras invocar al conector
|
|
7
|
+
* — su shape NO depende del conector (el mapping interno → estándar lo hace
|
|
8
|
+
* el propio conector en `/pay/standard`).
|
|
9
|
+
*
|
|
10
|
+
* Sin decoradores `class-validator`: el procesador la consume tal cual viene
|
|
11
|
+
* por la red, no la valida. Ver doc Fase 2 §8.2.
|
|
12
|
+
*/
|
|
13
|
+
export class BenefitPaymentResponse {
|
|
14
|
+
/** Estado final del pago. APPROVED dispara el upsert del favorito in-process. */
|
|
15
|
+
status: BenefitPaymentStatusEnum;
|
|
16
|
+
|
|
17
|
+
/** Tracking del proveedor externo (ej. STP authNum). Útil para auditoría. */
|
|
18
|
+
providerReference?: string;
|
|
19
|
+
|
|
20
|
+
/** Código en bruto del proveedor — sirve solo para debug. */
|
|
21
|
+
rawCode?: string;
|
|
22
|
+
|
|
23
|
+
/** Código canónico mapeado (cuando `status !== APPROVED`). */
|
|
24
|
+
errorCode?: BenefitPaymentErrorCodeEnum;
|
|
25
|
+
|
|
26
|
+
/** Mensaje legible asociado al error o al status. */
|
|
27
|
+
message?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BenefitSummary } from "./BenefitSummary";
|
|
2
|
+
import { CatalogNode } from "./CatalogNode";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Selección previa del usuario que el frontend usa para pre-llenar el form
|
|
6
|
+
* de pago. La `reference` viaja en claro (es data del propio usuario,
|
|
7
|
+
* autenticado).
|
|
8
|
+
*/
|
|
9
|
+
export class FavoriteSelection {
|
|
10
|
+
leafId: string;
|
|
11
|
+
productId: string;
|
|
12
|
+
amount: number | null;
|
|
13
|
+
reference: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Metadata del favorito en sí (para menús contextuales, ordenamiento, etc.).
|
|
18
|
+
*/
|
|
19
|
+
export class FavoriteDetailMeta {
|
|
20
|
+
id: string;
|
|
21
|
+
alias: string | null;
|
|
22
|
+
photo: string | null;
|
|
23
|
+
position: number;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
usageCount: number;
|
|
26
|
+
lastUsedAt: number;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
updatedAt: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Response de `GET /favorites/{id}`. Devuelve el shape del árbol del catálogo
|
|
33
|
+
* (BRANCH padre con los LEAFs hermanos del favorito; el LEAF del favorito
|
|
34
|
+
* trae `leaf` populado inline) más la selección previa y la metadata editable.
|
|
35
|
+
*
|
|
36
|
+
* El frontend reusa `renderCatalog(catalog)` sin caso especial.
|
|
37
|
+
*/
|
|
38
|
+
export class FavoriteDetailResponse {
|
|
39
|
+
benefit: BenefitSummary;
|
|
40
|
+
catalog: CatalogNode;
|
|
41
|
+
selection: FavoriteSelection;
|
|
42
|
+
favorite: FavoriteDetailMeta;
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FavoriteDisabledReasonEnum } from "../enums/FavoriteDisabledReasonEnum";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ítem que viaja en `GET /favorites`. Representa un favorito ACTIVO
|
|
5
|
+
* (la lista filtra `disabled=true` por default).
|
|
6
|
+
*/
|
|
7
|
+
export class FavoriteItem {
|
|
8
|
+
id: string;
|
|
9
|
+
benefitId: string;
|
|
10
|
+
|
|
11
|
+
leafId: string;
|
|
12
|
+
productId: string;
|
|
13
|
+
referenceMasked: string; // "555****567" — el campo crudo no se expone en lista
|
|
14
|
+
|
|
15
|
+
alias: string | null;
|
|
16
|
+
photo: string | null;
|
|
17
|
+
position: number; // orden definido por el usuario (drag-and-drop)
|
|
18
|
+
disabled: boolean; // siempre false en GET (filtra disabled=true por default)
|
|
19
|
+
disabledReason: FavoriteDisabledReasonEnum | null;
|
|
20
|
+
|
|
21
|
+
lastProductId: string | null;
|
|
22
|
+
lastAmount: number | null;
|
|
23
|
+
usageCount: number;
|
|
24
|
+
lastUsedAt: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsArray,
|
|
3
|
+
IsInt,
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsString,
|
|
6
|
+
Min,
|
|
7
|
+
ValidateNested,
|
|
8
|
+
} from "class-validator";
|
|
9
|
+
import { Type } from "class-transformer";
|
|
10
|
+
|
|
11
|
+
export class FavoriteReorderItem {
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsNotEmpty()
|
|
14
|
+
id!: string;
|
|
15
|
+
|
|
16
|
+
@IsInt()
|
|
17
|
+
@Min(0)
|
|
18
|
+
position!: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Body de `PATCH /favorites/reorder`. El frontend manda la lista completa con
|
|
23
|
+
* las posiciones finales (1, 2, 3, …); el backend confía y persiste.
|
|
24
|
+
*
|
|
25
|
+
* `items: []` es válido: equivale a no-op (drag sin cambios netos) y devuelve 204.
|
|
26
|
+
*/
|
|
27
|
+
export class FavoriteReorderRequest {
|
|
28
|
+
@IsArray()
|
|
29
|
+
@ValidateNested({ each: true })
|
|
30
|
+
@Type(() => FavoriteReorderItem)
|
|
31
|
+
items!: FavoriteReorderItem[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsOptional,
|
|
3
|
+
IsString,
|
|
4
|
+
IsUrl,
|
|
5
|
+
Length,
|
|
6
|
+
Matches,
|
|
7
|
+
MaxLength,
|
|
8
|
+
ValidateIf,
|
|
9
|
+
} from "class-validator";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Body de `PATCH /favorites/{id}`. Solo `alias` y `photo` son editables por
|
|
13
|
+
* el usuario.
|
|
14
|
+
*
|
|
15
|
+
* - `undefined` (campo ausente) → no se toca.
|
|
16
|
+
* - `null` → borra el valor actual.
|
|
17
|
+
* - `string` → setea el nuevo valor (validado).
|
|
18
|
+
*
|
|
19
|
+
* Si AMBOS llegan `undefined`, el manager devuelve `INVALID_PATCH_PAYLOAD`
|
|
20
|
+
* (PATCH vacío no aporta).
|
|
21
|
+
*/
|
|
22
|
+
export class FavoriteUpdateRequest {
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@ValidateIf((_, value) => value !== null)
|
|
25
|
+
@IsString()
|
|
26
|
+
@Length(1, 60)
|
|
27
|
+
@Matches(/^[^\u0000-\u001f<>]+$/, { message: "alias contiene caracteres no permitidos" })
|
|
28
|
+
alias?: string | null;
|
|
29
|
+
|
|
30
|
+
@IsOptional()
|
|
31
|
+
@ValidateIf((_, value) => value !== null)
|
|
32
|
+
@IsUrl({ protocols: ["https"], require_protocol: true })
|
|
33
|
+
@MaxLength(500)
|
|
34
|
+
photo?: string | null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contexto que el `PaymentManager` del marketplace pasa a
|
|
3
|
+
* `FavoriteManager.upsertFromPayment(...)` para crear/actualizar el favorito
|
|
4
|
+
* tras un pago APPROVED.
|
|
5
|
+
*
|
|
6
|
+
* NO ES UN DTO DE REQUEST HTTP: vive solo dentro del proceso del lambda
|
|
7
|
+
* `benefits-marketplace-business`. Por eso no lleva decoradores de
|
|
8
|
+
* `class-validator` — nunca se deserializa desde un body HTTP.
|
|
9
|
+
*
|
|
10
|
+
* El procesador NO conoce este tipo (no participa en la lógica de favoritos).
|
|
11
|
+
* Ver doc Fase 2 §4.3 y §8.4.
|
|
12
|
+
*/
|
|
13
|
+
export class FavoriteUpsertContext {
|
|
14
|
+
directoryId: string;
|
|
15
|
+
benefitId: string;
|
|
16
|
+
leafId: string;
|
|
17
|
+
productId: string;
|
|
18
|
+
reference: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
|
|
21
|
+
/** Idempotency key del pago — alimenta el GSI `transactionNumber-index`. */
|
|
22
|
+
transactionNumber: string;
|
|
23
|
+
|
|
24
|
+
/** Epoch ms — cuándo cerró la transacción exitosa en el conector. */
|
|
25
|
+
occurredAt: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AmountTypeEnum } from "../../servicePayment/enums/AmountTypeEnum";
|
|
2
|
+
import { FavoriteDisabledReasonEnum } from "../enums/FavoriteDisabledReasonEnum";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Información del leaf incluida en el response del validate cuando se pudo
|
|
6
|
+
* resolver. Si el leaf no existe (`reason === LEAF_NOT_FOUND`), no viaja.
|
|
7
|
+
*/
|
|
8
|
+
export class FavoriteValidationLeaf {
|
|
9
|
+
name: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Información del producto. `price` es `null` cuando `amountType === VARIABLE`
|
|
16
|
+
* (productos de monto abierto donde el usuario decide cuánto pagar).
|
|
17
|
+
*/
|
|
18
|
+
export class FavoriteValidationProduct {
|
|
19
|
+
productId: string;
|
|
20
|
+
productName: string;
|
|
21
|
+
amountType: AmountTypeEnum;
|
|
22
|
+
price: number | null;
|
|
23
|
+
currency: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resultado del endpoint `POST /favorites/{id}/validate`. Si `valid === false`,
|
|
28
|
+
* el backend ya marcó `disabled: true` con `disabledReason: <reason>` en la
|
|
29
|
+
* misma operación (excepto `USER`, que solo se setea por soft-delete del usuario).
|
|
30
|
+
*/
|
|
31
|
+
export class FavoriteValidationResult {
|
|
32
|
+
id: string;
|
|
33
|
+
valid: boolean;
|
|
34
|
+
reason?: FavoriteDisabledReasonEnum; // Nunca `USER` — eso es soft delete, no validación.
|
|
35
|
+
leaf?: FavoriteValidationLeaf;
|
|
36
|
+
product?: FavoriteValidationProduct;
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Códigos canónicos de error del pago. Cada conector mapea sus errores internos
|
|
3
|
+
* a esta lista antes de devolverle al marketplace. Solo se popula cuando
|
|
4
|
+
* `status === REJECTED` (o `PENDING` si el conector quiere comunicar la causa
|
|
5
|
+
* de la espera).
|
|
6
|
+
*
|
|
7
|
+
* Lista canónica documentada en doc Fase 2 §6.5.
|
|
8
|
+
*/
|
|
9
|
+
export enum BenefitPaymentErrorCodeEnum {
|
|
10
|
+
LEAF_NOT_FOUND = "LEAF_NOT_FOUND",
|
|
11
|
+
LEAF_DISABLED = "LEAF_DISABLED",
|
|
12
|
+
LEAF_NOT_VISIBLE = "LEAF_NOT_VISIBLE",
|
|
13
|
+
PRODUCT_NOT_FOUND = "PRODUCT_NOT_FOUND",
|
|
14
|
+
PROVIDER_REJECTED = "PROVIDER_REJECTED",
|
|
15
|
+
PROVIDER_TIMEOUT = "PROVIDER_TIMEOUT",
|
|
16
|
+
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado del pago devuelto por el marketplace al procesador.
|
|
3
|
+
*
|
|
4
|
+
* Lo decide el conector (STP, Multicomm, donaciones, etc.) en su `/pay/standard`;
|
|
5
|
+
* el marketplace lo reenvía sin transformar. APPROVED dispara el upsert in-process
|
|
6
|
+
* del favorito (ver doc Fase 2 §4.3); REJECTED y PENDING no.
|
|
7
|
+
*/
|
|
8
|
+
export enum BenefitPaymentStatusEnum {
|
|
9
|
+
APPROVED = "APPROVED",
|
|
10
|
+
REJECTED = "REJECTED",
|
|
11
|
+
PENDING = "PENDING",
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Razón por la que un favorito quedó deshabilitado (`disabled === true`).
|
|
3
|
+
*
|
|
4
|
+
* - `USER` solo aparece como motivo de deshabilitación (soft delete del usuario);
|
|
5
|
+
* nunca aparece como `reason` en el response del endpoint de validación.
|
|
6
|
+
* - Las otras 4 razones describen por qué el favorito no es usable contra el
|
|
7
|
+
* catálogo actual y SÍ pueden aparecer en el `ValidationResult.reason`.
|
|
8
|
+
*/
|
|
9
|
+
export enum FavoriteDisabledReasonEnum {
|
|
10
|
+
USER = "USER",
|
|
11
|
+
LEAF_NOT_FOUND = "LEAF_NOT_FOUND",
|
|
12
|
+
LEAF_DISABLED = "LEAF_DISABLED",
|
|
13
|
+
LEAF_NOT_VISIBLE = "LEAF_NOT_VISIBLE",
|
|
14
|
+
PRODUCT_NOT_FOUND = "PRODUCT_NOT_FOUND",
|
|
15
|
+
}
|
|
@@ -8,6 +8,9 @@ export * from "./enums/BannerStatusEnum";
|
|
|
8
8
|
export * from "./enums/BannerLocaleEnum";
|
|
9
9
|
export * from "./enums/BannerScreenEnum";
|
|
10
10
|
export * from "./enums/BannerTemplateVariantEnum";
|
|
11
|
+
export * from "./enums/FavoriteDisabledReasonEnum";
|
|
12
|
+
export * from "./enums/BenefitPaymentStatusEnum";
|
|
13
|
+
export * from "./enums/BenefitPaymentErrorCodeEnum";
|
|
11
14
|
|
|
12
15
|
//DTOs
|
|
13
16
|
export * from "./dtos/BenefitItem";
|
|
@@ -43,3 +46,15 @@ export * from "./dtos/BannerUpdateRequest";
|
|
|
43
46
|
export * from "./dtos/BannerTemplateThemeRequest";
|
|
44
47
|
export * from "./dtos/BannerTemplateRequest";
|
|
45
48
|
export * from "./dtos/PublicVerifyReferenceRequest";
|
|
49
|
+
//Favorites (v3.8.1)
|
|
50
|
+
export * from "./dtos/FavoriteItem";
|
|
51
|
+
export * from "./dtos/FavoriteListResponse";
|
|
52
|
+
export * from "./dtos/FavoriteValidationResult";
|
|
53
|
+
export * from "./dtos/FavoriteDetailResponse";
|
|
54
|
+
export * from "./dtos/FavoriteUpdateRequest";
|
|
55
|
+
export * from "./dtos/FavoriteReorderRequest";
|
|
56
|
+
//Phase 2 — Payments + favorite upsert context (v3.9.0)
|
|
57
|
+
export * from "./dtos/BenefitPaymentRequest";
|
|
58
|
+
export * from "./dtos/BenefitPaymentResponse";
|
|
59
|
+
export * from "./dtos/AuthorizeBenefitsMarketplaceTransactionRequest";
|
|
60
|
+
export * from "./dtos/FavoriteUpsertContext";
|