vr-commons 1.0.132 → 1.0.134

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.
@@ -36,3 +36,13 @@ export declare function validateHierarchy(adminLevel: number, targetLevel: numbe
36
36
  allowed: boolean;
37
37
  message?: string;
38
38
  };
39
+ /**
40
+ * Filter users based on hierarchical permissions using security clearance levels
41
+ * Pure function - no database calls
42
+ *
43
+ * @param currentUserLevel - The level of the requesting user (from securityClearance.level)
44
+ * @param users - Array of users to filter (must include securityClearance association)
45
+ * @param currentUserId - Optional: ID of the requesting user to always include them
46
+ * @returns Filtered array of users
47
+ */
48
+ export declare const hierarchicalView: (currentUserLevel: number, users: any[], currentUserId?: string) => any[];
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hierarchicalView = void 0;
3
4
  exports.getUserLevel = getUserLevel;
4
5
  exports.isSuperior = isSuperior;
5
6
  exports.isSubordinate = isSubordinate;
@@ -92,3 +93,29 @@ function validateHierarchy(adminLevel, targetLevel, action, allowEqual = false)
92
93
  }
93
94
  return { allowed: false, message: `Cannot ${action} this user` };
94
95
  }
96
+ // src/utils/hierarchical.util.ts
97
+ /**
98
+ * Filter users based on hierarchical permissions using security clearance levels
99
+ * Pure function - no database calls
100
+ *
101
+ * @param currentUserLevel - The level of the requesting user (from securityClearance.level)
102
+ * @param users - Array of users to filter (must include securityClearance association)
103
+ * @param currentUserId - Optional: ID of the requesting user to always include them
104
+ * @returns Filtered array of users
105
+ */
106
+ const hierarchicalView = (currentUserLevel, users, currentUserId) => {
107
+ // If current user is SUPER_ADMIN (level 4) or above, return all users
108
+ if (currentUserLevel >= 4) {
109
+ return users;
110
+ }
111
+ return users.filter((user) => {
112
+ const userLevel = user.securityClearance?.level ?? 0;
113
+ // Always include the current user themselves
114
+ if (currentUserId && user.id === currentUserId) {
115
+ return true;
116
+ }
117
+ // Only include users with lower level than current user
118
+ return userLevel < currentUserLevel;
119
+ });
120
+ };
121
+ exports.hierarchicalView = hierarchicalView;
@@ -8,7 +8,7 @@ export { banUtil } from "./bans.utils";
8
8
  export { suspensionUtil } from "./suspension.utils";
9
9
  export { createDeviceSession } from "./session.utils";
10
10
  export { generateOTP, getOTPExpiry, getVerificationMethod, sendEmail, sendSMS, sendVerificationCode, detectContactType, validateContactValue, } from "./verification.utils";
11
- export { getUserLevel, isRankEqual, isSubordinate, isSubordinateOrEqual, isSuperior, isSuperiorOrEqual, validateHierarchy, } from "./hierarchy.utils";
11
+ export { getUserLevel, isRankEqual, isSubordinate, isSubordinateOrEqual, isSuperior, isSuperiorOrEqual, validateHierarchy, hierarchicalView, } from "./hierarchy.utils";
12
12
  export { stockUtil } from "./admin.device.utils";
13
13
  export { cloudinaryUtil } from "./product.utils";
