resurgence-data 1.1.27 → 1.1.29

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.
@@ -16,7 +16,7 @@ export declare class CreateInvoiceDto extends BaseDTO {
16
16
  discountValue: number;
17
17
  total?: number;
18
18
  totalService?: number;
19
- discountType: string;
19
+ discountType?: string;
20
20
  dueDate: string;
21
21
  status?: string | "PENDING";
22
22
  customer?: InvoiceCustomerDto;
@@ -79,6 +79,12 @@ __decorate([
79
79
  __metadata("design:type", Number)
80
80
  ], InvoiceItemDto.prototype, "quantity", void 0);
81
81
  class CreateInvoiceDto extends dto_type_1.BaseDTO {
82
+ constructor() {
83
+ super(...arguments);
84
+ this.discountValue = 0;
85
+ this.total = 0;
86
+ this.discountType = "FIXED";
87
+ }
82
88
  }
83
89
  exports.CreateInvoiceDto = CreateInvoiceDto;
84
90
  __decorate([
@@ -113,14 +119,16 @@ __decorate([
113
119
  (0, swagger_1.ApiProperty)({
114
120
  description: "The discount value applied to the invoice",
115
121
  example: 10.5,
122
+ required: false,
116
123
  }),
117
- (0, class_validator_1.IsNotEmpty)({ message: "Discount value must not be empty" }),
118
124
  (0, class_validator_1.IsNumber)(undefined, { message: "Discount value must be a valid number" }),
125
+ (0, class_validator_1.IsOptional)(),
119
126
  __metadata("design:type", Number)
120
127
  ], CreateInvoiceDto.prototype, "discountValue", void 0);
121
128
  __decorate([
122
129
  (0, swagger_1.ApiProperty)({
123
130
  description: "Total for invoice",
131
+ required: false,
124
132
  example: 20030,
125
133
  }),
126
134
  (0, class_validator_1.IsInt)({ message: "Total invoice value must be a valid number" }),
@@ -131,17 +139,20 @@ __decorate([
131
139
  (0, swagger_1.ApiProperty)({
132
140
  description: "Total for invoice service charges",
133
141
  example: 1000,
142
+ required: false,
134
143
  }),
135
144
  (0, class_validator_1.IsNumber)(undefined, { message: "Service fee total value must be a valid number" }),
145
+ (0, class_validator_1.IsOptional)(),
136
146
  __metadata("design:type", Number)
137
147
  ], CreateInvoiceDto.prototype, "totalService", void 0);
138
148
  __decorate([
139
149
  (0, swagger_1.ApiProperty)({
140
150
  description: "The type of discount applied to the invoice",
141
151
  example: "FIXED",
152
+ required: false,
142
153
  }),
143
- (0, class_validator_1.IsNotEmpty)({ message: "Discount type must not be empty" }),
144
154
  (0, class_validator_1.IsEnum)(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" }),
155
+ (0, class_validator_1.IsOptional)(),
145
156
  __metadata("design:type", String)
146
157
  ], CreateInvoiceDto.prototype, "discountType", void 0);
147
158
  __decorate([
@@ -197,8 +208,8 @@ __decorate([
197
208
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
198
209
  required: false,
199
210
  }),
200
- (0, class_validator_1.IsNotEmpty)({ message: "Please provide items for this invoice" }),
201
211
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
212
+ (0, class_validator_1.IsOptional)(),
202
213
  __metadata("design:type", Array)
203
214
  ], UpdateInvoiceDto.prototype, "items", void 0);
204
215
  __decorate([
@@ -71,6 +71,7 @@ __decorate([
71
71
  (0, swagger_1.ApiProperty)({
72
72
  description: "List of items",
73
73
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
74
+ required: false,
74
75
  }),
75
76
  (0, class_validator_1.IsOptional)(),
76
77
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
@@ -117,7 +118,7 @@ __decorate([
117
118
  __decorate([
118
119
  (0, swagger_1.ApiProperty)({ description: "Amount's currency code", default: "NGN", required: false }),
119
120
  (0, class_validator_1.IsString)({ message: "currencyCode must be a string" }),
120
- (0, class_validator_1.IsNotEmpty)({ message: "Please select a currency" }),
121
+ (0, class_validator_1.IsOptional)(),
121
122
  __metadata("design:type", String)
122
123
  ], UpdatePaymentPageDto.prototype, "currencyCode", void 0);
123
124
  __decorate([
@@ -142,6 +143,7 @@ __decorate([
142
143
  (0, swagger_1.ApiProperty)({
143
144
  description: "List of items",
144
145
  example: "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
146
+ required: false,
145
147
  }),
146
148
  (0, class_validator_1.IsOptional)(),
147
149
  (0, class_validator_1.IsArray)({ message: "Please provide a list of items for this invoice" }),
@@ -191,6 +193,6 @@ __decorate([
191
193
  __metadata("design:type", Date)
192
194
  ], PaymentPageResponseDto.prototype, "updatedAt", void 0);
193
195
  __decorate([
194
- (0, swagger_1.ApiProperty)({ description: "List of Items" }),
196
+ (0, swagger_1.ApiProperty)({ description: "List of Items", required: false }),
195
197
  __metadata("design:type", Array)
196
198
  ], PaymentPageResponseDto.prototype, "items", void 0);
@@ -49,6 +49,7 @@ export declare class CardChargeDTO {
49
49
  transactionReference: string;
50
50
  cardHolderName?: string;
51
51
  redirectUrl?: string;
52
+ amount: number;
52
53
  }
53
54
  export declare class CardChargeAuthorizationDto {
54
55
  transactionReference: string;
@@ -242,7 +242,7 @@ __decorate([
242
242
  __metadata("design:type", String)
243
243
  ], CardChargeDTO.prototype, "cardNumber", void 0);
244
244
  __decorate([
245
- (0, swagger_1.ApiProperty)({ description: "Charge CVV" }),
245
+ (0, swagger_1.ApiProperty)({ description: "Card CVV" }),
246
246
  (0, class_validator_1.IsNotEmpty)({ message: "You must provide a security code" }),
247
247
  (0, class_validator_1.IsNumberString)(),
248
248
  (0, class_validator_1.Length)(3, 3, { message: "Please check your security code" }),
@@ -282,6 +282,12 @@ __decorate([
282
282
  (0, class_validator_1.IsOptional)(),
283
283
  __metadata("design:type", String)
284
284
  ], CardChargeDTO.prototype, "redirectUrl", void 0);
285
+ __decorate([
286
+ (0, swagger_1.ApiProperty)({ description: "amount to be paid" }),
287
+ (0, class_validator_1.IsNumber)({ allowNaN: false, allowInfinity: false }, { message: "Amount must be a number" }),
288
+ (0, class_validator_1.IsNotEmpty)({ message: "Please specify the amount to be paid" }),
289
+ __metadata("design:type", Number)
290
+ ], CardChargeDTO.prototype, "amount", void 0);
285
291
  class CardChargeAuthorizationDto {
286
292
  }
287
293
  exports.CardChargeAuthorizationDto = CardChargeAuthorizationDto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.27",
3
+ "version": "1.1.29",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -99,31 +99,36 @@ export class CreateInvoiceDto extends BaseDTO {
99
99
  @ApiProperty({
100
100
  description: "The discount value applied to the invoice",
101
101
  example: 10.5,
102
+ required: false,
102
103
  })
103
- @IsNotEmpty({ message: "Discount value must not be empty" })
104
104
  @IsNumber(undefined, { message: "Discount value must be a valid number" })
105
- discountValue: number;
105
+ @IsOptional()
106
+ discountValue: number = 0;
106
107
  @ApiProperty({
107
108
  description: "Total for invoice",
109
+ required: false,
108
110
  example: 20030,
109
111
  })
110
112
  @IsInt({ message: "Total invoice value must be a valid number" })
111
113
  @IsOptional()
112
- total?: number;
114
+ total?: number = 0;
113
115
  @ApiProperty({
114
116
  description: "Total for invoice service charges",
115
117
  example: 1000,
118
+ required: false,
116
119
  })
117
120
  @IsNumber(undefined, { message: "Service fee total value must be a valid number" })
121
+ @IsOptional()
118
122
  totalService?: number;
119
123
 
120
124
  @ApiProperty({
121
125
  description: "The type of discount applied to the invoice",
122
126
  example: "FIXED",
127
+ required: false,
123
128
  })
124
- @IsNotEmpty({ message: "Discount type must not be empty" })
125
129
  @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
126
- discountType: string;
130
+ @IsOptional()
131
+ discountType?: string = "FIXED";
127
132
 
128
133
  @ApiProperty({
129
134
  description: "The due date for the invoice",
@@ -172,8 +177,8 @@ export class UpdateInvoiceDto extends BaseDTO {
172
177
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
173
178
  required: false,
174
179
  })
175
- @IsNotEmpty({ message: "Please provide items for this invoice" })
176
180
  @IsArray({ message: "Please provide a list of items for this invoice" })
181
+ @IsOptional()
177
182
  items?: InvoiceItemDto[];
178
183
 
179
184
  @ApiProperty({
@@ -44,10 +44,12 @@ export class PaymentPageDto {
44
44
  @IsBoolean({ message: "acceptsUserAmount must be a boolean" })
45
45
  @IsOptional()
46
46
  acceptsUserAmount?: boolean;
47
+
47
48
  @ApiProperty({
48
49
  description: "List of items",
49
50
  example:
50
51
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
52
+ required: false,
51
53
  })
52
54
  @IsOptional()
53
55
  @IsArray({ message: "Please provide a list of items for this invoice" })
@@ -84,7 +86,7 @@ export class UpdatePaymentPageDto {
84
86
 
85
87
  @ApiProperty({ description: "Amount's currency code", default: "NGN", required: false })
86
88
  @IsString({ message: "currencyCode must be a string" })
87
- @IsNotEmpty({ message: "Please select a currency" })
89
+ @IsOptional()
88
90
  currencyCode?: string = "NGN";
89
91
 
90
92
  @ApiProperty({ description: "Invoice's active status", required: false })
@@ -106,6 +108,7 @@ export class UpdatePaymentPageDto {
106
108
  description: "List of items",
107
109
  example:
108
110
  "[{id:'550e8400-e29b-41d4-a716-446655440001', quantity:2},{id:'550e8400-e29b-41d4-a716-446655440001', quantity:3}]",
111
+ required: false,
109
112
  })
110
113
  @IsOptional()
111
114
  @IsArray({ message: "Please provide a list of items for this invoice" })
@@ -143,6 +146,6 @@ export class PaymentPageResponseDto {
143
146
  @ApiProperty({ description: "Date when the page was last updated" })
144
147
  updatedAt: Date;
145
148
 
146
- @ApiProperty({ description: "List of Items" })
149
+ @ApiProperty({ description: "List of Items", required: false })
147
150
  items?: InvoiceItemDto[];
148
151
  }
@@ -13,6 +13,7 @@ import {
13
13
  IsIP,
14
14
  IsUrl,
15
15
  IsEmail,
16
+ IsNumber,
16
17
  } from "class-validator";
17
18
 
18
19
  export class TransactionSplitDto {
@@ -199,7 +200,7 @@ export class CardChargeDTO {
199
200
  @IsNumberString()
200
201
  @MinLength(8, { message: "Please check you card number" })
201
202
  cardNumber: string;
202
- @ApiProperty({ description: "Charge CVV" })
203
+ @ApiProperty({ description: "Card CVV" })
203
204
  @IsNotEmpty({ message: "You must provide a security code" })
204
205
  @IsNumberString()
205
206
  @Length(3, 3, { message: "Please check your security code" })
@@ -226,6 +227,10 @@ export class CardChargeDTO {
226
227
  @ApiProperty({ description: "3D Secure redirect url for customer" })
227
228
  @IsOptional()
228
229
  redirectUrl?: string;
230
+ @ApiProperty({ description: "amount to be paid" })
231
+ @IsNumber({ allowNaN: false, allowInfinity: false }, { message: "Amount must be a number" })
232
+ @IsNotEmpty({ message: "Please specify the amount to be paid" })
233
+ amount: number;
229
234
  }
230
235
 
231
236
  export class CardChargeAuthorizationDto {