@fiado/type-kit 3.632.0 → 3.634.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/retailIntegration/eventPayloadBounds.test.ts +2 -1
- package/_test_/unit/retailIntegration/eventPayloads.test.ts +12 -0
- package/_test_/unit/retailPromotions/salePromotionPaymentCheck.test.ts +14 -0
- package/bin/retailCatalog/dtos/Product.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.d.ts +2 -1
- package/bin/retailCatalog/dtos/requests/BackofficeCreateProductRequest.js +6 -0
- package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.d.ts +2 -1
- package/bin/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.js +6 -0
- package/bin/retailCatalog/dtos/requests/CreateProductRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/CreateProductRequest.js +5 -0
- package/bin/retailCatalog/dtos/requests/SyncInventoryRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/SyncInventoryRequest.js +5 -0
- package/bin/retailCatalog/dtos/requests/UpdateProductRequest.d.ts +1 -0
- package/bin/retailCatalog/dtos/requests/UpdateProductRequest.js +5 -0
- package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +1 -0
- package/bin/retailCatalog/dtos/responses/StoreCatalogItem.d.ts +2 -0
- package/bin/retailIntegration/dtos/ProductEventPayload.d.ts +2 -0
- package/bin/retailIntegration/dtos/ProductEventPayload.js +8 -0
- package/bin/retailIntegration/models/RetailSystemProduct.d.ts +2 -0
- package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.d.ts +3 -1
- package/bin/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.js +10 -0
- package/bin/retailWizard/dtos/WizardLineProduct.d.ts +1 -0
- package/bin/retailWizard/dtos/WizardProduct.d.ts +2 -0
- package/package.json +1 -1
- package/src/retailCatalog/dtos/Product.ts +1 -0
- package/src/retailCatalog/dtos/requests/BackofficeCreateProductRequest.ts +6 -1
- package/src/retailCatalog/dtos/requests/BackofficeUpdateProductRequest.ts +6 -1
- package/src/retailCatalog/dtos/requests/CreateProductRequest.ts +4 -0
- package/src/retailCatalog/dtos/requests/SyncInventoryRequest.ts +4 -0
- package/src/retailCatalog/dtos/requests/UpdateProductRequest.ts +4 -0
- package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +1 -0
- package/src/retailCatalog/dtos/responses/StoreCatalogItem.ts +2 -0
- package/src/retailIntegration/dtos/ProductEventPayload.ts +3 -0
- package/src/retailIntegration/models/RetailSystemProduct.ts +2 -0
- package/src/retailPromotions/dtos/requests/CheckSalePromotionPaymentRequest.ts +12 -2
- package/src/retailWizard/dtos/WizardLineProduct.ts +1 -0
- package/src/retailWizard/dtos/WizardProduct.ts +2 -0
|
@@ -103,7 +103,7 @@ describe('RetailUserEventPayload: topes', () => {
|
|
|
103
103
|
describe('ProductEventPayload: topes', () => {
|
|
104
104
|
it('acepta textos, financieras y montos justo en su tope', async () => {
|
|
105
105
|
const atMax = {
|
|
106
|
-
...product, externalId: text(ID), brand: text(SHORT), model: text(SHORT), color: text(SHORT), capacity: text(SHORT), description: text(LONG),
|
|
106
|
+
...product, externalId: text(ID), brand: text(SHORT), model: text(SHORT), color: text(SHORT), capacity: text(SHORT), ram: text(SHORT), description: text(LONG),
|
|
107
107
|
price: { ...price, basePrice: '999999999999.99', listPrice: '999999999999.99' },
|
|
108
108
|
eligibleFinanciers: ['SUREKEEP', 'PAYJOY', 'CREDIYA', 'LESPAGO', 'INNOVA'],
|
|
109
109
|
};
|
|
@@ -116,6 +116,7 @@ describe('ProductEventPayload: topes', () => {
|
|
|
116
116
|
['model', { model: text(SHORT + 1) }],
|
|
117
117
|
['color', { color: text(SHORT + 1) }],
|
|
118
118
|
['capacity', { capacity: text(SHORT + 1) }],
|
|
119
|
+
['ram', { ram: text(SHORT + 1) }],
|
|
119
120
|
['description', { description: text(LONG + 1) }],
|
|
120
121
|
['price.basePrice', { price: { ...price, basePrice: '1000000000000.00' } }],
|
|
121
122
|
['price.listPrice', { price: { ...price, listPrice: '1000000000000.00' } }],
|
|
@@ -123,6 +123,18 @@ describe('ProductEventPayload', () => {
|
|
|
123
123
|
expect(dto.eligibleFinanciers).toEqual(['PAYJOY']);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
it('acepta ram ausente, null o texto, y al transformar ausente queda null', async () => {
|
|
127
|
+
expect(await errorsOf(ProductEventPayload, product)).toEqual([]);
|
|
128
|
+
expect(await errorsOf(ProductEventPayload, { ...product, ram: null })).toEqual([]);
|
|
129
|
+
expect(await errorsOf(ProductEventPayload, { ...product, ram: '8 GB' })).toEqual([]);
|
|
130
|
+
expect(plainToInstance(ProductEventPayload, product).ram).toBeNull();
|
|
131
|
+
expect(plainToInstance(ProductEventPayload, { ...product, ram: '8 GB' }).ram).toBe('8 GB');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('rechaza ram que no es texto', async () => {
|
|
135
|
+
expect(await errorsOf(ProductEventPayload, { ...product, ram: 8 })).toEqual(['ram']);
|
|
136
|
+
});
|
|
137
|
+
|
|
126
138
|
it('la gama de la integración trae los mismos valores que la de catálogo', () => {
|
|
127
139
|
expect(Object.values(RetailProductTierEnum)).toEqual(Object.values(ProductTierEnum));
|
|
128
140
|
});
|
|
@@ -20,6 +20,20 @@ describe('CheckSalePromotionPaymentRequest', () => {
|
|
|
20
20
|
expect(await errorsOf({})).toEqual([]);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
+
it('acepta methods con los medios de cada pago, tarjeta repetida incluida', async () => {
|
|
24
|
+
expect(await errorsOf({ methods: ['CARD', 'CARD', 'CASH'] })).toEqual([]);
|
|
25
|
+
expect(await errorsOf({ method: 'CARD', methods: ['CARD', 'WIRE'] })).toEqual([]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it.each([
|
|
29
|
+
['vacía', []],
|
|
30
|
+
['con un medio fuera del enum', ['CARD', 'BITCOIN']],
|
|
31
|
+
['con más de tres pagos', ['CARD', 'CARD', 'CARD', 'CARD']],
|
|
32
|
+
['que no es lista', 'CARD'],
|
|
33
|
+
])('rechaza methods %s', async (_case, methods) => {
|
|
34
|
+
expect(await errorsOf({ methods })).toEqual(['methods']);
|
|
35
|
+
});
|
|
36
|
+
|
|
23
37
|
it('el detalle del 422 nombra la promo y los medios que acepta', () => {
|
|
24
38
|
const details: PromotionPaymentNotEligibleDetails = {
|
|
25
39
|
promotionIds: 'p-1,p-2', promotionId: 'p-1', promotionName: 'Bono', acceptedOptions: 'SUREKEEP,CASH',
|
|
@@ -18,7 +18,8 @@ export declare class BackofficeCreateProductRequest {
|
|
|
18
18
|
tier?: ProductTierEnum;
|
|
19
19
|
brand?: string;
|
|
20
20
|
model?: string;
|
|
21
|
-
capacity?: string;
|
|
21
|
+
capacity?: string | null;
|
|
22
|
+
ram?: string | null;
|
|
22
23
|
color?: string;
|
|
23
24
|
description?: string;
|
|
24
25
|
imageUrl?: string;
|
|
@@ -74,6 +74,12 @@ __decorate([
|
|
|
74
74
|
(0, class_validator_1.IsString)(),
|
|
75
75
|
__metadata("design:type", String)
|
|
76
76
|
], BackofficeCreateProductRequest.prototype, "capacity", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, class_validator_1.IsOptional)(),
|
|
79
|
+
(0, class_validator_1.Matches)(/\S/),
|
|
80
|
+
(0, class_validator_1.IsString)(),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], BackofficeCreateProductRequest.prototype, "ram", void 0);
|
|
77
83
|
__decorate([
|
|
78
84
|
(0, class_validator_1.IsOptional)(),
|
|
79
85
|
(0, class_validator_1.Matches)(/\S/),
|
|
@@ -16,7 +16,8 @@ export declare class BackofficeUpdateProductRequest {
|
|
|
16
16
|
tier?: ProductTierEnum;
|
|
17
17
|
brand?: string;
|
|
18
18
|
model?: string;
|
|
19
|
-
capacity?: string;
|
|
19
|
+
capacity?: string | null;
|
|
20
|
+
ram?: string | null;
|
|
20
21
|
color?: string;
|
|
21
22
|
description?: string;
|
|
22
23
|
imageUrl?: string;
|
|
@@ -75,6 +75,12 @@ __decorate([
|
|
|
75
75
|
(0, class_validator_1.IsString)(),
|
|
76
76
|
__metadata("design:type", String)
|
|
77
77
|
], BackofficeUpdateProductRequest.prototype, "capacity", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
(0, class_validator_1.Matches)(/\S/),
|
|
81
|
+
(0, class_validator_1.IsString)(),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], BackofficeUpdateProductRequest.prototype, "ram", void 0);
|
|
78
84
|
__decorate([
|
|
79
85
|
(0, class_validator_1.IsOptional)(),
|
|
80
86
|
(0, class_validator_1.Matches)(/\S/),
|
|
@@ -46,6 +46,11 @@ __decorate([
|
|
|
46
46
|
(0, class_validator_1.IsString)(),
|
|
47
47
|
__metadata("design:type", String)
|
|
48
48
|
], CreateProductRequest.prototype, "capacity", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsOptional)(),
|
|
51
|
+
(0, class_validator_1.IsString)(),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], CreateProductRequest.prototype, "ram", void 0);
|
|
49
54
|
__decorate([
|
|
50
55
|
(0, class_validator_1.IsString)(),
|
|
51
56
|
__metadata("design:type", String)
|
|
@@ -101,6 +101,11 @@ __decorate([
|
|
|
101
101
|
(0, class_validator_1.IsString)(),
|
|
102
102
|
__metadata("design:type", String)
|
|
103
103
|
], SyncProduct.prototype, "capacity", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, class_validator_1.IsOptional)(),
|
|
106
|
+
(0, class_validator_1.IsString)(),
|
|
107
|
+
__metadata("design:type", String)
|
|
108
|
+
], SyncProduct.prototype, "ram", void 0);
|
|
104
109
|
__decorate([
|
|
105
110
|
(0, class_validator_1.IsOptional)(),
|
|
106
111
|
(0, class_validator_1.IsString)(),
|
|
@@ -42,6 +42,11 @@ __decorate([
|
|
|
42
42
|
(0, class_validator_1.IsString)(),
|
|
43
43
|
__metadata("design:type", String)
|
|
44
44
|
], UpdateProductRequest.prototype, "capacity", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, class_validator_1.IsString)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], UpdateProductRequest.prototype, "ram", void 0);
|
|
45
50
|
__decorate([
|
|
46
51
|
(0, class_validator_1.IsOptional)(),
|
|
47
52
|
(0, class_validator_1.IsString)(),
|
|
@@ -13,6 +13,8 @@ export declare class ProductEventPayload implements RetailSystemProduct {
|
|
|
13
13
|
model: string;
|
|
14
14
|
color: string | null;
|
|
15
15
|
capacity: string | null;
|
|
16
|
+
/** RAM del equipo. Opcional en el evento: ausente se vuelve `null`. */
|
|
17
|
+
ram: string | null;
|
|
16
18
|
description: string | null;
|
|
17
19
|
category: RetailProductCategory;
|
|
18
20
|
trackingMode: RetailTrackingMode;
|
|
@@ -75,6 +75,14 @@ __decorate([
|
|
|
75
75
|
(0, class_validator_1.MaxLength)(retailIntegrationLimits_1.RETAIL_SHORT_TEXT_MAX_LENGTH),
|
|
76
76
|
__metadata("design:type", String)
|
|
77
77
|
], ProductEventPayload.prototype, "capacity", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_transformer_1.Expose)(),
|
|
80
|
+
(0, class_transformer_1.Transform)(({ value }) => value ?? null),
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsString)(),
|
|
83
|
+
(0, class_validator_1.MaxLength)(retailIntegrationLimits_1.RETAIL_SHORT_TEXT_MAX_LENGTH),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], ProductEventPayload.prototype, "ram", void 0);
|
|
78
86
|
__decorate([
|
|
79
87
|
(0, class_validator_1.ValidateIf)(payloadValidators_1.isNullOrValidated),
|
|
80
88
|
(0, class_validator_1.IsString)(),
|
|
@@ -21,6 +21,8 @@ export interface RetailSystemProduct {
|
|
|
21
21
|
model: string;
|
|
22
22
|
color: string | null;
|
|
23
23
|
capacity: string | null;
|
|
24
|
+
/** RAM del equipo; `capacity` es la ROM. */
|
|
25
|
+
ram?: string | null;
|
|
24
26
|
description: string | null;
|
|
25
27
|
category: RetailProductCategory;
|
|
26
28
|
trackingMode: RetailTrackingMode;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SalePaymentMethodEnum } from '../../../retailWizard/enums/SalePaymentMethodEnum';
|
|
2
2
|
/** Body de `POST /private/sessions/{sessionId}/sale-promotion/payment-check` (M2M). */
|
|
3
3
|
export declare class CheckSalePromotionPaymentRequest {
|
|
4
|
-
/** Medio del cobro de contado; ausente = se valida contra la forma de pago de la sesión
|
|
4
|
+
/** @deprecated Usa `methods`. Medio del cobro de contado; ausente = se valida contra la forma de pago de la sesión. */
|
|
5
5
|
method?: SalePaymentMethodEnum;
|
|
6
|
+
/** Medios del cobro de contado, uno por pago; si viene, manda sobre `method`. */
|
|
7
|
+
methods?: SalePaymentMethodEnum[];
|
|
6
8
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CheckSalePromotionPaymentRequest = void 0;
|
|
13
13
|
const class_transformer_1 = require("class-transformer");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const retailWizardValidation_1 = require("../../../retailWizard/constants/retailWizardValidation");
|
|
15
16
|
const SalePaymentMethodEnum_1 = require("../../../retailWizard/enums/SalePaymentMethodEnum");
|
|
16
17
|
/** Body de `POST /private/sessions/{sessionId}/sale-promotion/payment-check` (M2M). */
|
|
17
18
|
class CheckSalePromotionPaymentRequest {
|
|
@@ -23,3 +24,12 @@ __decorate([
|
|
|
23
24
|
(0, class_validator_1.IsEnum)(SalePaymentMethodEnum_1.SalePaymentMethodEnum),
|
|
24
25
|
__metadata("design:type", String)
|
|
25
26
|
], CheckSalePromotionPaymentRequest.prototype, "method", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_transformer_1.Expose)(),
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
30
|
+
(0, class_validator_1.IsArray)(),
|
|
31
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
32
|
+
(0, class_validator_1.ArrayMaxSize)(retailWizardValidation_1.MAX_SALE_PAYMENTS),
|
|
33
|
+
(0, class_validator_1.IsEnum)(SalePaymentMethodEnum_1.SalePaymentMethodEnum, { each: true }),
|
|
34
|
+
__metadata("design:type", Array)
|
|
35
|
+
], CheckSalePromotionPaymentRequest.prototype, "methods", void 0);
|
|
@@ -31,6 +31,8 @@ export interface WizardProduct {
|
|
|
31
31
|
brand: string;
|
|
32
32
|
model: string;
|
|
33
33
|
capacity: string;
|
|
34
|
+
/** RAM del equipo; `capacity` es la ROM. */
|
|
35
|
+
ram?: string | null;
|
|
34
36
|
color: string;
|
|
35
37
|
imageUrl: string | null;
|
|
36
38
|
/** Gama del equipo (`PREMIUM` / `HIGH` / `MID` …). La define el catálogo, no el wizard. */
|
package/package.json
CHANGED
|
@@ -52,7 +52,12 @@ export class BackofficeCreateProductRequest {
|
|
|
52
52
|
@IsOptional()
|
|
53
53
|
@Matches(/\S/)
|
|
54
54
|
@IsString()
|
|
55
|
-
capacity?: string;
|
|
55
|
+
capacity?: string | null;
|
|
56
|
+
|
|
57
|
+
@IsOptional()
|
|
58
|
+
@Matches(/\S/)
|
|
59
|
+
@IsString()
|
|
60
|
+
ram?: string | null;
|
|
56
61
|
|
|
57
62
|
@IsOptional()
|
|
58
63
|
@Matches(/\S/)
|
|
@@ -53,7 +53,12 @@ export class BackofficeUpdateProductRequest {
|
|
|
53
53
|
@IsOptional()
|
|
54
54
|
@Matches(/\S/)
|
|
55
55
|
@IsString()
|
|
56
|
-
capacity?: string;
|
|
56
|
+
capacity?: string | null;
|
|
57
|
+
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@Matches(/\S/)
|
|
60
|
+
@IsString()
|
|
61
|
+
ram?: string | null;
|
|
57
62
|
|
|
58
63
|
@IsOptional()
|
|
59
64
|
@Matches(/\S/)
|
|
@@ -47,6 +47,9 @@ export class ProductEventPayload implements RetailSystemProduct {
|
|
|
47
47
|
@IsString() @Matches(/\S/) @MaxLength(RETAIL_SHORT_TEXT_MAX_LENGTH) model!: string;
|
|
48
48
|
@ValidateIf(isNullOrValidated) @IsString() @MaxLength(RETAIL_SHORT_TEXT_MAX_LENGTH) color!: string | null;
|
|
49
49
|
@ValidateIf(isNullOrValidated) @IsString() @MaxLength(RETAIL_SHORT_TEXT_MAX_LENGTH) capacity!: string | null;
|
|
50
|
+
/** RAM del equipo. Opcional en el evento: ausente se vuelve `null`. */
|
|
51
|
+
@Expose() @Transform(({ value }) => value ?? null)
|
|
52
|
+
@IsOptional() @IsString() @MaxLength(RETAIL_SHORT_TEXT_MAX_LENGTH) ram!: string | null;
|
|
50
53
|
@ValidateIf(isNullOrValidated) @IsString() @MaxLength(RETAIL_LONG_TEXT_MAX_LENGTH) description!: string | null;
|
|
51
54
|
@IsIn(Object.values(RetailProductCategoryEnum)) category!: RetailProductCategory;
|
|
52
55
|
@IsIn(Object.values(RetailTrackingModeEnum)) trackingMode!: RetailTrackingMode;
|
|
@@ -33,6 +33,8 @@ export interface RetailSystemProduct {
|
|
|
33
33
|
model: string;
|
|
34
34
|
color: string | null;
|
|
35
35
|
capacity: string | null;
|
|
36
|
+
/** RAM del equipo; `capacity` es la ROM. */
|
|
37
|
+
ram?: string | null;
|
|
36
38
|
description: string | null;
|
|
37
39
|
category: RetailProductCategory;
|
|
38
40
|
trackingMode: RetailTrackingMode;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { Expose } from 'class-transformer';
|
|
2
|
-
import { IsEnum, IsOptional } from 'class-validator';
|
|
2
|
+
import { ArrayMaxSize, ArrayNotEmpty, IsArray, IsEnum, IsOptional } from 'class-validator';
|
|
3
|
+
import { MAX_SALE_PAYMENTS } from '../../../retailWizard/constants/retailWizardValidation';
|
|
3
4
|
import { SalePaymentMethodEnum } from '../../../retailWizard/enums/SalePaymentMethodEnum';
|
|
4
5
|
|
|
5
6
|
/** Body de `POST /private/sessions/{sessionId}/sale-promotion/payment-check` (M2M). */
|
|
6
7
|
export class CheckSalePromotionPaymentRequest {
|
|
7
|
-
/** Medio del cobro de contado; ausente = se valida contra la forma de pago de la sesión
|
|
8
|
+
/** @deprecated Usa `methods`. Medio del cobro de contado; ausente = se valida contra la forma de pago de la sesión. */
|
|
8
9
|
@Expose()
|
|
9
10
|
@IsOptional()
|
|
10
11
|
@IsEnum(SalePaymentMethodEnum)
|
|
11
12
|
method?: SalePaymentMethodEnum;
|
|
13
|
+
|
|
14
|
+
/** Medios del cobro de contado, uno por pago; si viene, manda sobre `method`. */
|
|
15
|
+
@Expose()
|
|
16
|
+
@IsOptional()
|
|
17
|
+
@IsArray()
|
|
18
|
+
@ArrayNotEmpty()
|
|
19
|
+
@ArrayMaxSize(MAX_SALE_PAYMENTS)
|
|
20
|
+
@IsEnum(SalePaymentMethodEnum, { each: true })
|
|
21
|
+
methods?: SalePaymentMethodEnum[];
|
|
12
22
|
}
|
|
@@ -32,6 +32,8 @@ export interface WizardProduct {
|
|
|
32
32
|
brand: string;
|
|
33
33
|
model: string;
|
|
34
34
|
capacity: string;
|
|
35
|
+
/** RAM del equipo; `capacity` es la ROM. */
|
|
36
|
+
ram?: string | null;
|
|
35
37
|
color: string;
|
|
36
38
|
imageUrl: string | null;
|
|
37
39
|
/** Gama del equipo (`PREMIUM` / `HIGH` / `MID` …). La define el catálogo, no el wizard. */
|