14
14
  export { DPP_OperationsUtil } from "./admin.devicePayment.utils";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateContactValue = exports.detectContactType = exports.sendVerificationCode = exports.sendSMS = exports.sendEmail = exports.getVerificationMethod = exports.getOTPExpiry = exports.generateOTP = exports.createDeviceSession = exports.suspensionUtil = exports.banUtil = exports.hasHigherAuthority = exports.getModeratableRoles = exports.canModerateUser = exports.canModerate = exports.softDeleteUser = exports.hashPassword = exports.validatePassword = exports.validateUniqueFields = exports.generateJacketId = exports.getSortOrder = exports.generateEventSearchConditions = exports.generateUserSearchConditions = exports.findSecurityClearanceByRole = exports.getUsersByRole = exports.getUserById = exports.isAccountAccessible = exports.canModifyAccount = exports.hasAllPermissions = exports.hasAnyPermission = exports.hasPermission = exports.hasRole = exports.formatUserListResponse = exports.formatUserProfile = exports.sendErrorResponse = exports.sendSuccessResponse = exports.logEvent = exports.formatTimeRemaining = exports.getTokenTimeRemaining = exports.generateToken = exports.shouldRefreshToken = exports.verifyToken = exports.generateRiderToken = exports.generatePassengerToken = exports.generateAdminToken = exports.checkSuspensionStatus = exports.checkIsUserBannedOrSuspended = exports.checkBanStatus = exports.hasActiveDependencies = exports.checkAccountDependencies = void 0;
4
- exports.extractDedicatedUserFromSerial = exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = exports.stockUtil = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = void 0;
4
+ exports.extractDedicatedUserFromSerial = exports.buildUserSearchConditions = exports.buildSearchConditions = exports.buildEventLogWhereClause = exports.formatEventLogs = exports.formatEventLog = exports.formatDeviceSession = exports.DPP_OperationsUtil = exports.cloudinaryUtil = exports.stockUtil = exports.hierarchicalView = exports.validateHierarchy = exports.isSuperiorOrEqual = exports.isSuperior = exports.isSubordinateOrEqual = exports.isSubordinate = exports.isRankEqual = exports.getUserLevel = void 0;
5
5
  var account_utils_1 = require("./account.utils");
6
6
  Object.defineProperty(exports, "checkAccountDependencies", { enumerable: true, get: function () { return account_utils_1.checkAccountDependencies; } });
7
7
  Object.defineProperty(exports, "hasActiveDependencies", { enumerable: true, get: function () { return account_utils_1.hasActiveDependencies; } });
