@fiado/type-kit 3.563.0 → 3.565.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 (133) hide show
  1. package/_test_/unit/retailCustomer/customerReferralContract.test.ts +228 -0
  2. package/_test_/unit/retailCustomer/welcomeBonusRequests.test.ts +1 -1
  3. package/_test_/unit/retailPromotions/constants.test.ts +1 -1
  4. package/_test_/unit/retailPromotions/referralPromotion.test.ts +177 -0
  5. package/_test_/unit/retailPromotions/referralRewardsByPhones.test.ts +73 -0
  6. package/_test_/unit/retailPromotions/salePromotionPaymentCheck.test.ts +26 -0
  7. package/_test_/unit/retailPromotions/welcomeBonusPromotion.test.ts +34 -0
  8. package/_test_/unit/retailWizard/backofficeCustomerReferrals.test.ts +78 -0
  9. package/_test_/unit/retailWizard/promotionInboundMessages.test.ts +151 -0
  10. package/_test_/unit/retailWizard/referralsCapture.test.ts +66 -0
  11. package/_test_/unit/retailWizard/ventaSagaMessages.test.ts +7 -2
  12. package/bin/retailCustomer/dtos/CustomerReferral.d.ts +25 -0
  13. package/bin/retailCustomer/dtos/CustomerReferral.js +99 -0
  14. package/bin/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.d.ts +19 -0
  15. package/bin/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.js +101 -0
  16. package/bin/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.d.ts +4 -0
  17. package/bin/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.js +28 -0
  18. package/bin/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.d.ts +6 -0
  19. package/bin/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.js +39 -0
  20. package/bin/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.d.ts +8 -0
  21. package/bin/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.js +53 -0
  22. package/bin/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.d.ts +4 -0
  23. package/bin/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.js +15 -0
  24. package/bin/retailCustomer/dtos/responses/CustomerReferralResponses.d.ts +39 -0
  25. package/bin/retailCustomer/dtos/responses/CustomerReferralResponses.js +2 -0
  26. package/bin/retailCustomer/enums/ReferralRoleEnum.d.ts +5 -0
  27. package/bin/retailCustomer/enums/ReferralRoleEnum.js +9 -0
  28. package/bin/retailCustomer/enums/ReferralSourceEnum.d.ts +6 -0
  29. package/bin/retailCustomer/enums/ReferralSourceEnum.js +10 -0
  30. package/bin/retailCustomer/enums/ReferralStatusEnum.d.ts +7 -0
  31. package/bin/retailCustomer/enums/ReferralStatusEnum.js +11 -0
  32. package/bin/retailCustomer/enums/WelcomeBonusAmountSourceEnum.d.ts +3 -1
  33. package/bin/retailCustomer/enums/WelcomeBonusAmountSourceEnum.js +2 -0
  34. package/bin/retailCustomer/index.d.ts +9 -0
  35. package/bin/retailCustomer/index.js +9 -0
  36. package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.js +4 -0
  37. package/bin/retailPromotions/dtos/ReferralPromotion.d.ts +33 -0
  38. package/bin/retailPromotions/dtos/ReferralPromotion.js +2 -0
  39. package/bin/retailPromotions/dtos/SalePromotion.d.ts +6 -0
  40. package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.d.ts +5 -0
  41. package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.js +24 -0
  42. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.d.ts +3 -0
  43. package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.js +8 -0
  44. package/bin/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.d.ts +5 -0
  45. package/bin/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.js +34 -0
  46. package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.d.ts +6 -1
  47. package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.js +15 -1
  48. package/bin/retailPromotions/dtos/requests/ReferralPromotionInput.d.ts +24 -0
  49. package/bin/retailPromotions/dtos/requests/ReferralPromotionInput.js +119 -0
  50. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.d.ts +3 -0
  51. package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.js +8 -0
  52. package/bin/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.d.ts +25 -0
  53. package/bin/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.js +2 -0
  54. package/bin/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.d.ts +16 -0
  55. package/bin/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.js +2 -0
  56. package/bin/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.d.ts +6 -0
  57. package/bin/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.js +2 -0
  58. package/bin/retailPromotions/enums/ReferralPromotionChannelEnum.d.ts +5 -0
  59. package/bin/retailPromotions/enums/ReferralPromotionChannelEnum.js +9 -0
  60. package/bin/retailPromotions/enums/ReferralRewardStatusEnum.d.ts +9 -0
  61. package/bin/retailPromotions/enums/ReferralRewardStatusEnum.js +13 -0
  62. package/bin/retailPromotions/enums/ReferralRewardTypeEnum.d.ts +10 -0
  63. package/bin/retailPromotions/enums/ReferralRewardTypeEnum.js +14 -0
  64. package/bin/retailPromotions/enums/ReferralTriggerEnum.d.ts +13 -0
  65. package/bin/retailPromotions/enums/ReferralTriggerEnum.js +17 -0
  66. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.d.ts +9 -1
  67. package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.js +8 -0
  68. package/bin/retailPromotions/enums/SalePromotionKindEnum.d.ts +3 -2
  69. package/bin/retailPromotions/enums/SalePromotionKindEnum.js +2 -1
  70. package/bin/retailPromotions/enums/SalePromotionSystemKeyEnum.d.ts +5 -0
  71. package/bin/retailPromotions/enums/SalePromotionSystemKeyEnum.js +9 -0
  72. package/bin/retailPromotions/index.d.ts +12 -0
  73. package/bin/retailPromotions/index.js +12 -0
  74. package/bin/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.d.ts +58 -0
  75. package/bin/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.js +2 -0
  76. package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.d.ts +4 -2
  77. package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.js +3 -1
  78. package/bin/retailWizard/enums/WizardStepEnum.d.ts +3 -1
  79. package/bin/retailWizard/enums/WizardStepEnum.js +2 -0
  80. package/bin/retailWizard/events/RetailCommissionInboundMessage.d.ts +7 -0
  81. package/bin/retailWizard/events/RetailCommissionInboundMessage.js +22 -1
  82. package/bin/retailWizard/events/RetailPromotionAccountOpenedMessage.d.ts +15 -0
  83. package/bin/retailWizard/events/RetailPromotionAccountOpenedMessage.js +56 -0
  84. package/bin/retailWizard/events/RetailPromotionInboundMessage.d.ts +15 -0
  85. package/bin/retailWizard/events/RetailPromotionInboundMessage.js +41 -1
  86. package/bin/retailWizard/events/RetailPromotionInstallmentPaidMessage.d.ts +20 -0
  87. package/bin/retailWizard/events/RetailPromotionInstallmentPaidMessage.js +75 -0
  88. package/bin/retailWizard/events/RetailPromotionQueueMessage.d.ts +5 -0
  89. package/bin/retailWizard/events/RetailPromotionQueueMessage.js +2 -0
  90. package/bin/retailWizard/index.d.ts +4 -0
  91. package/bin/retailWizard/index.js +4 -0
  92. package/package.json +1 -1
  93. package/src/retailCustomer/dtos/CustomerReferral.ts +77 -0
  94. package/src/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.ts +91 -0
  95. package/src/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.ts +15 -0
  96. package/src/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.ts +23 -0
  97. package/src/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.ts +38 -0
  98. package/src/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.ts +15 -1
  99. package/src/retailCustomer/dtos/responses/CustomerReferralResponses.ts +46 -0
  100. package/src/retailCustomer/enums/ReferralRoleEnum.ts +5 -0
  101. package/src/retailCustomer/enums/ReferralSourceEnum.ts +6 -0
  102. package/src/retailCustomer/enums/ReferralStatusEnum.ts +7 -0
  103. package/src/retailCustomer/enums/WelcomeBonusAmountSourceEnum.ts +2 -0
  104. package/src/retailCustomer/index.ts +9 -0
  105. package/src/retailPromotions/constants/retailPromotionsErrorHttpStatus.ts +4 -0
  106. package/src/retailPromotions/dtos/ReferralPromotion.ts +35 -0
  107. package/src/retailPromotions/dtos/SalePromotion.ts +6 -0
  108. package/src/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.ts +10 -0
  109. package/src/retailPromotions/dtos/requests/CreateSalePromotionRequest.ts +8 -0
  110. package/src/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.ts +20 -0
  111. package/src/retailPromotions/dtos/requests/ListSalePromotionsQuery.ts +14 -1
  112. package/src/retailPromotions/dtos/requests/ReferralPromotionInput.ts +93 -0
  113. package/src/retailPromotions/dtos/requests/UpdateSalePromotionRequest.ts +8 -0
  114. package/src/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.ts +28 -0
  115. package/src/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.ts +17 -0
  116. package/src/retailPromotions/dtos/responses/WelcomeBonusPromotionResponse.ts +6 -0
  117. package/src/retailPromotions/enums/ReferralPromotionChannelEnum.ts +5 -0
  118. package/src/retailPromotions/enums/ReferralRewardStatusEnum.ts +9 -0
  119. package/src/retailPromotions/enums/ReferralRewardTypeEnum.ts +10 -0
  120. package/src/retailPromotions/enums/ReferralTriggerEnum.ts +13 -0
  121. package/src/retailPromotions/enums/RetailPromotionsErrorCodeEnum.ts +8 -0
  122. package/src/retailPromotions/enums/SalePromotionKindEnum.ts +2 -1
  123. package/src/retailPromotions/enums/SalePromotionSystemKeyEnum.ts +5 -0
  124. package/src/retailPromotions/index.ts +12 -0
  125. package/src/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.ts +63 -0
  126. package/src/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.ts +3 -1
  127. package/src/retailWizard/enums/WizardStepEnum.ts +2 -0
  128. package/src/retailWizard/events/RetailCommissionInboundMessage.ts +18 -0
  129. package/src/retailWizard/events/RetailPromotionAccountOpenedMessage.ts +38 -0
  130. package/src/retailWizard/events/RetailPromotionInboundMessage.ts +43 -1
  131. package/src/retailWizard/events/RetailPromotionInstallmentPaidMessage.ts +53 -0
  132. package/src/retailWizard/events/RetailPromotionQueueMessage.ts +9 -0
  133. package/src/retailWizard/index.ts +4 -0
