@eeplatform/core 1.0.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,2307 @@
1
+ import * as mongodb from 'mongodb';
2
+ import { ObjectId, ClientSession, Db, Collection } from 'mongodb';
3
+ import * as bson from 'bson';
4
+ import { Request, Response, NextFunction } from 'express';
5
+ import Joi from 'joi';
6
+ import { z } from 'zod';
7
+
8
+ type TVerificationMetadata = {
9
+ name?: string;
10
+ app?: string;
11
+ role?: string;
12
+ roleName?: string;
13
+ referralCode?: string;
14
+ org?: string | ObjectId;
15
+ orgName?: string;
16
+ };
17
+ type TVerification = {
18
+ _id?: ObjectId;
19
+ type: string;
20
+ email: string;
21
+ metadata?: TVerificationMetadata;
22
+ status?: string;
23
+ createdAt: string;
24
+ updatedAt?: string | null;
25
+ expireAt: string;
26
+ };
27
+ declare class MVerification implements TVerification {
28
+ _id?: ObjectId;
29
+ type: string;
30
+ email: string;
31
+ metadata?: TVerificationMetadata;
32
+ status?: string;
33
+ createdAt: string;
34
+ updatedAt?: string | null;
35
+ expireAt: string;
36
+ constructor(value: TVerification);
37
+ }
38
+
39
+ declare function useVerificationRepo(): {
40
+ createIndex: () => Promise<void>;
41
+ createTextIndex: () => Promise<void>;
42
+ createUniqueIndex: () => Promise<void>;
43
+ add: (value: TVerification, session?: ClientSession) => Promise<ObjectId>;
44
+ getVerifications: ({ search, page, limit, sort, status, type, email, app, }?: {
45
+ search?: string | undefined;
46
+ page?: number | undefined;
47
+ limit?: number | undefined;
48
+ sort?: Record<string, number> | undefined;
49
+ status?: string | undefined;
50
+ type?: string | string[] | undefined;
51
+ email?: string | undefined;
52
+ app?: string | undefined;
53
+ }) => Promise<TVerification[] | {
54
+ items: any[];
55
+ pages: number;
56
+ pageRange: string;
57
+ }>;
58
+ getById: (_id: ObjectId | string) => Promise<TVerification | null>;
59
+ getByIdByType: (type: string) => Promise<TVerification[] | TVerification[][]>;
60
+ updateStatusById: (_id: ObjectId | string, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
61
+ };
62
+
63
+ type TKeyValuePair<K extends string | number | symbol = string, V = any> = {
64
+ [key in K]: V;
65
+ };
66
+
67
+ declare function useVerificationService(): {
68
+ createForgetPassword: (email: string) => Promise<string>;
69
+ createUserInvite: ({ email, metadata, }: {
70
+ email: string;
71
+ metadata: TVerificationMetadata;
72
+ }) => Promise<bson.ObjectId>;
73
+ verify: (id: string) => Promise<TVerification | "Member invitation verified successfully.">;
74
+ getById: (id: string) => Promise<TVerification>;
75
+ getVerifications: ({ search, page, status, type, email, limit, app, }?: {
76
+ search?: string | undefined;
77
+ page?: number | undefined;
78
+ status?: string | undefined;
79
+ type?: string | undefined;
80
+ email?: string | undefined;
81
+ limit?: number | undefined;
82
+ app?: string | undefined;
83
+ }) => Promise<TVerification[] | {
84
+ items: any[];
85
+ pages: number;
86
+ pageRange: string;
87
+ }>;
88
+ cancelUserInvitation: (id: string) => Promise<void>;
89
+ updateStatusById: (_id: string, status: string) => Promise<string>;
90
+ signUp: ({ email, metadata, }: {
91
+ email: string;
92
+ metadata: TKeyValuePair;
93
+ }) => Promise<bson.ObjectId>;
94
+ };
95
+
96
+ declare function useVerificationController(): {
97
+ getVerifications: (req: Request, res: Response, next: NextFunction) => Promise<void>;
98
+ createUserInvite: (req: Request, res: Response, next: NextFunction) => Promise<void>;
99
+ createForgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
100
+ verify: (req: Request, res: Response, next: NextFunction) => Promise<void>;
101
+ cancelUserInvitation: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
102
+ };
103
+
104
+ type TToken = {
105
+ token: string;
106
+ user: ObjectId;
107
+ createdAt?: string;
108
+ };
109
+ declare class MToken implements TToken {
110
+ token: string;
111
+ user: ObjectId;
112
+ createdAt?: string;
113
+ constructor(value: TToken);
114
+ }
115
+
116
+ declare function useTokenRepo(): {
117
+ createToken: ({ token, user }?: {
118
+ token: string;
119
+ user: string | ObjectId;
120
+ }) => Promise<string>;
121
+ getToken: (token: string) => Promise<any>;
122
+ deleteToken: (token: string) => Promise<mongodb.DeleteResult>;
123
+ };
124
+
125
+ type TUserRole = {
126
+ name: string;
127
+ app: string;
128
+ role: ObjectId | string;
129
+ status?: string;
130
+ };
131
+ declare class MUserRole implements TUserRole {
132
+ name: string;
133
+ app: string;
134
+ role: ObjectId | string;
135
+ status?: string;
136
+ constructor(value: TUserRole);
137
+ }
138
+ type TUser = {
139
+ _id?: ObjectId;
140
+ email: string;
141
+ password: string;
142
+ prefix?: string;
143
+ firstName: string;
144
+ middleName?: string;
145
+ lastName: string;
146
+ suffix?: string;
147
+ birthMonth?: string;
148
+ birthDay?: number;
149
+ birthYear?: number;
150
+ gender?: string;
151
+ defaultOrg?: ObjectId | string;
152
+ xenditCustomerId?: string;
153
+ type?: string;
154
+ status?: string;
155
+ referralCode?: string;
156
+ referredBy?: string;
157
+ createdAt?: string;
158
+ updatedAt?: string;
159
+ deletedAt?: string;
160
+ };
161
+ declare class MUser implements TUser {
162
+ _id?: ObjectId;
163
+ email: string;
164
+ password: string;
165
+ prefix?: string;
166
+ firstName: string;
167
+ middleName?: string;
168
+ lastName: string;
169
+ suffix?: string;
170
+ birthMonth?: string;
171
+ birthDay?: number;
172
+ birthYear?: number;
173
+ gender?: string;
174
+ roles?: TUserRole[];
175
+ status?: string;
176
+ type?: string;
177
+ xenditCustomerId?: string | undefined;
178
+ referralCode?: string;
179
+ referredBy?: string;
180
+ createdAt?: string;
181
+ updatedAt?: string;
182
+ deletedAt?: string;
183
+ defaultOrg?: ObjectId | string;
184
+ constructor(value: TUser);
185
+ }
186
+
187
+ declare function useUserRepo(): {
188
+ createTextIndex: () => Promise<void>;
189
+ createUniqueIndex: () => Promise<void>;
190
+ createUser: (value: TUser, session?: ClientSession) => Promise<ObjectId>;
191
+ getUserByEmail: (email: string) => Promise<TUser | null>;
192
+ getUserById: (_id: string | ObjectId) => Promise<TUser | null>;
193
+ getUsers: ({ search, page, limit, sort, status, type, }?: {
194
+ search?: string | undefined;
195
+ page?: number | undefined;
196
+ limit?: number | undefined;
197
+ sort?: {} | undefined;
198
+ status?: string | undefined;
199
+ type?: string | undefined;
200
+ }) => Promise<Record<string, any>>;
201
+ updatePassword: ({ _id, password }?: {
202
+ _id: string | ObjectId;
203
+ password: string;
204
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
205
+ updateName: ({ _id, firstName, lastName }?: {
206
+ _id: string | ObjectId;
207
+ firstName?: string | undefined;
208
+ lastName?: string | undefined;
209
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
210
+ updateBirthday: ({ _id, month, day, year }?: {
211
+ _id: string | ObjectId;
212
+ month: string;
213
+ day: number;
214
+ year: number;
215
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
216
+ updateUserFieldById: ({ _id, field, value }?: {
217
+ _id: string | ObjectId;
218
+ field: string;
219
+ value: string | ObjectId;
220
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
221
+ addUserRole: ({ _id, role }?: {
222
+ _id: string | ObjectId;
223
+ role: TUserRole;
224
+ }, session?: ClientSession) => Promise<void>;
225
+ getUserByReferralCode: (referralCode: string) => Promise<TUser | null>;
226
+ };
227
+
228
+ declare function useUserService(): {
229
+ getUsers: ({ search, page, status, type, limit, }?: {
230
+ search?: string | undefined;
231
+ page?: number | undefined;
232
+ status?: string | undefined;
233
+ type?: string | undefined;
234
+ limit?: number | undefined;
235
+ }) => Promise<Record<string, any>>;
236
+ createUser: (value: Pick<TUser, "email" | "firstName" | "middleName" | "lastName" | "password" | "prefix" | "suffix">) => Promise<ObjectId>;
237
+ resetPassword: (id: string, newPassword: string, passwordConfirmation: string) => Promise<string>;
238
+ updateName: (_id: string, firstName?: string, lastName?: string) => Promise<string>;
239
+ updateBirthday: (_id: string, month: string, day: number, year: number) => Promise<string>;
240
+ updateUserFieldById: ({ _id, field, value }?: {
241
+ _id: string;
242
+ field: string;
243
+ value: string;
244
+ }) => Promise<mongodb.UpdateResult<bson.Document>>;
245
+ updateUserProfile: ({ file, user, previousProfile }?: {
246
+ file: Express.Multer.File;
247
+ user: string;
248
+ previousProfile?: string | undefined;
249
+ }) => Promise<string>;
250
+ createUserByInvite: ({ id, firstName, lastName, password, }?: {
251
+ id?: string | undefined;
252
+ firstName?: string | undefined;
253
+ lastName?: string | undefined;
254
+ password?: string | undefined;
255
+ }) => Promise<string | ObjectId>;
256
+ createUserBySignUp: ({ id, firstName, lastName, password, }?: {
257
+ id?: string | undefined;
258
+ firstName?: string | undefined;
259
+ lastName?: string | undefined;
260
+ password?: string | undefined;
261
+ }) => Promise<ObjectId>;
262
+ createDefaultUser: () => Promise<string>;
263
+ };
264
+
265
+ declare function useUserController(): {
266
+ getUsers: (req: Request, res: Response, next: NextFunction) => Promise<void>;
267
+ getUserById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
268
+ updateName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
269
+ updateBirthday: (req: Request, res: Response, next: NextFunction) => Promise<void>;
270
+ updateUserFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
271
+ updateUserProfile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
272
+ createUserByVerification: (req: Request, res: Response, next: NextFunction) => Promise<void>;
273
+ };
274
+
275
+ declare function useAuthService(): {
276
+ login: ({ email, password }?: {
277
+ email: string;
278
+ password: string;
279
+ }) => Promise<{
280
+ accessToken: string;
281
+ refreshToken: string;
282
+ id: bson.ObjectId | undefined;
283
+ }>;
284
+ refreshToken: (token: string) => Promise<string>;
285
+ logout: (token: string) => Promise<string>;
286
+ };
287
+
288
+ declare function useAuthController(): {
289
+ login: (req: Request, res: Response, next: NextFunction) => Promise<void>;
290
+ refreshToken: (req: Request, res: Response, next: NextFunction) => Promise<void>;
291
+ logout: (req: Request, res: Response, next: NextFunction) => Promise<void>;
292
+ resetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
293
+ signUp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
294
+ };
295
+
296
+ type TRole = {
297
+ _id?: ObjectId;
298
+ org?: string | ObjectId;
299
+ name?: string;
300
+ description?: string;
301
+ permissions?: Array<string>;
302
+ type?: string;
303
+ status?: string;
304
+ default?: boolean;
305
+ createdBy?: string | ObjectId;
306
+ createdAt?: string;
307
+ updatedAt?: string;
308
+ deletedAt?: string;
309
+ };
310
+ type TMiniRole = Pick<TRole, "name" | "permissions">;
311
+ declare class MRole implements TRole {
312
+ _id: ObjectId;
313
+ org: string | ObjectId;
314
+ name?: string;
315
+ description?: string;
316
+ permissions?: Array<string>;
317
+ type?: string;
318
+ status?: string;
319
+ default?: boolean;
320
+ createdBy?: string | ObjectId;
321
+ createdAt?: string;
322
+ updatedAt?: string;
323
+ deletedAt?: string;
324
+ constructor(value: TRole);
325
+ }
326
+
327
+ declare function useRoleRepo(): {
328
+ createIndex: () => Promise<void>;
329
+ createTextIndex: () => Promise<void>;
330
+ createUniqueIndex: () => Promise<void>;
331
+ addRole: (value: TRole, session?: ClientSession) => Promise<ObjectId>;
332
+ getRoles: ({ search, page, limit, sort, type, org, }?: {
333
+ search?: string | undefined;
334
+ page?: number | undefined;
335
+ limit?: number | undefined;
336
+ sort?: any;
337
+ type?: string | undefined;
338
+ org?: string | ObjectId | undefined;
339
+ }) => Promise<{
340
+ items: any[];
341
+ pages: number;
342
+ pageRange: string;
343
+ } | TRole[]>;
344
+ getRoleByUserId: (value: ObjectId | string) => Promise<TRole | null>;
345
+ getRoleById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
346
+ getRoleByName: (name: string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
347
+ updateRole: (_id: string | ObjectId, value: TMiniRole, session?: ClientSession) => Promise<string>;
348
+ deleteRole: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
349
+ updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
350
+ };
351
+
352
+ type TFile = {
353
+ _id?: ObjectId;
354
+ name: string;
355
+ type?: string;
356
+ status?: string;
357
+ createdAt: string;
358
+ };
359
+ declare class MFile implements TFile {
360
+ _id?: ObjectId;
361
+ name: string;
362
+ type?: string;
363
+ status?: string;
364
+ createdAt: string;
365
+ constructor(value: TFile);
366
+ }
367
+
368
+ declare function useFileRepo(): {
369
+ createFile: (value: TFile, session?: ClientSession) => Promise<string>;
370
+ deleteFileById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
371
+ getAllDraftedFiles: () => Promise<any[]>;
372
+ };
373
+
374
+ declare function useFileService(): {
375
+ createFile: (value: Express.Multer.File) => Promise<string>;
376
+ deleteFile: (id: string) => Promise<string>;
377
+ deleteDraft: () => void;
378
+ };
379
+
380
+ declare function useFileController(): {
381
+ upload: (req: Request, res: Response, next: NextFunction) => Promise<void>;
382
+ deleteFile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
383
+ };
384
+
385
+ declare function useRoleController(): {
386
+ createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
387
+ getRoles: (req: Request, res: Response, next: NextFunction) => Promise<void>;
388
+ getRoleByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
389
+ getRoleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
390
+ updateRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
391
+ deleteRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
392
+ updatePermissionsById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
393
+ };
394
+
395
+ type TEntity = {
396
+ _id?: ObjectId;
397
+ name: string;
398
+ username: string;
399
+ type: "strand" | "office" | "bureau" | "service" | "person";
400
+ createdAt?: string;
401
+ updatedAt?: string;
402
+ deletedAt?: string;
403
+ status?: string;
404
+ };
405
+ declare class MEntity implements TEntity {
406
+ _id?: ObjectId;
407
+ name: string;
408
+ username: string;
409
+ type: "strand" | "office" | "bureau" | "service" | "person";
410
+ createdAt?: string;
411
+ updatedAt?: string;
412
+ deletedAt?: string;
413
+ status?: string;
414
+ constructor(value: TEntity);
415
+ }
416
+
417
+ declare function useEntityRepo(): {
418
+ createIndex: () => Promise<void>;
419
+ createUniqueIndex: () => Promise<void>;
420
+ createEntity: (value: TEntity, session?: ClientSession) => Promise<string>;
421
+ getEntities: ({ search, page, limit, sort, }?: {
422
+ search?: string | undefined;
423
+ page?: number | undefined;
424
+ limit?: number | undefined;
425
+ sort?: {} | undefined;
426
+ }) => Promise<Record<string, any>>;
427
+ updateEntityFieldById: ({ _id, field, value }?: {
428
+ _id: string | ObjectId;
429
+ field: string;
430
+ value: string;
431
+ }, session?: ClientSession) => Promise<string>;
432
+ deleteEntity: (_id: string | ObjectId) => Promise<mongodb.UpdateResult<bson.Document>>;
433
+ };
434
+
435
+ declare function useEntityController(): {
436
+ createEntity: (req: Request, res: Response, next: NextFunction) => Promise<void>;
437
+ getEntities: (req: Request, res: Response, next: NextFunction) => Promise<void>;
438
+ updateEntityFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
439
+ deleteEntity: (req: Request, res: Response, next: NextFunction) => Promise<void>;
440
+ };
441
+
442
+ type TBillingRecipient = {
443
+ addedAt?: Date | string;
444
+ email: string;
445
+ };
446
+ type TSubscription = {
447
+ _id?: ObjectId;
448
+ user?: ObjectId | string;
449
+ org?: ObjectId | string;
450
+ customerId?: string;
451
+ paymentMethodId?: string;
452
+ amount: number;
453
+ description?: string;
454
+ currency: string;
455
+ promoCode?: string;
456
+ type: string;
457
+ paidSeats?: number;
458
+ currentSeats?: number;
459
+ maxSeats?: number;
460
+ status?: string;
461
+ billingCycle: "monthly" | "yearly";
462
+ billingContacts?: Array<TBillingRecipient>;
463
+ nextBillingDate?: Date;
464
+ lastPaymentStatus?: string;
465
+ failedAttempts?: number;
466
+ createdAt?: string | Date;
467
+ updatedAt?: string | Date;
468
+ deletedAt?: string | Date;
469
+ };
470
+ declare function MSubscription(value: TSubscription): TSubscription;
471
+
472
+ declare function useSubscriptionRepo(): {
473
+ createIndex: () => Promise<void>;
474
+ createUniqueIndex: () => Promise<void>;
475
+ add: (value: TSubscription, session?: ClientSession) => Promise<ObjectId>;
476
+ getById: (_id: string | ObjectId) => Promise<TSubscription | null>;
477
+ getBySubscriptionId: (subscriptionId: string) => Promise<TSubscription | null>;
478
+ getByUserId: (user: string | ObjectId) => Promise<TSubscription | null>;
479
+ getSubscriptions: ({ search, page, limit, sort, status, }?: {
480
+ search?: string | undefined;
481
+ page?: number | undefined;
482
+ limit?: number | undefined;
483
+ sort?: {} | undefined;
484
+ status?: string | undefined;
485
+ }) => Promise<Record<string, any>>;
486
+ updateStatus: (_id: string | ObjectId, status: string) => Promise<string>;
487
+ getByOrgId: (org: string | ObjectId) => Promise<TSubscription | null>;
488
+ getByAffiliateUserId: (user: string | ObjectId) => Promise<TSubscription | null>;
489
+ getDueSubscriptions: (BATCH_SIZE?: number) => Promise<TSubscription[]>;
490
+ getFailedSubscriptions: (BATCH_SIZE?: number) => Promise<TSubscription[]>;
491
+ processSuccessfulPayment: (value: Pick<TSubscription, "nextBillingDate"> & {
492
+ _id: string | ObjectId;
493
+ }, session?: ClientSession) => Promise<string>;
494
+ markSubscriptionAsFailed: ({ _id, failed }?: {
495
+ _id: string | ObjectId;
496
+ failed?: boolean | undefined;
497
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
498
+ markSubscriptionAsCanceled: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
499
+ updateSeatsById: ({ _id, currentSeats, maxSeats, paidSeats, amount, status, nextBillingDate, }?: {
500
+ _id: string | ObjectId;
501
+ currentSeats: number;
502
+ maxSeats: number;
503
+ paidSeats?: number | undefined;
504
+ amount: number;
505
+ status?: string | undefined;
506
+ nextBillingDate?: string | undefined;
507
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
508
+ updateMaxSeatsById: ({ _id, seats }?: {
509
+ _id: string | ObjectId;
510
+ seats: number;
511
+ }, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
512
+ updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
513
+ updatePromoCodeById: (_id: string | ObjectId, promoCode: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
514
+ updatePaymentMethodById: (_id: string | ObjectId, paymentMethodId: string, session?: ClientSession) => Promise<mongodb.UpdateResult<TSubscription>>;
515
+ addBillingContactById: (_id: string | ObjectId, email: string) => Promise<string>;
516
+ updateBillingContactByAddedAt: (_id: string | ObjectId, addedAt: string | Date, email: string) => Promise<string>;
517
+ deleteBillingContactByAddedAt: (_id: string | ObjectId, addedAt: string | Date) => Promise<string>;
518
+ };
519
+
520
+ type TOrg = {
521
+ _id?: ObjectId;
522
+ name: string;
523
+ description: string;
524
+ type?: string;
525
+ email?: string;
526
+ contact?: string;
527
+ busInst?: string;
528
+ status?: string;
529
+ xenditCustomerId?: string;
530
+ createdAt?: string;
531
+ updatedAt?: string;
532
+ deletedAt?: string;
533
+ };
534
+ declare function MOrg(value: TOrg): TOrg;
535
+
536
+ type TAddress = {
537
+ _id?: ObjectId;
538
+ type: string;
539
+ user: ObjectId | string;
540
+ org?: ObjectId | string;
541
+ country: string;
542
+ address: string;
543
+ continuedAddress?: string;
544
+ city: string;
545
+ province: string;
546
+ postalCode: string;
547
+ taxId: string;
548
+ };
549
+ declare const addressSchema: Joi.ObjectSchema<any>;
550
+ declare function MAddress(value: any): TAddress;
551
+
552
+ declare function useSubscriptionService(): {
553
+ subscribe: (value: {
554
+ user: string;
555
+ currency: string;
556
+ perSeatPrice: number;
557
+ seats: number;
558
+ transactionId?: string | undefined;
559
+ promoCode?: string | undefined;
560
+ org: {
561
+ name: string;
562
+ type: string;
563
+ email: string;
564
+ busInst?: string;
565
+ contact: string;
566
+ description: string;
567
+ };
568
+ }) => Promise<{
569
+ message: string;
570
+ data: {
571
+ org: string;
572
+ };
573
+ }>;
574
+ getByUserId: (id: string) => Promise<any>;
575
+ getStatusByUser: (user: string) => Promise<string>;
576
+ createAffiliateSubscription: (value: {
577
+ user: string;
578
+ amount: number;
579
+ currency: string;
580
+ promoCode?: string | undefined;
581
+ payment_method_id: string;
582
+ payment_method_expiry_month?: string | undefined;
583
+ payment_method_expiry_year?: string | undefined;
584
+ payment_method_cvv?: string | undefined;
585
+ payment_method_cardholder_name?: string | undefined;
586
+ payment_method_channel: string;
587
+ payment_method_type: string;
588
+ customer_id: string;
589
+ billingAddress: TAddress;
590
+ }) => Promise<string>;
591
+ createOrgSubscription: (value: {
592
+ user: string;
593
+ amount: number;
594
+ currency: string;
595
+ promoCode?: string | undefined;
596
+ payment_method_id: string;
597
+ payment_method_expiry_month?: string | undefined;
598
+ payment_method_expiry_year?: string | undefined;
599
+ payment_method_cvv?: string | undefined;
600
+ payment_method_cardholder_name?: string | undefined;
601
+ payment_method_channel: string;
602
+ payment_method_type: string;
603
+ customer_id: string;
604
+ organization: TOrg;
605
+ billingAddress: TAddress;
606
+ seats: number;
607
+ }) => Promise<{
608
+ message: string;
609
+ data: {
610
+ org: string;
611
+ };
612
+ }>;
613
+ processSubscriptions: (batchSize?: number, maxRetries?: number) => Promise<void>;
614
+ updateSeatsById: (value: {
615
+ transactionId?: string | undefined;
616
+ subscriptionId: string;
617
+ seats: number;
618
+ amount: number;
619
+ }) => Promise<void>;
620
+ updateSubscriptionSeats: (value: {
621
+ transactionId?: string | undefined;
622
+ subscriptionId: string;
623
+ seats: number;
624
+ amount: number;
625
+ }) => Promise<void>;
626
+ processSubscriptionPayment: (invoiceNumber: string, subscriptionId: string) => Promise<void>;
627
+ };
628
+
629
+ declare function useSubscriptionController(): {
630
+ subscribe: (req: Request, res: Response, next: NextFunction) => Promise<void>;
631
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
632
+ getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
633
+ getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
634
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
635
+ getByAffiliateUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
636
+ getSubscriptions: (req: Request, res: Response, next: NextFunction) => Promise<void>;
637
+ getSubscriptionStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
638
+ createAffiliateSubscription: (req: Request, res: Response, next: NextFunction) => Promise<void>;
639
+ createOrgSubscription: (req: Request, res: Response, next: NextFunction) => Promise<void>;
640
+ updateSubscriptionSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
641
+ updatePromoCodeById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
642
+ updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
643
+ updatePaymentMethodById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
644
+ addBillingContactById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
645
+ updateBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
646
+ deleteBillingContactByAddedAt: (req: Request, res: Response, next: NextFunction) => Promise<void>;
647
+ processSubscriptionPayment: (req: Request, res: Response, next: NextFunction) => Promise<void>;
648
+ };
649
+
650
+ declare const CustomerSchema: z.ZodEffects<z.ZodObject<{
651
+ reference_id: z.ZodString;
652
+ type: z.ZodEnum<["INDIVIDUAL", "BUSINESS"]>;
653
+ individual_detail: z.ZodOptional<z.ZodLazy<z.ZodObject<{
654
+ given_names: z.ZodString;
655
+ surname: z.ZodOptional<z.ZodString>;
656
+ nationality: z.ZodOptional<z.ZodString>;
657
+ place_of_birth: z.ZodOptional<z.ZodString>;
658
+ date_of_birth: z.ZodOptional<z.ZodString>;
659
+ gender: z.ZodOptional<z.ZodEnum<["MALE", "FEMALE", "OTHER"]>>;
660
+ employment: z.ZodOptional<z.ZodString>;
661
+ employer_name: z.ZodOptional<z.ZodString>;
662
+ nature_of_business: z.ZodOptional<z.ZodString>;
663
+ role_description: z.ZodOptional<z.ZodString>;
664
+ }, "strip", z.ZodTypeAny, {
665
+ given_names: string;
666
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
667
+ surname?: string | undefined;
668
+ nationality?: string | undefined;
669
+ place_of_birth?: string | undefined;
670
+ date_of_birth?: string | undefined;
671
+ employment?: string | undefined;
672
+ employer_name?: string | undefined;
673
+ nature_of_business?: string | undefined;
674
+ role_description?: string | undefined;
675
+ }, {
676
+ given_names: string;
677
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
678
+ surname?: string | undefined;
679
+ nationality?: string | undefined;
680
+ place_of_birth?: string | undefined;
681
+ date_of_birth?: string | undefined;
682
+ employment?: string | undefined;
683
+ employer_name?: string | undefined;
684
+ nature_of_business?: string | undefined;
685
+ role_description?: string | undefined;
686
+ }>>>;
687
+ business_detail: z.ZodOptional<z.ZodLazy<z.ZodObject<{
688
+ business_name: z.ZodString;
689
+ trading_name: z.ZodOptional<z.ZodString>;
690
+ business_type: z.ZodEnum<["CORPORATION", "SOLE_PROPRIETOR", "PARTNERSHIP", "COOPERATIVE", "TRUST", "NON_PROFIT", "GOVERNMENT"]>;
691
+ nature_of_business: z.ZodOptional<z.ZodString>;
692
+ business_domicile: z.ZodOptional<z.ZodString>;
693
+ date_of_registration: z.ZodOptional<z.ZodString>;
694
+ }, "strip", z.ZodTypeAny, {
695
+ business_name: string;
696
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
697
+ nature_of_business?: string | undefined;
698
+ trading_name?: string | undefined;
699
+ business_domicile?: string | undefined;
700
+ date_of_registration?: string | undefined;
701
+ }, {
702
+ business_name: string;
703
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
704
+ nature_of_business?: string | undefined;
705
+ trading_name?: string | undefined;
706
+ business_domicile?: string | undefined;
707
+ date_of_registration?: string | undefined;
708
+ }>>>;
709
+ mobile_number: z.ZodOptional<z.ZodString>;
710
+ phone_number: z.ZodOptional<z.ZodString>;
711
+ hashed_phone_number: z.ZodOptional<z.ZodString>;
712
+ email: z.ZodOptional<z.ZodString>;
713
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
714
+ country: z.ZodString;
715
+ street_line1: z.ZodOptional<z.ZodString>;
716
+ street_line2: z.ZodOptional<z.ZodString>;
717
+ city: z.ZodOptional<z.ZodString>;
718
+ province_state: z.ZodOptional<z.ZodString>;
719
+ postal_code: z.ZodOptional<z.ZodString>;
720
+ category: z.ZodOptional<z.ZodEnum<["HOME", "WORK", "PROVINCIAL"]>>;
721
+ is_primary: z.ZodOptional<z.ZodBoolean>;
722
+ }, "strip", z.ZodTypeAny, {
723
+ country: string;
724
+ street_line1?: string | undefined;
725
+ street_line2?: string | undefined;
726
+ city?: string | undefined;
727
+ province_state?: string | undefined;
728
+ postal_code?: string | undefined;
729
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
730
+ is_primary?: boolean | undefined;
731
+ }, {
732
+ country: string;
733
+ street_line1?: string | undefined;
734
+ street_line2?: string | undefined;
735
+ city?: string | undefined;
736
+ province_state?: string | undefined;
737
+ postal_code?: string | undefined;
738
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
739
+ is_primary?: boolean | undefined;
740
+ }>, "many">>;
741
+ identity_accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
742
+ type: z.ZodEnum<["BANK_ACCOUNT", "EWALLET", "CREDIT_CARD", "PAY_LATER", "OTC", "QR_CODE", "SOCIAL_MEDIA"]>;
743
+ company: z.ZodOptional<z.ZodString>;
744
+ description: z.ZodOptional<z.ZodString>;
745
+ country: z.ZodOptional<z.ZodString>;
746
+ properties: z.ZodOptional<z.ZodAny>;
747
+ }, "strip", z.ZodTypeAny, {
748
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
749
+ country?: string | undefined;
750
+ company?: string | undefined;
751
+ description?: string | undefined;
752
+ properties?: any;
753
+ }, {
754
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
755
+ country?: string | undefined;
756
+ company?: string | undefined;
757
+ description?: string | undefined;
758
+ properties?: any;
759
+ }>, "many">>;
760
+ kyc_documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
761
+ country: z.ZodString;
762
+ type: z.ZodEnum<["BIRTH_CERTIFICATE", "BANK_STATEMENT", "DRIVING_LICENSE", "IDENTITY_CARD", "PASSPORT", "VISA", "BUSINESS_REGISTRATION", "BUSINESS_LICENSE"]>;
763
+ sub_type: z.ZodOptional<z.ZodEnum<["NATIONAL_ID", "CONSULAR_ID", "VOTER_ID", "POSTAL_ID", "RESIDENCE_PERMIT", "TAX_ID", "STUDENT_ID", "MILITARY_ID", "MEDICAL_ID"]>>;
764
+ document_name: z.ZodOptional<z.ZodString>;
765
+ document_number: z.ZodOptional<z.ZodString>;
766
+ expires_at: z.ZodOptional<z.ZodString>;
767
+ holder_name: z.ZodOptional<z.ZodString>;
768
+ document_images: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
769
+ }, "strip", z.ZodTypeAny, {
770
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
771
+ country: string;
772
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
773
+ document_name?: string | undefined;
774
+ document_number?: string | undefined;
775
+ expires_at?: string | undefined;
776
+ holder_name?: string | undefined;
777
+ document_images?: string[] | undefined;
778
+ }, {
779
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
780
+ country: string;
781
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
782
+ document_name?: string | undefined;
783
+ document_number?: string | undefined;
784
+ expires_at?: string | undefined;
785
+ holder_name?: string | undefined;
786
+ document_images?: string[] | undefined;
787
+ }>, "many">>;
788
+ description: z.ZodOptional<z.ZodString>;
789
+ date_of_registration: z.ZodOptional<z.ZodString>;
790
+ }, "strip", z.ZodTypeAny, {
791
+ type: "INDIVIDUAL" | "BUSINESS";
792
+ reference_id: string;
793
+ email?: string | undefined;
794
+ description?: string | undefined;
795
+ date_of_registration?: string | undefined;
796
+ individual_detail?: {
797
+ given_names: string;
798
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
799
+ surname?: string | undefined;
800
+ nationality?: string | undefined;
801
+ place_of_birth?: string | undefined;
802
+ date_of_birth?: string | undefined;
803
+ employment?: string | undefined;
804
+ employer_name?: string | undefined;
805
+ nature_of_business?: string | undefined;
806
+ role_description?: string | undefined;
807
+ } | undefined;
808
+ business_detail?: {
809
+ business_name: string;
810
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
811
+ nature_of_business?: string | undefined;
812
+ trading_name?: string | undefined;
813
+ business_domicile?: string | undefined;
814
+ date_of_registration?: string | undefined;
815
+ } | undefined;
816
+ mobile_number?: string | undefined;
817
+ phone_number?: string | undefined;
818
+ hashed_phone_number?: string | undefined;
819
+ addresses?: {
820
+ country: string;
821
+ street_line1?: string | undefined;
822
+ street_line2?: string | undefined;
823
+ city?: string | undefined;
824
+ province_state?: string | undefined;
825
+ postal_code?: string | undefined;
826
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
827
+ is_primary?: boolean | undefined;
828
+ }[] | undefined;
829
+ identity_accounts?: {
830
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
831
+ country?: string | undefined;
832
+ company?: string | undefined;
833
+ description?: string | undefined;
834
+ properties?: any;
835
+ }[] | undefined;
836
+ kyc_documents?: {
837
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
838
+ country: string;
839
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
840
+ document_name?: string | undefined;
841
+ document_number?: string | undefined;
842
+ expires_at?: string | undefined;
843
+ holder_name?: string | undefined;
844
+ document_images?: string[] | undefined;
845
+ }[] | undefined;
846
+ }, {
847
+ type: "INDIVIDUAL" | "BUSINESS";
848
+ reference_id: string;
849
+ email?: string | undefined;
850
+ description?: string | undefined;
851
+ date_of_registration?: string | undefined;
852
+ individual_detail?: {
853
+ given_names: string;
854
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
855
+ surname?: string | undefined;
856
+ nationality?: string | undefined;
857
+ place_of_birth?: string | undefined;
858
+ date_of_birth?: string | undefined;
859
+ employment?: string | undefined;
860
+ employer_name?: string | undefined;
861
+ nature_of_business?: string | undefined;
862
+ role_description?: string | undefined;
863
+ } | undefined;
864
+ business_detail?: {
865
+ business_name: string;
866
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
867
+ nature_of_business?: string | undefined;
868
+ trading_name?: string | undefined;
869
+ business_domicile?: string | undefined;
870
+ date_of_registration?: string | undefined;
871
+ } | undefined;
872
+ mobile_number?: string | undefined;
873
+ phone_number?: string | undefined;
874
+ hashed_phone_number?: string | undefined;
875
+ addresses?: {
876
+ country: string;
877
+ street_line1?: string | undefined;
878
+ street_line2?: string | undefined;
879
+ city?: string | undefined;
880
+ province_state?: string | undefined;
881
+ postal_code?: string | undefined;
882
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
883
+ is_primary?: boolean | undefined;
884
+ }[] | undefined;
885
+ identity_accounts?: {
886
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
887
+ country?: string | undefined;
888
+ company?: string | undefined;
889
+ description?: string | undefined;
890
+ properties?: any;
891
+ }[] | undefined;
892
+ kyc_documents?: {
893
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
894
+ country: string;
895
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
896
+ document_name?: string | undefined;
897
+ document_number?: string | undefined;
898
+ expires_at?: string | undefined;
899
+ holder_name?: string | undefined;
900
+ document_images?: string[] | undefined;
901
+ }[] | undefined;
902
+ }>, {
903
+ type: "INDIVIDUAL" | "BUSINESS";
904
+ reference_id: string;
905
+ email?: string | undefined;
906
+ description?: string | undefined;
907
+ date_of_registration?: string | undefined;
908
+ individual_detail?: {
909
+ given_names: string;
910
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
911
+ surname?: string | undefined;
912
+ nationality?: string | undefined;
913
+ place_of_birth?: string | undefined;
914
+ date_of_birth?: string | undefined;
915
+ employment?: string | undefined;
916
+ employer_name?: string | undefined;
917
+ nature_of_business?: string | undefined;
918
+ role_description?: string | undefined;
919
+ } | undefined;
920
+ business_detail?: {
921
+ business_name: string;
922
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
923
+ nature_of_business?: string | undefined;
924
+ trading_name?: string | undefined;
925
+ business_domicile?: string | undefined;
926
+ date_of_registration?: string | undefined;
927
+ } | undefined;
928
+ mobile_number?: string | undefined;
929
+ phone_number?: string | undefined;
930
+ hashed_phone_number?: string | undefined;
931
+ addresses?: {
932
+ country: string;
933
+ street_line1?: string | undefined;
934
+ street_line2?: string | undefined;
935
+ city?: string | undefined;
936
+ province_state?: string | undefined;
937
+ postal_code?: string | undefined;
938
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
939
+ is_primary?: boolean | undefined;
940
+ }[] | undefined;
941
+ identity_accounts?: {
942
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
943
+ country?: string | undefined;
944
+ company?: string | undefined;
945
+ description?: string | undefined;
946
+ properties?: any;
947
+ }[] | undefined;
948
+ kyc_documents?: {
949
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
950
+ country: string;
951
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
952
+ document_name?: string | undefined;
953
+ document_number?: string | undefined;
954
+ expires_at?: string | undefined;
955
+ holder_name?: string | undefined;
956
+ document_images?: string[] | undefined;
957
+ }[] | undefined;
958
+ }, {
959
+ type: "INDIVIDUAL" | "BUSINESS";
960
+ reference_id: string;
961
+ email?: string | undefined;
962
+ description?: string | undefined;
963
+ date_of_registration?: string | undefined;
964
+ individual_detail?: {
965
+ given_names: string;
966
+ gender?: "MALE" | "FEMALE" | "OTHER" | undefined;
967
+ surname?: string | undefined;
968
+ nationality?: string | undefined;
969
+ place_of_birth?: string | undefined;
970
+ date_of_birth?: string | undefined;
971
+ employment?: string | undefined;
972
+ employer_name?: string | undefined;
973
+ nature_of_business?: string | undefined;
974
+ role_description?: string | undefined;
975
+ } | undefined;
976
+ business_detail?: {
977
+ business_name: string;
978
+ business_type: "CORPORATION" | "SOLE_PROPRIETOR" | "PARTNERSHIP" | "COOPERATIVE" | "TRUST" | "NON_PROFIT" | "GOVERNMENT";
979
+ nature_of_business?: string | undefined;
980
+ trading_name?: string | undefined;
981
+ business_domicile?: string | undefined;
982
+ date_of_registration?: string | undefined;
983
+ } | undefined;
984
+ mobile_number?: string | undefined;
985
+ phone_number?: string | undefined;
986
+ hashed_phone_number?: string | undefined;
987
+ addresses?: {
988
+ country: string;
989
+ street_line1?: string | undefined;
990
+ street_line2?: string | undefined;
991
+ city?: string | undefined;
992
+ province_state?: string | undefined;
993
+ postal_code?: string | undefined;
994
+ category?: "HOME" | "WORK" | "PROVINCIAL" | undefined;
995
+ is_primary?: boolean | undefined;
996
+ }[] | undefined;
997
+ identity_accounts?: {
998
+ type: "BANK_ACCOUNT" | "EWALLET" | "CREDIT_CARD" | "PAY_LATER" | "OTC" | "QR_CODE" | "SOCIAL_MEDIA";
999
+ country?: string | undefined;
1000
+ company?: string | undefined;
1001
+ description?: string | undefined;
1002
+ properties?: any;
1003
+ }[] | undefined;
1004
+ kyc_documents?: {
1005
+ type: "BIRTH_CERTIFICATE" | "BANK_STATEMENT" | "DRIVING_LICENSE" | "IDENTITY_CARD" | "PASSPORT" | "VISA" | "BUSINESS_REGISTRATION" | "BUSINESS_LICENSE";
1006
+ country: string;
1007
+ sub_type?: "NATIONAL_ID" | "CONSULAR_ID" | "VOTER_ID" | "POSTAL_ID" | "RESIDENCE_PERMIT" | "TAX_ID" | "STUDENT_ID" | "MILITARY_ID" | "MEDICAL_ID" | undefined;
1008
+ document_name?: string | undefined;
1009
+ document_number?: string | undefined;
1010
+ expires_at?: string | undefined;
1011
+ holder_name?: string | undefined;
1012
+ document_images?: string[] | undefined;
1013
+ }[] | undefined;
1014
+ }>;
1015
+ type TCustomer = z.infer<typeof CustomerSchema>;
1016
+
1017
+ declare function useXenditService(): {
1018
+ createCustomer: (value: TCustomer) => Promise<any>;
1019
+ linkPaymentMethodEWallet: ({ customerId, type, success_return_url, failure_return_url, cancel_return_url, }?: {
1020
+ customerId?: string | undefined;
1021
+ type?: string | undefined;
1022
+ success_return_url?: string | undefined;
1023
+ failure_return_url?: string | undefined;
1024
+ cancel_return_url?: string | undefined;
1025
+ }) => Promise<any>;
1026
+ initGCashLinkingAndPaymentRequest: ({ amount, currency, countryCode, customerId, success_return_url, failure_return_url, }?: {
1027
+ amount?: number | undefined;
1028
+ currency?: string | undefined;
1029
+ countryCode?: string | undefined;
1030
+ customerId?: string | undefined;
1031
+ success_return_url?: string | undefined;
1032
+ failure_return_url?: string | undefined;
1033
+ }) => Promise<any>;
1034
+ initSubscription: ({ customer, currency, amount, paymentMethod, description, interval, seats, }?: {
1035
+ customer?: string | undefined;
1036
+ currency?: string | undefined;
1037
+ amount?: number | undefined;
1038
+ paymentMethod?: string | undefined;
1039
+ description?: string | undefined;
1040
+ interval?: string | undefined;
1041
+ seats?: number | undefined;
1042
+ }) => Promise<any>;
1043
+ linkPaymentMethodCard: ({ success_return_url, failure_return_url, card_number, expiry_month, expiry_year, cvv, cardholder_name, currency, }?: {
1044
+ success_return_url?: string | undefined;
1045
+ failure_return_url?: string | undefined;
1046
+ card_number?: string | undefined;
1047
+ expiry_month?: string | undefined;
1048
+ expiry_year?: string | undefined;
1049
+ cvv?: string | undefined;
1050
+ cardholder_name?: string | undefined;
1051
+ currency?: string | undefined;
1052
+ }) => Promise<any>;
1053
+ eWalletSubsequentPayment: ({ amount, currency, payment_method_id, customer_id, description, }?: {
1054
+ amount?: number | undefined;
1055
+ currency?: string | undefined;
1056
+ payment_method_id?: string | undefined;
1057
+ customer_id?: string | undefined;
1058
+ description?: string | undefined;
1059
+ }) => Promise<any>;
1060
+ checkSubscriptionStatus: (subscriptionId: string) => Promise<string>;
1061
+ cancelSubscription: (subscriptionId: string) => Promise<string>;
1062
+ getSubscription: (id: string) => Promise<any>;
1063
+ getSubscriptionCycles: (id: string) => Promise<any>;
1064
+ pay: (value: {
1065
+ amount: number;
1066
+ currency: string;
1067
+ payment_method_id: string;
1068
+ customer_id: string;
1069
+ description?: string;
1070
+ metadata?: Record<string, any>;
1071
+ }) => Promise<any>;
1072
+ getPaymentMethodById: (id: string) => Promise<any>;
1073
+ getCustomerById: (id: string) => Promise<any>;
1074
+ eWalletLinkOnly: (value: Record<string, any>) => Promise<any>;
1075
+ directDebitLinkOnly: (value: Record<string, any>) => Promise<any>;
1076
+ cardLinkOnly: (value: Record<string, any>) => Promise<any>;
1077
+ getPaymentMethodsByCustomerId: (customerId: string) => Promise<any>;
1078
+ updatePaymentMethodStatusById: (id: string, status: string) => Promise<any>;
1079
+ };
1080
+
1081
+ type TPaymentMethod$1 = {
1082
+ _id?: ObjectId;
1083
+ user?: ObjectId | string;
1084
+ org?: ObjectId | string;
1085
+ name: string;
1086
+ description?: string;
1087
+ type: string;
1088
+ number: string;
1089
+ month_expiry?: string;
1090
+ year_expiry?: string;
1091
+ cvv?: string;
1092
+ paymentId: string;
1093
+ customerId?: string;
1094
+ status?: string;
1095
+ createdAt?: string;
1096
+ deletedAt?: string;
1097
+ };
1098
+ declare function MPaymentMethod(value: TPaymentMethod$1): TPaymentMethod$1;
1099
+
1100
+ declare function usePaymentMethodRepo(): {
1101
+ createIndex: () => Promise<void>;
1102
+ add: (value: TPaymentMethod$1, session?: ClientSession) => Promise<string>;
1103
+ getByUser: (user: string | ObjectId) => Promise<bson.Document[]>;
1104
+ getByOrg: (org: string | ObjectId) => Promise<bson.Document[]>;
1105
+ deleteById: (_id: string | ObjectId) => Promise<string>;
1106
+ createUniqueIndex: () => Promise<void>;
1107
+ getByPaymentMethodId: (paymentMethodId: string | ObjectId) => Promise<TPaymentMethod$1 | null>;
1108
+ };
1109
+
1110
+ declare function usePaymentMethodService(): {
1111
+ linkEWallet: ({ customer_id, type, success_return_url, failure_return_url, cancel_return_url, }?: {
1112
+ customer_id?: string | undefined;
1113
+ type?: string | undefined;
1114
+ success_return_url?: string | undefined;
1115
+ failure_return_url?: string | undefined;
1116
+ cancel_return_url?: string | undefined;
1117
+ }) => Promise<{
1118
+ paymentMethod: any;
1119
+ actions: any;
1120
+ }>;
1121
+ linkCard: ({ user, type, success_return_url, failure_return_url, card_number, expiry_month, expiry_year, cvv, cardholder_name, currency, }?: {
1122
+ user?: string | undefined;
1123
+ type?: string | undefined;
1124
+ success_return_url?: string | undefined;
1125
+ failure_return_url?: string | undefined;
1126
+ card_number?: string | undefined;
1127
+ expiry_month?: string | undefined;
1128
+ expiry_year?: string | undefined;
1129
+ cvv?: string | undefined;
1130
+ cardholder_name?: string | undefined;
1131
+ currency?: string | undefined;
1132
+ }) => Promise<any>;
1133
+ };
1134
+
1135
+ declare function usePaymentMethodController(): {
1136
+ linkEWallet: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1137
+ linkCard: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1138
+ getByUser: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1139
+ getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1140
+ linkOnly: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1141
+ getPaymentMethodById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1142
+ getPaymentMethodsByCustomerId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1143
+ updatePaymentMethodStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1144
+ };
1145
+
1146
+ declare function useAddressRepo(): {
1147
+ createIndex: () => Promise<void>;
1148
+ add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
1149
+ getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
1150
+ getByOrgId: (org: string | ObjectId) => Promise<TAddress | null>;
1151
+ updateById: (_id: string | ObjectId, value: Pick<TAddress, "org" | "country" | "city" | "address" | "continuedAddress" | "province" | "postalCode" | "taxId">, session?: ClientSession) => Promise<string>;
1152
+ };
1153
+
1154
+ declare function useAddressController(): {
1155
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1156
+ getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1157
+ getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1158
+ updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1159
+ };
1160
+
1161
+ declare function useOrgRepo(): {
1162
+ createIndex: () => Promise<void>;
1163
+ createTextIndex: () => Promise<void>;
1164
+ createUniqueIndex: () => Promise<void>;
1165
+ add: (value: TOrg, session?: ClientSession) => Promise<ObjectId>;
1166
+ getAll: ({ search, page, limit, sort, status, }?: {
1167
+ search?: string | undefined;
1168
+ page?: number | undefined;
1169
+ limit?: number | undefined;
1170
+ sort?: {} | undefined;
1171
+ status?: string | undefined;
1172
+ }) => Promise<Record<string, any>>;
1173
+ getById: (_id: string | ObjectId) => Promise<TOrg>;
1174
+ updateFieldById: ({ _id, field, value }?: {
1175
+ _id: string | ObjectId;
1176
+ field: string;
1177
+ value: string;
1178
+ }, session?: ClientSession) => Promise<string>;
1179
+ deleteById: (_id: string | ObjectId) => Promise<string>;
1180
+ getByName: (name: string) => Promise<TOrg>;
1181
+ };
1182
+
1183
+ declare function useOrgService(): {
1184
+ createOrg: ({ user, name, description }?: {
1185
+ user?: string | undefined;
1186
+ name?: string | undefined;
1187
+ description?: string | undefined;
1188
+ }) => Promise<string>;
1189
+ };
1190
+
1191
+ declare function useOrgController(): {
1192
+ createOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1193
+ getOrgsByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1194
+ getByName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1195
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1196
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1197
+ };
1198
+
1199
+ type TMember = {
1200
+ _id?: ObjectId;
1201
+ org?: string | ObjectId;
1202
+ orgName?: string;
1203
+ name: string;
1204
+ user: string | ObjectId;
1205
+ role: string | ObjectId;
1206
+ roleName?: string;
1207
+ type: string;
1208
+ status?: string;
1209
+ createdAt?: string;
1210
+ updatedAt?: string;
1211
+ deletedAt?: string;
1212
+ };
1213
+ declare function MMember(value: TMember): TMember;
1214
+
1215
+ declare function useMemberRepo(): {
1216
+ createIndex: () => Promise<void>;
1217
+ createUniqueIndex: () => Promise<void>;
1218
+ createTextIndex: () => Promise<void>;
1219
+ add: (value: TMember, session?: ClientSession) => Promise<string>;
1220
+ getById: (_id: string | ObjectId) => Promise<TMember | null>;
1221
+ getAll: ({ search, limit, page, user, org, type, status }?: {
1222
+ search: string;
1223
+ limit: number;
1224
+ page: number;
1225
+ user?: string | ObjectId | undefined;
1226
+ org?: string | ObjectId | undefined;
1227
+ type: string;
1228
+ status: string;
1229
+ }) => Promise<Record<string, any>>;
1230
+ getOrgsByUserId: ({ search, page, limit, sort, user, status, }?: {
1231
+ user: string | ObjectId;
1232
+ page: number;
1233
+ limit?: number | undefined;
1234
+ search?: string | undefined;
1235
+ sort?: Record<string, number> | undefined;
1236
+ status?: string | undefined;
1237
+ }) => Promise<{
1238
+ items: any[];
1239
+ pages: number;
1240
+ pageRange: string;
1241
+ } | {
1242
+ _id: ObjectId;
1243
+ name: string;
1244
+ }[]>;
1245
+ updateStatusByUserId: (user: string | ObjectId, status: string) => Promise<string>;
1246
+ updateName: (value: Pick<TMember, "name" | "user">, session?: ClientSession) => Promise<string>;
1247
+ getByUserId: (user: string | ObjectId) => Promise<TMember | null>;
1248
+ getOrgsByMembership: ({ search, limit, page, user }?: {
1249
+ search: string;
1250
+ limit: number;
1251
+ page: number;
1252
+ user?: string | ObjectId | undefined;
1253
+ }) => Promise<{
1254
+ items: any[];
1255
+ pages: number;
1256
+ pageRange: string;
1257
+ } | {
1258
+ text: string;
1259
+ value: ObjectId;
1260
+ }[]>;
1261
+ countByOrg: (org: string | ObjectId) => Promise<number>;
1262
+ countByUser: (user: string | ObjectId) => Promise<number>;
1263
+ getByUserType: (user: string | ObjectId, type: string, org?: string | ObjectId) => Promise<TMember | null>;
1264
+ };
1265
+
1266
+ declare function useMemberController(): {
1267
+ getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1268
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1269
+ getOrgsByMembership: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1270
+ updateStatusByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1271
+ getByUserType: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1272
+ };
1273
+
1274
+ declare const schema: Joi.ObjectSchema<any>;
1275
+
1276
+ type TPromoType = "tiered" | "fixed";
1277
+ type TPromoTier = {
1278
+ min: number;
1279
+ max: number;
1280
+ price: number;
1281
+ };
1282
+ type TPromoCode = {
1283
+ _id?: ObjectId;
1284
+ code: string;
1285
+ description?: string;
1286
+ type: TPromoType;
1287
+ tiers?: TPromoTier[];
1288
+ fixed_rate?: number;
1289
+ appliesTo?: string;
1290
+ createdAt?: string;
1291
+ expiresAt?: string;
1292
+ assignedTo?: string | ObjectId;
1293
+ status?: "active" | "expired" | "disabled";
1294
+ };
1295
+ declare function MPromoCode(data: TPromoCode): TPromoCode;
1296
+
1297
+ declare function usePromoCodeRepo(): {
1298
+ createIndex: () => Promise<void>;
1299
+ createUniqueIndex: () => Promise<void>;
1300
+ add: (value: TPromoCode) => Promise<void>;
1301
+ getByCode: (code: string, type?: string, assigned?: boolean | null) => Promise<TPromoCode | null>;
1302
+ getPromoCodes: ({ search, page, limit, sort, status, type, }?: {
1303
+ search?: string | undefined;
1304
+ page?: number | undefined;
1305
+ limit?: number | undefined;
1306
+ sort?: {} | undefined;
1307
+ status?: string | undefined;
1308
+ type?: string | undefined;
1309
+ }) => Promise<Record<string, any>>;
1310
+ assignByUserId: ({ user, code }?: {
1311
+ user: string | ObjectId;
1312
+ code: string;
1313
+ }, session?: ClientSession) => Promise<void>;
1314
+ getById: (_id: string | ObjectId) => Promise<TPromoCode | null>;
1315
+ };
1316
+
1317
+ declare function usePromoCodeController(): {
1318
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1319
+ getByCode: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1320
+ getPromoCodes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1321
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1322
+ };
1323
+
1324
+ type TOrderMetadata = {
1325
+ subscriptionId?: ObjectId | string;
1326
+ cycle?: number;
1327
+ seats?: number;
1328
+ promoCode?: string;
1329
+ };
1330
+ type TOrder = {
1331
+ _id?: ObjectId;
1332
+ payment?: string;
1333
+ user?: ObjectId | string;
1334
+ org?: ObjectId | string;
1335
+ type: string;
1336
+ amount: number;
1337
+ currency: string;
1338
+ description?: string;
1339
+ metadata?: TOrderMetadata;
1340
+ status?: string;
1341
+ createdAt?: string;
1342
+ updatedAt?: string;
1343
+ deletedAt?: string;
1344
+ };
1345
+ declare function MOrder(value: TOrder): TOrder;
1346
+
1347
+ declare function useOrderRepo(): {
1348
+ createIndex: () => void;
1349
+ add: (value: TOrder, session?: ClientSession) => void;
1350
+ getOrders: ({ search, page, limit, sort, status, type, id, }?: {
1351
+ search?: string | undefined;
1352
+ page?: number | undefined;
1353
+ limit?: number | undefined;
1354
+ sort?: {} | undefined;
1355
+ status?: string | undefined;
1356
+ type?: string | undefined;
1357
+ id?: string | undefined;
1358
+ }) => Promise<Record<string, any>>;
1359
+ };
1360
+
1361
+ declare function useOrderController(): {
1362
+ getOrders: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1363
+ };
1364
+
1365
+ declare const TInvoice: z.ZodObject<{
1366
+ _id: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>, ObjectId | undefined, string | ObjectId | undefined>;
1367
+ invoiceNumber: z.ZodString;
1368
+ type: z.ZodDefault<z.ZodEnum<["organization-subscription", "affiliate-subscription", "one-time-payment", "other"]>>;
1369
+ amount: z.ZodNumber;
1370
+ dueDate: z.ZodDate;
1371
+ status: z.ZodDefault<z.ZodEnum<["pending", "paid", "overdue", "cancelled"]>>;
1372
+ items: z.ZodArray<z.ZodObject<{
1373
+ description: z.ZodString;
1374
+ unitPrice: z.ZodNumber;
1375
+ quantity: z.ZodNumber;
1376
+ seats: z.ZodOptional<z.ZodNumber>;
1377
+ total: z.ZodNumber;
1378
+ }, "strip", z.ZodTypeAny, {
1379
+ description: string;
1380
+ unitPrice: number;
1381
+ quantity: number;
1382
+ total: number;
1383
+ seats?: number | undefined;
1384
+ }, {
1385
+ description: string;
1386
+ unitPrice: number;
1387
+ quantity: number;
1388
+ total: number;
1389
+ seats?: number | undefined;
1390
+ }>, "many">;
1391
+ metadata: z.ZodEffects<z.ZodOptional<z.ZodDefault<z.ZodObject<{
1392
+ transactionId: z.ZodOptional<z.ZodString>;
1393
+ userId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1394
+ orgId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1395
+ billingCycle: z.ZodOptional<z.ZodEnum<["monthly", "yearly", "quarterly"]>>;
1396
+ subscriptionId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1397
+ currency: z.ZodOptional<z.ZodDefault<z.ZodString>>;
1398
+ description: z.ZodOptional<z.ZodString>;
1399
+ }, "strip", z.ZodTypeAny, {
1400
+ description?: string | undefined;
1401
+ userId?: string | ObjectId | undefined;
1402
+ orgId?: string | ObjectId | undefined;
1403
+ transactionId?: string | undefined;
1404
+ currency?: string | undefined;
1405
+ subscriptionId?: string | ObjectId | undefined;
1406
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1407
+ }, {
1408
+ description?: string | undefined;
1409
+ userId?: string | ObjectId | undefined;
1410
+ orgId?: string | ObjectId | undefined;
1411
+ transactionId?: string | undefined;
1412
+ currency?: string | undefined;
1413
+ subscriptionId?: string | ObjectId | undefined;
1414
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1415
+ }>>>, {
1416
+ description?: string | undefined;
1417
+ userId?: string | ObjectId | undefined;
1418
+ orgId?: string | ObjectId | undefined;
1419
+ transactionId?: string | undefined;
1420
+ currency?: string | undefined;
1421
+ subscriptionId?: string | ObjectId | undefined;
1422
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1423
+ } | undefined, {
1424
+ description?: string | undefined;
1425
+ userId?: string | ObjectId | undefined;
1426
+ orgId?: string | ObjectId | undefined;
1427
+ transactionId?: string | undefined;
1428
+ currency?: string | undefined;
1429
+ subscriptionId?: string | ObjectId | undefined;
1430
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1431
+ } | undefined>;
1432
+ createdAt: z.ZodOptional<z.ZodDefault<z.ZodDate>>;
1433
+ updatedAt: z.ZodOptional<z.ZodDate>;
1434
+ }, "strip", z.ZodTypeAny, {
1435
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1436
+ status: "pending" | "cancelled" | "paid" | "overdue";
1437
+ items: {
1438
+ description: string;
1439
+ unitPrice: number;
1440
+ quantity: number;
1441
+ total: number;
1442
+ seats?: number | undefined;
1443
+ }[];
1444
+ amount: number;
1445
+ invoiceNumber: string;
1446
+ dueDate: Date;
1447
+ _id?: ObjectId | undefined;
1448
+ updatedAt?: Date | undefined;
1449
+ createdAt?: Date | undefined;
1450
+ metadata?: {
1451
+ description?: string | undefined;
1452
+ userId?: string | ObjectId | undefined;
1453
+ orgId?: string | ObjectId | undefined;
1454
+ transactionId?: string | undefined;
1455
+ currency?: string | undefined;
1456
+ subscriptionId?: string | ObjectId | undefined;
1457
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1458
+ } | undefined;
1459
+ }, {
1460
+ items: {
1461
+ description: string;
1462
+ unitPrice: number;
1463
+ quantity: number;
1464
+ total: number;
1465
+ seats?: number | undefined;
1466
+ }[];
1467
+ amount: number;
1468
+ invoiceNumber: string;
1469
+ dueDate: Date;
1470
+ type?: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other" | undefined;
1471
+ status?: "pending" | "cancelled" | "paid" | "overdue" | undefined;
1472
+ _id?: string | ObjectId | undefined;
1473
+ updatedAt?: Date | undefined;
1474
+ createdAt?: Date | undefined;
1475
+ metadata?: {
1476
+ description?: string | undefined;
1477
+ userId?: string | ObjectId | undefined;
1478
+ orgId?: string | ObjectId | undefined;
1479
+ transactionId?: string | undefined;
1480
+ currency?: string | undefined;
1481
+ subscriptionId?: string | ObjectId | undefined;
1482
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1483
+ } | undefined;
1484
+ }>;
1485
+ type TInvoice = z.infer<typeof TInvoice>;
1486
+ declare function useInvoiceModel(db: Db): {
1487
+ createInvoice: (data: TInvoice) => TInvoice;
1488
+ collection: Collection<{
1489
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1490
+ status: "pending" | "cancelled" | "paid" | "overdue";
1491
+ items: {
1492
+ description: string;
1493
+ unitPrice: number;
1494
+ quantity: number;
1495
+ total: number;
1496
+ seats?: number | undefined;
1497
+ }[];
1498
+ amount: number;
1499
+ invoiceNumber: string;
1500
+ dueDate: Date;
1501
+ _id?: ObjectId | undefined;
1502
+ updatedAt?: Date | undefined;
1503
+ createdAt?: Date | undefined;
1504
+ metadata?: {
1505
+ description?: string | undefined;
1506
+ userId?: string | ObjectId | undefined;
1507
+ orgId?: string | ObjectId | undefined;
1508
+ transactionId?: string | undefined;
1509
+ currency?: string | undefined;
1510
+ subscriptionId?: string | ObjectId | undefined;
1511
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1512
+ } | undefined;
1513
+ }>;
1514
+ };
1515
+
1516
+ declare function useInvoiceRepo(): {
1517
+ createIndex: () => Promise<void>;
1518
+ createUniqueIndex: () => Promise<void>;
1519
+ add: (value: TInvoice, session?: ClientSession) => Promise<void>;
1520
+ getByDueDate: (id: string | ObjectId, dueDate: Date, status?: TInvoice["status"]) => Promise<{
1521
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1522
+ status: "pending" | "cancelled" | "paid" | "overdue";
1523
+ items: {
1524
+ description: string;
1525
+ unitPrice: number;
1526
+ quantity: number;
1527
+ total: number;
1528
+ seats?: number | undefined;
1529
+ }[];
1530
+ amount: number;
1531
+ invoiceNumber: string;
1532
+ dueDate: Date;
1533
+ _id?: ObjectId | undefined;
1534
+ updatedAt?: Date | undefined;
1535
+ createdAt?: Date | undefined;
1536
+ metadata?: {
1537
+ description?: string | undefined;
1538
+ userId?: string | ObjectId | undefined;
1539
+ orgId?: string | ObjectId | undefined;
1540
+ transactionId?: string | undefined;
1541
+ currency?: string | undefined;
1542
+ subscriptionId?: string | ObjectId | undefined;
1543
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1544
+ } | undefined;
1545
+ } | null>;
1546
+ updateStatusByInvoiceNumber: (invoiceNumber: string, status: TInvoice["status"], session?: ClientSession) => Promise<void>;
1547
+ getOverdueInvoices: (BATCH_SIZE?: number) => Promise<{
1548
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1549
+ status: "pending" | "cancelled" | "paid" | "overdue";
1550
+ items: {
1551
+ description: string;
1552
+ unitPrice: number;
1553
+ quantity: number;
1554
+ total: number;
1555
+ seats?: number | undefined;
1556
+ }[];
1557
+ amount: number;
1558
+ invoiceNumber: string;
1559
+ dueDate: Date;
1560
+ _id?: ObjectId | undefined;
1561
+ updatedAt?: Date | undefined;
1562
+ createdAt?: Date | undefined;
1563
+ metadata?: {
1564
+ description?: string | undefined;
1565
+ userId?: string | ObjectId | undefined;
1566
+ orgId?: string | ObjectId | undefined;
1567
+ transactionId?: string | undefined;
1568
+ currency?: string | undefined;
1569
+ subscriptionId?: string | ObjectId | undefined;
1570
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1571
+ } | undefined;
1572
+ }[]>;
1573
+ getBySubscriptionId: ({ page, search, limit, sort, id }?: {
1574
+ page?: number | undefined;
1575
+ search?: string | undefined;
1576
+ limit?: number | undefined;
1577
+ sort?: Record<string, any> | undefined;
1578
+ id?: string | ObjectId | undefined;
1579
+ }) => Promise<{
1580
+ items: any[];
1581
+ pages: number;
1582
+ pageRange: string;
1583
+ }>;
1584
+ getByNumber: (number: string) => Promise<{
1585
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1586
+ status: "pending" | "cancelled" | "paid" | "overdue";
1587
+ items: {
1588
+ description: string;
1589
+ unitPrice: number;
1590
+ quantity: number;
1591
+ total: number;
1592
+ seats?: number | undefined;
1593
+ }[];
1594
+ amount: number;
1595
+ invoiceNumber: string;
1596
+ dueDate: Date;
1597
+ _id?: ObjectId | undefined;
1598
+ updatedAt?: Date | undefined;
1599
+ createdAt?: Date | undefined;
1600
+ metadata?: {
1601
+ description?: string | undefined;
1602
+ userId?: string | ObjectId | undefined;
1603
+ orgId?: string | ObjectId | undefined;
1604
+ transactionId?: string | undefined;
1605
+ currency?: string | undefined;
1606
+ subscriptionId?: string | ObjectId | undefined;
1607
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1608
+ } | undefined;
1609
+ } | null>;
1610
+ getByTransactionId: (id: string) => Promise<{
1611
+ type: "organization-subscription" | "affiliate-subscription" | "one-time-payment" | "other";
1612
+ status: "pending" | "cancelled" | "paid" | "overdue";
1613
+ items: {
1614
+ description: string;
1615
+ unitPrice: number;
1616
+ quantity: number;
1617
+ total: number;
1618
+ seats?: number | undefined;
1619
+ }[];
1620
+ amount: number;
1621
+ invoiceNumber: string;
1622
+ dueDate: Date;
1623
+ _id?: ObjectId | undefined;
1624
+ updatedAt?: Date | undefined;
1625
+ createdAt?: Date | undefined;
1626
+ metadata?: {
1627
+ description?: string | undefined;
1628
+ userId?: string | ObjectId | undefined;
1629
+ orgId?: string | ObjectId | undefined;
1630
+ transactionId?: string | undefined;
1631
+ currency?: string | undefined;
1632
+ subscriptionId?: string | ObjectId | undefined;
1633
+ billingCycle?: "monthly" | "yearly" | "quarterly" | undefined;
1634
+ } | undefined;
1635
+ } | null>;
1636
+ };
1637
+
1638
+ declare function useInvoiceService(): {
1639
+ processOverDueInvoices: (BATCH_SIZE?: number, MAX_RETRIES?: number) => Promise<void>;
1640
+ paypalPaidInvoiceWebhookHandler: (invoiceId: string) => Promise<"Payment processed successfully." | undefined>;
1641
+ };
1642
+
1643
+ declare function useInvoiceController(): {
1644
+ getBySubscriptionId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1645
+ getByNumber: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1646
+ getByDueDateStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1647
+ paidInvoiceWebhookHandler: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1648
+ };
1649
+
1650
+ declare const TPaymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE", "PAYPAL"]>;
1651
+ type TPaymentMethodType = z.infer<typeof TPaymentMethod>;
1652
+ declare const TPayment: z.ZodObject<{
1653
+ _id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1654
+ invoiceId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1655
+ amount: z.ZodNumber;
1656
+ paymentMethod: z.ZodEnum<["CARD", "DIRECT_DEBIT", "VIRTUAL_ACCOUNT", "EWALLET", "OVER_THE_COUNTER", "QR_CODE", "PAYPAL"]>;
1657
+ status: z.ZodEnum<["pending", "completed", "failed", "refunded"]>;
1658
+ metadata: z.ZodEffects<z.ZodObject<{
1659
+ userId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1660
+ orgId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1661
+ transactionId: z.ZodOptional<z.ZodString>;
1662
+ currency: z.ZodDefault<z.ZodString>;
1663
+ paymentMethod: z.ZodOptional<z.ZodString>;
1664
+ paymentMethodType: z.ZodOptional<z.ZodString>;
1665
+ paymentMethodId: z.ZodOptional<z.ZodString>;
1666
+ payment: z.ZodOptional<z.ZodString>;
1667
+ subscriptionId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>;
1668
+ }, "strip", z.ZodTypeAny, {
1669
+ currency: string;
1670
+ userId?: string | ObjectId | undefined;
1671
+ orgId?: string | ObjectId | undefined;
1672
+ transactionId?: string | undefined;
1673
+ paymentMethod?: string | undefined;
1674
+ paymentMethodType?: string | undefined;
1675
+ paymentMethodId?: string | undefined;
1676
+ payment?: string | undefined;
1677
+ subscriptionId?: string | ObjectId | undefined;
1678
+ }, {
1679
+ userId?: string | ObjectId | undefined;
1680
+ orgId?: string | ObjectId | undefined;
1681
+ transactionId?: string | undefined;
1682
+ currency?: string | undefined;
1683
+ paymentMethod?: string | undefined;
1684
+ paymentMethodType?: string | undefined;
1685
+ paymentMethodId?: string | undefined;
1686
+ payment?: string | undefined;
1687
+ subscriptionId?: string | ObjectId | undefined;
1688
+ }>, {
1689
+ currency: string;
1690
+ userId?: string | ObjectId | undefined;
1691
+ orgId?: string | ObjectId | undefined;
1692
+ transactionId?: string | undefined;
1693
+ paymentMethod?: string | undefined;
1694
+ paymentMethodType?: string | undefined;
1695
+ paymentMethodId?: string | undefined;
1696
+ payment?: string | undefined;
1697
+ subscriptionId?: string | ObjectId | undefined;
1698
+ }, {
1699
+ userId?: string | ObjectId | undefined;
1700
+ orgId?: string | ObjectId | undefined;
1701
+ transactionId?: string | undefined;
1702
+ currency?: string | undefined;
1703
+ paymentMethod?: string | undefined;
1704
+ paymentMethodType?: string | undefined;
1705
+ paymentMethodId?: string | undefined;
1706
+ payment?: string | undefined;
1707
+ subscriptionId?: string | ObjectId | undefined;
1708
+ }>;
1709
+ createdAt: z.ZodOptional<z.ZodDefault<z.ZodDate>>;
1710
+ updatedAt: z.ZodOptional<z.ZodDate>;
1711
+ }, "strip", z.ZodTypeAny, {
1712
+ status: "pending" | "completed" | "failed" | "refunded";
1713
+ metadata: {
1714
+ currency: string;
1715
+ userId?: string | ObjectId | undefined;
1716
+ orgId?: string | ObjectId | undefined;
1717
+ transactionId?: string | undefined;
1718
+ paymentMethod?: string | undefined;
1719
+ paymentMethodType?: string | undefined;
1720
+ paymentMethodId?: string | undefined;
1721
+ payment?: string | undefined;
1722
+ subscriptionId?: string | ObjectId | undefined;
1723
+ };
1724
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
1725
+ invoiceId: string;
1726
+ amount: number;
1727
+ _id?: string | ObjectId | undefined;
1728
+ updatedAt?: Date | undefined;
1729
+ createdAt?: Date | undefined;
1730
+ }, {
1731
+ status: "pending" | "completed" | "failed" | "refunded";
1732
+ metadata: {
1733
+ userId?: string | ObjectId | undefined;
1734
+ orgId?: string | ObjectId | undefined;
1735
+ transactionId?: string | undefined;
1736
+ currency?: string | undefined;
1737
+ paymentMethod?: string | undefined;
1738
+ paymentMethodType?: string | undefined;
1739
+ paymentMethodId?: string | undefined;
1740
+ payment?: string | undefined;
1741
+ subscriptionId?: string | ObjectId | undefined;
1742
+ };
1743
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
1744
+ amount: number;
1745
+ _id?: string | ObjectId | undefined;
1746
+ updatedAt?: Date | undefined;
1747
+ createdAt?: Date | undefined;
1748
+ invoiceId?: string | undefined;
1749
+ }>;
1750
+ type TPayment = z.infer<typeof TPayment>;
1751
+ declare const DirectDebitSchema: z.ZodObject<{
1752
+ type: z.ZodLiteral<"DIRECT_DEBIT">;
1753
+ direct_debit: z.ZodObject<{
1754
+ channel_code: z.ZodString;
1755
+ channel_properties: z.ZodObject<{
1756
+ success_return_url: z.ZodString;
1757
+ failure_return_url: z.ZodString;
1758
+ }, "strip", z.ZodTypeAny, {
1759
+ success_return_url: string;
1760
+ failure_return_url: string;
1761
+ }, {
1762
+ success_return_url: string;
1763
+ failure_return_url: string;
1764
+ }>;
1765
+ }, "strip", z.ZodTypeAny, {
1766
+ channel_code: string;
1767
+ channel_properties: {
1768
+ success_return_url: string;
1769
+ failure_return_url: string;
1770
+ };
1771
+ }, {
1772
+ channel_code: string;
1773
+ channel_properties: {
1774
+ success_return_url: string;
1775
+ failure_return_url: string;
1776
+ };
1777
+ }>;
1778
+ reusability: z.ZodEnum<["MULTIPLE_USE", "SINGLE_USE"]>;
1779
+ description: z.ZodOptional<z.ZodString>;
1780
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1781
+ customer_id: z.ZodString;
1782
+ }, "strip", z.ZodTypeAny, {
1783
+ type: "DIRECT_DEBIT";
1784
+ metadata: Record<string, string>;
1785
+ direct_debit: {
1786
+ channel_code: string;
1787
+ channel_properties: {
1788
+ success_return_url: string;
1789
+ failure_return_url: string;
1790
+ };
1791
+ };
1792
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1793
+ customer_id: string;
1794
+ description?: string | undefined;
1795
+ }, {
1796
+ type: "DIRECT_DEBIT";
1797
+ direct_debit: {
1798
+ channel_code: string;
1799
+ channel_properties: {
1800
+ success_return_url: string;
1801
+ failure_return_url: string;
1802
+ };
1803
+ };
1804
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1805
+ customer_id: string;
1806
+ metadata?: Record<string, string> | undefined;
1807
+ description?: string | undefined;
1808
+ }>;
1809
+ type DirectDebit = z.infer<typeof DirectDebitSchema>;
1810
+ declare function validateDirectDebit(data: Record<string, any>): DirectDebit;
1811
+ declare const CardPaymentSchema: z.ZodObject<{
1812
+ type: z.ZodLiteral<"CARD">;
1813
+ card: z.ZodObject<{
1814
+ currency: z.ZodLiteral<"PHP">;
1815
+ channel_properties: z.ZodObject<{
1816
+ skip_three_d_secure: z.ZodBoolean;
1817
+ success_return_url: z.ZodString;
1818
+ failure_return_url: z.ZodString;
1819
+ }, "strip", z.ZodTypeAny, {
1820
+ success_return_url: string;
1821
+ failure_return_url: string;
1822
+ skip_three_d_secure: boolean;
1823
+ }, {
1824
+ success_return_url: string;
1825
+ failure_return_url: string;
1826
+ skip_three_d_secure: boolean;
1827
+ }>;
1828
+ card_information: z.ZodObject<{
1829
+ card_number: z.ZodString;
1830
+ expiry_month: z.ZodString;
1831
+ expiry_year: z.ZodString;
1832
+ cvv: z.ZodString;
1833
+ cardholder_name: z.ZodString;
1834
+ }, "strip", z.ZodTypeAny, {
1835
+ card_number: string;
1836
+ expiry_month: string;
1837
+ expiry_year: string;
1838
+ cvv: string;
1839
+ cardholder_name: string;
1840
+ }, {
1841
+ card_number: string;
1842
+ expiry_month: string;
1843
+ expiry_year: string;
1844
+ cvv: string;
1845
+ cardholder_name: string;
1846
+ }>;
1847
+ }, "strip", z.ZodTypeAny, {
1848
+ currency: "PHP";
1849
+ channel_properties: {
1850
+ success_return_url: string;
1851
+ failure_return_url: string;
1852
+ skip_three_d_secure: boolean;
1853
+ };
1854
+ card_information: {
1855
+ card_number: string;
1856
+ expiry_month: string;
1857
+ expiry_year: string;
1858
+ cvv: string;
1859
+ cardholder_name: string;
1860
+ };
1861
+ }, {
1862
+ currency: "PHP";
1863
+ channel_properties: {
1864
+ success_return_url: string;
1865
+ failure_return_url: string;
1866
+ skip_three_d_secure: boolean;
1867
+ };
1868
+ card_information: {
1869
+ card_number: string;
1870
+ expiry_month: string;
1871
+ expiry_year: string;
1872
+ cvv: string;
1873
+ cardholder_name: string;
1874
+ };
1875
+ }>;
1876
+ reusability: z.ZodEnum<["MULTIPLE_USE", "SINGLE_USE"]>;
1877
+ description: z.ZodOptional<z.ZodString>;
1878
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1879
+ }, "strip", z.ZodTypeAny, {
1880
+ type: "CARD";
1881
+ metadata: Record<string, string>;
1882
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1883
+ card: {
1884
+ currency: "PHP";
1885
+ channel_properties: {
1886
+ success_return_url: string;
1887
+ failure_return_url: string;
1888
+ skip_three_d_secure: boolean;
1889
+ };
1890
+ card_information: {
1891
+ card_number: string;
1892
+ expiry_month: string;
1893
+ expiry_year: string;
1894
+ cvv: string;
1895
+ cardholder_name: string;
1896
+ };
1897
+ };
1898
+ description?: string | undefined;
1899
+ }, {
1900
+ type: "CARD";
1901
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1902
+ card: {
1903
+ currency: "PHP";
1904
+ channel_properties: {
1905
+ success_return_url: string;
1906
+ failure_return_url: string;
1907
+ skip_three_d_secure: boolean;
1908
+ };
1909
+ card_information: {
1910
+ card_number: string;
1911
+ expiry_month: string;
1912
+ expiry_year: string;
1913
+ cvv: string;
1914
+ cardholder_name: string;
1915
+ };
1916
+ };
1917
+ metadata?: Record<string, string> | undefined;
1918
+ description?: string | undefined;
1919
+ }>;
1920
+ type CardPayment = z.infer<typeof CardPaymentSchema>;
1921
+ declare function validateCardPayment(data: Record<string, any>): CardPayment;
1922
+ declare const EWalletPaymentSchema: z.ZodObject<{
1923
+ type: z.ZodLiteral<"EWALLET">;
1924
+ reusability: z.ZodEnum<["MULTIPLE_USE", "SINGLE_USE"]>;
1925
+ customer_id: z.ZodString;
1926
+ country: z.ZodString;
1927
+ ewallet: z.ZodObject<{
1928
+ channel_code: z.ZodString;
1929
+ channel_properties: z.ZodObject<{
1930
+ success_return_url: z.ZodString;
1931
+ failure_return_url: z.ZodString;
1932
+ cancel_return_url: z.ZodString;
1933
+ }, "strip", z.ZodTypeAny, {
1934
+ success_return_url: string;
1935
+ failure_return_url: string;
1936
+ cancel_return_url: string;
1937
+ }, {
1938
+ success_return_url: string;
1939
+ failure_return_url: string;
1940
+ cancel_return_url: string;
1941
+ }>;
1942
+ }, "strip", z.ZodTypeAny, {
1943
+ channel_code: string;
1944
+ channel_properties: {
1945
+ success_return_url: string;
1946
+ failure_return_url: string;
1947
+ cancel_return_url: string;
1948
+ };
1949
+ }, {
1950
+ channel_code: string;
1951
+ channel_properties: {
1952
+ success_return_url: string;
1953
+ failure_return_url: string;
1954
+ cancel_return_url: string;
1955
+ };
1956
+ }>;
1957
+ description: z.ZodOptional<z.ZodString>;
1958
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1959
+ }, "strip", z.ZodTypeAny, {
1960
+ type: "EWALLET";
1961
+ metadata: Record<string, string>;
1962
+ country: string;
1963
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1964
+ customer_id: string;
1965
+ ewallet: {
1966
+ channel_code: string;
1967
+ channel_properties: {
1968
+ success_return_url: string;
1969
+ failure_return_url: string;
1970
+ cancel_return_url: string;
1971
+ };
1972
+ };
1973
+ description?: string | undefined;
1974
+ }, {
1975
+ type: "EWALLET";
1976
+ country: string;
1977
+ reusability: "MULTIPLE_USE" | "SINGLE_USE";
1978
+ customer_id: string;
1979
+ ewallet: {
1980
+ channel_code: string;
1981
+ channel_properties: {
1982
+ success_return_url: string;
1983
+ failure_return_url: string;
1984
+ cancel_return_url: string;
1985
+ };
1986
+ };
1987
+ metadata?: Record<string, string> | undefined;
1988
+ description?: string | undefined;
1989
+ }>;
1990
+ type EWalletPayment = z.infer<typeof EWalletPaymentSchema>;
1991
+ declare function validateEWalletPayment(data: Record<string, any>): EWalletPayment;
1992
+ declare function usePaymentModel(db: Db): {
1993
+ collection: Collection<{
1994
+ status: "pending" | "completed" | "failed" | "refunded";
1995
+ metadata: {
1996
+ currency: string;
1997
+ userId?: string | ObjectId | undefined;
1998
+ orgId?: string | ObjectId | undefined;
1999
+ transactionId?: string | undefined;
2000
+ paymentMethod?: string | undefined;
2001
+ paymentMethodType?: string | undefined;
2002
+ paymentMethodId?: string | undefined;
2003
+ payment?: string | undefined;
2004
+ subscriptionId?: string | ObjectId | undefined;
2005
+ };
2006
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2007
+ invoiceId: string;
2008
+ amount: number;
2009
+ _id?: string | ObjectId | undefined;
2010
+ updatedAt?: Date | undefined;
2011
+ createdAt?: Date | undefined;
2012
+ }>;
2013
+ createPayment: (data: Partial<TPayment>) => {
2014
+ status: "pending" | "completed" | "failed" | "refunded";
2015
+ metadata: {
2016
+ currency: string;
2017
+ userId?: string | ObjectId | undefined;
2018
+ orgId?: string | ObjectId | undefined;
2019
+ transactionId?: string | undefined;
2020
+ paymentMethod?: string | undefined;
2021
+ paymentMethodType?: string | undefined;
2022
+ paymentMethodId?: string | undefined;
2023
+ payment?: string | undefined;
2024
+ subscriptionId?: string | ObjectId | undefined;
2025
+ };
2026
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2027
+ invoiceId: string;
2028
+ amount: number;
2029
+ _id?: string | ObjectId | undefined;
2030
+ updatedAt?: Date | undefined;
2031
+ createdAt?: Date | undefined;
2032
+ };
2033
+ validatePayment: (data: unknown) => {
2034
+ status: "pending" | "completed" | "failed" | "refunded";
2035
+ metadata: {
2036
+ currency: string;
2037
+ userId?: string | ObjectId | undefined;
2038
+ orgId?: string | ObjectId | undefined;
2039
+ transactionId?: string | undefined;
2040
+ paymentMethod?: string | undefined;
2041
+ paymentMethodType?: string | undefined;
2042
+ paymentMethodId?: string | undefined;
2043
+ payment?: string | undefined;
2044
+ subscriptionId?: string | ObjectId | undefined;
2045
+ };
2046
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2047
+ invoiceId: string;
2048
+ amount: number;
2049
+ _id?: string | ObjectId | undefined;
2050
+ updatedAt?: Date | undefined;
2051
+ createdAt?: Date | undefined;
2052
+ };
2053
+ };
2054
+
2055
+ declare function usePaymentRepo(): {
2056
+ createIndex: () => Promise<void>;
2057
+ createUniqueIndex: () => Promise<void>;
2058
+ add: (value: TPayment, session?: ClientSession) => Promise<void>;
2059
+ getPayments: ({ search, page, limit, sort, status, type, id, }?: {
2060
+ search?: string | undefined;
2061
+ page?: number | undefined;
2062
+ limit?: number | undefined;
2063
+ sort?: {} | undefined;
2064
+ status?: string | undefined;
2065
+ type?: string | undefined;
2066
+ id?: string | undefined;
2067
+ }) => Promise<{
2068
+ items: any[];
2069
+ pages: number;
2070
+ pageRange: string;
2071
+ }>;
2072
+ getByInvoiceId: (invoiceId: string) => Promise<mongodb.WithId<{
2073
+ status: "pending" | "completed" | "failed" | "refunded";
2074
+ metadata: {
2075
+ currency: string;
2076
+ userId?: string | ObjectId | undefined;
2077
+ orgId?: string | ObjectId | undefined;
2078
+ transactionId?: string | undefined;
2079
+ paymentMethod?: string | undefined;
2080
+ paymentMethodType?: string | undefined;
2081
+ paymentMethodId?: string | undefined;
2082
+ payment?: string | undefined;
2083
+ subscriptionId?: string | ObjectId | undefined;
2084
+ };
2085
+ paymentMethod: "EWALLET" | "QR_CODE" | "CARD" | "DIRECT_DEBIT" | "VIRTUAL_ACCOUNT" | "OVER_THE_COUNTER" | "PAYPAL";
2086
+ invoiceId: string;
2087
+ amount: number;
2088
+ _id?: string | ObjectId | undefined;
2089
+ updatedAt?: Date | undefined;
2090
+ createdAt?: Date | undefined;
2091
+ }> | null>;
2092
+ };
2093
+
2094
+ declare function usePaymentController(): {
2095
+ getPayments: (req: Request, res: Response, next: NextFunction) => Promise<void>;
2096
+ };
2097
+
2098
+ declare const TCounter: z.ZodObject<{
2099
+ _id: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>, ObjectId, string | ObjectId>>;
2100
+ count: z.ZodDefault<z.ZodNumber>;
2101
+ type: z.ZodString;
2102
+ createdAt: z.ZodDefault<z.ZodOptional<z.ZodDate>>;
2103
+ updatedAt: z.ZodOptional<z.ZodDate>;
2104
+ deletedAt: z.ZodOptional<z.ZodDate>;
2105
+ }, "strip", z.ZodTypeAny, {
2106
+ type: string;
2107
+ createdAt: Date;
2108
+ count: number;
2109
+ _id?: ObjectId | undefined;
2110
+ updatedAt?: Date | undefined;
2111
+ deletedAt?: Date | undefined;
2112
+ }, {
2113
+ type: string;
2114
+ _id?: string | ObjectId | undefined;
2115
+ updatedAt?: Date | undefined;
2116
+ deletedAt?: Date | undefined;
2117
+ createdAt?: Date | undefined;
2118
+ count?: number | undefined;
2119
+ }>;
2120
+ type TCounter = z.infer<typeof TCounter>;
2121
+ declare function useCounterModel(db: Db): {
2122
+ createCounter: (value: Pick<TCounter, "type">) => {
2123
+ type: string;
2124
+ createdAt: Date;
2125
+ count: number;
2126
+ _id?: ObjectId | undefined;
2127
+ updatedAt?: Date | undefined;
2128
+ deletedAt?: Date | undefined;
2129
+ };
2130
+ validateCounter: (data: unknown) => z.SafeParseReturnType<{
2131
+ type: string;
2132
+ _id?: string | ObjectId | undefined;
2133
+ updatedAt?: Date | undefined;
2134
+ deletedAt?: Date | undefined;
2135
+ createdAt?: Date | undefined;
2136
+ count?: number | undefined;
2137
+ }, {
2138
+ type: string;
2139
+ createdAt: Date;
2140
+ count: number;
2141
+ _id?: ObjectId | undefined;
2142
+ updatedAt?: Date | undefined;
2143
+ deletedAt?: Date | undefined;
2144
+ }>;
2145
+ collection: Collection<{
2146
+ type: string;
2147
+ createdAt: Date;
2148
+ count: number;
2149
+ _id?: ObjectId | undefined;
2150
+ updatedAt?: Date | undefined;
2151
+ deletedAt?: Date | undefined;
2152
+ }>;
2153
+ };
2154
+
2155
+ declare function useCounterRepo(): {
2156
+ createIndex: () => Promise<void>;
2157
+ createUniqueIndex: () => Promise<void>;
2158
+ add: (type: string) => Promise<void>;
2159
+ getByType: (type: string) => Promise<any>;
2160
+ incrementByType: (type: string, session?: ClientSession) => Promise<void>;
2161
+ };
2162
+
2163
+ declare const TPriceType: z.ZodEnum<["monthly-subscription", "yearly-subscription", "one-time-payment", "other"]>;
2164
+ type TPriceType = z.infer<typeof TPriceType>;
2165
+ declare const TPrice: z.ZodObject<{
2166
+ _id: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>]>>, ObjectId | undefined, string | ObjectId | undefined>;
2167
+ value: z.ZodDefault<z.ZodNumber>;
2168
+ saleValue: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
2169
+ saleExpiry: z.ZodOptional<z.ZodDate>;
2170
+ name: z.ZodString;
2171
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["monthly-subscription", "yearly-subscription", "one-time-payment", "other"]>>>;
2172
+ createdAt: z.ZodOptional<z.ZodDefault<z.ZodDate>>;
2173
+ updatedAt: z.ZodOptional<z.ZodDate>;
2174
+ deletedAt: z.ZodOptional<z.ZodDate>;
2175
+ }, "strip", z.ZodTypeAny, {
2176
+ type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
2177
+ value: number;
2178
+ name: string;
2179
+ _id?: ObjectId | undefined;
2180
+ updatedAt?: Date | undefined;
2181
+ deletedAt?: Date | undefined;
2182
+ createdAt?: Date | undefined;
2183
+ saleValue?: number | undefined;
2184
+ saleExpiry?: Date | undefined;
2185
+ }, {
2186
+ name: string;
2187
+ type?: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription" | undefined;
2188
+ _id?: string | ObjectId | undefined;
2189
+ updatedAt?: Date | undefined;
2190
+ deletedAt?: Date | undefined;
2191
+ value?: number | undefined;
2192
+ createdAt?: Date | undefined;
2193
+ saleValue?: number | undefined;
2194
+ saleExpiry?: Date | undefined;
2195
+ }>;
2196
+ type TPrice = z.infer<typeof TPrice>;
2197
+ declare function usePriceModel(db: Db): {
2198
+ createPrice: (value: Pick<TPrice, "type" | "name" | "value">) => {
2199
+ type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
2200
+ value: number;
2201
+ name: string;
2202
+ _id?: ObjectId | undefined;
2203
+ updatedAt?: Date | undefined;
2204
+ deletedAt?: Date | undefined;
2205
+ createdAt?: Date | undefined;
2206
+ saleValue?: number | undefined;
2207
+ saleExpiry?: Date | undefined;
2208
+ };
2209
+ validatePrice: (data: unknown) => z.SafeParseReturnType<{
2210
+ name: string;
2211
+ type?: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription" | undefined;
2212
+ _id?: string | ObjectId | undefined;
2213
+ updatedAt?: Date | undefined;
2214
+ deletedAt?: Date | undefined;
2215
+ value?: number | undefined;
2216
+ createdAt?: Date | undefined;
2217
+ saleValue?: number | undefined;
2218
+ saleExpiry?: Date | undefined;
2219
+ }, {
2220
+ type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
2221
+ value: number;
2222
+ name: string;
2223
+ _id?: ObjectId | undefined;
2224
+ updatedAt?: Date | undefined;
2225
+ deletedAt?: Date | undefined;
2226
+ createdAt?: Date | undefined;
2227
+ saleValue?: number | undefined;
2228
+ saleExpiry?: Date | undefined;
2229
+ }>;
2230
+ collection: Collection<{
2231
+ type: "one-time-payment" | "other" | "monthly-subscription" | "yearly-subscription";
2232
+ value: number;
2233
+ name: string;
2234
+ _id?: ObjectId | undefined;
2235
+ updatedAt?: Date | undefined;
2236
+ deletedAt?: Date | undefined;
2237
+ createdAt?: Date | undefined;
2238
+ saleValue?: number | undefined;
2239
+ saleExpiry?: Date | undefined;
2240
+ }>;
2241
+ };
2242
+
2243
+ declare function usePriceRepo(): {
2244
+ createIndex: () => Promise<void>;
2245
+ createUniqueIndex: () => Promise<void>;
2246
+ add: (value: Pick<TPrice, "type" | "name" | "value">) => Promise<void>;
2247
+ getByNameType: (name: string, type: TPriceType) => Promise<any>;
2248
+ setSaleValueByType: (value: Pick<TPrice, "type" | "saleValue" | "saleExpiry">, session?: ClientSession) => Promise<void>;
2249
+ };
2250
+
2251
+ declare function usePriceController(): {
2252
+ getByNameType: (req: Request, res: Response, next: NextFunction) => Promise<void>;
2253
+ };
2254
+
2255
+ declare function usePaypalService(): {
2256
+ createInvoice: (data: {
2257
+ invoiceNumber?: string | undefined;
2258
+ invoiceDate?: string | undefined;
2259
+ invoiceDueDate?: string | undefined;
2260
+ customerEmail: string;
2261
+ customerName?: string | undefined;
2262
+ quantity: number;
2263
+ ratePerSeat: number;
2264
+ currency: string;
2265
+ items?: Record<string, any>[] | undefined;
2266
+ note?: string | undefined;
2267
+ }) => Promise<string>;
2268
+ getInvoiceById: (invoiceId: string) => Promise<any>;
2269
+ };
2270
+
2271
+ declare const MONGO_URI: string;
2272
+ declare const MONGO_DB: string;
2273
+ declare const PORT: number;
2274
+ declare const SECRET_KEY: string;
2275
+ declare const isDev: boolean;
2276
+ declare const MAILER_TRANSPORT_HOST: string;
2277
+ declare const MAILER_TRANSPORT_PORT: number;
2278
+ declare const MAILER_TRANSPORT_SECURE: boolean;
2279
+ declare const MAILER_EMAIL: string;
2280
+ declare const MAILER_PASSWORD: string;
2281
+ declare const ACCESS_TOKEN_SECRET: string;
2282
+ declare const REFRESH_TOKEN_SECRET: string;
2283
+ declare const ACCESS_TOKEN_EXPIRY: string;
2284
+ declare const REFRESH_TOKEN_EXPIRY: string;
2285
+ declare const APP_ACCOUNT: string;
2286
+ declare const APP_MAIN: string;
2287
+ declare const VERIFICATION_FORGET_PASSWORD_DURATION: string;
2288
+ declare const VERIFICATION_USER_INVITE_DURATION: string;
2289
+ declare const REDIS_HOST: string;
2290
+ declare const REDIS_PORT: number;
2291
+ declare const REDIS_PASSWORD: string;
2292
+ declare const DEFAULT_USER_EMAIL: string;
2293
+ declare const DEFAULT_USER_PASSWORD: string;
2294
+ declare const DEFAULT_USER_FIRST_NAME: string;
2295
+ declare const DEFAULT_USER_LAST_NAME: string;
2296
+ declare const SPACES_ACCESS_KEY: string;
2297
+ declare const SPACES_SECRET_KEY: string;
2298
+ declare const SPACES_ENDPOINT: string;
2299
+ declare const SPACES_REGION: string;
2300
+ declare const SPACES_BUCKET: string;
2301
+ declare const PAYPAL_CLIENT_ID: string;
2302
+ declare const PAYPAL_CLIENT_SECRET: string;
2303
+ declare const PAYPAL_API_URL: string;
2304
+ declare const XENDIT_SECRET_KEY: string;
2305
+ declare const XENDIT_BASE_URL: string;
2306
+
2307
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, CardPayment, CardPaymentSchema, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DirectDebit, DirectDebitSchema, EWalletPayment, EWalletPaymentSchema, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MEntity, MFile, MMember, MONGO_DB, MONGO_URI, MOrder, MOrg, MPaymentMethod, MPromoCode, MRole, MSubscription, MToken, MUser, MUserRole, MVerification, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TBillingRecipient, TCounter, TEntity, TFile, TInvoice, TMember, TMiniRole, TOrder, TOrderMetadata, TOrg, TPayment, TPaymentMethod$1 as TPaymentMethod, TPaymentMethodType, TPrice, TPriceType, TPromoCode, TPromoTier, TRole, TSubscription, TToken, TUser, TUserRole, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, schema, useAddressController, useAddressRepo, useAuthController, useAuthService, useCounterModel, useCounterRepo, useEntityController, useEntityRepo, useFileController, useFileRepo, useFileService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useInvoiceService, useMemberController, useMemberRepo, useOrderController, useOrderRepo, useOrgController, useOrgRepo, useOrgService, usePaymentController, usePaymentMethodController, usePaymentMethodRepo, usePaymentMethodService, usePaymentModel, usePaymentRepo, usePaypalService, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRoleController, useRoleRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useTokenRepo, useUserController, useUserRepo, useUserService, useVerificationController, useVerificationRepo, useVerificationService, useXenditService, validateCardPayment, validateDirectDebit, validateEWalletPayment };