@@ -77,6 +77,7 @@ Object.defineProperty(exports, "isSubordinateOrEqual", { enumerable: true, get:
77
77
  Object.defineProperty(exports, "isSuperior", { enumerable: true, get: function () { return hierarchy_utils_1.isSuperior; } });
78
78
  Object.defineProperty(exports, "isSuperiorOrEqual", { enumerable: true, get: function () { return hierarchy_utils_1.isSuperiorOrEqual; } });
79
79
  Object.defineProperty(exports, "validateHierarchy", { enumerable: true, get: function () { return hierarchy_utils_1.validateHierarchy; } });
80
+ Object.defineProperty(exports, "hierarchicalView", { enumerable: true, get: function () { return hierarchy_utils_1.hierarchicalView; } });
80
81
  var admin_device_utils_1 = require("./admin.device.utils");
81
82
  Object.defineProperty(exports, "stockUtil", { enumerable: true, get: function () { return admin_device_utils_1.stockUtil; } });
82
83
  var product_utils_1 = require("./product.utils");
@@ -280,21 +280,21 @@ export declare const loginSchema: z.ZodObject<{
280
280
  contactValue: z.ZodEffects<z.ZodString, string, string>;
281
281
  password: z.ZodString;
282
282
  }, "strip", z.ZodTypeAny, {
283
- contactValue: string;
284
283
  password: string;
285
- }, {
286
284
  contactValue: string;
285
+ }, {
287
286
  password: string;
287
+ contactValue: string;
288
288
  }>;
289
289
  }, "strip", z.ZodTypeAny, {
290
290
  body: {
291
- contactValue: string;
292
291
  password: string;
292
+ contactValue: string;
293
293
  };
294
294
  }, {
295
295
  body: {
296
- contactValue: string;
297
296
  password: string;
297
+ contactValue: string;
298
298
  };
299
299
  }>;
300
300
  export declare const forgotPasswordSchema: z.ZodObject<{
@@ -346,6 +346,91 @@ export declare const resetPasswordSchema: z.ZodEffects<z.ZodObject<{
346
346
  confirmPassword: string;
347
347
  };
348
348
  }>;
349
+ export declare const riderPasswordSchema: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
350
+ export declare const registerRiderSchema: z.ZodObject<{
351
+ body: z.ZodEffects<z.ZodObject<{
352
+ firstName: z.ZodString;
353
+ lastName: z.ZodString;
354
+ phoneNumber: z.ZodString;
355
+ jacketId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
356
+ plateNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
357
+ gender: z.ZodEnum<["male", "female"]>;
358
+ birthDate: z.ZodNumber;
359
+ birthMonth: z.ZodNumber;
360
+ birthYear: z.ZodNumber;
361
+ password: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>>;
362
+ }, "strip", z.ZodTypeAny, {
363
+ firstName: string;
364
+ lastName: string;
365
+ gender: "male" | "female";
366
+ birthDate: number;
367
+ birthMonth: number;
368
+ birthYear: number;
369
+ phoneNumber: string;
370
+ jacketId?: string | null | undefined;
371
+ password?: string | undefined;
372
+ plateNumber?: string | null | undefined;
373
+ }, {
374
+ firstName: string;
375
+ lastName: string;
376
+ gender: "male" | "female";
377
+ birthDate: number;
378
+ birthMonth: number;
379
+ birthYear: number;
380
+ phoneNumber: string;
381
+ jacketId?: string | null | undefined;
382
+ password?: string | undefined;
383
+ plateNumber?: string | null | undefined;
384
+ }>, {
385
+ firstName: string;
386
+ lastName: string;
387
+ gender: "male" | "female";
388
+ birthDate: number;
389
+ birthMonth: number;
390
+ birthYear: number;
391
+ phoneNumber: string;
392
+ jacketId?: string | null | undefined;
393
+ password?: string | undefined;
394
+ plateNumber?: string | null | undefined;
395
+ }, {
396
+ firstName: string;
397
+ lastName: string;
398
+ gender: "male" | "female";
399
+ birthDate: number;
400
+ birthMonth: number;
401
+ birthYear: number;
402
+ phoneNumber: string;
403
+ jacketId?: string | null | undefined;
404
+ password?: string | undefined;
405
+ plateNumber?: string | null | undefined;
406
+ }>;
407
+ }, "strip", z.ZodTypeAny, {
408
+ body: {
409
+ firstName: string;
410
+ lastName: string;
411
+ gender: "male" | "female";
412
+ birthDate: number;
413
+ birthMonth: number;
414
+ birthYear: number;
415
+ phoneNumber: string;
416
+ jacketId?: string | null | undefined;
417
+ password?: string | undefined;
418
+ plateNumber?: string | null | undefined;
419
+ };
420
+ }, {
421
+ body: {
422
+ firstName: string;
423
+ lastName: string;
424
+ gender: "male" | "female";
425
+ birthDate: number;
426
+ birthMonth: number;
427
+ birthYear: number;
428
+ phoneNumber: string;
429
+ jacketId?: string | null | undefined;
430
+ password?: string | undefined;
431
+ plateNumber?: string | null | undefined;
432
+ };
433
+ }>;
349
434
  export type UpdateProfileSchema = z.infer<typeof updateProfileSchema>;
350
435
  export type UpdateContactSchema = z.infer<typeof updateContactSchema>;
351
436
  export type ChangeEmailSchema = z.infer<typeof changeEmailSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetPasswordSchema = exports.forgotPasswordSchema = exports.loginSchema = exports.changePasswordSchema = exports.deleteAccountSchema = exports.confirmVerificationSchema = exports.verifyContactSchema = exports.setPrimaryContactSchema = exports.deleteContactSchema = exports.addContactSchema = exports.verifyEmailChangeSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.changeEmailSchema = exports.updateContactSchema = exports.updateProfileSchema = exports.validateContactValue = exports.detectContactType = exports.strongPasswordRegex = exports.emailRegex = exports.phoneRegex = void 0;
3
+ exports.registerRiderSchema = exports.riderPasswordSchema = exports.resetPasswordSchema = exports.forgotPasswordSchema = exports.loginSchema = exports.changePasswordSchema = exports.deleteAccountSchema = exports.confirmVerificationSchema = exports.verifyContactSchema = exports.setPrimaryContactSchema = exports.deleteContactSchema = exports.addContactSchema = exports.verifyEmailChangeSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.changeEmailSchema = exports.updateContactSchema = exports.updateProfileSchema = exports.validateContactValue = exports.detectContactType = exports.strongPasswordRegex = exports.emailRegex = exports.phoneRegex = void 0;
4
4
  // src/modules/account/validations/account.schema.ts
5
5
  const zod_1 = require("zod");
6
6
  // ==================== REGEX PATTERNS ====================
@@ -191,3 +191,73 @@ exports.resetPasswordSchema = zod_1.z
191
191
  message: "Passwords do not match",
192
192
  path: ["confirmPassword"],
193
193
  });
