@fiado/type-kit 3.550.0 → 3.552.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/retailCatalog/singlePriceFields.test.ts +48 -0
- package/_test_/unit/retailCommission/commissionPayments.test.ts +168 -0
- package/_test_/unit/retailCommission/commissionRules.test.ts +53 -0
- package/_test_/unit/retailIntegration/eventPayloads.test.ts +1 -0
- package/_test_/unit/retailOrg/dtos/RetailUser.test.ts +47 -0
- package/_test_/unit/retailOrg/dtos/requests/retailUserWalletRequests.test.ts +41 -0
- package/_test_/unit/retailOrg/dtos/responses/retailUserWalletResponses.test.ts +30 -0
- package/_test_/unit/retailOrg/enums/RetailUserWalletLinkMethodEnum.test.ts +12 -0
- package/_test_/unit/retailPromotions/giftOptionValue.test.ts +20 -0
- package/_test_/unit/retailWizard/linesWithoutListPrice.test.ts +40 -0
- package/bin/retailCatalog/dtos/Product.d.ts +2 -1
- package/bin/retailCatalog/dtos/requests/BackofficeCreateSkuPriceRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/CreateProductRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/SyncInventoryRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/UpdateProductRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +1 -1
- package/bin/retailCatalog/dtos/responses/ReserveStockResponse.d.ts +4 -1
- package/bin/retailCatalog/dtos/responses/SkuPriceEntry.d.ts +2 -1
- package/bin/retailCatalog/dtos/responses/StoreCatalogItem.d.ts +1 -1
- package/bin/retailCommission/dtos/CommissionApi.d.ts +80 -1
- package/bin/retailCommission/dtos/CommissionLedger.d.ts +96 -0
- package/bin/retailCommission/dtos/CommissionLedger.js +2 -0
- package/bin/retailCommission/dtos/CommissionRule.d.ts +14 -1
- package/bin/retailCommission/enums/CommissionBillingPeriodEnum.d.ts +10 -0
- package/bin/retailCommission/enums/CommissionBillingPeriodEnum.js +14 -0
- package/bin/retailCommission/enums/CommissionLedgerMovementKindEnum.d.ts +14 -0
- package/bin/retailCommission/enums/CommissionLedgerMovementKindEnum.js +18 -0
- package/bin/retailCommission/enums/CommissionPayTimingEnum.d.ts +13 -0
- package/bin/retailCommission/enums/CommissionPayTimingEnum.js +17 -0
- package/bin/retailCommission/enums/CommissionPayTriggerEnum.d.ts +18 -0
- package/bin/retailCommission/enums/CommissionPayTriggerEnum.js +22 -0
- package/bin/retailCommission/enums/CommissionPaymentAttentionEnum.d.ts +14 -0
- package/bin/retailCommission/enums/CommissionPaymentAttentionEnum.js +18 -0
- package/bin/retailCommission/enums/CommissionPaymentStatusEnum.d.ts +14 -0
- package/bin/retailCommission/enums/CommissionPaymentStatusEnum.js +18 -0
- package/bin/retailCommission/index.d.ts +7 -0
- package/bin/retailCommission/index.js +7 -0
- package/bin/retailOrg/dtos/RetailUser.d.ts +13 -0
- package/bin/retailOrg/dtos/RetailUser.js +39 -0
- package/bin/retailOrg/dtos/requests/LinkRetailUserWalletRequest.d.ts +10 -0
- package/bin/retailOrg/dtos/requests/LinkRetailUserWalletRequest.js +37 -0
- package/bin/retailOrg/dtos/requests/LookupRetailUserWalletRequest.d.ts +10 -0
- package/bin/retailOrg/dtos/requests/LookupRetailUserWalletRequest.js +37 -0
- package/bin/retailOrg/dtos/responses/LookupRetailUserWalletResponse.d.ts +10 -0
- package/bin/retailOrg/dtos/responses/LookupRetailUserWalletResponse.js +2 -0
- package/bin/retailOrg/dtos/responses/PrivateRetailUserWalletResponse.d.ts +8 -0
- package/bin/retailOrg/dtos/responses/PrivateRetailUserWalletResponse.js +2 -0
- package/bin/retailOrg/enums/RetailUserWalletLinkMethodEnum.d.ts +11 -0
- package/bin/retailOrg/enums/RetailUserWalletLinkMethodEnum.js +15 -0
- package/bin/retailOrg/index.d.ts +6 -0
- package/bin/retailOrg/index.js +7 -0
- package/bin/retailOrg/validators/IsSingleWalletKeyConstraint.d.ts +6 -0
- package/bin/retailOrg/validators/IsSingleWalletKeyConstraint.js +24 -0
- package/bin/retailPromotions/dtos/responses/WizardSalePromotionResponses.d.ts +4 -1
- package/bin/retailWizard/dtos/SaleLine.d.ts +2 -1
- package/bin/retailWizard/dtos/WizardGiftLine.d.ts +1 -1
- package/bin/retailWizard/dtos/WizardLinePromotionFields.d.ts +1 -1
- package/bin/retailWizard/dtos/WizardReservedLine.d.ts +2 -1
- package/bin/retailWizard/events/SaleCompletedV1.d.ts +1 -1
- package/bin/retailWizard/events/SaleCompletedV2.d.ts +1 -1
- package/package.json +1 -1
- package/src/retailCatalog/dtos/Product.ts +2 -1
- package/src/retailCatalog/dtos/requests/BackofficeCreateSkuPriceRequest.ts +1 -0
- package/src/retailCatalog/dtos/requests/CreateProductRequest.ts +1 -0
- package/src/retailCatalog/dtos/requests/SyncInventoryRequest.ts +1 -0
- package/src/retailCatalog/dtos/requests/UpdateProductRequest.ts +1 -0
- package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +1 -1
- package/src/retailCatalog/dtos/responses/ReserveStockResponse.ts +4 -1
- package/src/retailCatalog/dtos/responses/SkuPriceEntry.ts +2 -1
- package/src/retailCatalog/dtos/responses/StoreCatalogItem.ts +1 -1
- package/src/retailCommission/dtos/CommissionApi.ts +97 -1
- package/src/retailCommission/dtos/CommissionLedger.ts +101 -0
- package/src/retailCommission/dtos/CommissionRule.ts +15 -1
- package/src/retailCommission/enums/CommissionBillingPeriodEnum.ts +10 -0
- package/src/retailCommission/enums/CommissionLedgerMovementKindEnum.ts +14 -0
- package/src/retailCommission/enums/CommissionPayTimingEnum.ts +13 -0
- package/src/retailCommission/enums/CommissionPayTriggerEnum.ts +18 -0
- package/src/retailCommission/enums/CommissionPaymentAttentionEnum.ts +14 -0
- package/src/retailCommission/enums/CommissionPaymentStatusEnum.ts +14 -0
- package/src/retailCommission/index.ts +7 -0
- package/src/retailOrg/dtos/RetailUser.ts +39 -0
- package/src/retailOrg/dtos/requests/LinkRetailUserWalletRequest.ts +24 -0
- package/src/retailOrg/dtos/requests/LookupRetailUserWalletRequest.ts +24 -0
- package/src/retailOrg/dtos/responses/LookupRetailUserWalletResponse.ts +11 -0
- package/src/retailOrg/dtos/responses/PrivateRetailUserWalletResponse.ts +8 -0
- package/src/retailOrg/enums/RetailUserWalletLinkMethodEnum.ts +11 -0
- package/src/retailOrg/index.ts +8 -0
- package/src/retailOrg/validators/IsSingleWalletKeyConstraint.ts +18 -0
- package/src/retailPromotions/dtos/responses/WizardSalePromotionResponses.ts +4 -1
- package/src/retailWizard/dtos/SaleLine.ts +2 -1
- package/src/retailWizard/dtos/WizardGiftLine.ts +1 -1
- package/src/retailWizard/dtos/WizardLinePromotionFields.ts +1 -1
- package/src/retailWizard/dtos/WizardReservedLine.ts +2 -1
- package/src/retailWizard/events/SaleCompletedV1.ts +1 -1
- package/src/retailWizard/events/SaleCompletedV2.ts +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ProductCategoryEnum } from '../../retailCatalog/enums/ProductCategoryEnum';
|
|
2
2
|
import type { ProductTierEnum } from '../../retailCatalog/enums/ProductTierEnum';
|
|
3
|
+
import type { CommissionBillingPeriodEnum } from '../enums/CommissionBillingPeriodEnum';
|
|
3
4
|
import type { CommissionBonusModeEnum } from '../enums/CommissionBonusModeEnum';
|
|
4
5
|
import type { CommissionCountByEnum } from '../enums/CommissionCountByEnum';
|
|
5
6
|
import type { CommissionMetricEnum } from '../enums/CommissionMetricEnum';
|
|
6
7
|
import type { CommissionOperatorEnum } from '../enums/CommissionOperatorEnum';
|
|
8
|
+
import type { CommissionPayTimingEnum } from '../enums/CommissionPayTimingEnum';
|
|
7
9
|
import type { CommissionRuleStatusEnum } from '../enums/CommissionRuleStatusEnum';
|
|
8
10
|
import type { CommissionWindowEnum } from '../enums/CommissionWindowEnum';
|
|
9
11
|
|
|
@@ -84,6 +86,8 @@ export interface CommissionRule {
|
|
|
84
86
|
replacesOthers: boolean;
|
|
85
87
|
/** Si la regla cuenta piezas o ventas. Ausente = `PIECE`. */
|
|
86
88
|
countBy?: CommissionCountByEnum;
|
|
89
|
+
/** Cuándo se paga lo que gana. Ausente = `ON_CUT`. */
|
|
90
|
+
payTiming?: CommissionPayTimingEnum;
|
|
87
91
|
/** Sube en cada guardado. */
|
|
88
92
|
version: number;
|
|
89
93
|
/** La versión que está en el plan vigente. `null` si nunca se publicó. */
|
|
@@ -114,10 +118,20 @@ export interface CommissionPolicyCommissions {
|
|
|
114
118
|
editedAt: string;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
/**
|
|
121
|
+
/** Política de pagos a la wallet de los vendedores. */
|
|
122
|
+
export interface CommissionPayoutPolicy {
|
|
123
|
+
/** Depositar las comisiones a la wallet. Apagado, todo se calcula y queda pendiente. */
|
|
124
|
+
walletDeposits: boolean;
|
|
125
|
+
/** Cada cuánto se le cobra a la cadena. */
|
|
126
|
+
chainBillingPeriod: CommissionBillingPeriodEnum;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Políticas de la cadena. `clawback` y `commissions` son `null` mientras la cadena no las guarda. */
|
|
118
130
|
export interface CommissionPolicies {
|
|
119
131
|
clawback: CommissionPolicyClawback | null;
|
|
120
132
|
commissions: CommissionPolicyCommissions | null;
|
|
133
|
+
/** Ausente = depósitos encendidos y cobro semanal. */
|
|
134
|
+
payouts?: CommissionPayoutPolicy;
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cada cuánto se le cobra a la cadena lo que Fiado depositó a sus vendedores.
|
|
3
|
+
*
|
|
4
|
+
* WEEKLY - Semanal. Es el valor cuando la cadena no guardó la política.
|
|
5
|
+
* MONTHLY - Mensual.
|
|
6
|
+
*/
|
|
7
|
+
export enum CommissionBillingPeriodEnum {
|
|
8
|
+
WEEKLY = 'WEEKLY',
|
|
9
|
+
MONTHLY = 'MONTHLY',
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipo de movimiento del libro de pagos. Un movimiento nunca cambia.
|
|
3
|
+
*
|
|
4
|
+
* EARN - Ganado: suma al exigible o al retenido.
|
|
5
|
+
* DEDUCT - Descontado del exigible.
|
|
6
|
+
* RELEASE - Liberación mensual: pasa de retenido a exigible.
|
|
7
|
+
* PAID_OUTSIDE - Pagado por fuera de la wallet: sale del exigible sin depósito.
|
|
8
|
+
*/
|
|
9
|
+
export enum CommissionLedgerMovementKindEnum {
|
|
10
|
+
EARN = 'EARN',
|
|
11
|
+
DEDUCT = 'DEDUCT',
|
|
12
|
+
RELEASE = 'RELEASE',
|
|
13
|
+
PAID_OUTSIDE = 'PAID_OUTSIDE',
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cuándo se paga lo que gana una regla.
|
|
3
|
+
*
|
|
4
|
+
* ON_SALE - Al momento: se vuelve exigible al registrar la venta. Solo para reglas que únicamente
|
|
5
|
+
* pagan bono por venta.
|
|
6
|
+
* ON_CUT - Al cierre de la semana. Es el valor cuando la regla no lo trae.
|
|
7
|
+
* MONTHLY - Al cierre del mes: se retiene hasta el día 1 del mes siguiente al lunes del corte.
|
|
8
|
+
*/
|
|
9
|
+
export enum CommissionPayTimingEnum {
|
|
10
|
+
ON_SALE = 'ON_SALE',
|
|
11
|
+
ON_CUT = 'ON_CUT',
|
|
12
|
+
MONTHLY = 'MONTHLY',
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qué pidió pagarle a un vendedor.
|
|
3
|
+
*
|
|
4
|
+
* SALE - Una venta con reglas al momento.
|
|
5
|
+
* CUT - El cierre del corte.
|
|
6
|
+
* RELEASE - La liberación mensual.
|
|
7
|
+
* ADJUSTMENT - Un ajuste manual.
|
|
8
|
+
* WALLET_LINKED - Se vinculó su wallet.
|
|
9
|
+
* RETRY - "Reintentar ahora" desde "Por pagar".
|
|
10
|
+
*/
|
|
11
|
+
export enum CommissionPayTriggerEnum {
|
|
12
|
+
SALE = 'SALE',
|
|
13
|
+
CUT = 'CUT',
|
|
14
|
+
RELEASE = 'RELEASE',
|
|
15
|
+
ADJUSTMENT = 'ADJUSTMENT',
|
|
16
|
+
WALLET_LINKED = 'WALLET_LINKED',
|
|
17
|
+
RETRY = 'RETRY',
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Por qué el saldo de un vendedor aparece en "Por pagar".
|
|
3
|
+
*
|
|
4
|
+
* NO_WALLET - No tiene wallet vinculada.
|
|
5
|
+
* REJECTED - Su último depósito se rechazó (cuenta bloqueada, tope de nivel...); el código va aparte.
|
|
6
|
+
* PAUSED - La cadena apagó los depósitos a la wallet.
|
|
7
|
+
* DEBT - Su exigible es negativo: debe.
|
|
8
|
+
*/
|
|
9
|
+
export enum CommissionPaymentAttentionEnum {
|
|
10
|
+
NO_WALLET = 'NO_WALLET',
|
|
11
|
+
REJECTED = 'REJECTED',
|
|
12
|
+
PAUSED = 'PAUSED',
|
|
13
|
+
DEBT = 'DEBT',
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estado de un depósito de comisiones a la wallet del vendedor.
|
|
3
|
+
*
|
|
4
|
+
* PENDING - El monto se apartó y el depósito está en curso.
|
|
5
|
+
* ACCREDITED - Depositado, con folio.
|
|
6
|
+
* FAILED - Rechazado sin mover dinero: el monto vuelve al exigible.
|
|
7
|
+
* UNVERIFIED - Resultado ambiguo: el monto sigue apartado y no se reintenta solo; alguien lo revisa.
|
|
8
|
+
*/
|
|
9
|
+
export enum CommissionPaymentStatusEnum {
|
|
10
|
+
PENDING = 'PENDING',
|
|
11
|
+
ACCREDITED = 'ACCREDITED',
|
|
12
|
+
FAILED = 'FAILED',
|
|
13
|
+
UNVERIFIED = 'UNVERIFIED',
|
|
14
|
+
}
|
|
@@ -21,6 +21,12 @@ export * from './enums/CommissionCountByEnum';
|
|
|
21
21
|
export * from './enums/CommissionAggregateByEnum';
|
|
22
22
|
export * from './enums/CommissionSeriesByEnum';
|
|
23
23
|
export * from './enums/CommissionSimulationSkipEnum';
|
|
24
|
+
export * from './enums/CommissionPayTimingEnum';
|
|
25
|
+
export * from './enums/CommissionBillingPeriodEnum';
|
|
26
|
+
export * from './enums/CommissionPaymentStatusEnum';
|
|
27
|
+
export * from './enums/CommissionPaymentAttentionEnum';
|
|
28
|
+
export * from './enums/CommissionLedgerMovementKindEnum';
|
|
29
|
+
export * from './enums/CommissionPayTriggerEnum';
|
|
24
30
|
|
|
25
31
|
// Entidades del dominio
|
|
26
32
|
export * from './dtos/CommissionPlan';
|
|
@@ -29,6 +35,7 @@ export * from './dtos/CommissionCouponAccrual';
|
|
|
29
35
|
export * from './dtos/CommissionCalcTrace';
|
|
30
36
|
export * from './dtos/CommissionAccrual';
|
|
31
37
|
export * from './dtos/CommissionPayout';
|
|
38
|
+
export * from './dtos/CommissionLedger';
|
|
32
39
|
|
|
33
40
|
// Contratos HTTP — uno por endpoint
|
|
34
41
|
export * from './dtos/CommissionApi';
|
|
@@ -4,6 +4,7 @@ import { regexIso8601 } from '../../helpers/constans/regex';
|
|
|
4
4
|
import { CollectorSeniorityEnum } from '../enums/CollectorSeniorityEnum';
|
|
5
5
|
import { EmploymentTypeEnum } from '../enums/EmploymentTypeEnum';
|
|
6
6
|
import { RetailUserStatusEnum } from '../enums/RetailUserStatusEnum';
|
|
7
|
+
import { RetailUserWalletLinkMethodEnum } from '../enums/RetailUserWalletLinkMethodEnum';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* RetailUser — usuario retail (empleado de tienda) de un retailer (SureKeep Fase 1 — pista Retail).
|
|
@@ -74,6 +75,44 @@ export class RetailUser {
|
|
|
74
75
|
@IsEnum(RetailUserStatusEnum)
|
|
75
76
|
status!: RetailUserStatusEnum;
|
|
76
77
|
|
|
78
|
+
/** Directorio de Fiado del dueño de la wallet PCF; `null` o ausente si no tiene wallet. */
|
|
79
|
+
@Expose()
|
|
80
|
+
@IsOptional()
|
|
81
|
+
@IsString()
|
|
82
|
+
fiadoDirectoryId?: string | null;
|
|
83
|
+
|
|
84
|
+
/** Cuenta PCF de la wallet. */
|
|
85
|
+
@Expose()
|
|
86
|
+
@IsOptional()
|
|
87
|
+
@IsString()
|
|
88
|
+
pcfAccountId?: string | null;
|
|
89
|
+
|
|
90
|
+
/** Cómo se encontró la wallet: por CLABE o por teléfono. */
|
|
91
|
+
@Expose()
|
|
92
|
+
@IsOptional()
|
|
93
|
+
@IsEnum(RetailUserWalletLinkMethodEnum)
|
|
94
|
+
walletLinkMethod?: RetailUserWalletLinkMethodEnum | null;
|
|
95
|
+
|
|
96
|
+
/** Últimos 4 dígitos de la CLABE; la CLABE completa no se guarda. */
|
|
97
|
+
@Expose()
|
|
98
|
+
@IsOptional()
|
|
99
|
+
@IsString()
|
|
100
|
+
@Matches(/^\d{4}$/, { message: 'walletClabeLast4 debe tener 4 dígitos' })
|
|
101
|
+
walletClabeLast4?: string | null;
|
|
102
|
+
|
|
103
|
+
/** Cuándo se vinculó (ISO). */
|
|
104
|
+
@Expose()
|
|
105
|
+
@IsOptional()
|
|
106
|
+
@IsString()
|
|
107
|
+
@Matches(regexIso8601, { message: 'walletLinkedAt debe ser una fecha ISO 8601' })
|
|
108
|
+
walletLinkedAt?: string | null;
|
|
109
|
+
|
|
110
|
+
/** Quién la vinculó: el actorId del usuario del back office. */
|
|
111
|
+
@Expose()
|
|
112
|
+
@IsOptional()
|
|
113
|
+
@IsString()
|
|
114
|
+
walletLinkedBy?: string | null;
|
|
115
|
+
|
|
77
116
|
@Expose()
|
|
78
117
|
@IsString()
|
|
79
118
|
@Matches(regexIso8601, { message: 'createdAt debe ser una fecha ISO 8601' })
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsOptional, IsString, Matches, Validate, ValidateIf } from 'class-validator';
|
|
3
|
+
import { IsSingleWalletKeyConstraint } from '../../validators/IsSingleWalletKeyConstraint';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Body de `PUT /retailers/{retailerId}/users/{retailUserId}/wallet`: vincula la wallet PCF del
|
|
7
|
+
* vendedor por CLABE o por teléfono, exactamente uno. El servidor vuelve a resolver la cuenta.
|
|
8
|
+
*/
|
|
9
|
+
export class LinkRetailUserWalletRequest {
|
|
10
|
+
/** CLABE PCF, 18 dígitos. Solo se guardan los últimos 4; no va a logs completa. */
|
|
11
|
+
@Expose()
|
|
12
|
+
@ValidateIf((o: LinkRetailUserWalletRequest) => o.clabe != null || o.phone == null)
|
|
13
|
+
@Validate(IsSingleWalletKeyConstraint)
|
|
14
|
+
@IsString({ message: 'clabe debe ser texto' })
|
|
15
|
+
@Matches(/^\d{18}$/, { message: 'clabe debe tener 18 dígitos' })
|
|
16
|
+
clabe?: string | null;
|
|
17
|
+
|
|
18
|
+
/** Teléfono de México: 10 dígitos, con o sin `+52`; retail-org lo normaliza a E.164. No va a logs completo. */
|
|
19
|
+
@Expose()
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsString({ message: 'phone debe ser texto' })
|
|
22
|
+
@Matches(/^(\+52)?\d{10}$/, { message: 'phone debe tener 10 dígitos, con o sin +52' })
|
|
23
|
+
phone?: string | null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Expose } from 'class-transformer';
|
|
2
|
+
import { IsOptional, IsString, Matches, Validate, ValidateIf } from 'class-validator';
|
|
3
|
+
import { IsSingleWalletKeyConstraint } from '../../validators/IsSingleWalletKeyConstraint';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Body de `POST /retailers/{retailerId}/users/wallet-lookup`: busca una wallet PCF por CLABE o por
|
|
7
|
+
* teléfono, exactamente uno. No escribe nada.
|
|
8
|
+
*/
|
|
9
|
+
export class LookupRetailUserWalletRequest {
|
|
10
|
+
/** CLABE PCF, 18 dígitos. No va a logs completa. */
|
|
11
|
+
@Expose()
|
|
12
|
+
@ValidateIf((o: LookupRetailUserWalletRequest) => o.clabe != null || o.phone == null)
|
|
13
|
+
@Validate(IsSingleWalletKeyConstraint)
|
|
14
|
+
@IsString({ message: 'clabe debe ser texto' })
|
|
15
|
+
@Matches(/^\d{18}$/, { message: 'clabe debe tener 18 dígitos' })
|
|
16
|
+
clabe?: string | null;
|
|
17
|
+
|
|
18
|
+
/** Teléfono de México: 10 dígitos, con o sin `+52`; retail-org lo normaliza a E.164. No va a logs completo. */
|
|
19
|
+
@Expose()
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsString({ message: 'phone debe ser texto' })
|
|
22
|
+
@Matches(/^(\+52)?\d{10}$/, { message: 'phone debe tener 10 dígitos, con o sin +52' })
|
|
23
|
+
phone?: string | null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RetailUserWalletLinkMethodEnum } from '../../enums/RetailUserWalletLinkMethodEnum';
|
|
2
|
+
|
|
3
|
+
/** Respuesta de `POST /retailers/{retailerId}/users/wallet-lookup`. */
|
|
4
|
+
export interface LookupRetailUserWalletResponse {
|
|
5
|
+
found: boolean;
|
|
6
|
+
active: boolean;
|
|
7
|
+
/** Nombre del titular para que el administrador confirme; `null` si no se encontró. */
|
|
8
|
+
holderName: string | null;
|
|
9
|
+
/** Por dónde se buscó. */
|
|
10
|
+
method: RetailUserWalletLinkMethodEnum;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respuesta de `GET /private/retailers/{retailerId}/users/{retailUserId}/wallet`: la wallet del
|
|
3
|
+
* vendedor para el motor de comisiones. Ambos `null` si no tiene wallet vinculada.
|
|
4
|
+
*/
|
|
5
|
+
export interface PrivateRetailUserWalletResponse {
|
|
6
|
+
directoryId: string | null;
|
|
7
|
+
pcfAccountId: string | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cómo se encontró la wallet PCF del vendedor.
|
|
3
|
+
* @enum {string}
|
|
4
|
+
*
|
|
5
|
+
* @property {string} CLABE - Por la CLABE PCF capturada en el alta.
|
|
6
|
+
* @property {string} PHONE - Por el teléfono de su usuario de Fiado.
|
|
7
|
+
*/
|
|
8
|
+
export enum RetailUserWalletLinkMethodEnum {
|
|
9
|
+
CLABE = 'CLABE',
|
|
10
|
+
PHONE = 'PHONE',
|
|
11
|
+
}
|
package/src/retailOrg/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './enums/StoreStatusEnum';
|
|
|
5
5
|
export * from './enums/RetailUserStatusEnum';
|
|
6
6
|
export * from './enums/EmploymentTypeEnum';
|
|
7
7
|
export * from './enums/CollectorSeniorityEnum';
|
|
8
|
+
export * from './enums/RetailUserWalletLinkMethodEnum';
|
|
8
9
|
// F3 — Portal Admin VentasLuga (metas de venta del periodo)
|
|
9
10
|
export * from './enums/GoalTargetTypeEnum';
|
|
10
11
|
|
|
@@ -26,6 +27,9 @@ export * from './dtos/validation/PrivateSellerListResponse';
|
|
|
26
27
|
// Paginación genérica
|
|
27
28
|
export * from './dtos/PaginatedResult';
|
|
28
29
|
|
|
30
|
+
// Validadores
|
|
31
|
+
export * from './validators/IsSingleWalletKeyConstraint';
|
|
32
|
+
|
|
29
33
|
// Request DTOs (input validado por endpoint)
|
|
30
34
|
export * from './dtos/requests/RetailAddressInput';
|
|
31
35
|
export * from './dtos/requests/CreateRetailerRequest';
|
|
@@ -43,6 +47,8 @@ export * from './dtos/requests/ProvisionRetailUserRequest';
|
|
|
43
47
|
export * from './dtos/requests/UpdateRetailUserRequest';
|
|
44
48
|
export * from './dtos/requests/ChangeRetailUserStatusRequest';
|
|
45
49
|
export * from './dtos/requests/TransferRetailUserRequest';
|
|
50
|
+
export * from './dtos/requests/LookupRetailUserWalletRequest';
|
|
51
|
+
export * from './dtos/requests/LinkRetailUserWalletRequest';
|
|
46
52
|
// F3 — metas y KPIs del Portal Admin VL
|
|
47
53
|
export * from './dtos/requests/GoalListQuery';
|
|
48
54
|
export * from './dtos/requests/GoalUpsertRequest';
|
|
@@ -58,3 +64,5 @@ export * from './dtos/responses/GoalUpsertResponse';
|
|
|
58
64
|
export * from './dtos/responses/PrivateGoalListResponse';
|
|
59
65
|
export * from './dtos/responses/StoreKpiResponse';
|
|
60
66
|
export * from './dtos/responses/SellerKpiResponse';
|
|
67
|
+
export * from './dtos/responses/LookupRetailUserWalletResponse';
|
|
68
|
+
export * from './dtos/responses/PrivateRetailUserWalletResponse';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ValidatorConstraint,
|
|
3
|
+
type ValidationArguments,
|
|
4
|
+
type ValidatorConstraintInterface,
|
|
5
|
+
} from 'class-validator';
|
|
6
|
+
|
|
7
|
+
/** Exige exactamente uno de `clabe` o `phone`. */
|
|
8
|
+
@ValidatorConstraint({ name: 'isSingleWalletKey', async: false })
|
|
9
|
+
export class IsSingleWalletKeyConstraint implements ValidatorConstraintInterface {
|
|
10
|
+
validate(_value: unknown, args: ValidationArguments): boolean {
|
|
11
|
+
const o = args.object as { clabe?: unknown; phone?: unknown };
|
|
12
|
+
return (o.clabe != null) !== (o.phone != null);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
defaultMessage(): string {
|
|
16
|
+
return 'debe venir clabe o phone, solo uno';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -46,7 +46,10 @@ export interface ListStoreSalePromotionsResponse {
|
|
|
46
46
|
export interface GiftOption {
|
|
47
47
|
sku: string;
|
|
48
48
|
name: string;
|
|
49
|
-
|
|
49
|
+
/** Valor del regalo: su precio de venta. */
|
|
50
|
+
valueCents?: number;
|
|
51
|
+
/** @deprecated Usa `valueCents`; trae el mismo valor. */
|
|
52
|
+
listPriceCents?: number;
|
|
50
53
|
inStock: boolean;
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -9,7 +9,8 @@ export interface SaleLine extends WizardLinePromotionFields {
|
|
|
9
9
|
sku: string;
|
|
10
10
|
qty: number;
|
|
11
11
|
basePriceCents: number;
|
|
12
|
-
|
|
12
|
+
/** @deprecated Ya no se escribe; el valor de un regalo vive en `originalPriceCents`. */
|
|
13
|
+
listPriceCents?: number | null;
|
|
13
14
|
/** Llave del registro PRICE# del que salió el precio. */
|
|
14
15
|
priceSk: string;
|
|
15
16
|
paymentType: LinePaymentTypeEnum;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WizardLineRoleEnum } from '../enums/WizardLineRoleEnum';
|
|
2
2
|
import type { WizardReservedLine } from './WizardReservedLine';
|
|
3
3
|
|
|
4
|
-
/** Línea GIFT: ligada a un ancla, con su promo y el
|
|
4
|
+
/** Línea GIFT: ligada a un ancla, con su promo y el valor del regalo (su precio de venta). */
|
|
5
5
|
export type WizardGiftLine = WizardReservedLine & {
|
|
6
6
|
role: WizardLineRoleEnum.GIFT;
|
|
7
7
|
linkedLineId: string;
|
|
@@ -12,7 +12,7 @@ export interface WizardLinePromotionFields {
|
|
|
12
12
|
discountCode?: string;
|
|
13
13
|
/** Descuento total de la línea; neto = basePriceCents × qty − discountCents. */
|
|
14
14
|
discountCents?: number;
|
|
15
|
-
/** Precio antes del descuento; en un regalo,
|
|
15
|
+
/** Precio antes del descuento; en un regalo, su precio de venta con la línea a $0. */
|
|
16
16
|
originalPriceCents?: number;
|
|
17
17
|
/** Descuento de cada promo en la línea; sin el campo, la de `promotionId` lleva todo menos el código. */
|
|
18
18
|
promotionDiscounts?: LinePromotionAmount[];
|
|
@@ -18,7 +18,8 @@ export interface WizardReservedLine extends WizardLinePromotionFields {
|
|
|
18
18
|
expiresAt: string;
|
|
19
19
|
/** Precio fijado de la línea (el del kit si es kit). */
|
|
20
20
|
basePriceCents: number | null;
|
|
21
|
-
|
|
21
|
+
/** @deprecated Ya no se escribe; el valor de un regalo vive en `originalPriceCents`. */
|
|
22
|
+
listPriceCents?: number | null;
|
|
22
23
|
/** Llave del registro PRICE# del que salió el precio. */
|
|
23
24
|
priceSk: string | null;
|
|
24
25
|
eligibleFinanciers: string[];
|
|
@@ -24,7 +24,7 @@ export interface SaleCompletedV1 {
|
|
|
24
24
|
* sin `type` un crédito con $1,300 de enganche era indistinguible de un contado de $1,300.
|
|
25
25
|
*/
|
|
26
26
|
type?: SaleTypeEnum;
|
|
27
|
-
/** Precio
|
|
27
|
+
/** Precio neto del equipo: su precio de venta menos su descuento. Sin equipo se omite. */
|
|
28
28
|
equipmentPriceCents?: number;
|
|
29
29
|
/** Enganche cobrado (solo `type=CREDIT`). */
|
|
30
30
|
downPaymentCents?: number;
|
|
@@ -31,7 +31,7 @@ export interface SaleCompletedV2 {
|
|
|
31
31
|
imei: string | null;
|
|
32
32
|
/** Lo COBRADO en caja. En contado == precio del equipo; en CREDIT es SOLO el enganche. */
|
|
33
33
|
amountCents: number;
|
|
34
|
-
/** Precio
|
|
34
|
+
/** Precio neto del equipo (venta menos descuento), la base de comisión. `null` sin el dato. */
|
|
35
35
|
equipmentPriceCents: number | null;
|
|
36
36
|
downPaymentCents: number | null;
|
|
37
37
|
creditId: string | null;
|