@@ -0,0 +1,20 @@
1
+ import { LoanInstallmentStatusEnum } from '../../loanCredit/enums/LoanInstallmentStatusEnum';
2
+ import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
3
+ /** Cuota pagada que loan-credit publica en RetailPromotionInboundQueue: `InstallmentPaidV1` + contexto. Sin PII. */
4
+ export declare class RetailPromotionInstallmentPaidMessage {
5
+ type: RetailPromotionInboundMessageTypeEnum.CREDIT_INSTALLMENT_PAID;
6
+ tenantId: string;
7
+ creditId: string;
8
+ installmentNumber: number;
9
+ /** Lo pagado de la cuota en total, en centavos. */
10
+ paidCents: number;
11
+ paidAt: string;
12
+ installmentStatus: LoanInstallmentStatusEnum;
13
+ paymentId: string;
14
+ wizardSessionId: string;
15
+ storeId: string;
16
+ /** Pagada a más tardar en su vencimiento. */
17
+ onTime: boolean;
18
+ /** Cuotas seguidas a tiempo hasta esta, incluida; 0 si esta fue tarde. */
19
+ onTimeStreak: number;
20
+ }
@@ -0,0 +1,75 @@
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.RetailPromotionInstallmentPaidMessage = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const LoanInstallmentStatusEnum_1 = require("../../loanCredit/enums/LoanInstallmentStatusEnum");
15
+ const RetailPromotionInboundMessageTypeEnum_1 = require("../enums/RetailPromotionInboundMessageTypeEnum");
16
+ /** Cuota pagada que loan-credit publica en RetailPromotionInboundQueue: `InstallmentPaidV1` + contexto. Sin PII. */
17
+ class RetailPromotionInstallmentPaidMessage {
18
+ }
19
+ exports.RetailPromotionInstallmentPaidMessage = RetailPromotionInstallmentPaidMessage;
20
+ __decorate([
21
+ (0, class_validator_1.Equals)(RetailPromotionInboundMessageTypeEnum_1.RetailPromotionInboundMessageTypeEnum.CREDIT_INSTALLMENT_PAID),
22
+ __metadata("design:type", String)
23
+ ], RetailPromotionInstallmentPaidMessage.prototype, "type", void 0);
24
+ __decorate([
25
+ (0, class_validator_1.IsString)(),
26
+ (0, class_validator_1.IsNotEmpty)(),
27
+ __metadata("design:type", String)
28
+ ], RetailPromotionInstallmentPaidMessage.prototype, "tenantId", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ __metadata("design:type", String)
33
+ ], RetailPromotionInstallmentPaidMessage.prototype, "creditId", void 0);
34
+ __decorate([
35
+ (0, class_validator_1.IsInt)(),
36
+ (0, class_validator_1.Min)(1),
37
+ __metadata("design:type", Number)
38
+ ], RetailPromotionInstallmentPaidMessage.prototype, "installmentNumber", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsInt)(),
41
+ (0, class_validator_1.Min)(0),
42
+ __metadata("design:type", Number)
43
+ ], RetailPromotionInstallmentPaidMessage.prototype, "paidCents", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsISO8601)(),
46
+ __metadata("design:type", String)
47
+ ], RetailPromotionInstallmentPaidMessage.prototype, "paidAt", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsEnum)(LoanInstallmentStatusEnum_1.LoanInstallmentStatusEnum),
50
+ __metadata("design:type", String)
51
+ ], RetailPromotionInstallmentPaidMessage.prototype, "installmentStatus", void 0);
52
+ __decorate([
53
+ (0, class_validator_1.IsString)(),
54
+ (0, class_validator_1.IsNotEmpty)(),
55
+ __metadata("design:type", String)
56
+ ], RetailPromotionInstallmentPaidMessage.prototype, "paymentId", void 0);
57
+ __decorate([
58
+ (0, class_validator_1.IsString)(),
59
+ (0, class_validator_1.IsNotEmpty)(),
60
+ __metadata("design:type", String)
61
+ ], RetailPromotionInstallmentPaidMessage.prototype, "wizardSessionId", void 0);
62
+ __decorate([
63
+ (0, class_validator_1.IsString)(),
64
+ (0, class_validator_1.IsNotEmpty)(),
65
+ __metadata("design:type", String)
66
+ ], RetailPromotionInstallmentPaidMessage.prototype, "storeId", void 0);
67
+ __decorate([
68
+ (0, class_validator_1.IsBoolean)(),
69
+ __metadata("design:type", Boolean)
70
+ ], RetailPromotionInstallmentPaidMessage.prototype, "onTime", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.IsInt)(),
73
+ (0, class_validator_1.Min)(0),
74
+ __metadata("design:type", Number)
75
+ ], RetailPromotionInstallmentPaidMessage.prototype, "onTimeStreak", void 0);
@@ -0,0 +1,5 @@
1
+ import { RetailPromotionAccountOpenedMessage } from './RetailPromotionAccountOpenedMessage';
2
+ import { RetailPromotionInboundMessage } from './RetailPromotionInboundMessage';
3
+ import { RetailPromotionInstallmentPaidMessage } from './RetailPromotionInstallmentPaidMessage';
4
+ /** Cualquier mensaje de RetailPromotionInboundQueue; el `type` dice cuál clase validar. */
5
+ export type RetailPromotionQueueMessage = RetailPromotionInboundMessage | RetailPromotionAccountOpenedMessage | RetailPromotionInstallmentPaidMessage;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -157,6 +157,7 @@ export * from './enums/SellerTableSourceStatusEnum';
157
157
  export * from './dtos/responses/BackofficeSellerTableResponse';