194
+ // Birth date validation helper
195
+ const isValidBirthDate = (date, month, year) => {
196
+ const maxDays = new Date(year, month, 0).getDate();
197
+ return date >= 1 && date <= maxDays;
198
+ };
199
+ // Password: exactly 4 digits, NOT all the same digit
200
+ // Examples: 1112 ✅, 1234 ✅, 5678 ✅, 1111 ❌, 3333 ❌
201
+ exports.riderPasswordSchema = zod_1.z
202
+ .string()
203
+ .length(4, "Password must be exactly 4 digits")
204
+ .regex(/^\d{4}$/, "Password must contain only digits")
205
+ .refine((password) => {
206
+ // Check if all 4 digits are the same
207
+ const uniqueDigits = new Set(password.split("")).size;
208
+ return uniqueDigits > 1;
209
+ }, {
210
+ message: "Password cannot have all 4 digits the same (e.g., 1112 is allowed, 1111 is not)",
211
+ })
212
+ .default("1234");
213
+ exports.registerRiderSchema = zod_1.z.object({
214
+ body: zod_1.z
215
+ .object({
216
+ firstName: zod_1.z
217
+ .string()
218
+ .min(2, "First name must be at least 2 characters")
219
+ .max(100, "First name cannot exceed 100 characters"),
220
+ lastName: zod_1.z
221
+ .string()
222
+ .min(2, "Last name must be at least 2 characters")
223
+ .max(100, "Last name cannot exceed 100 characters"),
224
+ phoneNumber: zod_1.z
225
+ .string()
226
+ .regex(exports.phoneRegex, "Invalid phone number format. Must be a valid Rwandan phone number (+250...) followed by 7 digits."),
227
+ jacketId: zod_1.z
228
+ .string()
229
+ .regex(/^JKT-\d{9}$/, "Jacket ID must be in format JKT-XXXXXXXXX")
230
+ .optional()
231
+ .nullable(),
232
+ plateNumber: zod_1.z
233
+ .string()
234
+ .max(20, "Plate number cannot exceed 20 characters")
235
+ .optional()
236
+ .nullable(),
237
+ gender: zod_1.z.enum(["male", "female"], {
238
+ errorMap: () => ({
239
+ message: "Gender must be either 'male' or 'female'",
240
+ }),
241
+ }),
242
+ birthDate: zod_1.z
243
+ .number()
244
+ .min(1, "Birth date must be between 1 and 31")
245
+ .max(31),
246
+ birthMonth: zod_1.z
247
+ .number()
248
+ .min(1, "Birth month must be between 1 and 12")
249
+ .max(12),
250
+ birthYear: zod_1.z
251
+ .number()
252
+ .min(1900, "Birth year must be between 1900 and current year")
253
+ .max(new Date().getFullYear(), "Birth year cannot be in the future"),
254
+ // Temporary password (optional, defaults to 1234)
255
+ password: exports.riderPasswordSchema.optional(),
256
+ })
257
+ .refine((data) => {
258
+ return isValidBirthDate(data.birthDate, data.birthMonth, data.birthYear);
259
+ }, {
260
+ message: "Invalid birth date. Please check day, month, and year.",
261
+ path: ["birthDate"],
262
+ }),
263
+ });
@@ -7,28 +7,28 @@ export declare const createPlanSchema: z.ZodObject<{
7
7
  productId: z.ZodString;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  userId: string;
10
- productId: string;
11
10
  deviceIds: string[];
12
11
  pricingId: string;
12
+ productId: string;
13
13
  }, {
14
14
  userId: string;
15
- productId: string;
16
15
  deviceIds: string[];
17
16
  pricingId: string;
17
+ productId: string;
18
18
  }>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  body: {
21
21
  userId: string;
22
- productId: string;
23
22
  deviceIds: string[];
24
23
  pricingId: string;
24
+ productId: string;
25
25
  };
