@fiado/type-kit 3.644.0 → 3.645.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 (64) hide show
  1. package/_test_/unit/collection/disburseRequest.test.ts +30 -0
  2. package/_test_/unit/collection/disbursementType.test.ts +7 -1
  3. package/_test_/unit/productCatalog/rewardTopupEnums.test.ts +16 -0
  4. package/_test_/unit/rewards/mobileTopup.test.ts +78 -0
  5. package/_test_/unit/rewards/waitingLimit.test.ts +3 -3
  6. package/_test_/unit/transactionProcessor/authorizeRewardTopupRequest.test.ts +59 -0
  7. package/_test_/unit/transactionProcessor/rewardTopupCodes.test.ts +17 -0
  8. package/bin/collection/dtos/DisburseRequest.d.ts +3 -0
  9. package/bin/collection/dtos/DisburseRequest.js +9 -0
  10. package/bin/collection/dtos/DisburseTopupDetail.d.ts +9 -0
  11. package/bin/collection/dtos/DisburseTopupDetail.js +46 -0
  12. package/bin/collection/enums/DisbursementType.d.ts +3 -1
  13. package/bin/collection/enums/DisbursementType.js +2 -0
  14. package/bin/collection/index.d.ts +1 -0
  15. package/bin/collection/index.js +1 -0
  16. package/bin/productCatalog/enums/ProductSubtypeEnum.d.ts +1 -0
  17. package/bin/productCatalog/enums/ProductSubtypeEnum.js +2 -0
  18. package/bin/rewards/dtos/backoffice/BackofficeGrantItemResponse.d.ts +2 -0
  19. package/bin/rewards/dtos/backoffice/MobileTopupConfigRequest.d.ts +10 -0
  20. package/bin/rewards/dtos/backoffice/MobileTopupConfigRequest.js +59 -0
  21. package/bin/rewards/dtos/backoffice/MobileTopupConfigResponse.d.ts +15 -0
  22. package/bin/rewards/dtos/backoffice/MobileTopupConfigResponse.js +2 -0
  23. package/bin/rewards/dtos/backoffice/MobileTopupContributionResponse.d.ts +9 -0
  24. package/bin/rewards/dtos/backoffice/MobileTopupContributionResponse.js +2 -0
  25. package/bin/rewards/dtos/backoffice/MobileTopupPlanListResponse.d.ts +5 -0
  26. package/bin/rewards/dtos/backoffice/MobileTopupPlanListResponse.js +2 -0
  27. package/bin/rewards/dtos/backoffice/MobileTopupPlanResponse.d.ts +22 -0
  28. package/bin/rewards/dtos/backoffice/MobileTopupPlanResponse.js +2 -0
  29. package/bin/rewards/dtos/backoffice/MobileTopupRechargeResponse.d.ts +8 -0
  30. package/bin/rewards/dtos/backoffice/MobileTopupRechargeResponse.js +2 -0
  31. package/bin/rewards/enums/MobileTopupPlanStatusEnum.d.ts +6 -0
  32. package/bin/rewards/enums/MobileTopupPlanStatusEnum.js +10 -0
  33. package/bin/rewards/enums/MobileTopupRechargeStatusEnum.d.ts +7 -0
  34. package/bin/rewards/enums/MobileTopupRechargeStatusEnum.js +11 -0
  35. package/bin/rewards/enums/RewardItemCodeEnum.d.ts +5 -1
  36. package/bin/rewards/enums/RewardItemCodeEnum.js +4 -0
  37. package/bin/rewards/index.d.ts +8 -0
  38. package/bin/rewards/index.js +8 -0
  39. package/bin/transactionProcessor/dtos/AuthorizeRewardTopupRequest.d.ts +21 -0
  40. package/bin/transactionProcessor/dtos/AuthorizeRewardTopupRequest.js +74 -0
  41. package/bin/transactionProcessor/enums/TransactionProcessorCodesEnum.d.ts +9 -1
  42. package/bin/transactionProcessor/enums/TransactionProcessorCodesEnum.js +8 -0
  43. package/bin/transactionProcessor/index.d.ts +1 -0
  44. package/bin/transactionProcessor/index.js +1 -0
  45. package/package.json +1 -1
  46. package/src/collection/dtos/DisburseRequest.ts +10 -1
  47. package/src/collection/dtos/DisburseTopupDetail.ts +15 -0
  48. package/src/collection/enums/DisbursementType.ts +2 -0
  49. package/src/collection/index.ts +1 -0
  50. package/src/productCatalog/enums/ProductSubtypeEnum.ts +2 -0
  51. package/src/rewards/dtos/backoffice/BackofficeGrantItemResponse.ts +2 -0
  52. package/src/rewards/dtos/backoffice/MobileTopupConfigRequest.ts +41 -0
  53. package/src/rewards/dtos/backoffice/MobileTopupConfigResponse.ts +15 -0
  54. package/src/rewards/dtos/backoffice/MobileTopupContributionResponse.ts +9 -0
  55. package/src/rewards/dtos/backoffice/MobileTopupPlanListResponse.ts +6 -0
  56. package/src/rewards/dtos/backoffice/MobileTopupPlanResponse.ts +23 -0
  57. package/src/rewards/dtos/backoffice/MobileTopupRechargeResponse.ts +9 -0
  58. package/src/rewards/enums/MobileTopupPlanStatusEnum.ts +6 -0
  59. package/src/rewards/enums/MobileTopupRechargeStatusEnum.ts +7 -0
  60. package/src/rewards/enums/RewardItemCodeEnum.ts +4 -0
  61. package/src/rewards/index.ts +8 -0
  62. package/src/transactionProcessor/dtos/AuthorizeRewardTopupRequest.ts +44 -0
  63. package/src/transactionProcessor/enums/TransactionProcessorCodesEnum.ts +8 -0
  64. package/src/transactionProcessor/index.ts +1 -0
@@ -88,6 +88,36 @@ describe('DisburseRequest', () => {
88
88
  );
89
89
  });
90
90
 