158
158
  export * from './dtos/responses/BackofficeCustomerTableResponse';
159
159
  export * from './dtos/responses/BackofficeAccountOpeningsResponse';
160
+ export * from './dtos/responses/BackofficeCustomerReferralsResponse';
160
161
  export * from './enums/StoreKindEnum';
161
162
  export * from './dtos/responses/BackofficeStoreTableResponse';
162
163
  export * from './enums/StoreMixCategoryEnum';
@@ -169,6 +170,9 @@ export * from './events/SessionExpiredV1';
169
170
  export * from './enums/RetailPromotionInboundMessageTypeEnum';
170
171
  export * from './enums/RetailCommissionInboundMessageTypeEnum';
171
172
  export * from './events/RetailPromotionInboundMessage';
173
+ export * from './events/RetailPromotionAccountOpenedMessage';
174
+ export * from './events/RetailPromotionInstallmentPaidMessage';
175
+ export * from './events/RetailPromotionQueueMessage';
172
176
  export * from './events/RetailCommissionInboundMessage';
173
177
  export * from './enums/WizardSessionLookupStatusEnum';
174
178
  export * from './dtos/WizardSessionLookupEntry';
@@ -190,6 +190,7 @@ __exportStar(require("./enums/SellerTableSourceStatusEnum"), exports);
190
190
  __exportStar(require("./dtos/responses/BackofficeSellerTableResponse"), exports);
