resurgence-data 1.1.7 → 1.1.9

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/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export * from "./exception";
4
4
  export * from "./user";
5
5
  export * from "./messaging";
6
6
  export * from "./biller";
7
- export * from "./payment/api-key";
7
+ export * from "./payment";
package/dist/index.js CHANGED
@@ -20,4 +20,4 @@ __exportStar(require("./exception"), exports);
20
20
  __exportStar(require("./user"), exports);
21
21
  __exportStar(require("./messaging"), exports);
22
22
  __exportStar(require("./biller"), exports);
23
- __exportStar(require("./payment/api-key"), exports);
23
+ __exportStar(require("./payment"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resurgence-data",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "DTOs and shareable resources",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -1329,149 +1329,6 @@ export class UpdateBillerItemDto extends BaseDTO {
1329
1329
  external?: boolean;
1330
1330
  }
1331
1331
 
1332
- export class CreateInvoiceDto extends BaseDTO {
1333
- @ApiProperty({
1334
- description: "The ID of the biller",
1335
- example: "550e8400-e29b-41d4-a716-446655440000",
1336
- })
1337
- @IsNotEmpty({ message: "Biller ID must not be empty" })
1338
- @IsString({ message: "Biller ID must be a valid string" })
1339
- billerId: string;
1340
-
1341
- @ApiProperty({
1342
- description: "The ID of the customer",
1343
- example: "550e8400-e29b-41d4-a716-446655440001",
1344
- })
1345
- @IsNotEmpty({ message: "Customer ID must not be empty" })
1346
- @IsString({ message: "Customer ID must be a valid string" })
1347
- customerId: string;
1348
-
1349
- @ApiProperty({
1350
- description: "List of items",
1351
- example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
1352
- })
1353
- @IsNotEmpty({ message: "Please provide items for this invoice" })
1354
- @IsArray({ message: "Please provide a list of items for this invoice" })
1355
- items: string[];
1356
-
1357
- @ApiProperty({
1358
- description: "The discount value applied to the invoice",
1359
- example: 10.5,
1360
- })
1361
- @IsNotEmpty({ message: "Discount value must not be empty" })
1362
- @IsNumber(undefined, { message: "Discount value must be a valid number" })
1363
- discountValue: number;
1364
- @ApiProperty({
1365
- description: "Total for invoice",
1366
- example: 20030,
1367
- })
1368
- @IsInt({ message: "Discount value must be a valid number" })
1369
- total?: number;
1370
- @ApiProperty({
1371
- description: "Total for invoice service charges",
1372
- example: 1000,
1373
- })
1374
- @IsNumber(undefined, { message: "Discount value must be a valid number" })
1375
- totalService?: number;
1376
-
1377
- @ApiProperty({
1378
- description: "The type of discount applied to the invoice",
1379
- example: "FIXED",
1380
- })
1381
- @IsNotEmpty({ message: "Discount type must not be empty" })
1382
- @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
1383
- discountType: string;
1384
-
1385
- @ApiProperty({
1386
- description: "The due date for the invoice",
1387
- example: "2025-01-31T23:59:59Z",
1388
- })
1389
- @IsNotEmpty({ message: "Due date must not be empty" })
1390
- @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
1391
- dueDate: string;
1392
-
1393
- @ApiProperty({
1394
- description: "The status of the invoice",
1395
- example: "PENDING",
1396
- })
1397
- @IsNotEmpty({ message: "Status must not be empty" })
1398
- @IsEnum(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" })
1399
- status: string;
1400
- }
1401
-
1402
- export class UpdateInvoiceDto extends BaseDTO {
1403
- @ApiProperty({
1404
- description: "The ID of the invoice",
1405
- example: "550e8400-e29b-41d4-a716-446655440000",
1406
- })
1407
- @IsNotEmpty({ message: "ID must not be empty" })
1408
- @IsString({ message: "ID must be a valid string" })
1409
- id: string;
1410
-
1411
- @ApiProperty({
1412
- description: "The ID of the biller",
1413
- example: "550e8400-e29b-41d4-a716-446655440000",
1414
- required: false,
1415
- })
1416
- @IsString({ message: "Biller ID must be a valid string" })
1417
- @IsOptional()
1418
- billerId?: string;
1419
-
1420
- @ApiProperty({
1421
- description: "List of items",
1422
- example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
1423
- required: false,
1424
- })
1425
- @IsNotEmpty({ message: "Please provide items for this invoice" })
1426
- @IsArray({ message: "Please provide a list of items for this invoice" })
1427
- items?: string[];
1428
-
1429
- @ApiProperty({
1430
- description: "The ID of the customer",
1431
- example: "550e8400-e29b-41d4-a716-446655440001",
1432
- required: false,
1433
- })
1434
- @IsString({ message: "Customer ID must be a valid string" })
1435
- @IsOptional()
1436
- customerId?: string;
1437
-
1438
- @ApiProperty({
1439
- description: "The discount value applied to the invoice",
1440
- example: 10.5,
1441
- required: false,
1442
- })
1443
- @IsInt({ message: "Discount value must be a valid number" })
1444
- @IsOptional()
1445
- discountValue?: number;
1446
-
1447
- @ApiProperty({
1448
- description: "The type of discount applied to the invoice",
1449
- example: "FIXED",
1450
- required: false,
1451
- })
1452
- @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
1453
- @IsOptional()
1454
- discountType?: string;
1455
-
1456
- @ApiProperty({
1457
- description: "The due date for the invoice",
1458
- example: "2025-01-31T23:59:59Z",
1459
- required: false,
1460
- })
1461
- @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
1462
- @IsOptional()
1463
- dueDate?: string;
1464
-
1465
- @ApiProperty({
1466
- description: "The status of the invoice",
1467
- example: "PENDING",
1468
- required: false,
1469
- })
1470
- @IsEnum(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" })
1471
- @IsOptional()
1472
- status?: string;
1473
- }
1474
-
1475
1332
  export class EnrollBillerDto extends CreateBillerDto {
1476
1333
  id: string;
1477
1334
  chargeConfigurations?: CreateBillerChargeConfigurationDto[];
package/src/index.ts CHANGED
@@ -4,4 +4,5 @@ export * from "./exception";
4
4
  export * from "./user";
5
5
  export * from "./messaging";
6
6
  export * from "./biller";
7
- export * from "./payment/api-key";
7
+ export * from "./payment";
8
+ export * from "./invoice";
@@ -0,0 +1,2 @@
1
+ export * from "./payment-page.dto";
2
+ export * from "./invoice.dto";
@@ -0,0 +1,202 @@
1
+ import { ApiProperty } from "@nestjs/swagger";
2
+ import {
3
+ IsString,
4
+ IsNotEmpty,
5
+ IsArray,
6
+ IsNumber,
7
+ IsInt,
8
+ IsEnum,
9
+ IsDateString,
10
+ IsOptional,
11
+ Length,
12
+ } from "class-validator";
13
+ import { BaseDTO } from "../types/dto.type";
14
+
15
+ export class CreateInvoiceDto extends BaseDTO {
16
+ @ApiProperty({
17
+ description: "The ID of the biller",
18
+ example: "550e8400-e29b-41d4-a716-446655440000",
19
+ })
20
+ @IsNotEmpty({ message: "Biller ID must not be empty" })
21
+ @IsString({ message: "Biller ID must be a valid string" })
22
+ billerId: string;
23
+
24
+ @ApiProperty({
25
+ description: "The ID of the customer",
26
+ example: "550e8400-e29b-41d4-a716-446655440001",
27
+ required: false,
28
+ })
29
+ @IsString({ message: "Customer ID must be a valid string" })
30
+ @IsOptional()
31
+ customerId?: string;
32
+
33
+ @ApiProperty({
34
+ description: "List of items",
35
+ example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
36
+ })
37
+ @IsNotEmpty({ message: "Please provide items for this invoice" })
38
+ @IsArray({ message: "Please provide a list of items for this invoice" })
39
+ items: string[];
40
+
41
+ @ApiProperty({
42
+ description: "The discount value applied to the invoice",
43
+ example: 10.5,
44
+ })
45
+ @IsNotEmpty({ message: "Discount value must not be empty" })
46
+ @IsNumber(undefined, { message: "Discount value must be a valid number" })
47
+ discountValue: number;
48
+ @ApiProperty({
49
+ description: "Total for invoice",
50
+ example: 20030,
51
+ })
52
+ @IsInt({ message: "Discount value must be a valid number" })
53
+ total?: number;
54
+ @ApiProperty({
55
+ description: "Total for invoice service charges",
56
+ example: 1000,
57
+ })
58
+ @IsNumber(undefined, { message: "Discount value must be a valid number" })
59
+ totalService?: number;
60
+
61
+ @ApiProperty({
62
+ description: "The type of discount applied to the invoice",
63
+ example: "FIXED",
64
+ })
65
+ @IsNotEmpty({ message: "Discount type must not be empty" })
66
+ @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
67
+ discountType: string;
68
+
69
+ @ApiProperty({
70
+ description: "The due date for the invoice",
71
+ example: "2025-01-31T23:59:59Z",
72
+ })
73
+ @IsNotEmpty({ message: "Due date must not be empty" })
74
+ @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
75
+ dueDate: string;
76
+
77
+ @ApiProperty({
78
+ description: "The status of the invoice",
79
+ example: "PENDING",
80
+ })
81
+ @IsNotEmpty({ message: "Status must not be empty" })
82
+ @IsEnum(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" })
83
+ status: string;
84
+
85
+ @ApiProperty({
86
+ description: "The customer details",
87
+ })
88
+ @IsOptional()
89
+ customer?: InvoiceCustomerDto;
90
+ }
91
+
92
+ export class UpdateInvoiceDto extends BaseDTO {
93
+ @ApiProperty({
94
+ description: "The ID of the invoice",
95
+ example: "550e8400-e29b-41d4-a716-446655440000",
96
+ })
97
+ @IsNotEmpty({ message: "ID must not be empty" })
98
+ @IsString({ message: "ID must be a valid string" })
99
+ id: string;
100
+
101
+ @ApiProperty({
102
+ description: "The ID of the biller",
103
+ example: "550e8400-e29b-41d4-a716-446655440000",
104
+ required: false,
105
+ })
106
+ @IsString({ message: "Biller ID must be a valid string" })
107
+ @IsOptional()
108
+ billerId?: string;
109
+
110
+ @ApiProperty({
111
+ description: "List of items",
112
+ example: "['550e8400-e29b-41d4-a716-446655440001','550e8400-e29b-41d4-a716-446655440001' ]",
113
+ required: false,
114
+ })
115
+ @IsNotEmpty({ message: "Please provide items for this invoice" })
116
+ @IsArray({ message: "Please provide a list of items for this invoice" })
117
+ items?: string[];
118
+
119
+ @ApiProperty({
120
+ description: "The ID of the customer",
121
+ example: "550e8400-e29b-41d4-a716-446655440001",
122
+ required: false,
123
+ })
124
+ @IsString({ message: "Customer ID must be a valid string" })
125
+ @IsOptional()
126
+ customerId?: string;
127
+
128
+ @ApiProperty({
129
+ description: "The discount value applied to the invoice",
130
+ example: 10.5,
131
+ required: false,
132
+ })
133
+ @IsInt({ message: "Discount value must be a valid number" })
134
+ @IsOptional()
135
+ discountValue?: number;
136
+
137
+ @ApiProperty({
138
+ description: "The type of discount applied to the invoice",
139
+ example: "FIXED",
140
+ required: false,
141
+ })
142
+ @IsEnum(["FIXED", "PERCENT"], { message: "Discount type must be FIXED or PERCENT" })
143
+ @IsOptional()
144
+ discountType?: string;
145
+
146
+ @ApiProperty({
147
+ description: "The due date for the invoice",
148
+ example: "2025-01-31T23:59:59Z",
149
+ required: false,
150
+ })
151
+ @IsDateString({}, { message: "Due date must be a valid ISO 8601 date string" })
152
+ @IsOptional()
153
+ dueDate?: string;
154
+
155
+ @ApiProperty({
156
+ description: "The status of the invoice",
157
+ example: "PENDING",
158
+ required: false,
159
+ })
160
+ @IsEnum(["PENDING", "PAID", "CANCELLED"], { message: "Status must be PENDING, PAID, or CANCELLED" })
161
+ @IsOptional()
162
+ status?: string;
163
+ }
164
+
165
+ export class InvoiceCustomerDto extends BaseDTO {
166
+ @ApiProperty({
167
+ description: "The name of the customer",
168
+ example: "Jane Smith",
169
+ })
170
+ @IsNotEmpty({ message: "Name must not be empty" })
171
+ @IsString({ message: "Name must be a valid string" })
172
+ @Length(1, 50, { message: "Name must be between 1 and 50 characters" })
173
+ name: string;
174
+
175
+ @ApiProperty({
176
+ description: "The email address of the customer",
177
+ example: "janesmith@example.com",
178
+ required: false,
179
+ })
180
+ @IsString({ message: "Email address must be a valid string" })
181
+ @Length(1, 50, { message: "Email address must be between 1 and 50 characters" })
182
+ @IsOptional()
183
+ emailAddress?: string;
184
+
185
+ @ApiProperty({
186
+ description: "The phone number of the customer",
187
+ example: "+9876543210",
188
+ required: false,
189
+ })
190
+ @IsString({ message: "Phone number must be a valid string" })
191
+ @IsOptional()
192
+ phoneNumber?: string;
193
+
194
+ @ApiProperty({
195
+ description: "Address of the customer",
196
+ example: "12 Fremont lane, New York",
197
+ required: false,
198
+ })
199
+ @IsString({ message: "Address must be a valid string" })
200
+ @IsOptional()
201
+ address?: string;
202
+ }
@@ -0,0 +1,126 @@
1
+ import { ApiProperty } from "@nestjs/swagger";
2
+ import { IsString, IsInt, IsOptional, IsBoolean, IsNotEmpty, IsUUID } from "class-validator";
3
+
4
+ export class PaymentPageDto {
5
+ @ApiProperty({ description: "Payment page biller code uuid" })
6
+ @IsString({ message: "billerId must be a string" })
7
+ @IsUUID("4", { message: "billerId must be a valid id format" })
8
+ @IsNotEmpty({ message: "billerId should not be empty" })
9
+ billerId: string;
10
+
11
+ @ApiProperty({ description: "Payment page description", required: false })
12
+ @IsString({ message: "description must be a string" })
13
+ @IsOptional()
14
+ description?: string;
15
+
16
+ @ApiProperty({ description: "Payment page's title" })
17
+ @IsString({ message: "title must be a string" })
18
+ @IsNotEmpty({ message: "title should not be empty" })
19
+ title: string;
20
+
21
+ @ApiProperty({ description: "Page total amount in lowest denomination" })
22
+ @IsInt({ message: "totalAmount must be an integer" })
23
+ @IsNotEmpty({ message: "totalAmount should not be empty" })
24
+ totalAmount: number;
25
+
26
+ @ApiProperty({ description: "Amount's currency code", default: "NGN" })
27
+ @IsString({ message: "currencyCode must be a string" })
28
+ @IsNotEmpty({ message: "Please select a currency" })
29
+ currencyCode: string = "NGN";
30
+
31
+ @ApiProperty({ description: "Invoice's active status", required: false })
32
+ @IsBoolean({ message: "active must be a boolean" })
33
+ @IsOptional()
34
+ active?: boolean;
35
+
36
+ @ApiProperty({ description: "Url of the page", required: false })
37
+ @IsString({ message: "URL should be text" })
38
+ @IsOptional()
39
+ url?: boolean;
40
+
41
+ @ApiProperty({ description: "Whether pages accept user amount", required: false })
42
+ @IsBoolean({ message: "acceptsUserAmount must be a boolean" })
43
+ @IsOptional()
44
+ acceptsUserAmount?: boolean;
45
+ }
46
+
47
+ export class UpdatePaymentPageDto {
48
+ @ApiProperty({ description: "Payment page biller code uuid" })
49
+ @IsString({ message: "Page id must be a string" })
50
+ @IsUUID("4", { message: "Id must be a valid id format" })
51
+ @IsNotEmpty({ message: "Page id should not be empty" })
52
+ id: string;
53
+
54
+ @ApiProperty({ description: "Payment page biller code uuid", required: false })
55
+ @IsUUID("4", { message: "billerId must be a valid id format" })
56
+ @IsString({ message: "billerId must be a string" })
57
+ @IsOptional()
58
+ billerId?: string;
59
+
60
+ @ApiProperty({ description: "Payment page description", required: false })
61
+ @IsString({ message: "description must be a string" })
62
+ @IsOptional()
63
+ description?: string;
64
+
65
+ @ApiProperty({ description: "Payment page's title", required: false })
66
+ @IsString({ message: "title must be a string" })
67
+ @IsOptional()
68
+ title?: string;
69
+
70
+ @ApiProperty({ description: "Page total amount in lowest denomination", required: false })
71
+ @IsInt({ message: "totalAmount must be an integer" })
72
+ @IsOptional()
73
+ totalAmount?: number;
74
+
75
+ @ApiProperty({ description: "Amount's currency code", default: "NGN", required: false })
76
+ @IsString({ message: "currencyCode must be a string" })
77
+ @IsNotEmpty({ message: "Please select a currency" })
78
+ currencyCode?: string = "NGN";
79
+
80
+ @ApiProperty({ description: "Invoice's active status", required: false })
81
+ @IsBoolean({ message: "active must be a boolean" })
82
+ @IsOptional()
83
+ active?: boolean;
84
+
85
+ @ApiProperty({ description: "Url of the page", required: false })
86
+ @IsString({ message: "URL should be text" })
87
+ @IsOptional()
88
+ url?: boolean;
89
+
90
+ @ApiProperty({ description: "Whether pages accept user amount", required: false })
91
+ @IsBoolean({ message: "acceptsUserAmount must be a boolean" })
92
+ @IsOptional()
93
+ acceptsUserAmount?: boolean;
94
+ }
95
+
96
+ export class PaymentPageResponseDto {
97
+ @ApiProperty({ description: "Payment page biller code uuid" })
98
+ billerId: string;
99
+
100
+ @ApiProperty({ description: "Payment page description", required: false })
101
+ description?: string;
102
+
103
+ @ApiProperty({ description: "Payment page's title" })
104
+ title: string;
105
+
106
+ @ApiProperty({ description: "Page total amount in lowest denomination" })
107
+ totalAmount: number;
108
+
109
+ @ApiProperty({ description: "Amount's currency code", default: "NGN" })
110
+ currencyCode: string;
111
+
112
+ @ApiProperty({ description: "Invoice's active status", required: false })
113
+ active?: boolean;
114
+
115
+ @ApiProperty({ description: "Url of the page", required: false })
116
+ url?: boolean;
117
+
118
+ @ApiProperty({ description: "Whether pages accept user amount", required: false })
119
+ acceptsUserAmount?: boolean;
120
+
121
+ @ApiProperty({ description: "Date when the page was created" })
122
+ createdAt: Date;
123
+
124
+ @ApiProperty({ description: "Date when the page was last updated" })
125
+ updatedAt: Date;
126
+ }