@fiado/type-kit 3.383.0 → 3.385.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 (23) hide show
  1. package/_test_/unit/loanOfferings/promotionBonusRequests.test.ts +53 -0
  2. package/bin/loanOfferings/dtos/requests/ReservePromotionBonusRequest.d.ts +7 -0
  3. package/bin/loanOfferings/dtos/requests/ReservePromotionBonusRequest.js +26 -0
  4. package/bin/loanOfferings/dtos/requests/SettlePromotionBonusRequest.d.ts +11 -0
  5. package/bin/loanOfferings/dtos/requests/SettlePromotionBonusRequest.js +38 -0
  6. package/bin/loanOfferings/dtos/responses/PromotionBonusResponse.d.ts +20 -0
  7. package/bin/loanOfferings/dtos/responses/PromotionBonusResponse.js +2 -0
  8. package/bin/loanOfferings/dtos/responses/ReservePromotionBonusResponse.d.ts +10 -0
  9. package/bin/loanOfferings/dtos/responses/ReservePromotionBonusResponse.js +2 -0
  10. package/bin/loanOfferings/enums/PromotionBonusStatusEnum.d.ts +11 -0
  11. package/bin/loanOfferings/enums/PromotionBonusStatusEnum.js +15 -0
  12. package/bin/loanOfferings/index.d.ts +5 -0
  13. package/bin/loanOfferings/index.js +5 -0
  14. package/bin/onboarding/enums/OnboardingAccountMessageKeyEnum.d.ts +32 -1
  15. package/bin/onboarding/enums/OnboardingAccountMessageKeyEnum.js +31 -0
  16. package/package.json +1 -1
  17. package/src/loanOfferings/dtos/requests/ReservePromotionBonusRequest.ts +12 -0
  18. package/src/loanOfferings/dtos/requests/SettlePromotionBonusRequest.ts +23 -0
  19. package/src/loanOfferings/dtos/responses/PromotionBonusResponse.ts +21 -0
  20. package/src/loanOfferings/dtos/responses/ReservePromotionBonusResponse.ts +11 -0
  21. package/src/loanOfferings/enums/PromotionBonusStatusEnum.ts +11 -0
  22. package/src/loanOfferings/index.ts +5 -0
  23. package/src/onboarding/enums/OnboardingAccountMessageKeyEnum.ts +32 -1