191
191
  __exportStar(require("./dtos/responses/BackofficeCustomerTableResponse"), exports);
192
192
  __exportStar(require("./dtos/responses/BackofficeAccountOpeningsResponse"), exports);
193
+ __exportStar(require("./dtos/responses/BackofficeCustomerReferralsResponse"), exports);
193
194
  __exportStar(require("./enums/StoreKindEnum"), exports);
194
195
  __exportStar(require("./dtos/responses/BackofficeStoreTableResponse"), exports);
195
196
  __exportStar(require("./enums/StoreMixCategoryEnum"), exports);
@@ -203,6 +204,9 @@ __exportStar(require("./events/SessionExpiredV1"), exports);
203
204
  __exportStar(require("./enums/RetailPromotionInboundMessageTypeEnum"), exports);
204
205
  __exportStar(require("./enums/RetailCommissionInboundMessageTypeEnum"), exports);
205
206
  __exportStar(require("./events/RetailPromotionInboundMessage"), exports);
207
+ __exportStar(require("./events/RetailPromotionAccountOpenedMessage"), exports);
208
+ __exportStar(require("./events/RetailPromotionInstallmentPaidMessage"), exports);
209
+ __exportStar(require("./events/RetailPromotionQueueMessage"), exports);
206
210
  __exportStar(require("./events/RetailCommissionInboundMessage"), exports);
207
211
  // Lookup privado por lote (GET /private/wizard-sessions/batch)