26
26
  }, {
27
27
  body: {
28
28
  userId: string;
29
- productId: string;
30
29
  deviceIds: string[];
31
30
  pricingId: string;
31
+ productId: string;
32
32
  };
33
33
  }>;
34
34
  export declare const listPlansSchema: z.ZodObject<{
@@ -43,49 +43,49 @@ export declare const listPlansSchema: z.ZodObject<{
43
43
  sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "updatedAt", "nextInstallmentDueAt", "paidAmount", "outstandingAmount"]>>;
44
44
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
45
45
  }, "strip", z.ZodTypeAny, {
46
- limit: number;
47
46
  page: number;
48
- search?: string | undefined;
47
+ limit: number;
48
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
49
49
  userId?: string | undefined;
50
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
51
- isOverdue?: "true" | "false" | undefined;
52
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
53
- sortOrder?: "DESC" | "ASC" | undefined;
54
50
  deviceId?: string | undefined;
55
- }, {
51
+ isOverdue?: "true" | "false" | undefined;
56
52
  search?: string | undefined;
57
- limit?: string | undefined;
53
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
54
+ sortOrder?: "ASC" | "DESC" | undefined;
55
+ }, {
56
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
58
57
  userId?: string | undefined;
59
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
60
- isOverdue?: "true" | "false" | undefined;
61
58
  page?: string | undefined;
62
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
63
- sortOrder?: "DESC" | "ASC" | undefined;
59
+ limit?: string | undefined;
64
60
  deviceId?: string | undefined;
61
+ isOverdue?: "true" | "false" | undefined;
62
+ search?: string | undefined;
63
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
64
+ sortOrder?: "ASC" | "DESC" | undefined;
65
65
  }>;
66
66
  }, "strip", z.ZodTypeAny, {
67
67
  query: {
68
- limit: number;
69
68
  page: number;
70
- search?: string | undefined;
69
+ limit: number;
70
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
71
71
  userId?: string | undefined;
72
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
73
- isOverdue?: "true" | "false" | undefined;
74
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
75
- sortOrder?: "DESC" | "ASC" | undefined;
76
72
  deviceId?: string | undefined;
73
+ isOverdue?: "true" | "false" | undefined;
74
+ search?: string | undefined;
75
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
76
+ sortOrder?: "ASC" | "DESC" | undefined;
77
77
  };
78
78
  }, {
79
79
  query: {
80
- search?: string | undefined;
81
- limit?: string | undefined;
80
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
82
81
  userId?: string | undefined;
83
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
84
- isOverdue?: "true" | "false" | undefined;
85
82
  page?: string | undefined;
86
- sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
87
- sortOrder?: "DESC" | "ASC" | undefined;
83
+ limit?: string | undefined;
88
84
  deviceId?: string | undefined;
85
+ isOverdue?: "true" | "false" | undefined;
86
+ search?: string | undefined;
87
+ sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
88
+ sortOrder?: "ASC" | "DESC" | undefined;
89
89
  };
90
90
  }>;
