@fiado/type-kit 1.0.1 → 1.0.3
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/bin/address/dtos/AddressShippingDto.d.ts +11 -0
- package/bin/address/index.d.ts +1 -0
- package/bin/card/dtos/CardActivateDto.d.ts +4 -0
- package/bin/card/dtos/CardActivateRequestDto.d.ts +4 -0
- package/bin/card/dtos/CardActivateRequestDto.js +26 -0
- package/bin/card/dtos/CardApplicationRequestDto.d.ts +6 -0
- package/bin/card/dtos/CardApplicationRequestDto.js +34 -0
- package/bin/card/dtos/CardRequestDto.d.ts +6 -0
- package/bin/card/dtos/CardUpdateRequestDto.d.ts +5 -0
- package/bin/card/dtos/CardUpdateRequestDto.js +28 -0
- package/bin/card/dtos/CreateCardDto.d.ts +34 -0
- package/bin/card/dtos/CreateCardRequestDto.d.ts +34 -0
- package/bin/card/dtos/CreateCardRequestDto.js +176 -0
- package/bin/card/enums/Brand.d.ts +8 -0
- package/bin/card/enums/CardType.d.ts +5 -0
- package/bin/card/enums/CardUpdateKey.d.ts +4 -0
- package/bin/card/enums/IssuanceType.d.ts +4 -0
- package/bin/card/enums/OwnershipType.d.ts +4 -0
- package/bin/card/enums/Status.d.ts +5 -0
- package/bin/card/enums/UpdateKey.d.ts +4 -0
- package/bin/card/enums/UpdateKey.js +8 -0
- package/bin/card/validations/CardUpdateKeyConstraint.d.ts +7 -0
- package/bin/card/validations/CardUpdateKeyConstraint.js +58 -0
- package/bin/country/enums/CountryId.d.ts +4 -0
- package/bin/country/index.d.ts +1 -0
- package/bin/helpers/ValidationUtils.d.ts +6 -0
- package/bin/helpers/constans/regex.d.ts +2 -0
- package/bin/index.d.ts +9 -0
- package/bin/index.js +25 -0
- package/bin/provider/enums/Provider.d.ts +4 -0
- package/package.json +1 -1
- package/src/card/dtos/{CardActivateDto.ts → CardActivateRequestDto.ts} +1 -1
- package/src/card/dtos/CardUpdateRequestDto.ts +16 -0
- package/src/card/enums/UpdateKey.ts +6 -0
- package/src/card/validations/CardUpdateKeyConstraint.ts +56 -0
- package/src/index.ts +13 -0
- package/src/card/index.ts +0 -13
- /package/src/card/dtos/{CardRequestDto.ts → CardApplicationRequestDto.ts} +0 -0
- /package/src/card/dtos/{CreateCardDto.ts → CreateCardRequestDto.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CountryId } from '../../country/enums/CountryId';
|
|
2
|
+
export declare class ShippingAddressDto {
|
|
3
|
+
municipality: string;
|
|
4
|
+
neighborhood: string;
|
|
5
|
+
postalCode: string;
|
|
6
|
+
street: string;
|
|
7
|
+
subRegion: string;
|
|
8
|
+
addressNumber: string;
|
|
9
|
+
internalNumber?: string;
|
|
10
|
+
countryId: CountryId;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dtos/AddressShippingDto';
|
|
@@ -0,0 +1,26 @@
|
|
|
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.CardActivateRequestDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const CountryId_1 = require("../../country/enums/CountryId");
|
|
15
|
+
class CardActivateRequestDto {
|
|
16
|
+
}
|
|
17
|
+
exports.CardActivateRequestDto = CardActivateRequestDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsEnum)(CountryId_1.CountryId),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], CardActivateRequestDto.prototype, "countryId", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
(0, class_validator_1.Matches)(/^\d{16}$/),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CardActivateRequestDto.prototype, "panOrCode", void 0);
|
|
@@ -0,0 +1,34 @@
|
|
|
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.CardRequest = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const CountryId_1 = require("../../country/enums/CountryId");
|
|
16
|
+
const CardType_1 = require("../enums/CardType");
|
|
17
|
+
const AddressShippingDto_1 = require("../../address/dtos/AddressShippingDto");
|
|
18
|
+
class CardRequest {
|
|
19
|
+
}
|
|
20
|
+
exports.CardRequest = CardRequest;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsEnum)(CountryId_1.CountryId),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], CardRequest.prototype, "countryId", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsEnum)(CardType_1.CardType),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], CardRequest.prototype, "type", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
(0, class_validator_1.ValidateNested)(),
|
|
32
|
+
(0, class_transformer_1.Type)(() => AddressShippingDto_1.ShippingAddressDto),
|
|
33
|
+
__metadata("design:type", AddressShippingDto_1.ShippingAddressDto)
|
|
34
|
+
], CardRequest.prototype, "address", void 0);
|
|
@@ -0,0 +1,28 @@
|
|
|
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.CardUpdateRequestDto = void 0;
|
|
13
|
+
const IsEnum_1 = require("class-validator/types/decorator/typechecker/IsEnum");
|
|
14
|
+
const UpdateKey_1 = require("../enums/UpdateKey");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const CardUpdateKeyConstraint_1 = require("../validations/CardUpdateKeyConstraint");
|
|
17
|
+
class CardUpdateRequestDto {
|
|
18
|
+
}
|
|
19
|
+
exports.CardUpdateRequestDto = CardUpdateRequestDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, IsEnum_1.IsEnum)(UpdateKey_1.UpdateKey),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CardUpdateRequestDto.prototype, "type", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, CardUpdateKeyConstraint_1.IsValueValid)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], CardUpdateRequestDto.prototype, "value", void 0);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CountryId } from '../../country/enums/CountryId';
|
|
2
|
+
import { ShippingAddressDto } from '../../address/dtos/AddressShippingDto';
|
|
3
|
+
import { CardType } from '../enums/CardType';
|
|
4
|
+
import { Brand } from '../enums/Brand';
|
|
5
|
+
import { OwnershipType } from '../enums/OwnershipType';
|
|
6
|
+
import { Status } from '../enums/Status';
|
|
7
|
+
export declare class CreateCardDto {
|
|
8
|
+
id?: string;
|
|
9
|
+
accountId?: string;
|
|
10
|
+
activationDate?: string;
|
|
11
|
+
countryId: CountryId;
|
|
12
|
+
type: CardType;
|
|
13
|
+
directoryId?: string;
|
|
14
|
+
externalCardId: string;
|
|
15
|
+
externalUserId: string;
|
|
16
|
+
externalShipmentId: string;
|
|
17
|
+
shipmentProvider: string;
|
|
18
|
+
externalShipmentTrackingId: string;
|
|
19
|
+
externalShipmentTrackingUrl: string;
|
|
20
|
+
holderName: string;
|
|
21
|
+
holderLastName: string;
|
|
22
|
+
imageUrl?: string;
|
|
23
|
+
brand: Brand;
|
|
24
|
+
ownershipType: OwnershipType;
|
|
25
|
+
lastFour: string;
|
|
26
|
+
providerName?: string;
|
|
27
|
+
status: Status;
|
|
28
|
+
statusUpdateDate?: string;
|
|
29
|
+
tenantId?: string;
|
|
30
|
+
spendLimitByTransaction?: number;
|
|
31
|
+
spendLimitByDay?: number;
|
|
32
|
+
spendLimitByMonth?: number;
|
|
33
|
+
shippedAddress?: ShippingAddressDto;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CountryId } from '../../country/enums/CountryId';
|
|
2
|
+
import { ShippingAddressDto } from '../../address/dtos/AddressShippingDto';
|
|
3
|
+
import { CardType } from '../enums/CardType';
|
|
4
|
+
import { Brand } from '../enums/Brand';
|
|
5
|
+
import { OwnershipType } from '../enums/OwnershipType';
|
|
6
|
+
import { Status } from '../enums/Status';
|
|
7
|
+
export declare class CreateCardDto {
|
|
8
|
+
id?: string;
|
|
9
|
+
accountId?: string;
|
|
10
|
+
activationDate?: string;
|
|
11
|
+
countryId: CountryId;
|
|
12
|
+
type: CardType;
|
|
13
|
+
directoryId?: string;
|
|
14
|
+
externalCardId: string;
|
|
15
|
+
externalUserId: string;
|
|
16
|
+
externalShipmentId: string;
|
|
17
|
+
shipmentProvider: string;
|
|
18
|
+
externalShipmentTrackingId: string;
|
|
19
|
+
externalShipmentTrackingUrl: string;
|
|
20
|
+
holderName: string;
|
|
21
|
+
holderLastName: string;
|
|
22
|
+
imageUrl?: string;
|
|
23
|
+
brand: Brand;
|
|
24
|
+
ownershipType: OwnershipType;
|
|
25
|
+
lastFour: string;
|
|
26
|
+
providerName?: string;
|
|
27
|
+
status: Status;
|
|
28
|
+
statusUpdateDate?: string;
|
|
29
|
+
tenantId?: string;
|
|
30
|
+
spendLimitByTransaction?: number;
|
|
31
|
+
spendLimitByDay?: number;
|
|
32
|
+
spendLimitByMonth?: number;
|
|
33
|
+
shippedAddress?: ShippingAddressDto;
|
|
34
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
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.CreateCardDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const CountryId_1 = require("../../country/enums/CountryId");
|
|
16
|
+
const AddressShippingDto_1 = require("../../address/dtos/AddressShippingDto");
|
|
17
|
+
const CardType_1 = require("../enums/CardType");
|
|
18
|
+
const Brand_1 = require("../enums/Brand");
|
|
19
|
+
const OwnershipType_1 = require("../enums/OwnershipType");
|
|
20
|
+
const Status_1 = require("../enums/Status");
|
|
21
|
+
const regex_1 = require("../../helpers/constans/regex");
|
|
22
|
+
class CreateCardDto {
|
|
23
|
+
}
|
|
24
|
+
exports.CreateCardDto = CreateCardDto;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsOptional)(),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.Matches)(regex_1.regexUuidV4, {
|
|
29
|
+
message: 'id must be a valid UUID v4',
|
|
30
|
+
}),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], CreateCardDto.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
(0, class_validator_1.Matches)(regex_1.regexUuidV4, {
|
|
37
|
+
message: 'accountId must be a valid UUID v4 or null',
|
|
38
|
+
}),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], CreateCardDto.prototype, "accountId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
(0, class_validator_1.Matches)(regex_1.regexIso8601, {
|
|
45
|
+
message: 'activationDate must be a valid ISO 8601 date string',
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], CreateCardDto.prototype, "activationDate", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsEnum)(CountryId_1.CountryId),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], CreateCardDto.prototype, "countryId", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_validator_1.IsEnum)(CardType_1.CardType),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], CreateCardDto.prototype, "type", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_validator_1.IsString)(),
|
|
59
|
+
(0, class_validator_1.Matches)(regex_1.regexUuidV4, {
|
|
60
|
+
message: 'directoryId must be a valid UUID v4',
|
|
61
|
+
}),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], CreateCardDto.prototype, "directoryId", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.Length)(1, 100),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], CreateCardDto.prototype, "externalCardId", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_validator_1.IsString)(),
|
|
71
|
+
(0, class_validator_1.Length)(1, 100),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], CreateCardDto.prototype, "externalUserId", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
(0, class_validator_1.IsString)(),
|
|
77
|
+
(0, class_validator_1.Length)(1, 100),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], CreateCardDto.prototype, "externalShipmentId", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsString)(),
|
|
83
|
+
(0, class_validator_1.Length)(1, 50),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], CreateCardDto.prototype, "shipmentProvider", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, class_validator_1.IsOptional)(),
|
|
88
|
+
(0, class_validator_1.IsString)(),
|
|
89
|
+
(0, class_validator_1.Length)(1, 50),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], CreateCardDto.prototype, "externalShipmentTrackingId", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_validator_1.IsOptional)(),
|
|
94
|
+
(0, class_validator_1.IsString)(),
|
|
95
|
+
(0, class_validator_1.Length)(1, 200),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], CreateCardDto.prototype, "externalShipmentTrackingUrl", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, class_validator_1.IsOptional)(),
|
|
100
|
+
(0, class_validator_1.IsString)(),
|
|
101
|
+
(0, class_validator_1.Length)(1, 50),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], CreateCardDto.prototype, "holderName", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, class_validator_1.IsOptional)(),
|
|
106
|
+
(0, class_validator_1.IsString)(),
|
|
107
|
+
(0, class_validator_1.Length)(1, 50),
|
|
108
|
+
__metadata("design:type", String)
|
|
109
|
+
], CreateCardDto.prototype, "holderLastName", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, class_validator_1.IsOptional)(),
|
|
112
|
+
(0, class_validator_1.IsString)(),
|
|
113
|
+
(0, class_validator_1.Length)(1, 200),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], CreateCardDto.prototype, "imageUrl", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, class_validator_1.IsEnum)(Brand_1.Brand),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], CreateCardDto.prototype, "brand", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, class_validator_1.IsEnum)(OwnershipType_1.OwnershipType),
|
|
122
|
+
__metadata("design:type", String)
|
|
123
|
+
], CreateCardDto.prototype, "ownershipType", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, class_validator_1.IsString)(),
|
|
126
|
+
(0, class_validator_1.Length)(4, 4),
|
|
127
|
+
__metadata("design:type", String)
|
|
128
|
+
], CreateCardDto.prototype, "lastFour", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
(0, class_validator_1.IsOptional)(),
|
|
131
|
+
(0, class_validator_1.IsString)(),
|
|
132
|
+
(0, class_validator_1.Length)(1, 50),
|
|
133
|
+
__metadata("design:type", String)
|
|
134
|
+
], CreateCardDto.prototype, "providerName", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, class_validator_1.IsEnum)(Status_1.Status),
|
|
137
|
+
__metadata("design:type", String)
|
|
138
|
+
], CreateCardDto.prototype, "status", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, class_validator_1.IsOptional)(),
|
|
141
|
+
(0, class_validator_1.IsString)(),
|
|
142
|
+
__metadata("design:type", String)
|
|
143
|
+
], CreateCardDto.prototype, "statusUpdateDate", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, class_validator_1.IsOptional)(),
|
|
146
|
+
(0, class_validator_1.IsString)(),
|
|
147
|
+
(0, class_validator_1.Length)(1, 50),
|
|
148
|
+
__metadata("design:type", String)
|
|
149
|
+
], CreateCardDto.prototype, "tenantId", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, class_validator_1.IsOptional)(),
|
|
152
|
+
(0, class_validator_1.IsNumber)(),
|
|
153
|
+
(0, class_validator_1.Min)(1),
|
|
154
|
+
(0, class_validator_1.Max)(9999999999),
|
|
155
|
+
__metadata("design:type", Number)
|
|
156
|
+
], CreateCardDto.prototype, "spendLimitByTransaction", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, class_validator_1.IsOptional)(),
|
|
159
|
+
(0, class_validator_1.IsNumber)(),
|
|
160
|
+
(0, class_validator_1.Min)(1),
|
|
161
|
+
(0, class_validator_1.Max)(9999999999),
|
|
162
|
+
__metadata("design:type", Number)
|
|
163
|
+
], CreateCardDto.prototype, "spendLimitByDay", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, class_validator_1.IsOptional)(),
|
|
166
|
+
(0, class_validator_1.IsNumber)(),
|
|
167
|
+
(0, class_validator_1.Min)(1),
|
|
168
|
+
(0, class_validator_1.Max)(9999999999),
|
|
169
|
+
__metadata("design:type", Number)
|
|
170
|
+
], CreateCardDto.prototype, "spendLimitByMonth", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, class_validator_1.IsOptional)(),
|
|
173
|
+
(0, class_validator_1.ValidateNested)(),
|
|
174
|
+
(0, class_transformer_1.Type)(() => AddressShippingDto_1.ShippingAddressDto),
|
|
175
|
+
__metadata("design:type", AddressShippingDto_1.ShippingAddressDto)
|
|
176
|
+
], CreateCardDto.prototype, "shippedAddress", void 0);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateKey = void 0;
|
|
4
|
+
var UpdateKey;
|
|
5
|
+
(function (UpdateKey) {
|
|
6
|
+
UpdateKey["CHANGE_STATUS"] = "CHANGE_STATUS";
|
|
7
|
+
UpdateKey["CHANGE_PIN"] = "CHANGE_PIN";
|
|
8
|
+
})(UpdateKey || (exports.UpdateKey = UpdateKey = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValidationArguments, ValidationOptions } from "class-validator";
|
|
2
|
+
import { Status } from "../enums/Status";
|
|
3
|
+
export declare class CardUpdateKeyConstraint {
|
|
4
|
+
static validateUpdateKey(value: string | Status, arg: ValidationArguments): boolean;
|
|
5
|
+
defaultMessage(args: ValidationArguments): string;
|
|
6
|
+
}
|
|
7
|
+
export declare function IsValueValid(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.IsValueValid = exports.CardUpdateKeyConstraint = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
const Status_1 = require("../enums/Status");
|
|
12
|
+
const UpdateKey_1 = require("../enums/UpdateKey");
|
|
13
|
+
let CardUpdateKeyConstraint = class CardUpdateKeyConstraint {
|
|
14
|
+
static validateUpdateKey(value, arg) {
|
|
15
|
+
const cardUpdateRequest = arg.object;
|
|
16
|
+
// Validar si el valor es uno de los status válidos
|
|
17
|
+
if (cardUpdateRequest.type === UpdateKey_1.UpdateKey.CHANGE_STATUS) {
|
|
18
|
+
return Object.values(Status_1.Status).includes(value);
|
|
19
|
+
}
|
|
20
|
+
// Validar si el valor es un string de 4 dígitos no consecutivos
|
|
21
|
+
if (cardUpdateRequest.type === UpdateKey_1.UpdateKey.CHANGE_PIN) {
|
|
22
|
+
if (!/^\d{4}$/.test(value))
|
|
23
|
+
return false; // Debe ser un string de 4 dígitos
|
|
24
|
+
// Verifica que no sean consecutivos asc o desc
|
|
25
|
+
for (let i = 0; i < value.length - 1; i++) {
|
|
26
|
+
if (Math.abs(parseInt(value[i]) - parseInt(value[i + 1])) !== 1) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
// En caso de que type no sea ninguno de los esperados
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
defaultMessage(args) {
|
|
39
|
+
// Se4 puede usar args para personalizar aún más el mensaje de error basado en el valor o las propiedades.
|
|
40
|
+
return "El valor no es adecuado para el tipo de actualización.";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.CardUpdateKeyConstraint = CardUpdateKeyConstraint;
|
|
44
|
+
exports.CardUpdateKeyConstraint = CardUpdateKeyConstraint = __decorate([
|
|
45
|
+
(0, class_validator_1.ValidatorConstraint)({ async: true })
|
|
46
|
+
], CardUpdateKeyConstraint);
|
|
47
|
+
function IsValueValid(validationOptions) {
|
|
48
|
+
return function (object, propertyName) {
|
|
49
|
+
(0, class_validator_1.registerDecorator)({
|
|
50
|
+
target: object.constructor,
|
|
51
|
+
propertyName: propertyName,
|
|
52
|
+
options: validationOptions,
|
|
53
|
+
constraints: [],
|
|
54
|
+
validator: CardUpdateKeyConstraint,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.IsValueValid = IsValueValid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums/CountryId';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare class ValidationUtils {
|
|
2
|
+
static validateUuidV4(value: any): boolean;
|
|
3
|
+
static validateStringLength(minLength: number, maxLength: number): (value: string) => boolean;
|
|
4
|
+
static validateIso8601(value: string): boolean;
|
|
5
|
+
static validateNumberRange(minValue: number, maxValue: number): (value: number | null) => boolean;
|
|
6
|
+
}
|
package/bin/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './card/dtos/CardActivateRequestDto';
|
|
2
|
+
export * from './card/dtos/CardApplicationRequestDto';
|
|
3
|
+
export * from './card/dtos/CreateCardRequestDto';
|
|
4
|
+
export * from './card/enums/CardType';
|
|
5
|
+
export * from './card/enums/CardUpdateKey';
|
|
6
|
+
export * from './card/enums/IssuanceType';
|
|
7
|
+
export * from './card/enums/Status';
|
|
8
|
+
export * from './card/enums/IssuanceType';
|
|
9
|
+
export * from './card/enums/OwnershipType';
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./card/dtos/CardActivateRequestDto"), exports);
|
|
18
|
+
__exportStar(require("./card/dtos/CardApplicationRequestDto"), exports);
|
|
19
|
+
__exportStar(require("./card/dtos/CreateCardRequestDto"), exports);
|
|
20
|
+
__exportStar(require("./card/enums/CardType"), exports);
|
|
21
|
+
__exportStar(require("./card/enums/CardUpdateKey"), exports);
|
|
22
|
+
__exportStar(require("./card/enums/IssuanceType"), exports);
|
|
23
|
+
__exportStar(require("./card/enums/Status"), exports);
|
|
24
|
+
__exportStar(require("./card/enums/IssuanceType"), exports);
|
|
25
|
+
__exportStar(require("./card/enums/OwnershipType"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IsEnum } from "class-validator/types/decorator/typechecker/IsEnum";
|
|
2
|
+
import { UpdateKey } from "../enums/UpdateKey";
|
|
3
|
+
import { IsString } from "class-validator";
|
|
4
|
+
import { IsValueValid } from "../validations/CardUpdateKeyConstraint";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class CardUpdateRequestDto {
|
|
9
|
+
|
|
10
|
+
@IsEnum(UpdateKey)
|
|
11
|
+
type: UpdateKey;
|
|
12
|
+
|
|
13
|
+
@IsString()
|
|
14
|
+
@IsValueValid()
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ValidationArguments, ValidationOptions, ValidatorConstraint, registerDecorator } from "class-validator";
|
|
2
|
+
import { CardUpdateRequestDto } from "../dtos/CardUpdateRequestDto";
|
|
3
|
+
import { Status } from "../enums/Status";
|
|
4
|
+
import { UpdateKey } from "../enums/UpdateKey";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@ValidatorConstraint({ async: true })
|
|
8
|
+
export class CardUpdateKeyConstraint {
|
|
9
|
+
|
|
10
|
+
public static validateUpdateKey(value: string | Status, arg: ValidationArguments) {
|
|
11
|
+
|
|
12
|
+
const cardUpdateRequest = arg.object as CardUpdateRequestDto;
|
|
13
|
+
|
|
14
|
+
// Validar si el valor es uno de los status válidos
|
|
15
|
+
if (cardUpdateRequest.type === UpdateKey.CHANGE_STATUS) {
|
|
16
|
+
return Object.values(Status).includes(value as Status);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Validar si el valor es un string de 4 dígitos no consecutivos
|
|
20
|
+
if (cardUpdateRequest.type === UpdateKey.CHANGE_PIN) {
|
|
21
|
+
|
|
22
|
+
if (!/^\d{4}$/.test(value)) return false; // Debe ser un string de 4 dígitos
|
|
23
|
+
|
|
24
|
+
// Verifica que no sean consecutivos asc o desc
|
|
25
|
+
for (let i = 0; i < value.length - 1; i++) {
|
|
26
|
+
if (Math.abs(parseInt(value[i]) - parseInt(value[i + 1])) !== 1) {
|
|
27
|
+
continue;
|
|
28
|
+
} else {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// En caso de que type no sea ninguno de los esperados
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
defaultMessage(args: ValidationArguments) {
|
|
40
|
+
// Se4 puede usar args para personalizar aún más el mensaje de error basado en el valor o las propiedades.
|
|
41
|
+
return "El valor no es adecuado para el tipo de actualización.";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function IsValueValid(validationOptions?: ValidationOptions) {
|
|
47
|
+
return function (object: Object, propertyName: string) {
|
|
48
|
+
registerDecorator({
|
|
49
|
+
target: object.constructor,
|
|
50
|
+
propertyName: propertyName,
|
|
51
|
+
options: validationOptions,
|
|
52
|
+
constraints: [],
|
|
53
|
+
validator: CardUpdateKeyConstraint,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './card/dtos/CardActivateRequestDto';
|
|
2
|
+
export * from './card/dtos/CardApplicationRequestDto';
|
|
3
|
+
export * from './card/dtos/CreateCardRequestDto';
|
|
4
|
+
|
|
5
|
+
export * from './card/enums/CardType';
|
|
6
|
+
export * from './card/enums/CardUpdateKey';
|
|
7
|
+
export * from './card/enums/IssuanceType';
|
|
8
|
+
export * from './card/enums/Status';
|
|
9
|
+
export * from './card/enums/IssuanceType';
|
|
10
|
+
export * from './card/enums/OwnershipType';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
package/src/card/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './dtos/CardActivateDto';
|
|
2
|
-
export * from './dtos/CardRequestDto';
|
|
3
|
-
export * from './dtos/CreateCardDto';
|
|
4
|
-
|
|
5
|
-
export * from './enums/CardType';
|
|
6
|
-
export * from './enums/CardUpdateKey';
|
|
7
|
-
export * from './enums/IssuanceType';
|
|
8
|
-
export * from './enums/Status';
|
|
9
|
-
export * from './enums/IssuanceType';
|
|
10
|
-
export * from './enums/OwnershipType';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
File without changes
|
|
File without changes
|