@fiado/type-kit 3.564.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.
- package/_test_/unit/retailCustomer/customerReferralContract.test.ts +228 -0
- package/_test_/unit/retailPromotions/constants.test.ts +1 -1
- package/_test_/unit/retailPromotions/referralPromotion.test.ts +177 -0
- package/_test_/unit/retailPromotions/referralRewardsByPhones.test.ts +73 -0
- package/_test_/unit/retailPromotions/salePromotionPaymentCheck.test.ts +26 -0
- package/_test_/unit/retailWizard/backofficeCustomerReferrals.test.ts +78 -0
- package/_test_/unit/retailWizard/promotionInboundMessages.test.ts +151 -0
- package/_test_/unit/retailWizard/referralsCapture.test.ts +66 -0
- package/_test_/unit/retailWizard/ventaSagaMessages.test.ts +7 -2
- package/bin/retailCustomer/dtos/CustomerReferral.d.ts +25 -0
- package/bin/retailCustomer/dtos/CustomerReferral.js +99 -0
- package/bin/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.d.ts +19 -0
- package/bin/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.js +101 -0
- package/bin/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.d.ts +4 -0
- package/bin/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.js +28 -0
- package/bin/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.d.ts +6 -0
- package/bin/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.js +39 -0
- package/bin/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.d.ts +8 -0
- package/bin/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.js +53 -0
- package/bin/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.d.ts +4 -0
- package/bin/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.js +15 -0
- package/bin/retailCustomer/dtos/responses/CustomerReferralResponses.d.ts +39 -0
- package/bin/retailCustomer/dtos/responses/CustomerReferralResponses.js +2 -0
- package/bin/retailCustomer/enums/ReferralRoleEnum.d.ts +5 -0
- package/bin/retailCustomer/enums/ReferralRoleEnum.js +9 -0
- package/bin/retailCustomer/enums/ReferralSourceEnum.d.ts +6 -0
- package/bin/retailCustomer/enums/ReferralSourceEnum.js +10 -0
- package/bin/retailCustomer/enums/ReferralStatusEnum.d.ts +7 -0
- package/bin/retailCustomer/enums/ReferralStatusEnum.js +11 -0
- package/bin/retailCustomer/index.d.ts +9 -0
- package/bin/retailCustomer/index.js +9 -0
- package/bin/retailPromotions/constants/retailPromotionsErrorHttpStatus.js +2 -0
- package/bin/retailPromotions/dtos/ReferralPromotion.d.ts +33 -0
- package/bin/retailPromotions/dtos/ReferralPromotion.js +2 -0
- package/bin/retailPromotions/dtos/SalePromotion.d.ts +3 -0
- package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.d.ts +5 -0
- package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.js +24 -0
- package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.d.ts +3 -0
- package/bin/retailPromotions/dtos/requests/CreateSalePromotionRequest.js +8 -0
- package/bin/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.d.ts +5 -0
- package/bin/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.js +34 -0
- package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.d.ts +6 -1
- package/bin/retailPromotions/dtos/requests/ListSalePromotionsQuery.js +15 -1
- package/bin/retailPromotions/dtos/requests/ReferralPromotionInput.d.ts +24 -0
- package/bin/retailPromotions/dtos/requests/ReferralPromotionInput.js +119 -0
- package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.d.ts +3 -0
- package/bin/retailPromotions/dtos/requests/UpdateSalePromotionRequest.js +8 -0
- package/bin/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.d.ts +25 -0
- package/bin/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.js +2 -0
- package/bin/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.d.ts +16 -0
- package/bin/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.js +2 -0
- package/bin/retailPromotions/enums/ReferralPromotionChannelEnum.d.ts +5 -0
- package/bin/retailPromotions/enums/ReferralPromotionChannelEnum.js +9 -0
- package/bin/retailPromotions/enums/ReferralRewardStatusEnum.d.ts +9 -0
- package/bin/retailPromotions/enums/ReferralRewardStatusEnum.js +13 -0
- package/bin/retailPromotions/enums/ReferralRewardTypeEnum.d.ts +10 -0
- package/bin/retailPromotions/enums/ReferralRewardTypeEnum.js +14 -0
- package/bin/retailPromotions/enums/ReferralTriggerEnum.d.ts +13 -0
- package/bin/retailPromotions/enums/ReferralTriggerEnum.js +17 -0
- package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.d.ts +5 -1
- package/bin/retailPromotions/enums/RetailPromotionsErrorCodeEnum.js +4 -0
- package/bin/retailPromotions/enums/SalePromotionKindEnum.d.ts +3 -2
- package/bin/retailPromotions/enums/SalePromotionKindEnum.js +2 -1
- package/bin/retailPromotions/index.d.ts +10 -0
- package/bin/retailPromotions/index.js +10 -0
- package/bin/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.d.ts +58 -0
- package/bin/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.js +2 -0
- package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.d.ts +4 -2
- package/bin/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.js +3 -1
- package/bin/retailWizard/enums/WizardStepEnum.d.ts +3 -1
- package/bin/retailWizard/enums/WizardStepEnum.js +2 -0
- package/bin/retailWizard/events/RetailCommissionInboundMessage.d.ts +7 -0
- package/bin/retailWizard/events/RetailCommissionInboundMessage.js +22 -1
- package/bin/retailWizard/events/RetailPromotionAccountOpenedMessage.d.ts +15 -0
- package/bin/retailWizard/events/RetailPromotionAccountOpenedMessage.js +56 -0
- package/bin/retailWizard/events/RetailPromotionInboundMessage.d.ts +15 -0
- package/bin/retailWizard/events/RetailPromotionInboundMessage.js +41 -1
- package/bin/retailWizard/events/RetailPromotionInstallmentPaidMessage.d.ts +20 -0
- package/bin/retailWizard/events/RetailPromotionInstallmentPaidMessage.js +75 -0
- package/bin/retailWizard/events/RetailPromotionQueueMessage.d.ts +5 -0
- package/bin/retailWizard/events/RetailPromotionQueueMessage.js +2 -0
- package/bin/retailWizard/index.d.ts +4 -0
- package/bin/retailWizard/index.js +4 -0
- package/package.json +1 -1
- package/src/retailCustomer/dtos/CustomerReferral.ts +77 -0
- package/src/retailCustomer/dtos/requests/CreateCustomerReferralsRequest.ts +91 -0
- package/src/retailCustomer/dtos/requests/GetCustomersByPhonesRequest.ts +15 -0
- package/src/retailCustomer/dtos/requests/GetReferralsByPhoneQuery.ts +23 -0
- package/src/retailCustomer/dtos/requests/UpdateCustomerReferralRequest.ts +38 -0
- package/src/retailCustomer/dtos/requests/UpsertPromotionBonusRequest.ts +15 -1
- package/src/retailCustomer/dtos/responses/CustomerReferralResponses.ts +46 -0
- package/src/retailCustomer/enums/ReferralRoleEnum.ts +5 -0
- package/src/retailCustomer/enums/ReferralSourceEnum.ts +6 -0
- package/src/retailCustomer/enums/ReferralStatusEnum.ts +7 -0
- package/src/retailCustomer/index.ts +9 -0
- package/src/retailPromotions/constants/retailPromotionsErrorHttpStatus.ts +2 -0
- package/src/retailPromotions/dtos/ReferralPromotion.ts +35 -0
- package/src/retailPromotions/dtos/SalePromotion.ts +3 -0
- package/src/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.ts +10 -0
- package/src/retailPromotions/dtos/requests/CreateSalePromotionRequest.ts +8 -0
- package/src/retailPromotions/dtos/requests/GetReferralRewardsByPhonesRequest.ts +20 -0
- package/src/retailPromotions/dtos/requests/ListSalePromotionsQuery.ts +14 -1
- package/src/retailPromotions/dtos/requests/ReferralPromotionInput.ts +93 -0
- package/src/retailPromotions/dtos/requests/UpdateSalePromotionRequest.ts +8 -0
- package/src/retailPromotions/dtos/responses/ReferralRewardsByPhonesResponses.ts +28 -0
- package/src/retailPromotions/dtos/responses/SalePromotionPaymentCheckResponses.ts +17 -0
- package/src/retailPromotions/enums/ReferralPromotionChannelEnum.ts +5 -0
- package/src/retailPromotions/enums/ReferralRewardStatusEnum.ts +9 -0
- package/src/retailPromotions/enums/ReferralRewardTypeEnum.ts +10 -0
- package/src/retailPromotions/enums/ReferralTriggerEnum.ts +13 -0
- package/src/retailPromotions/enums/RetailPromotionsErrorCodeEnum.ts +4 -0
- package/src/retailPromotions/enums/SalePromotionKindEnum.ts +2 -1
- package/src/retailPromotions/index.ts +10 -0
- package/src/retailWizard/dtos/responses/BackofficeCustomerReferralsResponse.ts +63 -0
- package/src/retailWizard/enums/RetailPromotionInboundMessageTypeEnum.ts +3 -1
- package/src/retailWizard/enums/WizardStepEnum.ts +2 -0
- package/src/retailWizard/events/RetailCommissionInboundMessage.ts +18 -0
- package/src/retailWizard/events/RetailPromotionAccountOpenedMessage.ts +38 -0
- package/src/retailWizard/events/RetailPromotionInboundMessage.ts +43 -1
- package/src/retailWizard/events/RetailPromotionInstallmentPaidMessage.ts +53 -0
- package/src/retailWizard/events/RetailPromotionQueueMessage.ts +9 -0
- package/src/retailWizard/index.ts +4 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { IsDefined, IsEnum, IsInt, IsOptional, Max, Min, ValidateIf, ValidateNested } from 'class-validator';
|
|
3
|
+
import { ReferralPromotionChannelEnum } from '../../enums/ReferralPromotionChannelEnum';
|
|
4
|
+
import { ReferralRewardTypeEnum } from '../../enums/ReferralRewardTypeEnum';
|
|
5
|
+
import { ReferralTriggerEnum } from '../../enums/ReferralTriggerEnum';
|
|
6
|
+
import { CouponLeverInput } from './SalePromotionLeversInput';
|
|
7
|
+
|
|
8
|
+
const isPercentReward = (o: ReferralRewardInput): boolean =>
|
|
9
|
+
o.type === ReferralRewardTypeEnum.PERCENT_BONUS || o.type === ReferralRewardTypeEnum.SALE_DISCOUNT;
|
|
10
|
+
|
|
11
|
+
/** Premio de un rol en el body: exige el campo de su `type`. Qué premio vale con qué evento lo valida el lambda (422). */
|
|
12
|
+
export class ReferralRewardInput {
|
|
13
|
+
@Expose()
|
|
14
|
+
@IsEnum(ReferralRewardTypeEnum)
|
|
15
|
+
type!: ReferralRewardTypeEnum;
|
|
16
|
+
|
|
17
|
+
@Expose()
|
|
18
|
+
@ValidateIf((o: ReferralRewardInput) => o.type === ReferralRewardTypeEnum.FIXED_BONUS)
|
|
19
|
+
@IsInt()
|
|
20
|
+
@Min(1)
|
|
21
|
+
amountCents?: number | null;
|
|
22
|
+
|
|
23
|
+
@Expose()
|
|
24
|
+
@ValidateIf(isPercentReward)
|
|
25
|
+
@IsInt()
|
|
26
|
+
@Min(1)
|
|
27
|
+
@Max(10000)
|
|
28
|
+
percentBps?: number | null;
|
|
29
|
+
|
|
30
|
+
@Expose()
|
|
31
|
+
@IsOptional()
|
|
32
|
+
@IsInt()
|
|
33
|
+
@Min(1)
|
|
34
|
+
maxAmountCents?: number | null;
|
|
35
|
+
|
|
36
|
+
@Expose()
|
|
37
|
+
@ValidateIf((o: ReferralRewardInput) => o.type === ReferralRewardTypeEnum.COUPON)
|
|
38
|
+
@IsDefined()
|
|
39
|
+
@ValidateNested()
|
|
40
|
+
@Type(() => CouponLeverInput)
|
|
41
|
+
coupon?: CouponLeverInput | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Bloque `referral` del body de la promo; su presencia la vuelve `REFERRAL`. Compra N y racha ≥ 2 los valida el lambda. */
|
|
45
|
+
export class ReferralPromotionInput {
|
|
46
|
+
@Expose()
|
|
47
|
+
@IsEnum(ReferralPromotionChannelEnum)
|
|
48
|
+
channel!: ReferralPromotionChannelEnum;
|
|
49
|
+
|
|
50
|
+
@Expose()
|
|
51
|
+
@IsEnum(ReferralTriggerEnum)
|
|
52
|
+
trigger!: ReferralTriggerEnum;
|
|
53
|
+
|
|
54
|
+
@Expose()
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@IsInt()
|
|
57
|
+
purchaseNumber?: number | null;
|
|
58
|
+
|
|
59
|
+
@Expose()
|
|
60
|
+
@IsOptional()
|
|
61
|
+
@IsInt()
|
|
62
|
+
installmentStreak?: number | null;
|
|
63
|
+
|
|
64
|
+
@Expose()
|
|
65
|
+
@IsOptional()
|
|
66
|
+
@IsInt()
|
|
67
|
+
@Min(1)
|
|
68
|
+
minAmountCents?: number | null;
|
|
69
|
+
|
|
70
|
+
@Expose()
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsInt()
|
|
73
|
+
@Min(1)
|
|
74
|
+
windowDays?: number | null;
|
|
75
|
+
|
|
76
|
+
@Expose()
|
|
77
|
+
@IsOptional()
|
|
78
|
+
@IsInt()
|
|
79
|
+
@Min(1)
|
|
80
|
+
maxRewardsPerReferrer?: number | null;
|
|
81
|
+
|
|
82
|
+
@Expose()
|
|
83
|
+
@IsDefined()
|
|
84
|
+
@ValidateNested()
|
|
85
|
+
@Type(() => ReferralRewardInput)
|
|
86
|
+
referrerReward!: ReferralRewardInput;
|
|
87
|
+
|
|
88
|
+
@Expose()
|
|
89
|
+
@IsOptional()
|
|
90
|
+
@ValidateNested()
|
|
91
|
+
@Type(() => ReferralRewardInput)
|
|
92
|
+
referredReward?: ReferralRewardInput | null;
|
|
93
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from 'class-validator';
|
|
13
13
|
import { PromotionAppliesToEnum } from '../../enums/PromotionAppliesToEnum';
|
|
14
14
|
import { PromotionPaymentOptionEnum } from '../../enums/PromotionPaymentOptionEnum';
|
|
15
|
+
import { ReferralPromotionInput } from './ReferralPromotionInput';
|
|
15
16
|
import { SalePromotionLeversInput } from './SalePromotionLeversInput';
|
|
16
17
|
import { SalePromotionScopeInput, SalePromotionSegmentationInput } from './SalePromotionScopeInput';
|
|
17
18
|
|
|
@@ -86,4 +87,11 @@ export class UpdateSalePromotionRequest {
|
|
|
86
87
|
@IsOptional()
|
|
87
88
|
@IsBoolean()
|
|
88
89
|
stackable?: boolean;
|
|
90
|
+
|
|
91
|
+
/** Evento, condiciones y premios de la promo de referido; ausente en las demás promos. */
|
|
92
|
+
@Expose()
|
|
93
|
+
@IsOptional()
|
|
94
|
+
@ValidateNested()
|
|
95
|
+
@Type(() => ReferralPromotionInput)
|
|
96
|
+
referral?: ReferralPromotionInput | null;
|
|
89
97
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReferralRoleEnum } from '../../../retailCustomer/enums/ReferralRoleEnum';
|
|
2
|
+
import { ReferralRewardStatusEnum } from '../../enums/ReferralRewardStatusEnum';
|
|
3
|
+
import { ReferralRewardTypeEnum } from '../../enums/ReferralRewardTypeEnum';
|
|
4
|
+
|
|
5
|
+
/** Premio de referido de un teléfono en una promo (candado REWARD#). Sin PII. */
|
|
6
|
+
export interface ReferralRewardByPhone {
|
|
7
|
+
promotionId: string;
|
|
8
|
+
promotionName: string;
|
|
9
|
+
referralId: string;
|
|
10
|
+
role: ReferralRoleEnum;
|
|
11
|
+
rewardType: ReferralRewardTypeEnum;
|
|
12
|
+
/** `null` si el premio no tiene monto en centavos. */
|
|
13
|
+
amountCents: number | null;
|
|
14
|
+
status: ReferralRewardStatusEnum;
|
|
15
|
+
/** Fecha del estado: pago, reserva o anulación. */
|
|
16
|
+
statusAt: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Premios de un teléfono; vacío si no tiene. */
|
|
20
|
+
export interface ReferralRewardsOfPhone {
|
|
21
|
+
phone: string;
|
|
22
|
+
rewards: ReferralRewardByPhone[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Respuesta de la ruta privada de premios por cadena y lote de teléfonos. */
|
|
26
|
+
export interface ReferralRewardsByPhonesResponse {
|
|
27
|
+
phones: ReferralRewardsOfPhone[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** 200 de privateCheckSalePromotionPayment: todas las promos apartadas admiten el medio. */
|
|
2
|
+
export interface PrivateSalePromotionPaymentCheckResponse {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
/** Promos apartadas que se revisaron; vacía si la sesión no tiene promo. */
|
|
5
|
+
checkedPromotionIds: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** `data` del 422 PROMOTION_PAYMENT_NOT_ELIGIBLE; las listas van separadas por coma. */
|
|
9
|
+
export interface PromotionPaymentNotEligibleDetails {
|
|
10
|
+
/** Todas las promos que no admiten el medio. */
|
|
11
|
+
promotionIds: string;
|
|
12
|
+
/** La primera de ellas, para el copy. */
|
|
13
|
+
promotionId: string;
|
|
14
|
+
promotionName: string;
|
|
15
|
+
/** `PromotionPaymentOptionEnum` que acepta esa promo. */
|
|
16
|
+
acceptedOptions: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado del premio de referido en el cajón. Del libro: ACCREDITED → PAID; PENDING y UNVERIFIED → PENDING;
|
|
3
|
+
* FAILED o entrega anulada → NOT_APPLICABLE.
|
|
4
|
+
*/
|
|
5
|
+
export enum ReferralRewardStatusEnum {
|
|
6
|
+
PAID = 'PAID',
|
|
7
|
+
PENDING = 'PENDING',
|
|
8
|
+
NOT_APPLICABLE = 'NOT_APPLICABLE',
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Premio de referido: bono fijo o % de lo que paga el referido (con tope) a cuenta PCF, cupón (solo venta)
|
|
3
|
+
* o descuento en esta venta (solo el recomendado, solo venta).
|
|
4
|
+
*/
|
|
5
|
+
export enum ReferralRewardTypeEnum {
|
|
6
|
+
FIXED_BONUS = 'FIXED_BONUS',
|
|
7
|
+
PERCENT_BONUS = 'PERCENT_BONUS',
|
|
8
|
+
COUPON = 'COUPON',
|
|
9
|
+
SALE_DISCOUNT = 'SALE_DISCOUNT',
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evento del referido que paga la promo. Venta: FIRST_PURCHASE, ACCOUNT_OPENED, ANY_PURCHASE, NTH_PURCHASE.
|
|
3
|
+
* Crédito: CREDIT_ACTIVATED, FIRST_INSTALLMENT, INSTALLMENT_STREAK.
|
|
4
|
+
*/
|
|
5
|
+
export enum ReferralTriggerEnum {
|
|
6
|
+
FIRST_PURCHASE = 'FIRST_PURCHASE',
|
|
7
|
+
ACCOUNT_OPENED = 'ACCOUNT_OPENED',
|
|
8
|
+
ANY_PURCHASE = 'ANY_PURCHASE',
|
|
9
|
+
NTH_PURCHASE = 'NTH_PURCHASE',
|
|
10
|
+
CREDIT_ACTIVATED = 'CREDIT_ACTIVATED',
|
|
11
|
+
FIRST_INSTALLMENT = 'FIRST_INSTALLMENT',
|
|
12
|
+
INSTALLMENT_STREAK = 'INSTALLMENT_STREAK',
|
|
13
|
+
}
|
|
@@ -53,4 +53,8 @@ export enum RetailPromotionsErrorCodeEnum {
|
|
|
53
53
|
SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED = 'SYSTEM_PROMOTION_TRANSITION_NOT_ALLOWED',
|
|
54
54
|
/** De la promo de sistema solo se edita el monto del bono. */
|
|
55
55
|
SYSTEM_PROMOTION_FIELD_LOCKED = 'SYSTEM_PROMOTION_FIELD_LOCKED',
|
|
56
|
+
/** La promo de apertura de cuenta eligió un premio que depende de la compra. */
|
|
57
|
+
REFERRAL_REWARD_NEEDS_PURCHASE = 'REFERRAL_REWARD_NEEDS_PURCHASE',
|
|
58
|
+
/** Evento de referido inválido: compra N o racha menor a 2, o evento de otro canal. */
|
|
59
|
+
INVALID_REFERRAL_TRIGGER = 'INVALID_REFERRAL_TRIGGER',
|
|
56
60
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tipo de promo
|
|
2
|
+
* Tipo de promo: GIFT solo trae regalo y va ligada al teléfono; REFERRAL premia por un referido; SALE es cualquier otra.
|
|
3
3
|
* @enum {string}
|
|
4
4
|
*/
|
|
5
5
|
export enum SalePromotionKindEnum {
|
|
6
6
|
GIFT = 'GIFT',
|
|
7
7
|
SALE = 'SALE',
|
|
8
|
+
REFERRAL = 'REFERRAL',
|
|
8
9
|
}
|
|
@@ -21,6 +21,10 @@ export * from './enums/RetailPromotionsErrorCodeEnum';
|
|
|
21
21
|
export * from './enums/SalePromotionKindEnum';
|
|
22
22
|
export * from './enums/SkuSalePromotionLookupStatusEnum';
|
|
23
23
|
export * from './enums/SalePromotionSystemKeyEnum';
|
|
24
|
+
export * from './enums/ReferralPromotionChannelEnum';
|
|
25
|
+
export * from './enums/ReferralTriggerEnum';
|
|
26
|
+
export * from './enums/ReferralRewardTypeEnum';
|
|
27
|
+
export * from './enums/ReferralRewardStatusEnum';
|
|
24
28
|
|
|
25
29
|
// Constantes y helpers puros
|
|
26
30
|
export * from './constants/retailPromotionsErrorHttpStatus';
|
|
@@ -40,6 +44,7 @@ export * from './dtos/DiscountCode';
|
|
|
40
44
|
export * from './dtos/LinePromotionDiscount';
|
|
41
45
|
export * from './dtos/LinePromotionAmount';
|
|
42
46
|
export * from './dtos/SalePromotionRef';
|
|
47
|
+
export * from './dtos/ReferralPromotion';
|
|
43
48
|
|
|
44
49
|
// Validadores
|
|
45
50
|
export * from './validators/IsHoldModeExclusiveConstraint';
|
|
@@ -48,6 +53,7 @@ export * from './validators/IsHoldModeExclusiveConstraint';
|
|
|
48
53
|
export * from './dtos/requests/DiscountValueInput';
|
|
49
54
|
export * from './dtos/requests/SalePromotionLeversInput';
|
|
50
55
|
export * from './dtos/requests/SalePromotionScopeInput';
|
|
56
|
+
export * from './dtos/requests/ReferralPromotionInput';
|
|
51
57
|
export * from './dtos/requests/CreateSalePromotionRequest';
|
|
52
58
|
export * from './dtos/requests/UpdateSalePromotionRequest';
|
|
53
59
|
export * from './dtos/requests/ChangeSalePromotionStatusRequest';
|
|
@@ -64,6 +70,8 @@ export * from './dtos/requests/HoldSalePromotionRequest';
|
|
|
64
70
|
export * from './dtos/requests/GetSaleCouponQuery';
|
|
65
71
|
export * from './dtos/requests/SkuSalePromotionsQuery';
|
|
66
72
|
export * from './dtos/requests/ActiveSalePromotionsBySkusRequest';
|
|
73
|
+
export * from './dtos/requests/CheckSalePromotionPaymentRequest';
|
|
74
|
+
export * from './dtos/requests/GetReferralRewardsByPhonesRequest';
|
|
67
75
|
|
|
68
76
|
// Response DTOs
|
|
69
77
|
export * from './dtos/responses/SalePromotionCrudResponses';
|
|
@@ -73,3 +81,5 @@ export * from './dtos/responses/SkuSalePromotionsResponse';
|
|
|
73
81
|
export * from './dtos/responses/SalePromotionSegmentsResponse';
|
|
74
82
|
export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';
|
|
75
83
|
export * from './dtos/responses/WelcomeBonusPromotionResponse';
|
|
84
|
+
export * from './dtos/responses/SalePromotionPaymentCheckResponses';
|
|
85
|
+
export * from './dtos/responses/ReferralRewardsByPhonesResponses';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReferralRoleEnum } from '../../../retailCustomer/enums/ReferralRoleEnum';
|
|
2
|
+
import { ReferralSourceEnum } from '../../../retailCustomer/enums/ReferralSourceEnum';
|
|
3
|
+
import { ReferralStatusEnum } from '../../../retailCustomer/enums/ReferralStatusEnum';
|
|
4
|
+
import { ReferralRewardStatusEnum } from '../../../retailPromotions/enums/ReferralRewardStatusEnum';
|
|
5
|
+
import { ReferralRewardTypeEnum } from '../../../retailPromotions/enums/ReferralRewardTypeEnum';
|
|
6
|
+
|
|
7
|
+
/** Premio de referido que muestra el cajón. */
|
|
8
|
+
export interface BackofficeReferralReward {
|
|
9
|
+
promotionId: string;
|
|
10
|
+
promotionName: string;
|
|
11
|
+
role: ReferralRoleEnum;
|
|
12
|
+
rewardType: ReferralRewardTypeEnum;
|
|
13
|
+
amountCents: number | null;
|
|
14
|
+
status: ReferralRewardStatusEnum;
|
|
15
|
+
/** Fecha del estado: pago, reserva o anulación. */
|
|
16
|
+
statusAt: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Dónde, cuándo y quién capturó el referido. */
|
|
20
|
+
export interface BackofficeReferralCapture {
|
|
21
|
+
source: ReferralSourceEnum;
|
|
22
|
+
/** `null` si se agregó en el cajón. */
|
|
23
|
+
storeId: string | null;
|
|
24
|
+
storeName: string | null;
|
|
25
|
+
/** Solo en `SALE`. */
|
|
26
|
+
saleId: string | null;
|
|
27
|
+
saleFolio: string | null;
|
|
28
|
+
/** Solo en `OPENING`. */
|
|
29
|
+
accountOpeningSessionId: string | null;
|
|
30
|
+
capturedBy: string;
|
|
31
|
+
capturedAt: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Referido del cliente en el cajón. */
|
|
35
|
+
export interface BackofficeCustomerReferral {
|
|
36
|
+
referralId: string;
|
|
37
|
+
name: string;
|
|
38
|
+
phone: string;
|
|
39
|
+
email: string | null;
|
|
40
|
+
status: ReferralStatusEnum;
|
|
41
|
+
capture: BackofficeReferralCapture;
|
|
42
|
+
updatedBy: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
/** Premios de quien recomienda por este referido; ausente si la ruta aún no los consulta. */
|
|
45
|
+
rewards?: BackofficeReferralReward[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Quién recomendó al cliente y, opcional, lo que ganó él. */
|
|
49
|
+
export interface BackofficeReferredBy {
|
|
50
|
+
referralId: string;
|
|
51
|
+
referrerCustomerId: string;
|
|
52
|
+
referrerName: string;
|
|
53
|
+
referredAt: string;
|
|
54
|
+
/** Premios del cliente como recomendado, con su promo. */
|
|
55
|
+
rewards?: BackofficeReferralReward[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** GET /backoffice/customers/{retailCustomerId}/referrals — pestaña Referidos del cajón. */
|
|
59
|
+
export interface BackofficeCustomerReferralsResponse {
|
|
60
|
+
referrals: BackofficeCustomerReferral[];
|
|
61
|
+
/** `null` si el cliente no llegó recomendado. */
|
|
62
|
+
referredBy: BackofficeReferredBy | null;
|
|
63
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
/** Tipo de mensaje
|
|
1
|
+
/** Tipo de mensaje en la cola de Promociones: venta y apertura los publica el wizard; la cuota, loan-credit. */
|
|
2
2
|
export enum RetailPromotionInboundMessageTypeEnum {
|
|
3
3
|
SALE_CONFIRMED = 'SALE_CONFIRMED',
|
|
4
4
|
SALE_CANCELLED = 'SALE_CANCELLED',
|
|
5
|
+
ACCOUNT_OPENED = 'ACCOUNT_OPENED',
|
|
6
|
+
CREDIT_INSTALLMENT_PAID = 'CREDIT_INSTALLMENT_PAID',
|
|
5
7
|
}
|
|
@@ -70,6 +70,17 @@ export class RetailCommissionInboundLine {
|
|
|
70
70
|
phoneCount?: number;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/** Referido capturado en la venta, con quien lo capturó para su comisión. */
|
|
74
|
+
export class RetailCommissionInboundReferral {
|
|
75
|
+
@IsString()
|
|
76
|
+
@IsNotEmpty()
|
|
77
|
+
referralId!: string;
|
|
78
|
+
|
|
79
|
+
@IsString()
|
|
80
|
+
@IsNotEmpty()
|
|
81
|
+
capturedBy!: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
73
84
|
/** Venta cerrada o cancelada que el wizard publica en RetailCommissionInboundQueue. */
|
|
74
85
|
export class RetailCommissionInboundMessage {
|
|
75
86
|
@IsEnum(RetailCommissionInboundMessageTypeEnum)
|
|
@@ -130,4 +141,11 @@ export class RetailCommissionInboundMessage {
|
|
|
130
141
|
@ValidateNested({ each: true })
|
|
131
142
|
@Type(() => RetailCommissionInboundLine)
|
|
132
143
|
lines!: RetailCommissionInboundLine[];
|
|
144
|
+
|
|
145
|
+
/** Referidos capturados en la venta; ausente en mensajes viejos. */
|
|
146
|
+
@IsOptional()
|
|
147
|
+
@IsArray()
|
|
148
|
+
@ValidateNested({ each: true })
|
|
149
|
+
@Type(() => RetailCommissionInboundReferral)
|
|
150
|
+
referrals?: RetailCommissionInboundReferral[];
|
|
133
151
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Equals, IsISO8601, IsNotEmpty, IsString } from 'class-validator';
|
|
2
|
+
import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
|
|
3
|
+
|
|
4
|
+
/** Cuenta PCF que quedó OPEN (LINKED no cuenta); el wizard la publica en RetailPromotionInboundQueue. */
|
|
5
|
+
export class RetailPromotionAccountOpenedMessage {
|
|
6
|
+
@Equals(RetailPromotionInboundMessageTypeEnum.ACCOUNT_OPENED)
|
|
7
|
+
type!: RetailPromotionInboundMessageTypeEnum.ACCOUNT_OPENED;
|
|
8
|
+
|
|
9
|
+
@IsString()
|
|
10
|
+
@IsNotEmpty()
|
|
11
|
+
tenantId!: string;
|
|
12
|
+
|
|
13
|
+
@IsString()
|
|
14
|
+
@IsNotEmpty()
|
|
15
|
+
retailerId!: string;
|
|
16
|
+
|
|
17
|
+
@IsString()
|
|
18
|
+
@IsNotEmpty()
|
|
19
|
+
storeId!: string;
|
|
20
|
+
|
|
21
|
+
/** El retailCustomerId de quien abrió la cuenta. */
|
|
22
|
+
@IsString()
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
customerId!: string;
|
|
25
|
+
|
|
26
|
+
/** Teléfono a 10 dígitos: con él se busca al referidor. */
|
|
27
|
+
@IsString()
|
|
28
|
+
@IsNotEmpty()
|
|
29
|
+
phone!: string;
|
|
30
|
+
|
|
31
|
+
/** Sesión del wizard donde se abrió la cuenta. */
|
|
32
|
+
@IsString()
|
|
33
|
+
@IsNotEmpty()
|
|
34
|
+
sessionId!: string;
|
|
35
|
+
|
|
36
|
+
@IsISO8601()
|
|
37
|
+
openedAt!: string;
|
|
38
|
+
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
IsArray,
|
|
5
5
|
IsBoolean,
|
|
6
6
|
IsEnum,
|
|
7
|
+
IsIn,
|
|
7
8
|
IsISO8601,
|
|
8
9
|
IsInt,
|
|
9
10
|
IsNotEmpty,
|
|
@@ -14,7 +15,10 @@ import {
|
|
|
14
15
|
} from 'class-validator';
|
|
15
16
|
import { LinePromotionAmount } from '../../retailPromotions/dtos/LinePromotionAmount';
|
|
16
17
|
import { SalePromotionRef } from '../../retailPromotions/dtos/SalePromotionRef';
|
|
18
|
+
import { ExternalProviderEnum } from '../enums/ExternalProviderEnum';
|
|
17
19
|
import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
|
|
20
|
+
import { SalePaymentMethodEnum } from '../enums/SalePaymentMethodEnum';
|
|
21
|
+
import { SaleTypeEnum } from '../enums/SaleTypeEnum';
|
|
18
22
|
import { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
|
|
19
23
|
|
|
20
24
|
/** Línea de la venta en el mensaje de Promociones. */
|
|
@@ -90,9 +94,14 @@ export class RetailPromotionInboundLine {
|
|
|
90
94
|
returned?: boolean;
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
const SALE_MESSAGE_TYPES = [
|
|
98
|
+
RetailPromotionInboundMessageTypeEnum.SALE_CONFIRMED,
|
|
99
|
+
RetailPromotionInboundMessageTypeEnum.SALE_CANCELLED,
|
|
100
|
+
];
|
|
101
|
+
|
|
93
102
|
/** Venta confirmada o cancelada que el wizard publica en RetailPromotionInboundQueue; crédito = trae creditId. */
|
|
94
103
|
export class RetailPromotionInboundMessage {
|
|
95
|
-
@
|
|
104
|
+
@IsIn(SALE_MESSAGE_TYPES)
|
|
96
105
|
type!: RetailPromotionInboundMessageTypeEnum;
|
|
97
106
|
|
|
98
107
|
@IsString()
|
|
@@ -159,4 +168,37 @@ export class RetailPromotionInboundMessage {
|
|
|
159
168
|
@ValidateNested({ each: true })
|
|
160
169
|
@Type(() => RetailPromotionInboundLine)
|
|
161
170
|
lines!: RetailPromotionInboundLine[];
|
|
171
|
+
|
|
172
|
+
/** Forma de pago; ausente en mensajes viejos. */
|
|
173
|
+
@IsOptional()
|
|
174
|
+
@IsEnum(SaleTypeEnum)
|
|
175
|
+
saleType?: SaleTypeEnum;
|
|
176
|
+
|
|
177
|
+
/** Medio de cobro, solo en contado. */
|
|
178
|
+
@IsOptional()
|
|
179
|
+
@IsEnum(SalePaymentMethodEnum)
|
|
180
|
+
paymentMethod?: SalePaymentMethodEnum | null;
|
|
181
|
+
|
|
182
|
+
/** Financiera externa, solo en `EXTERNAL_REFERRAL`. */
|
|
183
|
+
@IsOptional()
|
|
184
|
+
@IsEnum(ExternalProviderEnum)
|
|
185
|
+
externalProvider?: ExternalProviderEnum | null;
|
|
186
|
+
|
|
187
|
+
/** Precio del equipo en centavos; en crédito no es el enganche. */
|
|
188
|
+
@IsOptional()
|
|
189
|
+
@IsInt()
|
|
190
|
+
@Min(0)
|
|
191
|
+
amountCents?: number;
|
|
192
|
+
|
|
193
|
+
/** 1 + ventas no canceladas del cliente en la cadena. */
|
|
194
|
+
@IsOptional()
|
|
195
|
+
@IsInt()
|
|
196
|
+
@Min(1)
|
|
197
|
+
purchaseNumber?: number;
|
|
198
|
+
|
|
199
|
+
/** Teléfono del cliente a 10 dígitos. */
|
|
200
|
+
@IsOptional()
|
|
201
|
+
@IsString()
|
|
202
|
+
@IsNotEmpty()
|
|
203
|
+
phone?: string;
|
|
162
204
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Equals, IsBoolean, IsEnum, IsISO8601, IsInt, IsNotEmpty, IsString, Min } from 'class-validator';
|
|
2
|
+
import { LoanInstallmentStatusEnum } from '../../loanCredit/enums/LoanInstallmentStatusEnum';
|
|
3
|
+
import { RetailPromotionInboundMessageTypeEnum } from '../enums/RetailPromotionInboundMessageTypeEnum';
|
|
4
|
+
|
|
5
|
+
/** Cuota pagada que loan-credit publica en RetailPromotionInboundQueue: `InstallmentPaidV1` + contexto. Sin PII. */
|
|
6
|
+
export class RetailPromotionInstallmentPaidMessage {
|
|
7
|
+
@Equals(RetailPromotionInboundMessageTypeEnum.CREDIT_INSTALLMENT_PAID)
|
|
8
|
+
type!: RetailPromotionInboundMessageTypeEnum.CREDIT_INSTALLMENT_PAID;
|
|
9
|
+
|
|
10
|
+
@IsString()
|
|
11
|
+
@IsNotEmpty()
|
|
12
|
+
tenantId!: string;
|
|
13
|
+
|
|
14
|
+
@IsString()
|
|
15
|
+
@IsNotEmpty()
|
|
16
|
+
creditId!: string;
|
|
17
|
+
|
|
18
|
+
@IsInt()
|
|
19
|
+
@Min(1)
|
|
20
|
+
installmentNumber!: number;
|
|
21
|
+
|
|
22
|
+
/** Lo pagado de la cuota en total, en centavos. */
|
|
23
|
+
@IsInt()
|
|
24
|
+
@Min(0)
|
|
25
|
+
paidCents!: number;
|
|
26
|
+
|
|
27
|
+
@IsISO8601()
|
|
28
|
+
paidAt!: string;
|
|
29
|
+
|
|
30
|
+
@IsEnum(LoanInstallmentStatusEnum)
|
|
31
|
+
installmentStatus!: LoanInstallmentStatusEnum;
|
|
32
|
+
|
|
33
|
+
@IsString()
|
|
34
|
+
@IsNotEmpty()
|
|
35
|
+
paymentId!: string;
|
|
36
|
+
|
|
37
|
+
@IsString()
|
|
38
|
+
@IsNotEmpty()
|
|
39
|
+
wizardSessionId!: string;
|
|
40
|
+
|
|
41
|
+
@IsString()
|
|
42
|
+
@IsNotEmpty()
|
|
43
|
+
storeId!: string;
|
|
44
|
+
|
|
45
|
+
/** Pagada a más tardar en su vencimiento. */
|
|
46
|
+
@IsBoolean()
|
|
47
|
+
onTime!: boolean;
|
|
48
|
+
|
|
49
|
+
/** Cuotas seguidas a tiempo hasta esta, incluida; 0 si esta fue tarde. */
|
|
50
|
+
@IsInt()
|
|
51
|
+
@Min(0)
|
|
52
|
+
onTimeStreak!: number;
|
|
53
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RetailPromotionAccountOpenedMessage } from './RetailPromotionAccountOpenedMessage';
|
|
2
|
+
import { RetailPromotionInboundMessage } from './RetailPromotionInboundMessage';
|
|
3
|
+
import { RetailPromotionInstallmentPaidMessage } from './RetailPromotionInstallmentPaidMessage';
|
|
4
|
+
|
|
5
|
+
/** Cualquier mensaje de RetailPromotionInboundQueue; el `type` dice cuál clase validar. */
|
|
6
|
+
export type RetailPromotionQueueMessage =
|
|
7
|
+
| RetailPromotionInboundMessage
|
|
8
|
+
| RetailPromotionAccountOpenedMessage
|
|
9
|
+
| RetailPromotionInstallmentPaidMessage;
|
|
@@ -182,6 +182,7 @@ export * from './enums/SellerTableSourceStatusEnum';
|
|
|
182
182
|
export * from './dtos/responses/BackofficeSellerTableResponse';
|
|
183
183
|
export * from './dtos/responses/BackofficeCustomerTableResponse';
|
|
184
184
|
export * from './dtos/responses/BackofficeAccountOpeningsResponse';
|
|
185
|
+
export * from './dtos/responses/BackofficeCustomerReferralsResponse';
|
|
185
186
|
export * from './enums/StoreKindEnum';
|
|
186
187
|
export * from './dtos/responses/BackofficeStoreTableResponse';
|
|
187
188
|
export * from './enums/StoreMixCategoryEnum';
|
|
@@ -196,6 +197,9 @@ export * from './events/SessionExpiredV1';
|
|
|
196
197
|
export * from './enums/RetailPromotionInboundMessageTypeEnum';
|
|
197
198
|
export * from './enums/RetailCommissionInboundMessageTypeEnum';
|
|
198
199
|
export * from './events/RetailPromotionInboundMessage';
|
|
200
|
+
export * from './events/RetailPromotionAccountOpenedMessage';
|
|
201
|
+
export * from './events/RetailPromotionInstallmentPaidMessage';
|
|
202
|
+
export * from './events/RetailPromotionQueueMessage';
|
|
199
203
|
export * from './events/RetailCommissionInboundMessage';
|
|
200
204
|
|
|
201
205
|
// Lookup privado por lote (GET /private/wizard-sessions/batch)
|