91
91
  export declare const getPlanSchema: z.ZodObject<{
@@ -117,10 +117,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
117
117
  status: z.ZodOptional<z.ZodEnum<["ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
118
118
  includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
119
119
  }, "strip", z.ZodTypeAny, {
120
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
120
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
121
121
  includeCompleted?: "true" | "false" | undefined;
122
122
  }, {
123
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
123
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
124
124
  includeCompleted?: "true" | "false" | undefined;
125
125
  }>>;
126
126
  }, "strip", z.ZodTypeAny, {
@@ -128,7 +128,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
128
128
  userId: string;
129
129
  };
130
130
  query?: {
131
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
131
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
132
132
  includeCompleted?: "true" | "false" | undefined;
133
133
  } | undefined;
134
134
  }, {
@@ -136,7 +136,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
136
136
  userId: string;
137
137
  };
138
138
  query?: {
139
- status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
139
+ status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
140
140
  includeCompleted?: "true" | "false" | undefined;
141
141
  } | undefined;
142
142
  }>;
@@ -172,44 +172,44 @@ export declare const limitedUpdateSchema: z.ZodObject<{
172
172
  userId: z.ZodOptional<z.ZodString>;
173
173
  }, "strip", z.ZodTypeAny, {
174
174
  userId?: string | undefined;
175
- productId?: string | undefined;
176
175
  deviceIds?: string[] | undefined;
177
176
  pricingId?: string | undefined;
177
+ productId?: string | undefined;
178
178
  }, {
179
179
  userId?: string | undefined;
180
- productId?: string | undefined;
181
180
  deviceIds?: string[] | undefined;
182
181
  pricingId?: string | undefined;
182
+ productId?: string | undefined;
183
183
  }>, {
184
184
  userId?: string | undefined;
185
- productId?: string | undefined;
186
185
  deviceIds?: string[] | undefined;
187
186
  pricingId?: string | undefined;
187
+ productId?: string | undefined;
188
188
  }, {
189
189
  userId?: string | undefined;
190
- productId?: string | undefined;
191
190
  deviceIds?: string[] | undefined;
192
191
  pricingId?: string | undefined;
192
+ productId?: string | undefined;
193
193
  }>;
194
194
  }, "strip", z.ZodTypeAny, {
195
+ params: {
196
+ id: string;
197
+ };
195
198
  body: {
196
199
  userId?: string | undefined;
197
- productId?: string | undefined;
198
200
  deviceIds?: string[] | undefined;
199
201
  pricingId?: string | undefined;
202
+ productId?: string | undefined;
200
203
  };
204
+ }, {
201
205
  params: {
202
206
  id: string;
203
207
  };
204
- }, {
205
208
  body: {
206
209
  userId?: string | undefined;
207
- productId?: string | undefined;
208
210
  deviceIds?: string[] | undefined;
209
211
  pricingId?: string | undefined;
210
- };
211
- params: {
212
- id: string;
212
+ productId?: string | undefined;
213
213
  };
214
214
  }>;