@@ -0,0 +1,53 @@
1
+ import 'reflect-metadata';
2
+ import { ClassConstructor, plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import {
5
+ PromotionBonusStatusEnum,
6
+ ReservePromotionBonusRequest,
7
+ SettlePromotionBonusRequest,
8
+ } from '../../../src/loanOfferings/index';
9
+
10
+ const errorProperties = async <T extends object>(
11
+ dtoClass: ClassConstructor<T>,
12
+ raw: Record<string, unknown>,
13
+ ): Promise<string[]> => {
14
+ const instance = plainToInstance(dtoClass, raw, { excludeExtraneousValues: true });
15
+ return (await validate(instance as object)).map((error) => error.property);
16
+ };
17
+
18
+ describe('ReservePromotionBonusRequest', () => {
19
+ it('valida con el crédito y nada más', async () => {
20
+ expect(await errorProperties(ReservePromotionBonusRequest, { creditId: 'CR-1' })).toHaveLength(0);
21
+ });
22
+
23
+ it('exige el crédito: es el candado del pago', async () => {
24
+ expect(await errorProperties(ReservePromotionBonusRequest, {})).toContain('creditId');
25
+ });
26
+ });
27
+
28
+ describe('SettlePromotionBonusRequest', () => {
29
+ const base = { bonusId: 'BON-1', status: PromotionBonusStatusEnum.SETTLED, transactionId: 'TX-9' };
30
+
31
+ it('valida el cierre completo', async () => {
32
+ expect(await errorProperties(SettlePromotionBonusRequest, base)).toHaveLength(0);
33
+ });
34
+
35
+ it('el folio es opcional: el processor puede aprobar sin darlo', async () => {
36
+ const { transactionId, ...sinFolio } = base;
37
+ expect(await errorProperties(SettlePromotionBonusRequest, sinFolio)).toHaveLength(0);
38
+ });
39
+
40
+ it('rechaza un estado fuera del enum', async () => {
41
+ expect(await errorProperties(SettlePromotionBonusRequest, { ...base, status: 'PAGADO' })).toContain('status');
42
+ });
43
+
44
+ it('acepta los tres desenlaces del processor', async () => {
45
+ for (const status of [
46
+ PromotionBonusStatusEnum.SETTLED,
47
+ PromotionBonusStatusEnum.FAILED,
48
+ PromotionBonusStatusEnum.UNVERIFIED,
49
+ ]) {
50
+ expect(await errorProperties(SettlePromotionBonusRequest, { ...base, status })).toHaveLength(0);
51
+ }
52
+ });
53
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Body de POST /private/promotions/:promotionId/bonus-payment — el crédito recién activado que va a
3
+ * cobrar el bono. `creditId` es el candado: reenviarlo devuelve `reserved: false`, no un segundo pago.
4
+ */
5
+ export declare class ReservePromotionBonusRequest {
6
+ creditId: string;
7
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReservePromotionBonusRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * Body de POST /private/promotions/:promotionId/bonus-payment — el crédito recién activado que va a
17
+ * cobrar el bono. `creditId` es el candado: reenviarlo devuelve `reserved: false`, no un segundo pago.
18
+ */
19
+ class ReservePromotionBonusRequest {
20
+ }
21
+ exports.ReservePromotionBonusRequest = ReservePromotionBonusRequest;
22
+ __decorate([
23
+ (0, class_transformer_1.Expose)(),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], ReservePromotionBonusRequest.prototype, "creditId", void 0);
@@ -0,0 +1,11 @@
1
+ import { PromotionBonusStatusEnum } from '../../enums/PromotionBonusStatusEnum';
2
+ /**
3
+ * Body de PUT /private/promotions/:promotionId/bonus-payment/result — cierra el asiento con lo que
4
+ * contestó el processor. `RESERVED` no se acepta: es el estado del que se sale, no al que se llega.
5
+ */
6
+ export declare class SettlePromotionBonusRequest {
7
+ bonusId: string;
8
+ status: PromotionBonusStatusEnum;
9
+ /** Folio del processor. Ausente cuando aprobó sin darlo, o cuando el pago falló. */
10
+ transactionId?: string;
11
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SettlePromotionBonusRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const PromotionBonusStatusEnum_1 = require("../../enums/PromotionBonusStatusEnum");
16
+ /**
17
+ * Body de PUT /private/promotions/:promotionId/bonus-payment/result — cierra el asiento con lo que
18
+ * contestó el processor. `RESERVED` no se acepta: es el estado del que se sale, no al que se llega.
19
+ */
20
+ class SettlePromotionBonusRequest {
21
+ }
22
+ exports.SettlePromotionBonusRequest = SettlePromotionBonusRequest;
23
+ __decorate([
24
+ (0, class_transformer_1.Expose)(),
25
+ (0, class_validator_1.IsString)(),
26
+ __metadata("design:type", String)
27
+ ], SettlePromotionBonusRequest.prototype, "bonusId", void 0);
28
+ __decorate([
29
+ (0, class_transformer_1.Expose)(),
30
+ (0, class_validator_1.IsEnum)(PromotionBonusStatusEnum_1.PromotionBonusStatusEnum),
31
+ __metadata("design:type", String)
32
+ ], SettlePromotionBonusRequest.prototype, "status", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsOptional)(),
36
+ (0, class_validator_1.IsString)(),
37
+ __metadata("design:type", String)
38
+ ], SettlePromotionBonusRequest.prototype, "transactionId", void 0);
@@ -0,0 +1,20 @@
1
+ import { PromotionBonusStatusEnum } from '../../enums/PromotionBonusStatusEnum';
2
+ /**
3
+ * Asiento del bono PCF de una promoción, uno por crédito. Vive junto a la promoción porque ahí está
4
+ * el monto y ahí está el presupuesto contra el que se compara.
5
+ */
6
+ export interface PromotionBonusResponse {
7
+ /** Llave de idempotencia con la que el processor mueve la plata. */
8
+ bonusId: string;
9
+ creditId: string;
10
+ promotionId: string;
11
+ /** Versión de la promoción al reservar: el monto queda congelado aunque la promo se edite. */
12
+ promotionVersion: number;
13
+ amountCents: number;
14
+ status: PromotionBonusStatusEnum;
15
+ /** Folio del processor. `null` mientras no haya cerrado, o si cerró sin darlo. */
16
+ transactionId: string | null;
17
+ reservedAt: string;
18
+ /** Instante en que dejó de estar `RESERVED`. `null` si sigue abierto. */
19
+ settledAt: string | null;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { PromotionBonusResponse } from './PromotionBonusResponse';
2
+ /**
3
+ * Resultado de reservar el bono de un crédito. `reserved: false` es un reenvío o una segunda venta
4
+ * del mismo crédito: no es error, y `bonus` trae el asiento que ya existía para poder consultarlo.
5
+ */
6
+ export interface ReservePromotionBonusResponse {
7
+ reserved: boolean;
8
+ /** `null` cuando la promoción no declara bono PCF: no hay nada que pagar ni asiento que abrir. */
9
+ bonus: PromotionBonusResponse | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Estado del asiento del bono PCF de una promoción. `RESERVED` nace con el candado por crédito;
3
+ * los otros tres lo cierran según lo que haya contestado el processor.
4
+ * @enum {string}
5
+ */
6
+ export declare enum PromotionBonusStatusEnum {
7
+ RESERVED = "RESERVED",
8
+ SETTLED = "SETTLED",
9
+ FAILED = "FAILED",
10
+ UNVERIFIED = "UNVERIFIED"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromotionBonusStatusEnum = void 0;
4
+ /**
5
+ * Estado del asiento del bono PCF de una promoción. `RESERVED` nace con el candado por crédito;
6
+ * los otros tres lo cierran según lo que haya contestado el processor.
7
+ * @enum {string}
8
+ */
9
+ var PromotionBonusStatusEnum;
10
+ (function (PromotionBonusStatusEnum) {
11
+ PromotionBonusStatusEnum["RESERVED"] = "RESERVED";
12
+ PromotionBonusStatusEnum["SETTLED"] = "SETTLED";
13
+ PromotionBonusStatusEnum["FAILED"] = "FAILED";
14
+ PromotionBonusStatusEnum["UNVERIFIED"] = "UNVERIFIED";
15
+ })(PromotionBonusStatusEnum || (exports.PromotionBonusStatusEnum = PromotionBonusStatusEnum = {}));
@@ -6,6 +6,7 @@ export * from './enums/FinancierTypeEnum';
6
6
  export * from './enums/FinancierStatusEnum';
7
7
  export * from './enums/PromotionStatusEnum';
8
8
  export * from './enums/PromotionEffectKindEnum';
9
+ export * from './enums/PromotionBonusStatusEnum';
9
10
  export * from './enums/PromotionPhaseEnum';
10
11
  export * from './enums/PromotionLogEventEnum';
11
12
  export * from './enums/StorePolicyStatusEnum';
@@ -30,6 +31,8 @@ export * from './dtos/requests/CreatePromotionRequest';
30
31
  export * from './dtos/requests/UpdatePromotionRequest';
31
32
  export * from './dtos/requests/ChangePromotionStatusRequest';
32
33
  export * from './dtos/requests/ConsumePromotionRequest';
34
+ export * from './dtos/requests/ReservePromotionBonusRequest';
35
+ export * from './dtos/requests/SettlePromotionBonusRequest';
33
36
  export * from './dtos/requests/CreateStorePolicyRequest';
34
37
  export * from './dtos/requests/UpdateStorePolicyRequest';
35
38
  export * from './dtos/requests/ChangeStorePolicyStatusRequest';
@@ -44,6 +47,8 @@ export * from './dtos/responses/SimulationResultResponse';
44
47
  export * from './dtos/responses/PromotionResponse';
45
48
  export * from './dtos/responses/PromotionLogEntryResponse';
46
49
  export * from './dtos/responses/ConsumePromotionResponse';
50
+ export * from './dtos/responses/PromotionBonusResponse';
51
+ export * from './dtos/responses/ReservePromotionBonusResponse';
47
52
  export * from './dtos/responses/PromotedSkusResponse';
48
53
  export * from './dtos/responses/StorePolicyResponse';
49
54
  export * from './dtos/responses/SegmentResponse';
@@ -23,6 +23,7 @@ __exportStar(require("./enums/FinancierTypeEnum"), exports);
23
23
  __exportStar(require("./enums/FinancierStatusEnum"), exports);
24
24
  __exportStar(require("./enums/PromotionStatusEnum"), exports);
25
25
  __exportStar(require("./enums/PromotionEffectKindEnum"), exports);
26
+ __exportStar(require("./enums/PromotionBonusStatusEnum"), exports);
26
27
  __exportStar(require("./enums/PromotionPhaseEnum"), exports);
27
28
  __exportStar(require("./enums/PromotionLogEventEnum"), exports);
28
29
  __exportStar(require("./enums/StorePolicyStatusEnum"), exports);
@@ -49,6 +50,8 @@ __exportStar(require("./dtos/requests/CreatePromotionRequest"), exports);
49
50
  __exportStar(require("./dtos/requests/UpdatePromotionRequest"), exports);
50
51
  __exportStar(require("./dtos/requests/ChangePromotionStatusRequest"), exports);
51
52
  __exportStar(require("./dtos/requests/ConsumePromotionRequest"), exports);
53
+ __exportStar(require("./dtos/requests/ReservePromotionBonusRequest"), exports);
54
+ __exportStar(require("./dtos/requests/SettlePromotionBonusRequest"), exports);
52
55
  __exportStar(require("./dtos/requests/CreateStorePolicyRequest"), exports);
53
56
  __exportStar(require("./dtos/requests/UpdateStorePolicyRequest"), exports);
54
57
  __exportStar(require("./dtos/requests/ChangeStorePolicyStatusRequest"), exports);
@@ -64,6 +67,8 @@ __exportStar(require("./dtos/responses/SimulationResultResponse"), exports);
64
67
  __exportStar(require("./dtos/responses/PromotionResponse"), exports);
65
68
  __exportStar(require("./dtos/responses/PromotionLogEntryResponse"), exports);
66
69
  __exportStar(require("./dtos/responses/ConsumePromotionResponse"), exports);
70
+ __exportStar(require("./dtos/responses/PromotionBonusResponse"), exports);
71
+ __exportStar(require("./dtos/responses/ReservePromotionBonusResponse"), exports);
67
72
  __exportStar(require("./dtos/responses/PromotedSkusResponse"), exports);
68
73
  __exportStar(require("./dtos/responses/StorePolicyResponse"), exports);
69
74
  __exportStar(require("./dtos/responses/SegmentResponse"), exports);
@@ -39,5 +39,36 @@ export declare enum OnboardingAccountMessageKeyEnum {
39
39
  */
40
40
  IDENTITY_MISMATCH = "IDENTITY_MISMATCH",
41
41
  /** Trámite en curso, esperando que la persona complete sus pasos. */
42
- COMPLETE_YOUR_INFORMATION = "COMPLETE_YOUR_INFORMATION"
42
+ COMPLETE_YOUR_INFORMATION = "COMPLETE_YOUR_INFORMATION",
43
+ /**
44
+ * El usuario marcó su domicilio ESTADOUNIDENSE como incorrecto en la confirmación de datos.
45
+ *
46
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Va separada de la mexicana
47
+ * porque la acción es distinta: ésta se corrige TECLEANDO la dirección en el paso `US_ADDRESS`.
48
+ * No se reusó `COMPLETE_YOUR_INFORMATION` porque ese copy es genérico y no le dice a la persona
49
+ * cuál de sus datos quedó pendiente ni qué tiene que hacer con él.
50
+ */
51
+ ADDRESS_US_CORRECTION = "ADDRESS_US_CORRECTION",
52
+ /**
53
+ * El usuario marcó su domicilio MEXICANO como incorrecto en la confirmación de datos.
54
+ *
55
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Separada de la estadounidense
56
+ * porque acá NO alcanza con escribir la dirección: el paso `PROOF_OF_ADDRESS` pide un
57
+ * COMPROBANTE de domicilio, y el copy tiene que anticiparlo para que la persona llegue con el
58
+ * documento a mano.
59
+ */
60
+ ADDRESS_MEX_CORRECTION = "ADDRESS_MEX_CORRECTION",
61
+ /**
62
+ * El usuario reportó que su FECHA DE NACIMIENTO es incorrecta y la está revisando soporte.
63
+ *
64
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Es el único caso de la
65
+ * confirmación de datos donde la persona NO TIENE NADA QUE HACER: la fecha se escribe una sola
66
+ * vez con el primer documento y ni subiendo otro se corrige, así que la arregla customer service
67
+ * desde el backoffice avisado por un ticket.
68
+ *
69
+ * Por eso NO se reusó `COMPLETE_YOUR_INFORMATION`: le diría que complete algo que no puede
70
+ * completar, mandándola a buscar un paso que está bloqueado a propósito. Tampoco `KEEP_CALM`,
71
+ * cuyo copy habla de una revisión del PROVEEDOR y no de un dato que ella misma reportó.
72
+ */
73
+ DATE_OF_BIRTH_UNDER_REVIEW = "DATE_OF_BIRTH_UNDER_REVIEW"
43
74
  }
@@ -44,4 +44,35 @@ var OnboardingAccountMessageKeyEnum;
44
44
  OnboardingAccountMessageKeyEnum["IDENTITY_MISMATCH"] = "IDENTITY_MISMATCH";
45
45
  /** Trámite en curso, esperando que la persona complete sus pasos. */
46
46
  OnboardingAccountMessageKeyEnum["COMPLETE_YOUR_INFORMATION"] = "COMPLETE_YOUR_INFORMATION";
47
+ /**
48
+ * El usuario marcó su domicilio ESTADOUNIDENSE como incorrecto en la confirmación de datos.
49
+ *
50
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Va separada de la mexicana
51
+ * porque la acción es distinta: ésta se corrige TECLEANDO la dirección en el paso `US_ADDRESS`.
52
+ * No se reusó `COMPLETE_YOUR_INFORMATION` porque ese copy es genérico y no le dice a la persona
53
+ * cuál de sus datos quedó pendiente ni qué tiene que hacer con él.
54
+ */
55
+ OnboardingAccountMessageKeyEnum["ADDRESS_US_CORRECTION"] = "ADDRESS_US_CORRECTION";
56
+ /**
57
+ * El usuario marcó su domicilio MEXICANO como incorrecto en la confirmación de datos.
58
+ *
59
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Separada de la estadounidense
60
+ * porque acá NO alcanza con escribir la dirección: el paso `PROOF_OF_ADDRESS` pide un
61
+ * COMPROBANTE de domicilio, y el copy tiene que anticiparlo para que la persona llegue con el
62
+ * documento a mano.
63
+ */
64
+ OnboardingAccountMessageKeyEnum["ADDRESS_MEX_CORRECTION"] = "ADDRESS_MEX_CORRECTION";
65
+ /**
66
+ * El usuario reportó que su FECHA DE NACIMIENTO es incorrecta y la está revisando soporte.
67
+ *
68
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Es el único caso de la
69
+ * confirmación de datos donde la persona NO TIENE NADA QUE HACER: la fecha se escribe una sola
70
+ * vez con el primer documento y ni subiendo otro se corrige, así que la arregla customer service
71
+ * desde el backoffice avisado por un ticket.
72
+ *
73
+ * Por eso NO se reusó `COMPLETE_YOUR_INFORMATION`: le diría que complete algo que no puede
74
+ * completar, mandándola a buscar un paso que está bloqueado a propósito. Tampoco `KEEP_CALM`,
75
+ * cuyo copy habla de una revisión del PROVEEDOR y no de un dato que ella misma reportó.
76
+ */
77
+ OnboardingAccountMessageKeyEnum["DATE_OF_BIRTH_UNDER_REVIEW"] = "DATE_OF_BIRTH_UNDER_REVIEW";
47
78
  })(OnboardingAccountMessageKeyEnum || (exports.OnboardingAccountMessageKeyEnum = OnboardingAccountMessageKeyEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.383.0",
3
+ "version": "3.385.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,12 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsString } from 'class-validator';
3
+
4
+ /**
5
+ * Body de POST /private/promotions/:promotionId/bonus-payment — el crédito recién activado que va a
6
+ * cobrar el bono. `creditId` es el candado: reenviarlo devuelve `reserved: false`, no un segundo pago.
7
+ */
8
+ export class ReservePromotionBonusRequest {
9
+ @Expose()
10
+ @IsString()
11
+ creditId!: string;
12
+ }
@@ -0,0 +1,23 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsOptional, IsString } from 'class-validator';
3
+ import { PromotionBonusStatusEnum } from '../../enums/PromotionBonusStatusEnum';
4
+
5
+ /**
6
+ * Body de PUT /private/promotions/:promotionId/bonus-payment/result — cierra el asiento con lo que
7
+ * contestó el processor. `RESERVED` no se acepta: es el estado del que se sale, no al que se llega.
8
+ */
9
+ export class SettlePromotionBonusRequest {
10
+ @Expose()
11
+ @IsString()
12
+ bonusId!: string;
13
+
14
+ @Expose()
15
+ @IsEnum(PromotionBonusStatusEnum)
16
+ status!: PromotionBonusStatusEnum;
17
+
18
+ /** Folio del processor. Ausente cuando aprobó sin darlo, o cuando el pago falló. */
19
+ @Expose()
20
+ @IsOptional()
21
+ @IsString()
22
+ transactionId?: string;
23
+ }
@@ -0,0 +1,21 @@
1
+ import { PromotionBonusStatusEnum } from '../../enums/PromotionBonusStatusEnum';
2
+
3
+ /**
4
+ * Asiento del bono PCF de una promoción, uno por crédito. Vive junto a la promoción porque ahí está
5
+ * el monto y ahí está el presupuesto contra el que se compara.
6
+ */
7
+ export interface PromotionBonusResponse {
8
+ /** Llave de idempotencia con la que el processor mueve la plata. */
9
+ bonusId: string;
10
+ creditId: string;
11
+ promotionId: string;
12
+ /** Versión de la promoción al reservar: el monto queda congelado aunque la promo se edite. */
13
+ promotionVersion: number;
14
+ amountCents: number;
15
+ status: PromotionBonusStatusEnum;
16
+ /** Folio del processor. `null` mientras no haya cerrado, o si cerró sin darlo. */
17
+ transactionId: string | null;
18
+ reservedAt: string;
19
+ /** Instante en que dejó de estar `RESERVED`. `null` si sigue abierto. */
20
+ settledAt: string | null;
21
+ }
@@ -0,0 +1,11 @@
1
+ import { PromotionBonusResponse } from './PromotionBonusResponse';
2
+
3
+ /**
4
+ * Resultado de reservar el bono de un crédito. `reserved: false` es un reenvío o una segunda venta
5
+ * del mismo crédito: no es error, y `bonus` trae el asiento que ya existía para poder consultarlo.
6
+ */
7
+ export interface ReservePromotionBonusResponse {
8
+ reserved: boolean;
9
+ /** `null` cuando la promoción no declara bono PCF: no hay nada que pagar ni asiento que abrir. */
10
+ bonus: PromotionBonusResponse | null;
11
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Estado del asiento del bono PCF de una promoción. `RESERVED` nace con el candado por crédito;
3
+ * los otros tres lo cierran según lo que haya contestado el processor.
4
+ * @enum {string}
5
+ */
6
+ export enum PromotionBonusStatusEnum {
7
+ RESERVED = 'RESERVED',
8
+ SETTLED = 'SETTLED',
9
+ FAILED = 'FAILED',
10
+ UNVERIFIED = 'UNVERIFIED',
11
+ }
@@ -7,6 +7,7 @@ export * from './enums/FinancierTypeEnum';
7
7
  export * from './enums/FinancierStatusEnum';
8
8
  export * from './enums/PromotionStatusEnum';
9
9
  export * from './enums/PromotionEffectKindEnum';
10
+ export * from './enums/PromotionBonusStatusEnum';
10
11
  export * from './enums/PromotionPhaseEnum';
11
12
  export * from './enums/PromotionLogEventEnum';
12
13
  export * from './enums/StorePolicyStatusEnum';
@@ -35,6 +36,8 @@ export * from './dtos/requests/CreatePromotionRequest';
35
36
  export * from './dtos/requests/UpdatePromotionRequest';
36
37
  export * from './dtos/requests/ChangePromotionStatusRequest';
37
38
  export * from './dtos/requests/ConsumePromotionRequest';
39
+ export * from './dtos/requests/ReservePromotionBonusRequest';
40
+ export * from './dtos/requests/SettlePromotionBonusRequest';
38
41
  export * from './dtos/requests/CreateStorePolicyRequest';
39
42
  export * from './dtos/requests/UpdateStorePolicyRequest';
40
43
  export * from './dtos/requests/ChangeStorePolicyStatusRequest';
@@ -51,6 +54,8 @@ export * from './dtos/responses/SimulationResultResponse';
51
54
  export * from './dtos/responses/PromotionResponse';
52
55
  export * from './dtos/responses/PromotionLogEntryResponse';
53
56
  export * from './dtos/responses/ConsumePromotionResponse';
57
+ export * from './dtos/responses/PromotionBonusResponse';
58
+ export * from './dtos/responses/ReservePromotionBonusResponse';
54
59
  export * from './dtos/responses/PromotedSkusResponse';
55
60
  export * from './dtos/responses/StorePolicyResponse';
56
61
  export * from './dtos/responses/SegmentResponse';
@@ -39,5 +39,36 @@ export enum OnboardingAccountMessageKeyEnum {
39
39
  */
40
40
  IDENTITY_MISMATCH = 'IDENTITY_MISMATCH',
41
41
  /** Trámite en curso, esperando que la persona complete sus pasos. */
42
- COMPLETE_YOUR_INFORMATION = 'COMPLETE_YOUR_INFORMATION'
42
+ COMPLETE_YOUR_INFORMATION = 'COMPLETE_YOUR_INFORMATION',
43
+ /**
44
+ * El usuario marcó su domicilio ESTADOUNIDENSE como incorrecto en la confirmación de datos.
45
+ *
46
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Va separada de la mexicana
47
+ * porque la acción es distinta: ésta se corrige TECLEANDO la dirección en el paso `US_ADDRESS`.
48
+ * No se reusó `COMPLETE_YOUR_INFORMATION` porque ese copy es genérico y no le dice a la persona
49
+ * cuál de sus datos quedó pendiente ni qué tiene que hacer con él.
50
+ */
51
+ ADDRESS_US_CORRECTION = 'ADDRESS_US_CORRECTION',
52
+ /**
53
+ * El usuario marcó su domicilio MEXICANO como incorrecto en la confirmación de datos.
54
+ *
55
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Separada de la estadounidense
56
+ * porque acá NO alcanza con escribir la dirección: el paso `PROOF_OF_ADDRESS` pide un
57
+ * COMPROBANTE de domicilio, y el copy tiene que anticiparlo para que la persona llegue con el
58
+ * documento a mano.
59
+ */
60
+ ADDRESS_MEX_CORRECTION = 'ADDRESS_MEX_CORRECTION',
61
+ /**
62
+ * El usuario reportó que su FECHA DE NACIMIENTO es incorrecta y la está revisando soporte.
63
+ *
64
+ * CLAVE NUEVA, **hay que darle de alta el copy en Remote Config**. Es el único caso de la
65
+ * confirmación de datos donde la persona NO TIENE NADA QUE HACER: la fecha se escribe una sola
66
+ * vez con el primer documento y ni subiendo otro se corrige, así que la arregla customer service
67
+ * desde el backoffice avisado por un ticket.
68
+ *
69
+ * Por eso NO se reusó `COMPLETE_YOUR_INFORMATION`: le diría que complete algo que no puede
70
+ * completar, mandándola a buscar un paso que está bloqueado a propósito. Tampoco `KEEP_CALM`,
71
+ * cuyo copy habla de una revisión del PROVEEDOR y no de un dato que ella misma reportó.
72
+ */
73
+ DATE_OF_BIRTH_UNDER_REVIEW = 'DATE_OF_BIRTH_UNDER_REVIEW'
43
74
  }