91
+ describe('topup (MEX_REWARD_TOPUP)', () => {
92
+ const TOPUP_OK = { phone: '5512345678', moduleName: 'multicenter', benefitId: 'b1', leafId: 'l1', productId: 'p1' };
93
+ const TOPUP_TYPE = { ...VALID, disbursementType: 'MEX_REWARD_TOPUP' };
94
+
95
+ it('acepta MEX_REWARD_TOPUP con topup válido', async () => {
96
+ expect(await invalidProperties({ ...TOPUP_TYPE, topup: TOPUP_OK })).toEqual([]);
97
+ });
98
+
99
+ it('exige topup con MEX_REWARD_TOPUP', async () => {
100
+ expect(await invalidProperties(TOPUP_TYPE)).toContain('topup');
101
+ });
102
+
103
+ it.each(['551234567', '55123456789', '55123abc78', '+525512345678'])('rechaza phone %s', async (phone) => {
104
+ expect(await invalidProperties({ ...TOPUP_TYPE, topup: { ...TOPUP_OK, phone } })).toContain('topup');
105
+ });
106
+
107
+ it('rechaza leafId vacío', async () => {
108
+ expect(await invalidProperties({ ...TOPUP_TYPE, topup: { ...TOPUP_OK, leafId: '' } })).toContain('topup');
109
+ });
110
+
111
+ it('no exige topup a otros tipos y lo ignora si viene', async () => {
112
+ expect(await invalidProperties(VALID)).toEqual([]);
113
+ expect(await invalidProperties({ ...VALID, topup: TOPUP_OK })).toEqual([]);
114
+ });
115
+
116
+ it('acepta idempotencyKey de 64 caracteres (el límite de 60 lo aplica el processor)', async () => {
117
+ expect(await invalidProperties({ ...TOPUP_TYPE, topup: TOPUP_OK, idempotencyKey: 'k'.repeat(64) })).toEqual([]);
118
+ });
119
+ });
120
+
91
121
  it('sale por el index raíz', () => {
92
122
  expect(new Collection.DisburseRequest()).toBeInstanceOf(DisburseRequest);
93
123
  expect(new Collection.DisburseResponse()).toBeInstanceOf(DisburseResponse);
@@ -4,13 +4,18 @@ import { DisbursementType } from '../../../src/collection/index';
4
4
 
5
5
  describe('DisbursementType', () => {
6
6
  it('trae los productos de bono, comisión de vendedor y recompensa', () => {
7
- expect(Object.values(DisbursementType)).toEqual(['MEX_BONUS', 'MEX_SELLER_COMMISSION', 'MEX_REWARD']);
7
+ expect(Object.values(DisbursementType)).toEqual(['MEX_BONUS', 'MEX_SELLER_COMMISSION', 'MEX_REWARD', 'MEX_REWARD_TOPUP']);
8
8
  });
9
9
 
10
10
  it('MEX_REWARD vale MEX_REWARD', () => {
11
11
  expect(DisbursementType.MEX_REWARD).toBe('MEX_REWARD');
12
12
  });
13
13
 
14
+ it('MEX_REWARD_TOPUP vale MEX_REWARD_TOPUP', () => {
15
+ expect(DisbursementType.MEX_REWARD_TOPUP).toBe('MEX_REWARD_TOPUP');
16
+ expect(Object.values(DisbursementType)).toEqual(expect.arrayContaining(['MEX_BONUS', 'MEX_SELLER_COMMISSION', 'MEX_REWARD', 'MEX_REWARD_TOPUP']));
17
+ });
18
+
14
19
  it('cada clave es igual a su valor', () => {
15
20
  for (const [key, value] of Object.entries(DisbursementType)) {
16
21
  expect(key).toBe(value);
@@ -21,5 +26,6 @@ describe('DisbursementType', () => {
21
26
  expect(Collection.DisbursementType.MEX_BONUS).toBe('MEX_BONUS');
22
27
  expect(Collection.DisbursementType.MEX_SELLER_COMMISSION).toBe('MEX_SELLER_COMMISSION');
23
28
  expect(Collection.DisbursementType.MEX_REWARD).toBe('MEX_REWARD');
29
+ expect(Collection.DisbursementType.MEX_REWARD_TOPUP).toBe('MEX_REWARD_TOPUP');
24
30
  });
25
31
  });
@@ -0,0 +1,16 @@
1
+ import { ProductSubtypeEnum } from '../../../src/productCatalog/enums/ProductSubtypeEnum';
2
+
3
+ describe('ProductSubtypeEnum recarga de recompensa', () => {
4
+ it('REWARD_TOPUP_MX vale "REWARD_TOPUP_MX"', () => {
5
+ expect(ProductSubtypeEnum.REWARD_TOPUP_MX).toBe('REWARD_TOPUP_MX');
6
+ });
7
+
8
+ it('ningún otro miembro vale "REWARD_TOPUP_MX"', () => {
9
+ const others = Object.entries(ProductSubtypeEnum).filter(([key, value]) => value === 'REWARD_TOPUP_MX' && key !== 'REWARD_TOPUP_MX');
10
+ expect(others).toEqual([]);
11
+ });
12
+
13
+ it('REWARD_MX no cambia', () => {
14
+ expect(ProductSubtypeEnum.REWARD_MX).toBe('REWARD_MX');
15
+ });
16
+ });
@@ -0,0 +1,78 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import {
5
+ BackofficeGrantItemResponse,
6
+ MobileTopupConfigRequest,
7
+ MobileTopupPlanResponse,
8
+ MobileTopupPlanStatusEnum,
9
+ MobileTopupRechargeStatusEnum,
10
+ RewardItemCodeEnum,
11
+ } from '../../../src/rewards';
12
+
13
+ const valid = { moduleName: 'm', benefitId: 'b', leafId: 'l', productId: 'p', monthlyPrice: 99.5 };
14
+
15
+ describe('rewards mobile topup', () => {
16
+ it('enums con valores exactos', () => {
17
+ expect({ ...MobileTopupPlanStatusEnum }).toEqual({ ACTIVE: 'ACTIVE', NEEDS_ATTENTION: 'NEEDS_ATTENTION', DONE: 'DONE' });
18
+ expect({ ...MobileTopupRechargeStatusEnum }).toEqual({
19
+ PAID: 'PAID',
20
+ REJECTED: 'REJECTED',
21
+ UNCONFIRMED: 'UNCONFIRMED',
22
+ NOT_DELIVERED: 'NOT_DELIVERED',
23
+ });
24
+ });
25
+
26
+ it('RewardItemCodeEnum conserva los previos y agrega los nuevos', () => {
27
+ expect(RewardItemCodeEnum.TOPUP_REJECTED).toBe('TOPUP_REJECTED');
28
+ expect(RewardItemCodeEnum.ITEM_DISMISSED).toBe('ITEM_DISMISSED');
29
+ expect(RewardItemCodeEnum.AMOUNT_ABOVE_MAX).toBe('AMOUNT_ABOVE_MAX');
30
+ expect(RewardItemCodeEnum.LIMIT_WAIT_EXPIRED).toBe('LIMIT_WAIT_EXPIRED');
31
+ expect(RewardItemCodeEnum.OUTCOME_UNKNOWN).toBe('OUTCOME_UNKNOWN');
32
+ });
33
+
34
+ it('MobileTopupConfigRequest válido', async () => {
35
+ expect(await validate(plainToInstance(MobileTopupConfigRequest, valid))).toHaveLength(0);
36
+ expect(await validate(plainToInstance(MobileTopupConfigRequest, { ...valid, expectedVersion: 3 }))).toHaveLength(0);
37
+ });
38
+
39
+ it.each([
40
+ ['monthlyPrice 0', { monthlyPrice: 0 }],
41
+ ['monthlyPrice -1', { monthlyPrice: -1 }],
42
+ ['monthlyPrice 10.123', { monthlyPrice: 10.123 }],
43
+ ['moduleName vacío', { moduleName: '' }],
44
+ ['productId 101 chars', { productId: 'x'.repeat(101) }],
45
+ ['expectedVersion 0', { expectedVersion: 0 }],
46
+ ])('MobileTopupConfigRequest inválido: %s', async (_n, patch) => {
47
+ const errors = await validate(plainToInstance(MobileTopupConfigRequest, { ...valid, ...patch }));
48
+ expect(errors.length).toBeGreaterThanOrEqual(1);
49
+ });
50
+
51
+ it('MobileTopupPlanResponse completo compila', () => {
52
+ const plan = {
53
+ phone: '5512345678',
54
+ status: MobileTopupPlanStatusEnum.ACTIVE,
55
+ promised: 3,
56
+ done: 1,
57
+ pending: 2,
58
+ nextDueAt: 1,
59
+ lastRechargeAt: 1,
60
+ lastFolio: 'RW-g-i-M1',
61
+ failedAttempts: 0,
62
+ lastError: 'x',
63
+ closedUndelivered: 0,
64
+ closedBy: 'op',
65
+ closedAt: 1,
66
+ contributions: [{ grantId: 'g', itemKey: 'i', months: 3, sourceService: 's', sourceReference: 'r', campaignId: 'c', addedAt: 1 }],
67
+ recharges: [{ folio: 'RW-g-i-M1', rechargeNumber: 1, status: MobileTopupRechargeStatusEnum.PAID, at: 1, summary: 's' }],
68
+ updatedAt: 1,
69
+ } satisfies MobileTopupPlanResponse;
70
+ expect(plan.pending).toBe(2);
71
+ });
72
+
73
+ it('BackofficeGrantItemResponse acepta type opcional', () => {
74
+ const item = new BackofficeGrantItemResponse();
75
+ item.type = 'MOBILE_TOPUP';
76
+ expect(item.type).toBe('MOBILE_TOPUP');
77
+ });
78
+ });
@@ -18,11 +18,11 @@ describe('espera por tope de nivel (WAITING_LIMIT)', () => {
18
18
  expect(Object.values(LimitWaitReasonEnum)).toHaveLength(2);
19
19
  });
20
20
 
21
- it('RewardItemCodeEnum contiene los tres códigos', () => {
21
+ it('RewardItemCodeEnum contiene los cinco códigos', () => {
22
22
  expect(Object.values(RewardItemCodeEnum)).toEqual(
23
- expect.arrayContaining(['AMOUNT_ABOVE_MAX', 'LIMIT_WAIT_EXPIRED', 'OUTCOME_UNKNOWN']),
23
+ expect.arrayContaining(['AMOUNT_ABOVE_MAX', 'LIMIT_WAIT_EXPIRED', 'OUTCOME_UNKNOWN', 'TOPUP_REJECTED', 'ITEM_DISMISSED']),
24
24
  );
25
- expect(Object.values(RewardItemCodeEnum)).toHaveLength(3);
25
+ expect(Object.values(RewardItemCodeEnum)).toHaveLength(5);
26
26
  });
27
27
 
28
28
  it('BackofficeGrantItemResponse acepta los campos de espera', () => {
@@ -0,0 +1,59 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import { TransactionProcessor } from '../../../src/index';
5
+ import { AuthorizeRewardTopupRequest } from '../../../src/transactionProcessor/index';
6
+
7
+ const VALID = {
8
+ idempotencyKey: 'RW-' + 'a'.repeat(32) + '-bait3m-M1',
9
+ directoryId: 'dir-1',
10
+ phone: '5512345678',
11
+ moduleName: 'multicenter',
12
+ benefitId: 'b1',
13
+ leafId: 'l1',
14
+ productId: 'p1',
15
+ amount: 15,
16
+ concept: 'Recarga Bait de recompensa',
17
+ };
18
+
19
+ async function invalidProperties(body: Record<string, unknown>): Promise<string[]> {
20
+ const dto = plainToInstance(AuthorizeRewardTopupRequest, body);
21
+ return (await validate(dto as object)).map((e) => e.property);
22
+ }
23
+
24
+ describe('AuthorizeRewardTopupRequest', () => {
25
+ it('acepta un request válido', async () => {
26
+ expect(await invalidProperties(VALID)).toEqual([]);
27
+ expect(VALID.idempotencyKey.length).toBeLessThanOrEqual(60);
28
+ });
29
+
30
+ it('acepta idempotencyKey de exactamente 60 y rechaza 61', async () => {
31
+ expect(await invalidProperties({ ...VALID, idempotencyKey: 'k'.repeat(60) })).toEqual([]);
32
+ expect(await invalidProperties({ ...VALID, idempotencyKey: 'k'.repeat(61) })).toContain('idempotencyKey');
33
+ });
34
+
35
+ it('rechaza idempotencyKey con #', async () => {
36
+ expect(await invalidProperties({ ...VALID, idempotencyKey: 'RW-a#b' })).toContain('idempotencyKey');
37
+ });
38
+
39
+ it.each([0, -1, 10.005])('rechaza amount %s', async (amount) => {
40
+ expect(await invalidProperties({ ...VALID, amount })).toContain('amount');
41
+ });
42
+
43
+ it('acepta amount 15 y 15.5', async () => {
44
+ expect(await invalidProperties({ ...VALID, amount: 15 })).not.toContain('amount');
45
+ expect(await invalidProperties({ ...VALID, amount: 15.5 })).not.toContain('amount');
46
+ });
47
+
48
+ it('rechaza phone de 9 dígitos', async () => {
49
+ expect(await invalidProperties({ ...VALID, phone: '551234567' })).toContain('phone');
50
+ });
51
+
52
+ it('rechaza concept de 121', async () => {
53
+ expect(await invalidProperties({ ...VALID, concept: 'c'.repeat(121) })).toContain('concept');
54
+ });
55
+
56
+ it('sale por el index raíz', () => {
57
+ expect(new TransactionProcessor.AuthorizeRewardTopupRequest()).toBeInstanceOf(AuthorizeRewardTopupRequest);
58
+ });
59
+ });
@@ -0,0 +1,17 @@
1
+ import { TransactionProcessorCodesEnum } from '../../../src/transactionProcessor/enums/TransactionProcessorCodesEnum';
2
+
3
+ describe('TransactionProcessorCodesEnum recarga de recompensa', () => {
4
+ it.each([
5
+ 'REWARD_TOPUP_PROVIDER_REJECTED',
6
+ 'REWARD_TOPUP_UNAVAILABLE',
7
+ 'REWARD_TOPUP_OUTCOME_UNKNOWN',
8
+ 'REWARD_TOPUP_IN_FLIGHT',
9
+ ] as const)('%s vale su propio nombre', (code) => {
10
+ expect(TransactionProcessorCodesEnum[code]).toBe(code);
11
+ });
12
+
13
+ it('INVALID_REQUEST y TRANSACTION_APPROVED no cambian', () => {
14
+ expect(TransactionProcessorCodesEnum.INVALID_REQUEST).toBe('INVALID_REQUEST');
15
+ expect(TransactionProcessorCodesEnum.TRANSACTION_APPROVED).toBe('TRANSACTION_APPROVED');
16
+ });
17
+ });
@@ -1,5 +1,6 @@
1
1
  import { CurrencyId } from '../../currency/enums/CurrencyId';
2
2
  import { DisbursementType } from '../enums/DisbursementType';
3
+ import { DisburseTopupDetail } from './DisburseTopupDetail';
3
4
  /** Dispersión síncrona: el motor deposita `amount` pesos al titular por el riel de `disbursementType`. */
4
5
  export declare class DisburseRequest {
5
6
  tenantId: string;
@@ -17,4 +18,6 @@ export declare class DisburseRequest {
17
18
  concept: string;
18
19
  /** Id del llamador para rastreo: asiento, crédito. */
19
20
  reference?: string;
21
+ /** Datos de la recarga. Obligatorio si `disbursementType` es `MEX_REWARD_TOPUP`; en otros tipos se ignora. */
22
+ topup?: DisburseTopupDetail;
20
23
  }
@@ -10,9 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DisburseRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
13
14
  const class_validator_1 = require("class-validator");
14
15
  const CurrencyId_1 = require("../../currency/enums/CurrencyId");
15
16
  const DisbursementType_1 = require("../enums/DisbursementType");
17
+ const DisburseTopupDetail_1 = require("./DisburseTopupDetail");
16
18
  /** Dispersión síncrona: el motor deposita `amount` pesos al titular por el riel de `disbursementType`. */
17
19
  class DisburseRequest {
18
20
  }
@@ -62,3 +64,10 @@ __decorate([
62
64
  (0, class_validator_1.IsString)(),
63
65
  __metadata("design:type", String)
64
66
  ], DisburseRequest.prototype, "reference", void 0);
67
+ __decorate([
68
+ (0, class_validator_1.ValidateIf)((o) => o.disbursementType === DisbursementType_1.DisbursementType.MEX_REWARD_TOPUP),
69
+ (0, class_validator_1.IsDefined)(),
70
+ (0, class_validator_1.ValidateNested)(),
71
+ (0, class_transformer_1.Type)(() => DisburseTopupDetail_1.DisburseTopupDetail),
72
+ __metadata("design:type", DisburseTopupDetail_1.DisburseTopupDetail)
73
+ ], DisburseRequest.prototype, "topup", void 0);
@@ -0,0 +1,9 @@
1
+ /** Datos de la recarga Bait de una dispersión `MEX_REWARD_TOPUP`. */
2
+ export declare class DisburseTopupDetail {
3
+ /** Celular MX normalizado a 10 dígitos. */
4
+ phone: string;
5
+ moduleName: string;
6
+ benefitId: string;
7
+ leafId: string;
8
+ productId: string;
9
+ }
@@ -0,0 +1,46 @@
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.DisburseTopupDetail = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ /** Datos de la recarga Bait de una dispersión `MEX_REWARD_TOPUP`. */
15
+ class DisburseTopupDetail {
16
+ }
17
+ exports.DisburseTopupDetail = DisburseTopupDetail;
18
+ __decorate([
19
+ (0, class_validator_1.IsString)(),
20
+ (0, class_validator_1.Matches)(/^[0-9]{10}$/),
21
+ __metadata("design:type", String)
22
+ ], DisburseTopupDetail.prototype, "phone", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsNotEmpty)(),
26
+ (0, class_validator_1.MaxLength)(64),
27
+ __metadata("design:type", String)
28
+ ], DisburseTopupDetail.prototype, "moduleName", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ (0, class_validator_1.MaxLength)(64),
33
+ __metadata("design:type", String)
34
+ ], DisburseTopupDetail.prototype, "benefitId", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ (0, class_validator_1.IsNotEmpty)(),
38
+ (0, class_validator_1.MaxLength)(256),
39
+ __metadata("design:type", String)
40
+ ], DisburseTopupDetail.prototype, "leafId", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsNotEmpty)(),
44
+ (0, class_validator_1.MaxLength)(64),
45
+ __metadata("design:type", String)
46
+ ], DisburseTopupDetail.prototype, "productId", void 0);
@@ -8,5 +8,7 @@ export declare enum DisbursementType {
8
8
  /** Comisión de vendedor. */
9
9
  MEX_SELLER_COMMISSION = "MEX_SELLER_COMMISSION",
10
10
  /** Abono de recompensas de `rewards-business`. */
11
- MEX_REWARD = "MEX_REWARD"
11
+ MEX_REWARD = "MEX_REWARD",
12
+ /** Recarga Bait de recompensas de `rewards-business`. */
13
+ MEX_REWARD_TOPUP = "MEX_REWARD_TOPUP"
12
14
  }
@@ -13,4 +13,6 @@ var DisbursementType;
13
13
  DisbursementType["MEX_SELLER_COMMISSION"] = "MEX_SELLER_COMMISSION";
14
14
  /** Abono de recompensas de `rewards-business`. */
15
15
  DisbursementType["MEX_REWARD"] = "MEX_REWARD";
16
+ /** Recarga Bait de recompensas de `rewards-business`. */
17
+ DisbursementType["MEX_REWARD_TOPUP"] = "MEX_REWARD_TOPUP";
16
18
  })(DisbursementType || (exports.DisbursementType = DisbursementType = {}));
@@ -30,6 +30,7 @@ export * from './dtos/RegisterCollectibleResponse';
30
30
  export * from './dtos/CollectionPricingDto';
31
31
  export * from './dtos/ResolvePendingChargesRequest';
32
32
  export * from './dtos/MoneyInEvent';
33
+ export * from './dtos/DisburseTopupDetail';
33
34
  export * from './dtos/DisburseRequest';
34
35
  export * from './dtos/DisburseResponse';
35
36
  export * from './dtos/CollectionIntentSummaryDto';
@@ -49,6 +49,7 @@ __exportStar(require("./dtos/RegisterCollectibleResponse"), exports);
49
49
  __exportStar(require("./dtos/CollectionPricingDto"), exports);
50
50
  __exportStar(require("./dtos/ResolvePendingChargesRequest"), exports);
51
51
  __exportStar(require("./dtos/MoneyInEvent"), exports);
52
+ __exportStar(require("./dtos/DisburseTopupDetail"), exports);
52
53
  __exportStar(require("./dtos/DisburseRequest"), exports);
53
54
  __exportStar(require("./dtos/DisburseResponse"), exports);
54
55
  // DTOs — backoffice de monitoreo
@@ -61,6 +61,7 @@ export declare enum ProductSubtypeEnum {
61
61
  SUREKEEP_BONUS_MX = "BONUS_MX",
62
62
  SUREKEEP_SELLER_COMMISSION_MX = "SELLER_COMMISSION_MX",
63
63
  REWARD_MX = "REWARD_MX",
64
+ REWARD_TOPUP_MX = "REWARD_TOPUP_MX",
64
65
  STORE_PHONE = "PHONE",
65
66
  REFUND_PCF_DICTAMEN_PROCEDE = "DICTAMEN_PROCEDE",
66
67
  REFUND_PCF_AUTO_T2_SIN_2FA = "AUTO_T2_SIN_2FA",
@@ -80,6 +80,8 @@ var ProductSubtypeEnum;
80
80
  //REWARDS
81
81
  // Abono de recompensas de `rewards-business`.
82
82
  ProductSubtypeEnum["REWARD_MX"] = "REWARD_MX";
83
+ // Recarga Bait de recompensas de `rewards-business`.
84
+ ProductSubtypeEnum["REWARD_TOPUP_MX"] = "REWARD_TOPUP_MX";
83
85
  //STORE
84
86
  ProductSubtypeEnum["STORE_PHONE"] = "PHONE";
85
87
  // REFUND_PCF
@@ -4,6 +4,8 @@ import { BackofficeGrantAttemptResponse } from './BackofficeGrantAttemptResponse
4
4
  export declare class BackofficeGrantItemResponse extends GrantItemResponse {
5
5
  /** Nombre de la recompensa congelada en la entrega. */
6
6
  name: string;
7
+ /** Tipo de recompensa congelado en la entrega (ej. `'MOBILE_TOPUP'`). */
8
+ type?: string;
7
9
  attempts: BackofficeGrantAttemptResponse[];
8
10
  /** Motivo de la espera por tope; solo cuando el ítem está en `WAITING_LIMIT`. */
9
11
  waitReason?: LimitWaitReasonEnum;
@@ -0,0 +1,10 @@
1
+ /** Guarda la configuración de la recarga Bait (producto en Multicenter y precio mensual). */
2
+ export declare class MobileTopupConfigRequest {
3
+ moduleName: string;
4
+ benefitId: string;
5
+ leafId: string;
6
+ productId: string;
7
+ monthlyPrice: number;
8
+ /** Candado optimista: versión que el operador vio al editar. */
9
+ expectedVersion?: number;
10
+ }
@@ -0,0 +1,59 @@
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.MobileTopupConfigRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /** Guarda la configuración de la recarga Bait (producto en Multicenter y precio mensual). */
16
+ class MobileTopupConfigRequest {
17
+ }
18
+ exports.MobileTopupConfigRequest = MobileTopupConfigRequest;
19
+ __decorate([
20
+ (0, class_transformer_1.Expose)(),
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ (0, class_validator_1.MaxLength)(100),
24
+ __metadata("design:type", String)
25
+ ], MobileTopupConfigRequest.prototype, "moduleName", void 0);
26
+ __decorate([
27
+ (0, class_transformer_1.Expose)(),
28
+ (0, class_validator_1.IsString)(),
29
+ (0, class_validator_1.IsNotEmpty)(),
30
+ (0, class_validator_1.MaxLength)(100),
31
+ __metadata("design:type", String)
32
+ ], MobileTopupConfigRequest.prototype, "benefitId", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsString)(),
36
+ (0, class_validator_1.IsNotEmpty)(),
37
+ (0, class_validator_1.MaxLength)(100),
38
+ __metadata("design:type", String)
39
+ ], MobileTopupConfigRequest.prototype, "leafId", void 0);
40
+ __decorate([
41
+ (0, class_transformer_1.Expose)(),
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsNotEmpty)(),
44
+ (0, class_validator_1.MaxLength)(100),
45
+ __metadata("design:type", String)
46
+ ], MobileTopupConfigRequest.prototype, "productId", void 0);
47
+ __decorate([
48
+ (0, class_transformer_1.Expose)(),
49
+ (0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
50
+ (0, class_validator_1.IsPositive)(),
51
+ __metadata("design:type", Number)
52
+ ], MobileTopupConfigRequest.prototype, "monthlyPrice", void 0);
53
+ __decorate([
54
+ (0, class_transformer_1.Expose)(),
55
+ (0, class_validator_1.IsOptional)(),
56
+ (0, class_validator_1.IsInt)(),
57
+ (0, class_validator_1.Min)(1),
58
+ __metadata("design:type", Number)
59
+ ], MobileTopupConfigRequest.prototype, "expectedVersion", void 0);
@@ -0,0 +1,15 @@
1
+ export interface MobileTopupConfigResponse {
2
+ moduleName: string;
3
+ benefitId: string;
4
+ leafId: string;
5
+ productId: string;
6
+ monthlyPrice: number;
7
+ currency: 'MXN';
8
+ version: number;
9
+ updatedBy: string;
10
+ updatedAt: number;
11
+ /** Ítems del catálogo `MOBILE_TOPUP` recalculados al guardar. */
12
+ repricedItems?: number;
13
+ /** Ítems omitidos por conflicto de versión. */
14
+ skippedItems?: number;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ export interface MobileTopupContributionResponse {
2
+ grantId: string;
3
+ itemKey: string;
4
+ months: number;
5
+ sourceService: string;
6
+ sourceReference: string;
7
+ campaignId?: string;
8
+ addedAt: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { MobileTopupPlanResponse } from './MobileTopupPlanResponse';
2
+ export interface MobileTopupPlanListResponse {
3
+ items: MobileTopupPlanResponse[];
4
+ truncated: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { MobileTopupPlanStatusEnum } from '../../enums/MobileTopupPlanStatusEnum';
2
+ import { MobileTopupContributionResponse } from './MobileTopupContributionResponse';
3
+ import { MobileTopupRechargeResponse } from './MobileTopupRechargeResponse';
4
+ /** Calendario de recargas Bait de un número. */
5
+ export interface MobileTopupPlanResponse {
6
+ phone: string;
7
+ status: MobileTopupPlanStatusEnum;
8
+ promised: number;
9
+ done: number;
10
+ pending: number;
11
+ nextDueAt?: number;
12
+ lastRechargeAt?: number;
13
+ lastFolio?: string;
14
+ failedAttempts: number;
15
+ lastError?: string;
16
+ closedUndelivered?: number;
17
+ closedBy?: string;
18
+ closedAt?: number;
19
+ contributions: MobileTopupContributionResponse[];
20
+ recharges?: MobileTopupRechargeResponse[];
21
+ updatedAt: number;
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { MobileTopupRechargeStatusEnum } from '../../enums/MobileTopupRechargeStatusEnum';
2
+ export interface MobileTopupRechargeResponse {
3
+ folio: string;
4
+ rechargeNumber: number;
5
+ status: MobileTopupRechargeStatusEnum;
6
+ at: number;
7
+ summary?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /** Estado del calendario de recargas Bait de un número. */
2
+ export declare enum MobileTopupPlanStatusEnum {
3
+ ACTIVE = "ACTIVE",
4
+ NEEDS_ATTENTION = "NEEDS_ATTENTION",
5
+ DONE = "DONE"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileTopupPlanStatusEnum = void 0;
4
+ /** Estado del calendario de recargas Bait de un número. */
5
+ var MobileTopupPlanStatusEnum;
6
+ (function (MobileTopupPlanStatusEnum) {
7
+ MobileTopupPlanStatusEnum["ACTIVE"] = "ACTIVE";
8
+ MobileTopupPlanStatusEnum["NEEDS_ATTENTION"] = "NEEDS_ATTENTION";
9
+ MobileTopupPlanStatusEnum["DONE"] = "DONE";
10
+ })(MobileTopupPlanStatusEnum || (exports.MobileTopupPlanStatusEnum = MobileTopupPlanStatusEnum = {}));
@@ -0,0 +1,7 @@
1
+ /** Resultado de una recarga mensual del calendario. */
2
+ export declare enum MobileTopupRechargeStatusEnum {
3
+ PAID = "PAID",
4
+ REJECTED = "REJECTED",
5
+ UNCONFIRMED = "UNCONFIRMED",
6
+ NOT_DELIVERED = "NOT_DELIVERED"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileTopupRechargeStatusEnum = void 0;
4
+ /** Resultado de una recarga mensual del calendario. */
5
+ var MobileTopupRechargeStatusEnum;
6
+ (function (MobileTopupRechargeStatusEnum) {
7
+ MobileTopupRechargeStatusEnum["PAID"] = "PAID";
8
+ MobileTopupRechargeStatusEnum["REJECTED"] = "REJECTED";
9
+ MobileTopupRechargeStatusEnum["UNCONFIRMED"] = "UNCONFIRMED";
10
+ MobileTopupRechargeStatusEnum["NOT_DELIVERED"] = "NOT_DELIVERED";
11
+ })(MobileTopupRechargeStatusEnum || (exports.MobileTopupRechargeStatusEnum = MobileTopupRechargeStatusEnum = {}));
@@ -5,5 +5,9 @@ export declare enum RewardItemCodeEnum {
5
5
  /** Venció la espera por tope (30 días desde `waitingSince`). */
6
6
  LIMIT_WAIT_EXPIRED = "LIMIT_WAIT_EXPIRED",
7
7
  /** Resultado desconocido agotado: no se puede asegurar si el abono ocurrió. */
8
- OUTCOME_UNKNOWN = "OUTCOME_UNKNOWN"
8
+ OUTCOME_UNKNOWN = "OUTCOME_UNKNOWN",
9
+ /** Bait rechazó la recarga de forma permanente: queda en atención del operador. */
10
+ TOPUP_REJECTED = "TOPUP_REJECTED",
11
+ /** Un operador dio el ítem por fallido. */
12
+ ITEM_DISMISSED = "ITEM_DISMISSED"
9
13
  }
@@ -10,4 +10,8 @@ var RewardItemCodeEnum;
10
10
  RewardItemCodeEnum["LIMIT_WAIT_EXPIRED"] = "LIMIT_WAIT_EXPIRED";
11
11
  /** Resultado desconocido agotado: no se puede asegurar si el abono ocurrió. */
12
12
  RewardItemCodeEnum["OUTCOME_UNKNOWN"] = "OUTCOME_UNKNOWN";
13
+ /** Bait rechazó la recarga de forma permanente: queda en atención del operador. */
14
+ RewardItemCodeEnum["TOPUP_REJECTED"] = "TOPUP_REJECTED";
15
+ /** Un operador dio el ítem por fallido. */
16
+ RewardItemCodeEnum["ITEM_DISMISSED"] = "ITEM_DISMISSED";
13
17
  })(RewardItemCodeEnum || (exports.RewardItemCodeEnum = RewardItemCodeEnum = {}));
@@ -12,6 +12,8 @@ export * from './enums/RewardsErrorCodeEnum';
12
12
  export * from './enums/DeliveryDimensionEnum';
13
13
  export * from './enums/DeliveryTopDimensionEnum';
14
14
  export * from './enums/DeliveryTopByEnum';
15
+ export * from './enums/MobileTopupPlanStatusEnum';
16
+ export * from './enums/MobileTopupRechargeStatusEnum';
15
17
  export * from './types/RewardInputs';
16
18
  export * from './dtos/RewardCost';
17
19
  export * from './dtos/RewardChargeTo';
@@ -56,3 +58,9 @@ export * from './dtos/backoffice/DeliveryMetricsQuery';
56
58
  export * from './dtos/backoffice/DeliveryTopQuery';
57
59
  export * from './dtos/backoffice/DeliveryMetricsPoint';
58
60
  export * from './dtos/backoffice/DeliveryTopEntry';
61
+ export * from './dtos/backoffice/MobileTopupConfigRequest';
62
+ export * from './dtos/backoffice/MobileTopupConfigResponse';
63
+ export * from './dtos/backoffice/MobileTopupContributionResponse';
64
+ export * from './dtos/backoffice/MobileTopupRechargeResponse';
65
+ export * from './dtos/backoffice/MobileTopupPlanResponse';
66
+ export * from './dtos/backoffice/MobileTopupPlanListResponse';
@@ -29,6 +29,8 @@ __exportStar(require("./enums/RewardsErrorCodeEnum"), exports);
29
29
  __exportStar(require("./enums/DeliveryDimensionEnum"), exports);
30
30
  __exportStar(require("./enums/DeliveryTopDimensionEnum"), exports);
31
31
  __exportStar(require("./enums/DeliveryTopByEnum"), exports);
32
+ __exportStar(require("./enums/MobileTopupPlanStatusEnum"), exports);
33
+ __exportStar(require("./enums/MobileTopupRechargeStatusEnum"), exports);
32
34
  //Types
33
35
  __exportStar(require("./types/RewardInputs"), exports);
34
36
  //DTOs
@@ -81,3 +83,9 @@ __exportStar(require("./dtos/backoffice/DeliveryMetricsQuery"), exports);
81
83
  __exportStar(require("./dtos/backoffice/DeliveryTopQuery"), exports);
82
84
  __exportStar(require("./dtos/backoffice/DeliveryMetricsPoint"), exports);
83
85
  __exportStar(require("./dtos/backoffice/DeliveryTopEntry"), exports);
86
+ __exportStar(require("./dtos/backoffice/MobileTopupConfigRequest"), exports);
87
+ __exportStar(require("./dtos/backoffice/MobileTopupConfigResponse"), exports);
88
+ __exportStar(require("./dtos/backoffice/MobileTopupContributionResponse"), exports);
89
+ __exportStar(require("./dtos/backoffice/MobileTopupRechargeResponse"), exports);
90
+ __exportStar(require("./dtos/backoffice/MobileTopupPlanResponse"), exports);
91
+ __exportStar(require("./dtos/backoffice/MobileTopupPlanListResponse"), exports);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Pago de una recarga Bait de recompensa (`MEX_REWARD_TOPUP`). No toca ninguna wallet.
3
+ *
4
+ * `idempotencyKey` ≤ 60: el folio del proveedor admite 64 y se reservan 4 caracteres para el
5
+ * sufijo `-{k}` del folio por intento.
6
+ */
7
+ export declare class AuthorizeRewardTopupRequest {
8
+ idempotencyKey: string;
9
+ /** Titular beneficiario de la recompensa. */
10
+ directoryId: string;
11
+ /** Celular MX normalizado a 10 dígitos. */
12
+ phone: string;
13
+ moduleName: string;
14
+ benefitId: string;
15
+ leafId: string;
16
+ productId: string;
17
+ /** En PESOS, no centavos. */
18
+ amount: number;
19
+ concept: string;
20
+ }
21
+ export default AuthorizeRewardTopupRequest;
@@ -0,0 +1,74 @@
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.AuthorizeRewardTopupRequest = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ /**
15
+ * Pago de una recarga Bait de recompensa (`MEX_REWARD_TOPUP`). No toca ninguna wallet.
16
+ *
17
+ * `idempotencyKey` ≤ 60: el folio del proveedor admite 64 y se reservan 4 caracteres para el
18
+ * sufijo `-{k}` del folio por intento.
19
+ */
20
+ class AuthorizeRewardTopupRequest {
21
+ }
22
+ exports.AuthorizeRewardTopupRequest = AuthorizeRewardTopupRequest;
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsNotEmpty)(),
26
+ (0, class_validator_1.MaxLength)(60),
27
+ (0, class_validator_1.Matches)(/^[^#]+$/),
28
+ __metadata("design:type", String)
29
+ ], AuthorizeRewardTopupRequest.prototype, "idempotencyKey", void 0);
30
+ __decorate([
31
+ (0, class_validator_1.IsString)(),
32
+ (0, class_validator_1.IsNotEmpty)(),
33
+ __metadata("design:type", String)
34
+ ], AuthorizeRewardTopupRequest.prototype, "directoryId", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ (0, class_validator_1.Matches)(/^[0-9]{10}$/),
38
+ __metadata("design:type", String)
39
+ ], AuthorizeRewardTopupRequest.prototype, "phone", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsString)(),
42
+ (0, class_validator_1.IsNotEmpty)(),
43
+ (0, class_validator_1.MaxLength)(64),
44
+ __metadata("design:type", String)
45
+ ], AuthorizeRewardTopupRequest.prototype, "moduleName", void 0);
46
+ __decorate([
47
+ (0, class_validator_1.IsString)(),
48
+ (0, class_validator_1.IsNotEmpty)(),
49
+ (0, class_validator_1.MaxLength)(64),
50
+ __metadata("design:type", String)
51
+ ], AuthorizeRewardTopupRequest.prototype, "benefitId", void 0);
52
+ __decorate([
53
+ (0, class_validator_1.IsString)(),
54
+ (0, class_validator_1.IsNotEmpty)(),
55
+ (0, class_validator_1.MaxLength)(256),
56
+ __metadata("design:type", String)
57
+ ], AuthorizeRewardTopupRequest.prototype, "leafId", void 0);
58
+ __decorate([
59
+ (0, class_validator_1.IsString)(),
60
+ (0, class_validator_1.IsNotEmpty)(),
61
+ (0, class_validator_1.MaxLength)(64),
62
+ __metadata("design:type", String)
63
+ ], AuthorizeRewardTopupRequest.prototype, "productId", void 0);
64
+ __decorate([
65
+ (0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
66
+ (0, class_validator_1.IsPositive)(),
67
+ __metadata("design:type", Number)
68
+ ], AuthorizeRewardTopupRequest.prototype, "amount", void 0);
69
+ __decorate([
70
+ (0, class_validator_1.IsString)(),
71
+ (0, class_validator_1.MaxLength)(120),
72
+ __metadata("design:type", String)
73
+ ], AuthorizeRewardTopupRequest.prototype, "concept", void 0);
74
+ exports.default = AuthorizeRewardTopupRequest;
@@ -19,5 +19,13 @@ export declare enum TransactionProcessorCodesEnum {
19
19
  BLOCKED_SECRET_NUMBER = "BLOCKED_SECRET_NUMBER",
20
20
  PROVIDER_NOT_FOUND = "PROVIDER_NOT_FOUND",
21
21
  /** El request no cumple el contrato del DTO. Nada tocó saldo. */
22
- INVALID_REQUEST = "INVALID_REQUEST"
22
+ INVALID_REQUEST = "INVALID_REQUEST",
23
+ /** Recarga de recompensa: el proveedor la rechazó de forma permanente (o se agotaron los intentos de folio). */
24
+ REWARD_TOPUP_PROVIDER_REJECTED = "REWARD_TOPUP_PROVIDER_REJECTED",
25
+ /** Recarga de recompensa: rechazo transitorio del proveedor; reintentable con la misma llave. */
26
+ REWARD_TOPUP_UNAVAILABLE = "REWARD_TOPUP_UNAVAILABLE",
27
+ /** Recarga de recompensa: resultado desconocido (timeout/PENDING); no se repaga. */
28
+ REWARD_TOPUP_OUTCOME_UNKNOWN = "REWARD_TOPUP_OUTCOME_UNKNOWN",
29
+ /** Recarga de recompensa: la llave de idempotencia sigue en vuelo. */
30
+ REWARD_TOPUP_IN_FLIGHT = "REWARD_TOPUP_IN_FLIGHT"
23
31
  }
@@ -24,4 +24,12 @@ var TransactionProcessorCodesEnum;
24
24
  TransactionProcessorCodesEnum["PROVIDER_NOT_FOUND"] = "PROVIDER_NOT_FOUND";
25
25
  /** El request no cumple el contrato del DTO. Nada tocó saldo. */
26
26
  TransactionProcessorCodesEnum["INVALID_REQUEST"] = "INVALID_REQUEST";
27
+ /** Recarga de recompensa: el proveedor la rechazó de forma permanente (o se agotaron los intentos de folio). */
28
+ TransactionProcessorCodesEnum["REWARD_TOPUP_PROVIDER_REJECTED"] = "REWARD_TOPUP_PROVIDER_REJECTED";
29
+ /** Recarga de recompensa: rechazo transitorio del proveedor; reintentable con la misma llave. */
30
+ TransactionProcessorCodesEnum["REWARD_TOPUP_UNAVAILABLE"] = "REWARD_TOPUP_UNAVAILABLE";
31
+ /** Recarga de recompensa: resultado desconocido (timeout/PENDING); no se repaga. */
32
+ TransactionProcessorCodesEnum["REWARD_TOPUP_OUTCOME_UNKNOWN"] = "REWARD_TOPUP_OUTCOME_UNKNOWN";
33
+ /** Recarga de recompensa: la llave de idempotencia sigue en vuelo. */
34
+ TransactionProcessorCodesEnum["REWARD_TOPUP_IN_FLIGHT"] = "REWARD_TOPUP_IN_FLIGHT";
27
35
  })(TransactionProcessorCodesEnum || (exports.TransactionProcessorCodesEnum = TransactionProcessorCodesEnum = {}));
@@ -11,6 +11,7 @@ export * from './dtos/AuthorizeSpeiBankTransferNcRequest';
11
11
  export * from './dtos/AuthorizeCollectorTransactionRequest';
12
12
  export * from './dtos/AuthorizeDisputeTransactionRequest';
13
13
  export * from './dtos/AuthorizeBonusRequest';
14
+ export * from './dtos/AuthorizeRewardTopupRequest';
14
15
  export * from './dtos/CardInfo';
15
16
  export * from './dtos/InstallmentsInfo';
16
17
  export * from './dtos/MerchantInfo';
@@ -27,6 +27,7 @@ __exportStar(require("./dtos/AuthorizeSpeiBankTransferNcRequest"), exports);
27
27
  __exportStar(require("./dtos/AuthorizeCollectorTransactionRequest"), exports);
28
28
  __exportStar(require("./dtos/AuthorizeDisputeTransactionRequest"), exports);
29
29
  __exportStar(require("./dtos/AuthorizeBonusRequest"), exports);
30
+ __exportStar(require("./dtos/AuthorizeRewardTopupRequest"), exports);
30
31
  __exportStar(require("./dtos/CardInfo"), exports);
31
32
  __exportStar(require("./dtos/InstallmentsInfo"), exports);
32
33
  __exportStar(require("./dtos/MerchantInfo"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.644.0",
3
+ "version": "3.645.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -1,6 +1,8 @@
1
- import { IsEnum, IsIn, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, Matches, MaxLength } from 'class-validator';
1
+ import { Type } from 'class-transformer';
2
+ import { IsDefined, IsEnum, IsIn, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, Matches, MaxLength, ValidateIf, ValidateNested } from 'class-validator';
2
3
  import { CurrencyId } from '../../currency/enums/CurrencyId';
3
4
  import { DisbursementType } from '../enums/DisbursementType';
5
+ import { DisburseTopupDetail } from './DisburseTopupDetail';
4
6
 
5
7
  /** Dispersión síncrona: el motor deposita `amount` pesos al titular por el riel de `disbursementType`. */
6
8
  export class DisburseRequest {
@@ -27,4 +29,11 @@ export class DisburseRequest {
27
29
 
28
30
  /** Id del llamador para rastreo: asiento, crédito. */
29
31
  @IsOptional() @IsString() reference?: string;
32
+
33
+ /** Datos de la recarga. Obligatorio si `disbursementType` es `MEX_REWARD_TOPUP`; en otros tipos se ignora. */
34
+ @ValidateIf((o: DisburseRequest) => o.disbursementType === DisbursementType.MEX_REWARD_TOPUP)
35
+ @IsDefined()
36
+ @ValidateNested()
37
+ @Type(() => DisburseTopupDetail)
38
+ topup?: DisburseTopupDetail;
30
39
  }
@@ -0,0 +1,15 @@
1
+ import { IsNotEmpty, IsString, Matches, MaxLength } from 'class-validator';
2
+
3
+ /** Datos de la recarga Bait de una dispersión `MEX_REWARD_TOPUP`. */
4
+ export class DisburseTopupDetail {
5
+ /** Celular MX normalizado a 10 dígitos. */
6
+ @IsString() @Matches(/^[0-9]{10}$/) phone!: string;
7
+
8
+ @IsString() @IsNotEmpty() @MaxLength(64) moduleName!: string;
9
+
10
+ @IsString() @IsNotEmpty() @MaxLength(64) benefitId!: string;
11
+
12
+ @IsString() @IsNotEmpty() @MaxLength(256) leafId!: string;
13
+
14
+ @IsString() @IsNotEmpty() @MaxLength(64) productId!: string;
15
+ }
@@ -9,4 +9,6 @@ export enum DisbursementType {
9
9
  MEX_SELLER_COMMISSION = 'MEX_SELLER_COMMISSION',
10
10
  /** Abono de recompensas de `rewards-business`. */
11
11
  MEX_REWARD = 'MEX_REWARD',
12
+ /** Recarga Bait de recompensas de `rewards-business`. */
13
+ MEX_REWARD_TOPUP = 'MEX_REWARD_TOPUP',
12
14
  }
@@ -35,6 +35,7 @@ export * from './dtos/RegisterCollectibleResponse';
35
35
  export * from './dtos/CollectionPricingDto';
36
36
  export * from './dtos/ResolvePendingChargesRequest';
37
37
  export * from './dtos/MoneyInEvent';
38
+ export * from './dtos/DisburseTopupDetail';
38
39
  export * from './dtos/DisburseRequest';
39
40
  export * from './dtos/DisburseResponse';
40
41
 
@@ -89,6 +89,8 @@ export enum ProductSubtypeEnum {
89
89
  //REWARDS
90
90
  // Abono de recompensas de `rewards-business`.
91
91
  REWARD_MX = "REWARD_MX",
92
+ // Recarga Bait de recompensas de `rewards-business`.
93
+ REWARD_TOPUP_MX = "REWARD_TOPUP_MX",
92
94
 
93
95
  //STORE
94
96
  STORE_PHONE = "PHONE",
@@ -5,6 +5,8 @@ import { BackofficeGrantAttemptResponse } from './BackofficeGrantAttemptResponse
5
5
  export class BackofficeGrantItemResponse extends GrantItemResponse {
6
6
  /** Nombre de la recompensa congelada en la entrega. */
7
7
  name: string;
8
+ /** Tipo de recompensa congelado en la entrega (ej. `'MOBILE_TOPUP'`). */
9
+ type?: string;
8
10
  attempts: BackofficeGrantAttemptResponse[];
9
11
  /** Motivo de la espera por tope; solo cuando el ítem está en `WAITING_LIMIT`. */
10
12
  waitReason?: LimitWaitReasonEnum;
@@ -0,0 +1,41 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsInt, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, MaxLength, Min } from 'class-validator';
3
+
4
+ /** Guarda la configuración de la recarga Bait (producto en Multicenter y precio mensual). */
5
+ export class MobileTopupConfigRequest {
6
+ @Expose()
7
+ @IsString()
8
+ @IsNotEmpty()
9
+ @MaxLength(100)
10
+ moduleName: string;
11
+
12
+ @Expose()
13
+ @IsString()
14
+ @IsNotEmpty()
15
+ @MaxLength(100)
16
+ benefitId: string;
17
+
18
+ @Expose()
19
+ @IsString()
20
+ @IsNotEmpty()
21
+ @MaxLength(100)
22
+ leafId: string;
23
+
24
+ @Expose()
25
+ @IsString()
26
+ @IsNotEmpty()
27
+ @MaxLength(100)
28
+ productId: string;
29
+
30
+ @Expose()
31
+ @IsNumber({ maxDecimalPlaces: 2 })
32
+ @IsPositive()
33
+ monthlyPrice: number;
34
+
35
+ /** Candado optimista: versión que el operador vio al editar. */
36
+ @Expose()
37
+ @IsOptional()
38
+ @IsInt()
39
+ @Min(1)
40
+ expectedVersion?: number;
41
+ }
@@ -0,0 +1,15 @@
1
+ export interface MobileTopupConfigResponse {
2
+ moduleName: string;
3
+ benefitId: string;
4
+ leafId: string;
5
+ productId: string;
6
+ monthlyPrice: number;
7
+ currency: 'MXN';
8
+ version: number;
9
+ updatedBy: string;
10
+ updatedAt: number;
11
+ /** Ítems del catálogo `MOBILE_TOPUP` recalculados al guardar. */
12
+ repricedItems?: number;
13
+ /** Ítems omitidos por conflicto de versión. */
14
+ skippedItems?: number;
15
+ }
@@ -0,0 +1,9 @@
1
+ export interface MobileTopupContributionResponse {
2
+ grantId: string;
3
+ itemKey: string;
4
+ months: number;
5
+ sourceService: string;
6
+ sourceReference: string;
7
+ campaignId?: string;
8
+ addedAt: number;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { MobileTopupPlanResponse } from './MobileTopupPlanResponse';
2
+
3
+ export interface MobileTopupPlanListResponse {
4
+ items: MobileTopupPlanResponse[];
5
+ truncated: boolean;
6
+ }
@@ -0,0 +1,23 @@
1
+ import { MobileTopupPlanStatusEnum } from '../../enums/MobileTopupPlanStatusEnum';
2
+ import { MobileTopupContributionResponse } from './MobileTopupContributionResponse';
3
+ import { MobileTopupRechargeResponse } from './MobileTopupRechargeResponse';
4
+
5
+ /** Calendario de recargas Bait de un número. */
6
+ export interface MobileTopupPlanResponse {
7
+ phone: string;
8
+ status: MobileTopupPlanStatusEnum;
9
+ promised: number;
10
+ done: number;
11
+ pending: number;
12
+ nextDueAt?: number;
13
+ lastRechargeAt?: number;
14
+ lastFolio?: string;
15
+ failedAttempts: number;
16
+ lastError?: string;
17
+ closedUndelivered?: number;
18
+ closedBy?: string;
19
+ closedAt?: number;
20
+ contributions: MobileTopupContributionResponse[];
21
+ recharges?: MobileTopupRechargeResponse[];
22
+ updatedAt: number;
23
+ }
@@ -0,0 +1,9 @@
1
+ import { MobileTopupRechargeStatusEnum } from '../../enums/MobileTopupRechargeStatusEnum';
2
+
3
+ export interface MobileTopupRechargeResponse {
4
+ folio: string;
5
+ rechargeNumber: number;
6
+ status: MobileTopupRechargeStatusEnum;
7
+ at: number;
8
+ summary?: string;
9
+ }
@@ -0,0 +1,6 @@
1
+ /** Estado del calendario de recargas Bait de un número. */
2
+ export enum MobileTopupPlanStatusEnum {
3
+ ACTIVE = 'ACTIVE',
4
+ NEEDS_ATTENTION = 'NEEDS_ATTENTION',
5
+ DONE = 'DONE',
6
+ }
@@ -0,0 +1,7 @@
1
+ /** Resultado de una recarga mensual del calendario. */
2
+ export enum MobileTopupRechargeStatusEnum {
3
+ PAID = 'PAID',
4
+ REJECTED = 'REJECTED',
5
+ UNCONFIRMED = 'UNCONFIRMED',
6
+ NOT_DELIVERED = 'NOT_DELIVERED',
7
+ }
@@ -6,4 +6,8 @@ export enum RewardItemCodeEnum {
6
6
  LIMIT_WAIT_EXPIRED = 'LIMIT_WAIT_EXPIRED',
7
7
  /** Resultado desconocido agotado: no se puede asegurar si el abono ocurrió. */
8
8
  OUTCOME_UNKNOWN = 'OUTCOME_UNKNOWN',
9
+ /** Bait rechazó la recarga de forma permanente: queda en atención del operador. */
10
+ TOPUP_REJECTED = 'TOPUP_REJECTED',
11
+ /** Un operador dio el ítem por fallido. */
12
+ ITEM_DISMISSED = 'ITEM_DISMISSED',
9
13
  }
@@ -13,6 +13,8 @@ export * from './enums/RewardsErrorCodeEnum';
13
13
  export * from './enums/DeliveryDimensionEnum';
14
14
  export * from './enums/DeliveryTopDimensionEnum';
15
15
  export * from './enums/DeliveryTopByEnum';
16
+ export * from './enums/MobileTopupPlanStatusEnum';
17
+ export * from './enums/MobileTopupRechargeStatusEnum';
16
18
 
17
19
  //Types
18
20
  export * from './types/RewardInputs';
@@ -73,3 +75,9 @@ export * from './dtos/backoffice/DeliveryMetricsQuery';
73
75
  export * from './dtos/backoffice/DeliveryTopQuery';
74
76
  export * from './dtos/backoffice/DeliveryMetricsPoint';
75
77
  export * from './dtos/backoffice/DeliveryTopEntry';
78
+ export * from './dtos/backoffice/MobileTopupConfigRequest';
79
+ export * from './dtos/backoffice/MobileTopupConfigResponse';
80
+ export * from './dtos/backoffice/MobileTopupContributionResponse';
81
+ export * from './dtos/backoffice/MobileTopupRechargeResponse';
82
+ export * from './dtos/backoffice/MobileTopupPlanResponse';
83
+ export * from './dtos/backoffice/MobileTopupPlanListResponse';
@@ -0,0 +1,44 @@
1
+ import { IsNotEmpty, IsNumber, IsPositive, IsString, Matches, MaxLength } from 'class-validator';
2
+
3
+ /**
4
+ * Pago de una recarga Bait de recompensa (`MEX_REWARD_TOPUP`). No toca ninguna wallet.
5
+ *
6
+ * `idempotencyKey` ≤ 60: el folio del proveedor admite 64 y se reservan 4 caracteres para el
7
+ * sufijo `-{k}` del folio por intento.
8
+ */
9
+ export class AuthorizeRewardTopupRequest {
10
+ @IsString()
11
+ @IsNotEmpty()
12
+ @MaxLength(60)
13
+ @Matches(/^[^#]+$/)
14
+ idempotencyKey: string;
15
+
16
+ /** Titular beneficiario de la recompensa. */
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ directoryId: string;
20
+
21
+ /** Celular MX normalizado a 10 dígitos. */
22
+ @IsString()
23
+ @Matches(/^[0-9]{10}$/)
24
+ phone: string;
25
+
26
+ @IsString() @IsNotEmpty() @MaxLength(64) moduleName: string;
27
+
28
+ @IsString() @IsNotEmpty() @MaxLength(64) benefitId: string;
29
+
30
+ @IsString() @IsNotEmpty() @MaxLength(256) leafId: string;
31
+
32
+ @IsString() @IsNotEmpty() @MaxLength(64) productId: string;
33
+
34
+ /** En PESOS, no centavos. */
35
+ @IsNumber({ maxDecimalPlaces: 2 })
36
+ @IsPositive()
37
+ amount: number;
38
+
39
+ @IsString()
40
+ @MaxLength(120)
41
+ concept: string;
42
+ }
43
+
44
+ export default AuthorizeRewardTopupRequest;
@@ -20,4 +20,12 @@ export enum TransactionProcessorCodesEnum {
20
20
  PROVIDER_NOT_FOUND = "PROVIDER_NOT_FOUND",
21
21
  /** El request no cumple el contrato del DTO. Nada tocó saldo. */
22
22
  INVALID_REQUEST = "INVALID_REQUEST",
23
+ /** Recarga de recompensa: el proveedor la rechazó de forma permanente (o se agotaron los intentos de folio). */
24
+ REWARD_TOPUP_PROVIDER_REJECTED = "REWARD_TOPUP_PROVIDER_REJECTED",
25
+ /** Recarga de recompensa: rechazo transitorio del proveedor; reintentable con la misma llave. */
26
+ REWARD_TOPUP_UNAVAILABLE = "REWARD_TOPUP_UNAVAILABLE",
27
+ /** Recarga de recompensa: resultado desconocido (timeout/PENDING); no se repaga. */
28
+ REWARD_TOPUP_OUTCOME_UNKNOWN = "REWARD_TOPUP_OUTCOME_UNKNOWN",
29
+ /** Recarga de recompensa: la llave de idempotencia sigue en vuelo. */
30
+ REWARD_TOPUP_IN_FLIGHT = "REWARD_TOPUP_IN_FLIGHT",
23
31
  }
@@ -11,6 +11,7 @@ export * from './dtos/AuthorizeSpeiBankTransferNcRequest';
11
11
  export * from './dtos/AuthorizeCollectorTransactionRequest';
12
12
  export * from './dtos/AuthorizeDisputeTransactionRequest';
13
13
  export * from './dtos/AuthorizeBonusRequest';
14
+ export * from './dtos/AuthorizeRewardTopupRequest';
14
15
  export * from './dtos/CardInfo';
15
16
  export * from './dtos/InstallmentsInfo';
16
17
  export * from './dtos/MerchantInfo';