@fiado/type-kit 3.590.0 → 3.592.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/_test_/unit/messageMoments/MessageMomentCatalog.test.ts +55 -7
- package/bin/directory/dtos/AccountCreatedEventDetail.d.ts +16 -0
- package/bin/directory/dtos/AccountCreatedEventDetail.js +14 -0
- package/bin/directory/dtos/DirectoryUserScopeUpdateRequest.d.ts +5 -0
- package/bin/directory/dtos/DirectoryUserScopeUpdateRequest.js +34 -0
- package/bin/directory/index.d.ts +2 -0
- package/bin/directory/index.js +2 -0
- package/bin/messageMoments/constants/MessageMomentCatalog.d.ts +1 -1
- package/bin/messageMoments/constants/MessageMomentCatalog.js +8 -8
- package/bin/messageMoments/constants/MessageMomentVariables.d.ts +8 -0
- package/bin/messageMoments/constants/MessageMomentVariables.js +9 -1
- package/bin/messageMoments/enums/MessageMomentBlockEnum.d.ts +2 -1
- package/bin/messageMoments/enums/MessageMomentBlockEnum.js +1 -0
- package/bin/messageMoments/enums/MessageMomentEnum.d.ts +3 -1
- package/bin/messageMoments/enums/MessageMomentEnum.js +2 -0
- package/package.json +1 -1
- package/src/directory/dtos/AccountCreatedEventDetail.ts +21 -0
- package/src/directory/dtos/DirectoryUserScopeUpdateRequest.ts +19 -0
- package/src/directory/index.ts +2 -0
- package/src/messageMoments/constants/MessageMomentCatalog.ts +19 -8
- package/src/messageMoments/constants/MessageMomentVariables.ts +12 -0
- package/src/messageMoments/enums/MessageMomentBlockEnum.ts +1 -0
- package/src/messageMoments/enums/MessageMomentEnum.ts +3 -0
|
@@ -8,20 +8,68 @@ import {
|
|
|
8
8
|
MessageMomentBlockEnum,
|
|
9
9
|
MessageMomentEnum,
|
|
10
10
|
OTP_MOMENT_VARIABLES,
|
|
11
|
+
REFERRAL_BONUS_ALWAYS_VARIABLES,
|
|
12
|
+
REFERRAL_BONUS_CONDITIONAL_VARIABLES,
|
|
13
|
+
REFERRAL_COUPON_ALWAYS_VARIABLES,
|
|
14
|
+
REFERRAL_COUPON_CONDITIONAL_VARIABLES,
|
|
11
15
|
RESTRUCTURE_MOMENT_VARIABLES,
|
|
12
16
|
TEMPLATE_PLACEHOLDER_PATTERN,
|
|
13
17
|
momentByMessageType,
|
|
14
18
|
momentByTemplateId,
|
|
15
19
|
} from '../../../src/messageMoments/index';
|
|
16
20
|
|
|
21
|
+
const NON_CREDIT_MOMENTS = new Set<string>([
|
|
22
|
+
MessageMomentEnum.OTP_CODE,
|
|
23
|
+
MessageMomentEnum.REFERRAL_BONUS_CREDITED,
|
|
24
|
+
MessageMomentEnum.REFERRAL_COUPON_ISSUED,
|
|
25
|
+
]);
|
|
26
|
+
|
|
17
27
|
describe('MESSAGE_MOMENT_CATALOG', () => {
|
|
18
|
-
it('trae los 38 momentos del
|
|
19
|
-
expect(MESSAGE_MOMENT_CATALOG).toHaveLength(
|
|
28
|
+
it('trae los 38 momentos del crédito más los 2 de referidos', () => {
|
|
29
|
+
expect(MESSAGE_MOMENT_CATALOG).toHaveLength(40);
|
|
20
30
|
});
|
|
21
31
|
|
|
22
32
|
it('ni el templateId ni el messageType se repiten', () => {
|
|
23
|
-
expect(momentByTemplateId.size).toBe(
|
|
24
|
-
expect(momentByMessageType.size).toBe(
|
|
33
|
+
expect(momentByTemplateId.size).toBe(40);
|
|
34
|
+
expect(momentByMessageType.size).toBe(40);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('los momentos de referidos cierran el catálogo, en su bloque', () => {
|
|
38
|
+
expect(MESSAGE_MOMENT_CATALOG.slice(-2).map((m) => [m.templateId, m.messageType, m.blockId])).toEqual([
|
|
39
|
+
['PM-080', MessageMomentEnum.REFERRAL_BONUS_CREDITED, MessageMomentBlockEnum.REFERRALS],
|
|
40
|
+
['PM-081', MessageMomentEnum.REFERRAL_COUPON_ISSUED, MessageMomentBlockEnum.REFERRALS],
|
|
41
|
+
]);
|
|
42
|
+
expect(MessageMomentBlockEnum.REFERRALS).toBe('referrals');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('el premio abonado ofrece cliente y monto, y el nombre del referido cuando se conoce', () => {
|
|
46
|
+
const bonus = momentByTemplateId.get('PM-080');
|
|
47
|
+
expect(REFERRAL_BONUS_ALWAYS_VARIABLES).toEqual(['cliente_nombre', 'monto']);
|
|
48
|
+
expect(REFERRAL_BONUS_CONDITIONAL_VARIABLES).toEqual(['referido_nombre']);
|
|
49
|
+
expect(bonus?.alwaysVariables).toEqual(REFERRAL_BONUS_ALWAYS_VARIABLES);
|
|
50
|
+
expect(bonus?.conditionalVariables).toEqual(REFERRAL_BONUS_CONDITIONAL_VARIABLES);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('el cupón emitido ofrece código, descuento y vigencia, y la tienda cuando no aplica en todas', () => {
|
|
54
|
+
const coupon = momentByTemplateId.get('PM-081');
|
|
55
|
+
expect(REFERRAL_COUPON_ALWAYS_VARIABLES).toEqual(['cliente_nombre', 'codigo', 'descuento', 'vigencia']);
|
|
56
|
+
expect(REFERRAL_COUPON_CONDITIONAL_VARIABLES).toEqual(['tienda']);
|
|
57
|
+
expect(coupon?.alwaysVariables).toEqual(REFERRAL_COUPON_ALWAYS_VARIABLES);
|
|
58
|
+
expect(coupon?.conditionalVariables).toEqual(REFERRAL_COUPON_CONDITIONAL_VARIABLES);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('los momentos de referidos no ofrecen variables del crédito', () => {
|
|
62
|
+
const credit = new Set([...CREDIT_MOMENT_ALWAYS_VARIABLES, ...CREDIT_MOMENT_CONDITIONAL_VARIABLES].filter((n) => n !== 'cliente_nombre' && n !== 'monto' && n !== 'tienda'));
|
|
63
|
+
for (const moment of MESSAGE_MOMENT_CATALOG.filter((m) => m.blockId === MessageMomentBlockEnum.REFERRALS)) {
|
|
64
|
+
expect([...moment.alwaysVariables, ...moment.conditionalVariables].filter((n) => credit.has(n))).toEqual([]);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('en ningún momento una variable es siempre y condicional a la vez', () => {
|
|
69
|
+
for (const moment of MESSAGE_MOMENT_CATALOG) {
|
|
70
|
+
const always = new Set(moment.alwaysVariables);
|
|
71
|
+
expect(moment.conditionalVariables.filter((n) => always.has(n))).toEqual([]);
|
|
72
|
+
}
|
|
25
73
|
});
|
|
26
74
|
|
|
27
75
|
it('todo templateId tiene la forma PM-NNN', () => {
|
|
@@ -47,8 +95,8 @@ describe('MESSAGE_MOMENT_CATALOG', () => {
|
|
|
47
95
|
expect(otp?.conditionalVariables).toEqual([]);
|
|
48
96
|
});
|
|
49
97
|
|
|
50
|
-
it('los
|
|
51
|
-
for (const moment of MESSAGE_MOMENT_CATALOG.filter((m) => m.messageType
|
|
98
|
+
it('los momentos del crédito ofrecen sus variables más las propias del momento', () => {
|
|
99
|
+
for (const moment of MESSAGE_MOMENT_CATALOG.filter((m) => !NON_CREDIT_MOMENTS.has(m.messageType))) {
|
|
52
100
|
const own = MOMENT_SPECIFIC_VARIABLES[moment.messageType] ?? [];
|
|
53
101
|
expect(moment.alwaysVariables).toEqual([...CREDIT_MOMENT_ALWAYS_VARIABLES, ...own]);
|
|
54
102
|
expect(moment.conditionalVariables).toEqual(CREDIT_MOMENT_CONDITIONAL_VARIABLES);
|
|
@@ -70,7 +118,7 @@ describe('MESSAGE_MOMENT_CATALOG', () => {
|
|
|
70
118
|
it('una variable propia no se cuela en otro momento', () => {
|
|
71
119
|
const own = new Set(Object.values(MOMENT_SPECIFIC_VARIABLES).flat());
|
|
72
120
|
const owners = new Set(Object.keys(MOMENT_SPECIFIC_VARIABLES));
|
|
73
|
-
for (const moment of MESSAGE_MOMENT_CATALOG.filter((m) => !owners.has(m.messageType))) {
|
|
121
|
+
for (const moment of MESSAGE_MOMENT_CATALOG.filter((m) => !owners.has(m.messageType) && !NON_CREDIT_MOMENTS.has(m.messageType))) {
|
|
74
122
|
expect(moment.alwaysVariables.filter((name) => own.has(name))).toEqual([]);
|
|
75
123
|
}
|
|
76
124
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CountryId } from "../../country/enums/CountryId";
|
|
2
|
+
export declare const DIRECTORY_EVENTS_SOURCE = "fiado.directory";
|
|
3
|
+
export declare enum DirectoryEventDetailTypeEnum {
|
|
4
|
+
/** Alta real del scope de un país (fiado.mx o fiado.us) en el directorio: la cuenta de ese lado quedó abierta. */
|
|
5
|
+
ACCOUNT_CREATED = "AccountCreated"
|
|
6
|
+
}
|
|
7
|
+
export declare class AccountCreatedEventDetail {
|
|
8
|
+
/** Fijo por directorio y país (`<countryId>#<directoryId>`): un reenvío llega con el mismo id y el consumidor lo descarta. */
|
|
9
|
+
eventId: string;
|
|
10
|
+
directoryId: string;
|
|
11
|
+
peopleId: string;
|
|
12
|
+
/** CountryId.MEX (484) o CountryId.USA (840). */
|
|
13
|
+
countryId: CountryId;
|
|
14
|
+
/** ISO 8601 del momento en que se guardó el scope. */
|
|
15
|
+
occurredAt: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountCreatedEventDetail = exports.DirectoryEventDetailTypeEnum = exports.DIRECTORY_EVENTS_SOURCE = void 0;
|
|
4
|
+
// Origen de los eventos de EventBridge que publica directory-business.
|
|
5
|
+
exports.DIRECTORY_EVENTS_SOURCE = "fiado.directory";
|
|
6
|
+
var DirectoryEventDetailTypeEnum;
|
|
7
|
+
(function (DirectoryEventDetailTypeEnum) {
|
|
8
|
+
/** Alta real del scope de un país (fiado.mx o fiado.us) en el directorio: la cuenta de ese lado quedó abierta. */
|
|
9
|
+
DirectoryEventDetailTypeEnum["ACCOUNT_CREATED"] = "AccountCreated";
|
|
10
|
+
})(DirectoryEventDetailTypeEnum || (exports.DirectoryEventDetailTypeEnum = DirectoryEventDetailTypeEnum = {}));
|
|
11
|
+
// `detail` del evento AccountCreated. Sale uno por país dado de alta.
|
|
12
|
+
class AccountCreatedEventDetail {
|
|
13
|
+
}
|
|
14
|
+
exports.AccountCreatedEventDetail = AccountCreatedEventDetail;
|
|
@@ -0,0 +1,34 @@
|
|
|
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.DirectoryUserScopeUpdateRequest = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
// Body de POST /directories/users/scope (directory-business), sucesor de updateScope de fiado-directory-lambda.
|
|
15
|
+
// `scope` es el arreglo COMPLETO que queda guardado, no un delta. Se valida como string y no contra el enum
|
|
16
|
+
// Scope porque los llamadores reenvían el arreglo que ya tenía el directorio, como en v1.
|
|
17
|
+
class DirectoryUserScopeUpdateRequest {
|
|
18
|
+
}
|
|
19
|
+
exports.DirectoryUserScopeUpdateRequest = DirectoryUserScopeUpdateRequest;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], DirectoryUserScopeUpdateRequest.prototype, "directoryId", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsArray)(),
|
|
27
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
28
|
+
__metadata("design:type", Array)
|
|
29
|
+
], DirectoryUserScopeUpdateRequest.prototype, "scope", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsOptional)(),
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], DirectoryUserScopeUpdateRequest.prototype, "app", void 0);
|
package/bin/directory/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export * from './dtos/CreateDirectoryUserEventResponse';
|
|
|
8
8
|
export * from './dtos/DeleteByDirectoryResponse';
|
|
9
9
|
export * from './dtos/DirectoryAgentsBySponsorRequest';
|
|
10
10
|
export * from './dtos/DirectoryAgentsBySponsorResponse';
|
|
11
|
+
export * from './dtos/DirectoryUserScopeUpdateRequest';
|
|
12
|
+
export * from './dtos/AccountCreatedEventDetail';
|
|
11
13
|
export * from './dtos/External';
|
|
12
14
|
export * from './enums/TypeOfDirectoryId';
|
|
13
15
|
export * from './enums/DirectoryBackofficeStatusEnum';
|
package/bin/directory/index.js
CHANGED
|
@@ -25,6 +25,8 @@ __exportStar(require("./dtos/CreateDirectoryUserEventResponse"), exports);
|
|
|
25
25
|
__exportStar(require("./dtos/DeleteByDirectoryResponse"), exports);
|
|
26
26
|
__exportStar(require("./dtos/DirectoryAgentsBySponsorRequest"), exports);
|
|
27
27
|
__exportStar(require("./dtos/DirectoryAgentsBySponsorResponse"), exports);
|
|
28
|
+
__exportStar(require("./dtos/DirectoryUserScopeUpdateRequest"), exports);
|
|
29
|
+
__exportStar(require("./dtos/AccountCreatedEventDetail"), exports);
|
|
28
30
|
__exportStar(require("./dtos/External"), exports);
|
|
29
31
|
//enums
|
|
30
32
|
__exportStar(require("./enums/TypeOfDirectoryId"), exports);
|
|
@@ -10,7 +10,7 @@ export interface MessageMomentIdentity {
|
|
|
10
10
|
alwaysVariables: readonly string[];
|
|
11
11
|
conditionalVariables: readonly string[];
|
|
12
12
|
}
|
|
13
|
-
/** Los 38 momentos EN ORDEN de recorrido
|
|
13
|
+
/** Los 38 momentos del crédito EN ORDEN de recorrido y al final los de referidos. `PM-071` apunta al OTP de plataforma. */
|
|
14
14
|
export declare const MESSAGE_MOMENT_CATALOG: readonly MessageMomentIdentity[];
|
|
15
15
|
/** La identidad por id de ficha (`PM-030`). */
|
|
16
16
|
export declare const momentByTemplateId: ReadonlyMap<string, MessageMomentIdentity>;
|
|
@@ -14,9 +14,13 @@ function creditMoment(templateId, messageType, blockId) {
|
|
|
14
14
|
conditionalVariables: MessageMomentVariables_1.CREDIT_MOMENT_CONDITIONAL_VARIABLES,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
/** Un momento fuera del crédito: solo las variables que su emisor manda. */
|
|
18
|
+
function standaloneMoment(templateId, messageType, blockId, alwaysVariables, conditionalVariables = []) {
|
|
19
|
+
return { templateId, messageType, blockId, alwaysVariables, conditionalVariables };
|
|
20
|
+
}
|
|
17
21
|
const B = MessageMomentBlockEnum_1.MessageMomentBlockEnum;
|
|
18
22
|
const M = MessageMomentEnum_1.MessageMomentEnum;
|
|
19
|
-
/** Los 38 momentos EN ORDEN de recorrido
|
|
23
|
+
/** Los 38 momentos del crédito EN ORDEN de recorrido y al final los de referidos. `PM-071` apunta al OTP de plataforma. */
|
|
20
24
|
exports.MESSAGE_MOMENT_CATALOG = [
|
|
21
25
|
creditMoment('PM-001', M.APPLICATION_APPROVED, B.ORIGINATION),
|
|
22
26
|
creditMoment('PM-002', M.APPLICATION_REJECTED, B.ORIGINATION),
|
|
@@ -50,18 +54,14 @@ exports.MESSAGE_MOMENT_CATALOG = [
|
|
|
50
54
|
creditMoment('PM-062', M.SETTLEMENT_BUREAU_NOTICE, B.CLOSURE),
|
|
51
55
|
creditMoment('PM-063', M.REENTRY_INVITATION, B.CLOSURE),
|
|
52
56
|
creditMoment('PM-070', M.APP_WELCOME, B.SERVICE),
|
|
53
|
-
|
|
54
|
-
templateId: 'PM-071',
|
|
55
|
-
messageType: M.OTP_CODE,
|
|
56
|
-
blockId: B.SERVICE,
|
|
57
|
-
alwaysVariables: MessageMomentVariables_1.OTP_MOMENT_VARIABLES,
|
|
58
|
-
conditionalVariables: [],
|
|
59
|
-
},
|
|
57
|
+
standaloneMoment('PM-071', M.OTP_CODE, B.SERVICE, MessageMomentVariables_1.OTP_MOMENT_VARIABLES),
|
|
60
58
|
creditMoment('PM-072', M.SECURITY_ALERT, B.SERVICE),
|
|
61
59
|
creditMoment('PM-073', M.PROFILE_CHANGE_CONFIRMED, B.SERVICE),
|
|
62
60
|
creditMoment('PM-074', M.MONTHLY_STATEMENT, B.SERVICE),
|
|
63
61
|
creditMoment('PM-075', M.CAT_TERMS_NOTICE, B.SERVICE),
|
|
64
62
|
creditMoment('PM-076', M.PRIVACY_ARCO_NOTICE, B.SERVICE),
|
|
63
|
+
standaloneMoment('PM-080', M.REFERRAL_BONUS_CREDITED, B.REFERRALS, MessageMomentVariables_1.REFERRAL_BONUS_ALWAYS_VARIABLES, MessageMomentVariables_1.REFERRAL_BONUS_CONDITIONAL_VARIABLES),
|
|
64
|
+
standaloneMoment('PM-081', M.REFERRAL_COUPON_ISSUED, B.REFERRALS, MessageMomentVariables_1.REFERRAL_COUPON_ALWAYS_VARIABLES, MessageMomentVariables_1.REFERRAL_COUPON_CONDITIONAL_VARIABLES),
|
|
65
65
|
];
|
|
66
66
|
/** La identidad por id de ficha (`PM-030`). */
|
|
67
67
|
exports.momentByTemplateId = new Map(exports.MESSAGE_MOMENT_CATALOG.map((moment) => [moment.templateId, moment]));
|
|
@@ -5,6 +5,14 @@ export declare const CREDIT_MOMENT_ALWAYS_VARIABLES: readonly string[];
|
|
|
5
5
|
export declare const CREDIT_MOMENT_CONDITIONAL_VARIABLES: readonly string[];
|
|
6
6
|
/** El OTP lo arma messages-business: llena `code` y su alias posicional `var1`. */
|
|
7
7
|
export declare const OTP_MOMENT_VARIABLES: readonly string[];
|
|
8
|
+
/** Premio de referido abonado a la cuenta PCF: a quién y cuánto. */
|
|
9
|
+
export declare const REFERRAL_BONUS_ALWAYS_VARIABLES: readonly string[];
|
|
10
|
+
/** El referido solo se nombra cuando el premio es de quien recomendó. */
|
|
11
|
+
export declare const REFERRAL_BONUS_CONDITIONAL_VARIABLES: readonly string[];
|
|
12
|
+
/** Cupón de referido emitido: el código, su descuento ya formateado y hasta cuándo vale. */
|
|
13
|
+
export declare const REFERRAL_COUPON_ALWAYS_VARIABLES: readonly string[];
|
|
14
|
+
/** La tienda solo viaja cuando el cupón no vale en todas. */
|
|
15
|
+
export declare const REFERRAL_COUPON_CONDITIONAL_VARIABLES: readonly string[];
|
|
8
16
|
/** Lo que el plan nuevo de una reestructura le dice al cliente. */
|
|
9
17
|
export declare const RESTRUCTURE_MOMENT_VARIABLES: readonly string[];
|
|
10
18
|
/** Variables que solo emite su momento, siempre con valor. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MOMENT_SPECIFIC_VARIABLES = exports.RESTRUCTURE_MOMENT_VARIABLES = exports.OTP_MOMENT_VARIABLES = exports.CREDIT_MOMENT_CONDITIONAL_VARIABLES = exports.CREDIT_MOMENT_ALWAYS_VARIABLES = void 0;
|
|
3
|
+
exports.MOMENT_SPECIFIC_VARIABLES = exports.RESTRUCTURE_MOMENT_VARIABLES = exports.REFERRAL_COUPON_CONDITIONAL_VARIABLES = exports.REFERRAL_COUPON_ALWAYS_VARIABLES = exports.REFERRAL_BONUS_CONDITIONAL_VARIABLES = exports.REFERRAL_BONUS_ALWAYS_VARIABLES = exports.OTP_MOMENT_VARIABLES = exports.CREDIT_MOMENT_CONDITIONAL_VARIABLES = exports.CREDIT_MOMENT_ALWAYS_VARIABLES = void 0;
|
|
4
4
|
const MessageMomentEnum_1 = require("../enums/MessageMomentEnum");
|
|
5
5
|
/** Variables del crédito que el emisor manda siempre con valor. */
|
|
6
6
|
exports.CREDIT_MOMENT_ALWAYS_VARIABLES = [
|
|
@@ -29,6 +29,14 @@ exports.CREDIT_MOMENT_CONDITIONAL_VARIABLES = [
|
|
|
29
29
|
];
|
|
30
30
|
/** El OTP lo arma messages-business: llena `code` y su alias posicional `var1`. */
|
|
31
31
|
exports.OTP_MOMENT_VARIABLES = ['code', 'var1'];
|
|
32
|
+
/** Premio de referido abonado a la cuenta PCF: a quién y cuánto. */
|
|
33
|
+
exports.REFERRAL_BONUS_ALWAYS_VARIABLES = ['cliente_nombre', 'monto'];
|
|
34
|
+
/** El referido solo se nombra cuando el premio es de quien recomendó. */
|
|
35
|
+
exports.REFERRAL_BONUS_CONDITIONAL_VARIABLES = ['referido_nombre'];
|
|
36
|
+
/** Cupón de referido emitido: el código, su descuento ya formateado y hasta cuándo vale. */
|
|
37
|
+
exports.REFERRAL_COUPON_ALWAYS_VARIABLES = ['cliente_nombre', 'codigo', 'descuento', 'vigencia'];
|
|
38
|
+
/** La tienda solo viaja cuando el cupón no vale en todas. */
|
|
39
|
+
exports.REFERRAL_COUPON_CONDITIONAL_VARIABLES = ['tienda'];
|
|
32
40
|
/** Lo que el plan nuevo de una reestructura le dice al cliente. */
|
|
33
41
|
exports.RESTRUCTURE_MOMENT_VARIABLES = ['plazo_nuevo', 'cuota_nueva', 'saldo_nuevo'];
|
|
34
42
|
/** Variables que solo emite su momento, siempre con valor. */
|
|
@@ -12,4 +12,5 @@ var MessageMomentBlockEnum;
|
|
|
12
12
|
MessageMomentBlockEnum["EXCEPTIONS"] = "exceptions";
|
|
13
13
|
MessageMomentBlockEnum["CLOSURE"] = "closure";
|
|
14
14
|
MessageMomentBlockEnum["SERVICE"] = "service";
|
|
15
|
+
MessageMomentBlockEnum["REFERRALS"] = "referrals";
|
|
15
16
|
})(MessageMomentBlockEnum || (exports.MessageMomentBlockEnum = MessageMomentBlockEnum = {}));
|
|
@@ -38,5 +38,7 @@ export declare enum MessageMomentEnum {
|
|
|
38
38
|
PROFILE_CHANGE_CONFIRMED = "PROFILE_CHANGE_CONFIRMED",
|
|
39
39
|
MONTHLY_STATEMENT = "MONTHLY_STATEMENT",
|
|
40
40
|
CAT_TERMS_NOTICE = "CAT_TERMS_NOTICE",
|
|
41
|
-
PRIVACY_ARCO_NOTICE = "PRIVACY_ARCO_NOTICE"
|
|
41
|
+
PRIVACY_ARCO_NOTICE = "PRIVACY_ARCO_NOTICE",
|
|
42
|
+
REFERRAL_BONUS_CREDITED = "REFERRAL_BONUS_CREDITED",
|
|
43
|
+
REFERRAL_COUPON_ISSUED = "REFERRAL_COUPON_ISSUED"
|
|
42
44
|
}
|
|
@@ -43,4 +43,6 @@ var MessageMomentEnum;
|
|
|
43
43
|
MessageMomentEnum["MONTHLY_STATEMENT"] = "MONTHLY_STATEMENT";
|
|
44
44
|
MessageMomentEnum["CAT_TERMS_NOTICE"] = "CAT_TERMS_NOTICE";
|
|
45
45
|
MessageMomentEnum["PRIVACY_ARCO_NOTICE"] = "PRIVACY_ARCO_NOTICE";
|
|
46
|
+
MessageMomentEnum["REFERRAL_BONUS_CREDITED"] = "REFERRAL_BONUS_CREDITED";
|
|
47
|
+
MessageMomentEnum["REFERRAL_COUPON_ISSUED"] = "REFERRAL_COUPON_ISSUED";
|
|
46
48
|
})(MessageMomentEnum || (exports.MessageMomentEnum = MessageMomentEnum = {}));
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CountryId } from "../../country/enums/CountryId";
|
|
2
|
+
|
|
3
|
+
// Origen de los eventos de EventBridge que publica directory-business.
|
|
4
|
+
export const DIRECTORY_EVENTS_SOURCE = "fiado.directory";
|
|
5
|
+
|
|
6
|
+
export enum DirectoryEventDetailTypeEnum {
|
|
7
|
+
/** Alta real del scope de un país (fiado.mx o fiado.us) en el directorio: la cuenta de ese lado quedó abierta. */
|
|
8
|
+
ACCOUNT_CREATED = "AccountCreated",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// `detail` del evento AccountCreated. Sale uno por país dado de alta.
|
|
12
|
+
export class AccountCreatedEventDetail {
|
|
13
|
+
/** Fijo por directorio y país (`<countryId>#<directoryId>`): un reenvío llega con el mismo id y el consumidor lo descarta. */
|
|
14
|
+
eventId!: string;
|
|
15
|
+
directoryId!: string;
|
|
16
|
+
peopleId!: string;
|
|
17
|
+
/** CountryId.MEX (484) o CountryId.USA (840). */
|
|
18
|
+
countryId!: CountryId;
|
|
19
|
+
/** ISO 8601 del momento en que se guardó el scope. */
|
|
20
|
+
occurredAt!: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IsArray, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
|
2
|
+
|
|
3
|
+
// Body de POST /directories/users/scope (directory-business), sucesor de updateScope de fiado-directory-lambda.
|
|
4
|
+
// `scope` es el arreglo COMPLETO que queda guardado, no un delta. Se valida como string y no contra el enum
|
|
5
|
+
// Scope porque los llamadores reenvían el arreglo que ya tenía el directorio, como en v1.
|
|
6
|
+
export class DirectoryUserScopeUpdateRequest {
|
|
7
|
+
@IsString()
|
|
8
|
+
@IsNotEmpty()
|
|
9
|
+
directoryId!: string;
|
|
10
|
+
|
|
11
|
+
@IsArray()
|
|
12
|
+
@IsString({ each: true })
|
|
13
|
+
scope!: string[];
|
|
14
|
+
|
|
15
|
+
// App de origen tomada del token por quien llama; decide si se puede pedir el lado americano.
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsString()
|
|
18
|
+
app?: string | null;
|
|
19
|
+
}
|
package/src/directory/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ export * from './dtos/CreateDirectoryUserEventResponse';
|
|
|
10
10
|
export * from './dtos/DeleteByDirectoryResponse';
|
|
11
11
|
export * from './dtos/DirectoryAgentsBySponsorRequest';
|
|
12
12
|
export * from './dtos/DirectoryAgentsBySponsorResponse';
|
|
13
|
+
export * from './dtos/DirectoryUserScopeUpdateRequest';
|
|
14
|
+
export * from './dtos/AccountCreatedEventDetail';
|
|
13
15
|
|
|
14
16
|
export * from './dtos/External';
|
|
15
17
|
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
CREDIT_MOMENT_CONDITIONAL_VARIABLES,
|
|
6
6
|
MOMENT_SPECIFIC_VARIABLES,
|
|
7
7
|
OTP_MOMENT_VARIABLES,
|
|
8
|
+
REFERRAL_BONUS_ALWAYS_VARIABLES,
|
|
9
|
+
REFERRAL_BONUS_CONDITIONAL_VARIABLES,
|
|
10
|
+
REFERRAL_COUPON_ALWAYS_VARIABLES,
|
|
11
|
+
REFERRAL_COUPON_CONDITIONAL_VARIABLES,
|
|
8
12
|
} from './MessageMomentVariables';
|
|
9
13
|
|
|
10
14
|
/** Quién es un momento: su id de ficha, su plantilla, su bloque y las variables que emite. */
|
|
@@ -29,10 +33,21 @@ function creditMoment(templateId: string, messageType: MessageMomentEnum, blockI
|
|
|
29
33
|
};
|
|
30
34
|
}
|
|
31
35
|
|
|
36
|
+
/** Un momento fuera del crédito: solo las variables que su emisor manda. */
|
|
37
|
+
function standaloneMoment(
|
|
38
|
+
templateId: string,
|
|
39
|
+
messageType: MessageMomentEnum,
|
|
40
|
+
blockId: MessageMomentBlockEnum,
|
|
41
|
+
alwaysVariables: readonly string[],
|
|
42
|
+
conditionalVariables: readonly string[] = [],
|
|
43
|
+
): MessageMomentIdentity {
|
|
44
|
+
return { templateId, messageType, blockId, alwaysVariables, conditionalVariables };
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
const B = MessageMomentBlockEnum;
|
|
33
48
|
const M = MessageMomentEnum;
|
|
34
49
|
|
|
35
|
-
/** Los 38 momentos EN ORDEN de recorrido
|
|
50
|
+
/** Los 38 momentos del crédito EN ORDEN de recorrido y al final los de referidos. `PM-071` apunta al OTP de plataforma. */
|
|
36
51
|
export const MESSAGE_MOMENT_CATALOG: readonly MessageMomentIdentity[] = [
|
|
37
52
|
creditMoment('PM-001', M.APPLICATION_APPROVED, B.ORIGINATION),
|
|
38
53
|
creditMoment('PM-002', M.APPLICATION_REJECTED, B.ORIGINATION),
|
|
@@ -66,18 +81,14 @@ export const MESSAGE_MOMENT_CATALOG: readonly MessageMomentIdentity[] = [
|
|
|
66
81
|
creditMoment('PM-062', M.SETTLEMENT_BUREAU_NOTICE, B.CLOSURE),
|
|
67
82
|
creditMoment('PM-063', M.REENTRY_INVITATION, B.CLOSURE),
|
|
68
83
|
creditMoment('PM-070', M.APP_WELCOME, B.SERVICE),
|
|
69
|
-
|
|
70
|
-
templateId: 'PM-071',
|
|
71
|
-
messageType: M.OTP_CODE,
|
|
72
|
-
blockId: B.SERVICE,
|
|
73
|
-
alwaysVariables: OTP_MOMENT_VARIABLES,
|
|
74
|
-
conditionalVariables: [],
|
|
75
|
-
},
|
|
84
|
+
standaloneMoment('PM-071', M.OTP_CODE, B.SERVICE, OTP_MOMENT_VARIABLES),
|
|
76
85
|
creditMoment('PM-072', M.SECURITY_ALERT, B.SERVICE),
|
|
77
86
|
creditMoment('PM-073', M.PROFILE_CHANGE_CONFIRMED, B.SERVICE),
|
|
78
87
|
creditMoment('PM-074', M.MONTHLY_STATEMENT, B.SERVICE),
|
|
79
88
|
creditMoment('PM-075', M.CAT_TERMS_NOTICE, B.SERVICE),
|
|
80
89
|
creditMoment('PM-076', M.PRIVACY_ARCO_NOTICE, B.SERVICE),
|
|
90
|
+
standaloneMoment('PM-080', M.REFERRAL_BONUS_CREDITED, B.REFERRALS, REFERRAL_BONUS_ALWAYS_VARIABLES, REFERRAL_BONUS_CONDITIONAL_VARIABLES),
|
|
91
|
+
standaloneMoment('PM-081', M.REFERRAL_COUPON_ISSUED, B.REFERRALS, REFERRAL_COUPON_ALWAYS_VARIABLES, REFERRAL_COUPON_CONDITIONAL_VARIABLES),
|
|
81
92
|
];
|
|
82
93
|
|
|
83
94
|
/** La identidad por id de ficha (`PM-030`). */
|
|
@@ -30,6 +30,18 @@ export const CREDIT_MOMENT_CONDITIONAL_VARIABLES: readonly string[] = [
|
|
|
30
30
|
/** El OTP lo arma messages-business: llena `code` y su alias posicional `var1`. */
|
|
31
31
|
export const OTP_MOMENT_VARIABLES: readonly string[] = ['code', 'var1'];
|
|
32
32
|
|
|
33
|
+
/** Premio de referido abonado a la cuenta PCF: a quién y cuánto. */
|
|
34
|
+
export const REFERRAL_BONUS_ALWAYS_VARIABLES: readonly string[] = ['cliente_nombre', 'monto'];
|
|
35
|
+
|
|
36
|
+
/** El referido solo se nombra cuando el premio es de quien recomendó. */
|
|
37
|
+
export const REFERRAL_BONUS_CONDITIONAL_VARIABLES: readonly string[] = ['referido_nombre'];
|
|
38
|
+
|
|
39
|
+
/** Cupón de referido emitido: el código, su descuento ya formateado y hasta cuándo vale. */
|
|
40
|
+
export const REFERRAL_COUPON_ALWAYS_VARIABLES: readonly string[] = ['cliente_nombre', 'codigo', 'descuento', 'vigencia'];
|
|
41
|
+
|
|
42
|
+
/** La tienda solo viaja cuando el cupón no vale en todas. */
|
|
43
|
+
export const REFERRAL_COUPON_CONDITIONAL_VARIABLES: readonly string[] = ['tienda'];
|
|
44
|
+
|
|
33
45
|
/** Lo que el plan nuevo de una reestructura le dice al cliente. */
|
|
34
46
|
export const RESTRUCTURE_MOMENT_VARIABLES: readonly string[] = ['plazo_nuevo', 'cuota_nueva', 'saldo_nuevo'];
|
|
35
47
|
|
|
@@ -47,4 +47,7 @@ export enum MessageMomentEnum {
|
|
|
47
47
|
MONTHLY_STATEMENT = 'MONTHLY_STATEMENT',
|
|
48
48
|
CAT_TERMS_NOTICE = 'CAT_TERMS_NOTICE',
|
|
49
49
|
PRIVACY_ARCO_NOTICE = 'PRIVACY_ARCO_NOTICE',
|
|
50
|
+
|
|
51
|
+
REFERRAL_BONUS_CREDITED = 'REFERRAL_BONUS_CREDITED',
|
|
52
|
+
REFERRAL_COUPON_ISSUED = 'REFERRAL_COUPON_ISSUED',
|
|
50
53
|
}
|