208
212
  __exportStar(require("./enums/WizardSessionLookupStatusEnum"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.563.0",
3
+ "version": "3.565.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,77 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum, IsISO8601, IsOptional, IsString } from 'class-validator';
3
+ import { ReferralSourceEnum } from '../enums/ReferralSourceEnum';
4
+
5
+ /** Persona que un cliente recomienda (owner: retail-customer-business). Teléfono normalizado a 10 dígitos. */
6
+ export class CustomerReferral {
7
+ @Expose()
8
+ @IsString()
9
+ referralId!: string;
10
+
11
+ /** Cliente que recomienda. */
12
+ @Expose()
13
+ @IsString()
14
+ retailCustomerId!: string;
15
+
16
+ /** Cadena del cliente que recomienda. */
17
+ @Expose()
18
+ @IsString()
19
+ retailerId!: string;
20
+
21
+ /** Tienda de captura; `null` si se agregó en el cajón. */
22
+ @Expose()
23
+ @IsOptional()
24
+ @IsString()
25
+ storeId!: string | null;
26
+
27
+ @Expose()
28
+ @IsString()
29
+ name!: string;
30
+
31
+ @Expose()
32
+ @IsString()
33
+ phone!: string;
34
+
35
+ @Expose()
36
+ @IsOptional()
37
+ @IsString()
38
+ email!: string | null;
39
+
40
+ @Expose()
41
+ @IsEnum(ReferralSourceEnum)
42
+ source!: ReferralSourceEnum;
43
+
44
+ /** Sesión del wizard donde se capturó (venta). */
45
+ @Expose()
46
+ @IsOptional()
47
+ @IsString()
48
+ wizardSessionId!: string | null;
49
+
50
+ /** Solo en `SALE`. */
51
+ @Expose()
52
+ @IsOptional()
53
+ @IsString()
54
+ saleId!: string | null;
55
+
56
+ /** Solo en `OPENING`. */
57
+ @Expose()
58
+ @IsOptional()
59
+ @IsString()
60
+ accountOpeningSessionId!: string | null;
61
+
62
+ @Expose()
63
+ @IsString()
64
+ createdBy!: string;
65
+
66
+ @Expose()
67
+ @IsString()
68
+ updatedBy!: string;
69
+
70
+ @Expose()
71
+ @IsISO8601()
72
+ createdAt!: string;
73
+
74
+ @Expose()
75
+ @IsISO8601()
76
+ updatedAt!: string;
77
+ }
@@ -0,0 +1,91 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import {
3
+ ArrayMinSize,
4
+ IsArray,
5
+ IsEmail,
6
+ IsEnum,
7
+ IsNotEmpty,
8
+ IsOptional,
9
+ IsString,
10
+ MaxLength,
11
+ ValidateIf,
12
+ ValidateNested,
13
+ } from 'class-validator';
14
+ import { Trim } from '../../../common/decorators/Trim';
15
+ import { EMAIL_MAX_LENGTH } from '../../../common/constants/InputPatterns';
16
+ import { ReferralSourceEnum } from '../../enums/ReferralSourceEnum';
17
+
18
+ const REFERRAL_NAME_MAX_LENGTH = 120;
19
+
20
+ /** Un renglón del lote. El teléfono llega como se tecleó; el lambda lo normaliza y valida. */
21
+ export class CustomerReferralInput {
22
+ @Expose()
23
+ @Trim()
24
+ @IsString()
25
+ @IsNotEmpty()
26
+ @MaxLength(REFERRAL_NAME_MAX_LENGTH)
27
+ name!: string;
28
+
29
+ @Expose()
30
+ @Trim()
31
+ @IsString()
32
+ @IsNotEmpty()
33
+ phone!: string;
34
+
35
+ @Expose()
36
+ @IsOptional()
37
+ @Trim()
38
+ @IsEmail()
39
+ @MaxLength(EMAIL_MAX_LENGTH)
40
+ email?: string;
41
+ }
42
+
43
+ /** Body de `privateCreateCustomerReferrals`: lote de referidos de un cliente. */
44
+ export class CreateCustomerReferralsRequest {
45
+ @Expose()
46
+ @IsEnum(ReferralSourceEnum)
47
+ source!: ReferralSourceEnum;
48
+
49
+ /** Tienda de captura; obligatoria en venta y apertura. */
50
+ @Expose()
51
+ @ValidateIf((o: CreateCustomerReferralsRequest) => o.source !== ReferralSourceEnum.BACKOFFICE || o.storeId !== undefined)
52
+ @Trim()
53
+ @IsString()
54
+ @IsNotEmpty()
55
+ storeId?: string;
56
+
57
+ @Expose()
58
+ @IsOptional()
59
+ @Trim()
60
+ @IsString()
61
+ @IsNotEmpty()
62
+ wizardSessionId?: string;
63
+
64
+ @Expose()
65
+ @IsOptional()
66
+ @Trim()
67
+ @IsString()
68
+ @IsNotEmpty()
69
+ saleId?: string;
70
+
71
+ @Expose()
72
+ @IsOptional()
73
+ @Trim()
74
+ @IsString()
75
+ @IsNotEmpty()
76
+ accountOpeningSessionId?: string;
77
+
78
+ /** Usuario que capturó (vendedor o admin); la llamada M2M no lo trae en el token. */
79
+ @Expose()
80
+ @Trim()
81
+ @IsString()
82
+ @IsNotEmpty()
83
+ capturedBy!: string;
84
+
85
+ @Expose()
86
+ @IsArray()
87
+ @ArrayMinSize(1)
88
+ @ValidateNested({ each: true })
89
+ @Type(() => CustomerReferralInput)
90
+ referrals!: CustomerReferralInput[];
91
+ }
@@ -0,0 +1,15 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { ArrayMaxSize, ArrayMinSize, IsArray, IsNotEmpty, IsString } from 'class-validator';
3
+
4
+ const PHONES_MAX_BATCH = 100;
5
+
6
+ /** Body de `privateGetCustomersByPhones`: qué teléfonos ya son clientes. */
7
+ export class GetCustomersByPhonesRequest {
8
+ @Expose()
9
+ @IsArray()
10
+ @ArrayMinSize(1)
11
+ @ArrayMaxSize(PHONES_MAX_BATCH)
12
+ @IsString({ each: true })
13
+ @IsNotEmpty({ each: true })
14
+ phones!: string[];
15
+ }
@@ -0,0 +1,23 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsISO8601, IsNotEmpty, IsOptional, IsString } from 'class-validator';
3
+ import { Trim } from '../../../common/decorators/Trim';
4
+
5
+ /** Query de `privateGetReferralsByPhone`: quién recomendó ese teléfono en la cadena, capturado antes de `before`. */
6
+ export class GetReferralsByPhoneQuery {
7
+ @Expose()
8
+ @Trim()
9
+ @IsString()
10
+ @IsNotEmpty()
11
+ retailerId!: string;
12
+
13
+ @Expose()
14
+ @Trim()
15
+ @IsString()
16
+ @IsNotEmpty()
17
+ phone!: string;
18
+
19
+ @Expose()
20
+ @IsOptional()
21
+ @IsISO8601()
22
+ before?: string;
23
+ }
@@ -0,0 +1,38 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEmail, IsNotEmpty, IsOptional, IsString, MaxLength, ValidateIf } from 'class-validator';
3
+ import { Trim } from '../../../common/decorators/Trim';
4
+ import { EMAIL_MAX_LENGTH } from '../../../common/constants/InputPatterns';
5
+
6
+ const REFERRAL_NAME_MAX_LENGTH = 120;
7
+
8
+ /** Body de `privateUpdateCustomerReferral`: corrige datos sin cambiar dónde se capturó. `email: null` lo quita. */
9
+ export class UpdateCustomerReferralRequest {
10
+ @Expose()
11
+ @IsOptional()
12
+ @Trim()
13
+ @IsString()
14
+ @IsNotEmpty()
15
+ @MaxLength(REFERRAL_NAME_MAX_LENGTH)
16
+ name?: string;
17
+
18
+ @Expose()
19
+ @IsOptional()
20
+ @Trim()
21
+ @IsString()
22
+ @IsNotEmpty()
23
+ phone?: string;
24
+
25
+ @Expose()
26
+ @ValidateIf((o: UpdateCustomerReferralRequest) => o.email !== undefined && o.email !== null)
27
+ @Trim()
28
+ @IsEmail()
29
+ @MaxLength(EMAIL_MAX_LENGTH)
30
+ email?: string | null;
31
+
32
+ /** Usuario que edita; la llamada M2M no lo trae en el token. */
33
+ @Expose()
34
+ @Trim()
35
+ @IsString()
36
+ @IsNotEmpty()
37
+ updatedBy!: string;
38
+ }
@@ -1,7 +1,8 @@
1
1
  import { Expose } from 'class-transformer';