215
215
  export declare const recordPaymentSchema: z.ZodObject<{
@@ -222,44 +222,54 @@ export declare const recordPaymentSchema: z.ZodObject<{
222
222
  }>;
223
223
  body: z.ZodObject<{
224
224
  amount: z.ZodNumber;
225
- provider: z.ZodEnum<["MTN_MOMO", "AIRTEL_MONEY", "DPO", "FLUTTERWAVE"]>;
225
+ provider: z.ZodDefault<z.ZodEnum<["MTN_MOMO", "AIRTEL_MONEY", "DPO", "FLUTTERWAVE", "CASH", "MOMO_PAY"]>>;
226
226
  providerReference: z.ZodOptional<z.ZodString>;
227
227
  customerPhone: z.ZodOptional<z.ZodString>;
228
+ customerName: z.ZodOptional<z.ZodString>;
229
+ notes: z.ZodOptional<z.ZodString>;
228
230
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
229
231
  }, "strip", z.ZodTypeAny, {
230
232
  amount: number;
231
- provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
232
- metadata?: Record<string, any> | undefined;
233
+ provider: "MTN_MOMO" | "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | "DPO" | "FLUTTERWAVE";
233
234
  providerReference?: string | undefined;
234
235
  customerPhone?: string | undefined;
236
+ customerName?: string | undefined;
237
+ notes?: string | undefined;
238
+ metadata?: Record<string, any> | undefined;
235
239
  }, {
236
240
  amount: number;
237
- provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
238
- metadata?: Record<string, any> | undefined;
241
+ provider?: "MTN_MOMO" | "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | "DPO" | "FLUTTERWAVE" | undefined;
239
242
  providerReference?: string | undefined;
240
243
  customerPhone?: string | undefined;
244
+ customerName?: string | undefined;
245
+ notes?: string | undefined;
246
+ metadata?: Record<string, any> | undefined;
241
247
  }>;
242
248
  }, "strip", z.ZodTypeAny, {
249
+ params: {
250
+ id: string;
251
+ };
243
252
  body: {
244
253
  amount: number;
245
- provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
246
- metadata?: Record<string, any> | undefined;
254
+ provider: "MTN_MOMO" | "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | "DPO" | "FLUTTERWAVE";
247
255
  providerReference?: string | undefined;
248
256
  customerPhone?: string | undefined;
257
+ customerName?: string | undefined;
258
+ notes?: string | undefined;
259
+ metadata?: Record<string, any> | undefined;
249
260
  };
261
+ }, {
250
262
  params: {
251
263
  id: string;
252
264
  };
253
- }, {
254
265
  body: {
255
266
  amount: number;
256
- provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
257
- metadata?: Record<string, any> | undefined;
267
+ provider?: "MTN_MOMO" | "AIRTEL_MONEY" | "CASH" | "MOMO_PAY" | "DPO" | "FLUTTERWAVE" | undefined;
258
268
  providerReference?: string | undefined;
259
269
  customerPhone?: string | undefined;
260
- };
261
- params: {
262
- id: string;
270
+ customerName?: string | undefined;
271
+ notes?: string | undefined;
272
+ metadata?: Record<string, any> | undefined;
263
273
  };
264
274
  }>;
265
275
  export declare const deletePlanSchema: z.ZodObject<{
@@ -80,21 +80,21 @@ exports.limitedUpdateSchema = zod_1.z.object({
80
80
  message: "At least one field to update is required",
81
81
  }),
82
82
  });
83
- // src/modules/device-payment-plans/validations/devicePaymentPlan.validations.ts
83
+ // src/modules/devicePaymentPlans/validations/devicePaymentPlans.validations.ts
84
84
  exports.recordPaymentSchema = zod_1.z.object({
85
85
  params: zod_1.z.object({
86
86
  id: zod_1.z.string().uuid("Invalid payment plan ID"),
87
87
  }),
88
88
  body: zod_1.z.object({
89
89
  amount: zod_1.z.number().min(0.01, "Amount must be greater than 0"),
90
- provider: zod_1.z.enum(vr_models_1.PAYMENT_PROVIDER, {
91
- errorMap: () => ({ message: "Invalid payment provider" }),
92
- }),
90
+ provider: zod_1.z.enum(vr_models_1.PAYMENT_PROVIDER).default("MOMO_PAY"),
93
91
  providerReference: zod_1.z.string().optional(),
94
92
  customerPhone: zod_1.z
95
93
  .string()
96
94
  .regex(/^\+?250[0-9]{9}$/, "Invalid MTN Rwanda phone number")
97
95
  .optional(),
96
+ customerName: zod_1.z.string().min(2).max(100).optional(),
97
+ notes: zod_1.z.string().optional(),
98
98
  metadata: zod_1.z.record(zod_1.z.any()).optional(),
99
99
  }),
100
100
  });