@fiado/type-kit 3.449.0 → 3.450.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.
@@ -0,0 +1,37 @@
1
+ import 'reflect-metadata';
2
+ import { validate } from "class-validator";
3
+ import { plainToInstance } from "class-transformer";
4
+ import { CreateProductCatalogRequest } from "../../../../src/productCatalog/dtos/CreateProductCatalogRequest";
5
+
6
+ describe("CreateProductCatalogRequest — campo minFee", () => {
7
+ const base = {
8
+ id: "SP_CASH_IN",
9
+ description: "Comisión fondeo en efectivo",
10
+ displayName: "Comisión fondeo en efectivo",
11
+ type: "SP_CASH_IN",
12
+ currencyId: "484",
13
+ feeType: "PERCENT_WITH_MIN",
14
+ fee: 3.5,
15
+ taxType: "PERCENT",
16
+ tax: 16,
17
+ };
18
+
19
+ it("acepta minFee numérico >= 0", async () => {
20
+ const dto = plainToInstance(CreateProductCatalogRequest, { ...base, minFee: 10 });
21
+ const errors = await validate(dto);
22
+ expect(errors).toEqual([]);
23
+ });
24
+
25
+ it("acepta minFee ausente (opcional, retro-compat)", async () => {
26
+ const dto = plainToInstance(CreateProductCatalogRequest, base);
27
+ const errors = await validate(dto);
28
+ expect(errors).toEqual([]);
29
+ });
30
+
31
+ it("rechaza minFee no numérico", async () => {
32
+ const dto = plainToInstance(CreateProductCatalogRequest, { ...base, minFee: "diez" });
33
+ const errors = await validate(dto);
34
+ expect(errors.length).toBeGreaterThan(0);
35
+ expect(errors[0].property).toBe("minFee");
36
+ });
37
+ });
@@ -0,0 +1,39 @@
1
+ import 'reflect-metadata';
2
+ import { validate } from "class-validator";
3
+ import { plainToInstance } from "class-transformer";
4
+ import GetProductCatalogResponse from "../../../../src/productCatalog/dtos/GetProductCatalogResponse";
5
+
6
+ describe("GetProductCatalogResponse — campo minFee", () => {
7
+ const base = {
8
+ id: "SP_CASH_IN",
9
+ description: "Comisión fondeo en efectivo",
10
+ displayName: "Comisión fondeo en efectivo",
11
+ type: "SP_CASH_IN",
12
+ currencyId: "484",
13
+ feeType: "PERCENT_WITH_MIN",
14
+ fee: 3.5,
15
+ taxType: "PERCENT",
16
+ tax: 16,
17
+ createdAt: "2026-01-01T00:00:00Z",
18
+ updatedAt: "2026-09-19T00:00:00Z",
19
+ };
20
+
21
+ it("acepta minFee numérico >= 0", async () => {
22
+ const dto = plainToInstance(GetProductCatalogResponse, { ...base, minFee: 10 });
23
+ const errors = await validate(dto);
24
+ expect(errors).toEqual([]);
25
+ });
26
+
27
+ it("acepta minFee ausente (opcional, retro-compat)", async () => {
28
+ const dto = plainToInstance(GetProductCatalogResponse, base);
29
+ const errors = await validate(dto);
30
+ expect(errors).toEqual([]);
31
+ });
32
+
33
+ it("rechaza minFee no numérico", async () => {
34
+ const dto = plainToInstance(GetProductCatalogResponse, { ...base, minFee: "diez" });
35
+ const errors = await validate(dto);
36
+ expect(errors.length).toBeGreaterThan(0);
37
+ expect(errors[0].property).toBe("minFee");
38
+ });
39
+ });
@@ -0,0 +1,13 @@
1
+ import 'reflect-metadata';
2
+ import { ProductTaxFeeTypeEnum } from "../../../../src/productCatalog/enums/ProductTaxFeeTypeEnum";
3
+
4
+ describe("ProductTaxFeeTypeEnum", () => {
5
+ it("incluye PERCENT_WITH_MIN para tarifas con piso", () => {
6
+ expect(ProductTaxFeeTypeEnum.PERCENT_WITH_MIN).toBe("PERCENT_WITH_MIN");
7
+ });
8
+
9
+ it("preserva valores existentes PERCENT y FIXED", () => {
10
+ expect(ProductTaxFeeTypeEnum.PERCENT).toBe("PERCENT");
11
+ expect(ProductTaxFeeTypeEnum.FIXED).toBe("FIXED");
12
+ });
13
+ });
@@ -11,4 +11,5 @@ export declare class CreateProductCatalogRequest {
11
11
  fee: number;
12
12
  taxType: ProductTaxFeeTypeEnum;
13
13
  tax: number;
14
+ minFee?: number;
14
15
  }