2
- import { IsIn, IsInt, IsNotEmpty, IsOptional, IsPositive, IsString, MaxLength, ValidateIf } from 'class-validator';
2
+ import { IsEnum, IsIn, IsInt, IsNotEmpty, IsOptional, IsPositive, IsString, MaxLength, ValidateIf } from 'class-validator';
3
3
  import { Trim } from '../../../common/decorators/Trim';
4
4
  import { BonusTypeEnum } from '../../enums/BonusTypeEnum';
5
+ import { ReferralRoleEnum } from '../../enums/ReferralRoleEnum';
5
6
  import { WelcomeBonusStatusEnum } from '../../enums/WelcomeBonusStatusEnum';
6
7
 
7
8
  /** Tope del motivo libre que el caller escribe en el asiento. */
@@ -118,4 +119,17 @@ export class UpsertPromotionBonusRequest {
118
119
  @IsString()
119
120
  @IsNotEmpty()
120
121
  sellerRetailUserId?: string;
122
+
123
+ /** Solo en premios de referido: a quién se le paga. */
124
+ @Expose()
125
+ @IsOptional()
126
+ @IsEnum(ReferralRoleEnum)
127
+ role?: ReferralRoleEnum;
128
+
129
+ @Expose()
130
+ @IsOptional()
131
+ @Trim()
132
+ @IsString()
133
+ @IsNotEmpty()
134
+ referralId?: string;
121
135
  }
@@ -0,0 +1,46 @@
1
+ import { CustomerReferral } from '../CustomerReferral';
2
+ import { AccountStatusEnum } from '../../enums/AccountStatusEnum';
3
+ import { ReferralSourceEnum } from '../../enums/ReferralSourceEnum';
4
+
5
+ /** Respuesta de `privateCreateCustomerReferrals`. */
6
+ export interface CreateCustomerReferralsResponse {
7
+ referrals: CustomerReferral[];
8
+ }
9
+
10
+ /** Respuesta de `privateUpdateCustomerReferral`. */
11
+ export interface UpdateCustomerReferralResponse {
12
+ referral: CustomerReferral;
13
+ }
14
+
15
+ /** Respuesta de `privateListCustomerReferrals`. */
16
+ export interface ListCustomerReferralsResponse {
17
+ referrals: CustomerReferral[];
18
+ }
19
+
20
+ /** Quién recomendó un teléfono. */
21
+ export interface ReferralByPhone {
22
+ referralId: string;
23
+ referrerCustomerId: string;
24
+ referrerName: string;
25
+ source: ReferralSourceEnum;
26
+ capturedAt: string;
27
+ }
28
+
29
+ /** Respuesta de `privateGetReferralsByPhone`, del más antiguo al más reciente. */
30
+ export interface ReferralsByPhoneResponse {
31
+ referrals: ReferralByPhone[];
32
+ }
33
+
34
+ /** Teléfono que ya es cliente. */
35
+ export interface CustomerByPhone {
36
+ phone: string;
37
+ retailCustomerId: string;
38
+ retailerId: string;
39
+ /** `null` si la cuenta PCF aún no se pide. */
40
+ accountStatus: AccountStatusEnum | null;
41
+ }
42
+
43
+ /** Respuesta de `privateGetCustomersByPhones`; los teléfonos que no son clientes no aparecen. */
44
+ export interface CustomersByPhonesResponse {
45
+ customers: CustomerByPhone[];
46
+ }
@@ -0,0 +1,5 @@
1
+ /** A quién premia una promo de referido: a quien recomienda o al recomendado. */
2
+ export enum ReferralRoleEnum {
3
+ REFERRER = 'REFERRER',
4
+ REFERRED = 'REFERRED',
5
+ }
@@ -0,0 +1,6 @@
1
+ /** Dónde se capturó un referido: en la venta, en la apertura sin venta o en el cajón del cliente. */
2
+ export enum ReferralSourceEnum {
3
+ SALE = 'SALE',
4
+ OPENING = 'OPENING',
5
+ BACKOFFICE = 'BACKOFFICE',
6
+ }
@@ -0,0 +1,7 @@
1
+ /** Estado del referido en el cajón: aún no compra, abrió su cuenta, ya compró o tiene crédito SureKeep. */
2
+ export enum ReferralStatusEnum {
3
+ NOT_PURCHASED = 'NOT_PURCHASED',
4
+ ACCOUNT_OPENED = 'ACCOUNT_OPENED',
5
+ PURCHASED = 'PURCHASED',
6
+ SUREKEEP_CREDIT = 'SUREKEEP_CREDIT',
7
+ }
@@ -9,4 +9,6 @@ export enum WelcomeBonusAmountSourceEnum {
9
9
  PARAM = 'PARAM',
10
10
  /** Default local del wizard, usado porque `loan-config` no respondió. */
11
11
  DEFAULT = 'DEFAULT',
12
+ /** Monto de la promo de venta de sistema `WELCOME_BONUS` del retailer. */
13
+ SALE_PROMOTION = 'SALE_PROMOTION',
12
14
  }
@@ -9,11 +9,15 @@ export * from './enums/WelcomeBonusStatusEnum';
9
9
  export * from './enums/WelcomeBonusAmountSourceEnum';
10
10
  export * from './enums/WelcomeBonusSettlementStatusEnum';
11
11
  export * from './enums/BonusTypeEnum';
12
+ export * from './enums/ReferralSourceEnum';
13
+ export * from './enums/ReferralStatusEnum';
14
+ export * from './enums/ReferralRoleEnum';
12
15
 
13
16
  // Entidades (planas, con class-validator + @Expose)
14
17
  export * from './dtos/KycReview';
15
18
  export * from './dtos/RetailAddress';
16
19
  export * from './dtos/RetailCustomer';
20
+ export * from './dtos/CustomerReferral';
17
21
 
18
22
  // Request DTOs (input validado por endpoint)
19
23
  export * from './dtos/requests/CreateCustomerRequest';
@@ -24,6 +28,10 @@ export * from './dtos/requests/KycReviewRequest';
24
28
  export * from './dtos/requests/WelcomeAccreditationRequest';
25
29
  export * from './dtos/requests/WelcomeAccreditationResultRequest';
26
30
  export * from './dtos/requests/UpsertPromotionBonusRequest';
31
+ export * from './dtos/requests/CreateCustomerReferralsRequest';
32
+ export * from './dtos/requests/UpdateCustomerReferralRequest';
33
+ export * from './dtos/requests/GetCustomersByPhonesRequest';
34
+ export * from './dtos/requests/GetReferralsByPhoneQuery';
27
35
 
28
36
  // Response DTOs
29
37
  export * from './dtos/responses/CustomerResponse';
@@ -31,6 +39,7 @@ export * from './dtos/responses/Customer360Response';
31
39
  export * from './dtos/responses/WelcomeBonusResponse';
32
40
  export * from './dtos/responses/WelcomeAccreditationResponse';
33
41
  export * from './dtos/responses/PromotionBonusEntryResponse';
42
+ export * from './dtos/responses/CustomerReferralResponses';
34
43
 
35
44
  // Contratos de eventos (PascalCase + sufijo V1)
36
45
  export * from './events/CustomerCreatedV1';
@@ -34,4 +34,8 @@ export const RETAIL_PROMOTIONS_ERROR_HTTP_STATUS: Readonly<Record<C, 400 | 403 |
34
34
  [C.SPLIT_FINANCING_DISABLED]: 409,
35
35
  [C.PROMOTION_NOT_STACKABLE]: 422,
36
36
  [C.PROMOTION_PAYMENT_NOT_ELIGIBLE]: 422,
37
+ [C.SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED]: 422,
38
+ [C.SYSTEM_PROMOTION_FIELD_LOCKED]: 422,
39
+ [C.REFERRAL_REWARD_NEEDS_PURCHASE]: 422,
40
+ [C.INVALID_REFERRAL_TRIGGER]: 400,
37
41
  };