@@ -1,6 +1,21 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.CreateProductCatalogRequest = void 0;
13
+ const class_validator_1 = require("class-validator");
4
14
  class CreateProductCatalogRequest {
5
15
  }
6
16
  exports.CreateProductCatalogRequest = CreateProductCatalogRequest;
17
+ __decorate([
18
+ (0, class_validator_1.IsOptional)(),
19
+ (0, class_validator_1.IsNumber)(),
20
+ __metadata("design:type", Number)
21
+ ], CreateProductCatalogRequest.prototype, "minFee", void 0);
@@ -11,6 +11,7 @@ export default class GetProductCatalogResponse {
11
11
  fee: number;
12
12
  taxType: ProductTaxFeeTypeEnum;
13
13
  tax: number;
14
+ minFee?: number;
14
15
  createdAt: string;
15
16
  updatedAt: string;
16
17
  }
@@ -52,6 +52,11 @@ __decorate([
52
52
  (0, class_validator_1.IsNumber)(),
53
53
  __metadata("design:type", Number)
54
54
  ], GetProductCatalogResponse.prototype, "tax", void 0);
55
+ __decorate([
56
+ (0, class_validator_1.IsOptional)(),
57
+ (0, class_validator_1.IsNumber)(),
58
+ __metadata("design:type", Number)
59
+ ], GetProductCatalogResponse.prototype, "minFee", void 0);
55
60
  __decorate([
56
61
  (0, class_validator_1.IsString)(),
57
62
  __metadata("design:type", String)
@@ -1,4 +1,5 @@
1
1
  export declare enum ProductTaxFeeTypeEnum {
2
2
  PERCENT = "PERCENT",
3
- FIXED = "FIXED"
3
+ FIXED = "FIXED",
4
+ PERCENT_WITH_MIN = "PERCENT_WITH_MIN"
4
5
  }
@@ -5,4 +5,5 @@ var ProductTaxFeeTypeEnum;
5
5
  (function (ProductTaxFeeTypeEnum) {
6
6
  ProductTaxFeeTypeEnum["PERCENT"] = "PERCENT";
7
7
  ProductTaxFeeTypeEnum["FIXED"] = "FIXED";
8
+ ProductTaxFeeTypeEnum["PERCENT_WITH_MIN"] = "PERCENT_WITH_MIN";
8
9
  })(ProductTaxFeeTypeEnum || (exports.ProductTaxFeeTypeEnum = ProductTaxFeeTypeEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.449.0",
3
+ "version": "3.450.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import {CountryId} from "../../country";
2
2
  import {ProductTaxFeeTypeEnum} from "../enums/ProductTaxFeeTypeEnum";
3
3
  import {ProductTypeEnum} from "../enums/ProductTypeEnum";
4
+ import {IsNumber, IsOptional} from "class-validator";
4
5
 
5
6
  export class CreateProductCatalogRequest {
6
7
  id: string;
@@ -12,4 +13,8 @@ export class CreateProductCatalogRequest {
12
13
  fee: number;
13
14
  taxType: ProductTaxFeeTypeEnum;
14
15
  tax: number;
16
+
17
+ @IsOptional()
18
+ @IsNumber()
19
+ minFee?: number;
15
20
  }
@@ -1,6 +1,6 @@
1
1
  import {CountryId} from "../../country";
2
2
  import {ProductTaxFeeTypeEnum} from "../enums/ProductTaxFeeTypeEnum";
3
- import {IsEnum, IsNumber, IsString} from "class-validator";
3
+ import {IsEnum, IsNumber, IsOptional, IsString} from "class-validator";
4
4
  import {ProductTypeEnum} from "../enums/ProductTypeEnum";
5
5
 
6
6
  export default class GetProductCatalogResponse {
@@ -31,6 +31,10 @@ export default class GetProductCatalogResponse {
31
31
  @IsNumber()
32
32
  tax: number;
33
33
 
34
+ @IsOptional()
35
+ @IsNumber()
36
+ minFee?: number;
37
+
34
38
  @IsString()
35
39
  createdAt: string;
36
40
 
@@ -1,4 +1,5 @@
1
1
  export enum ProductTaxFeeTypeEnum {
2
2
  PERCENT = "PERCENT",
3
- FIXED = "FIXED"
3
+ FIXED = "FIXED",
4
+ PERCENT_WITH_MIN = "PERCENT_WITH_MIN",
4
5
  }