@@ -0,0 +1,35 @@
1
+ import { ReferralPromotionChannelEnum } from '../enums/ReferralPromotionChannelEnum';
2
+ import { ReferralRewardTypeEnum } from '../enums/ReferralRewardTypeEnum';
3
+ import { ReferralTriggerEnum } from '../enums/ReferralTriggerEnum';
4
+ import { CouponLever } from './SalePromotionLevers';
5
+
6
+ /** Premio de un rol; solo trae valor el campo que corresponde a su `type`. */
7
+ export interface ReferralReward {
8
+ type: ReferralRewardTypeEnum;
9
+ /** `FIXED_BONUS`. */
10
+ amountCents: number | null;
11
+ /** `PERCENT_BONUS` y `SALE_DISCOUNT`; 1000 = 10%. */
12
+ percentBps: number | null;
13
+ /** Tope del %; `null` = sin tope. */
14
+ maxAmountCents: number | null;
15
+ /** `COUPON`. */
16
+ coupon: CouponLever | null;
17
+ }
18
+
19
+ /** Evento, condiciones y premios de una promo `REFERRAL`; forma de pago, gama, vigencia y presupuesto son los de la promo. */
20
+ export interface ReferralPromotionConfig {
21
+ channel: ReferralPromotionChannelEnum;
22
+ trigger: ReferralTriggerEnum;
23
+ /** Solo en `NTH_PURCHASE`. */
24
+ purchaseNumber: number | null;
25
+ /** Solo en `INSTALLMENT_STREAK`. */
26
+ installmentStreak: number | null;
27
+ /** Monto mínimo de la compra o del crédito. */
28
+ minAmountCents: number | null;
29
+ /** Días desde la captura del referido. */
30
+ windowDays: number | null;
31
+ maxRewardsPerReferrer: number | null;
32
+ referrerReward: ReferralReward;
33
+ /** `null` = el recomendado no gana nada. */
34
+ referredReward: ReferralReward | null;
35
+ }
@@ -2,12 +2,16 @@ import { PromotionAppliesToEnum } from '../enums/PromotionAppliesToEnum';
2
2
  import { PromotionPaymentOptionEnum } from '../enums/PromotionPaymentOptionEnum';
3
3
  import { SalePromotionPhaseEnum } from '../enums/SalePromotionPhaseEnum';
4
4
  import { SalePromotionStatusEnum } from '../enums/SalePromotionStatusEnum';
5
+ import { SalePromotionSystemKeyEnum } from '../enums/SalePromotionSystemKeyEnum';
6
+ import { ReferralPromotionConfig } from './ReferralPromotion';
5
7
  import { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from './SalePromotionLevers';
6
8
 
7
9
  /** Promo de venta tal como la devuelve el CRUD. Dinero en centavos, fechas ISO. */
8
10
  export interface SalePromotion {
9
11
  promotionId: string;
10
12
  retailerId: string;
13
+ /** Presente solo en promos sembradas por el sistema; ausente en las del admin. */
14
+ systemKey?: SalePromotionSystemKeyEnum;
11
15
  name: string;
12
16
  /** Texto que ve el cliente en el wizard. */
13
17
  customerText: string;
@@ -28,6 +32,8 @@ export interface SalePromotion {
28
32
  oncePerCustomer: boolean;
29
33
  /** Si se puede sumar con otras promos en la misma línea. */
30
34
  stackable: boolean;
35
+ /** Solo en promos `REFERRAL`. */
36
+ referral?: ReferralPromotionConfig | null;
31
37
  status: SalePromotionStatusEnum;
32
38
  /** Derivada; `null` cuando el estado no es `ACTIVE`. */
33
39
  phase: SalePromotionPhaseEnum | null;
@@ -0,0 +1,10 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsEnum } from 'class-validator';
3
+ import { SalePaymentMethodEnum } from '../../../retailWizard/enums/SalePaymentMethodEnum';
4
+
5
+ /** Body de `POST /private/sessions/{sessionId}/sale-promotion/payment-check` (M2M): el medio con que se va a cobrar. */
6
+ export class CheckSalePromotionPaymentRequest {
7
+ @Expose()
8
+ @IsEnum(SalePaymentMethodEnum)
9
+ method!: SalePaymentMethodEnum;
10
+ }
@@ -13,6 +13,7 @@ import {
13
13
  } from 'class-validator';
14
14
  import { PromotionAppliesToEnum } from '../../enums/PromotionAppliesToEnum';
15
15
  import { PromotionPaymentOptionEnum } from '../../enums/PromotionPaymentOptionEnum';
16
+ import { ReferralPromotionInput } from './ReferralPromotionInput';
16
17
  import { SalePromotionLeversInput } from './SalePromotionLeversInput';
17
18
  import { SalePromotionScopeInput, SalePromotionSegmentationInput } from './SalePromotionScopeInput';
18
19
 
@@ -85,4 +86,11 @@ export class CreateSalePromotionRequest {
85
86
  @IsOptional()
86
87
  @IsBoolean()
87
88
  stackable?: boolean;
89
+
90
+ /** Evento, condiciones y premios de la promo de referido; ausente en las demás promos. */
91
+ @Expose()
92
+ @IsOptional()
93
+ @ValidateNested()
94
+ @Type(() => ReferralPromotionInput)
95
+ referral?: ReferralPromotionInput | null;
88
96
  }