@classytic/revenue 0.2.3 → 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.
Files changed (111) hide show
  1. package/README.md +498 -499
  2. package/dist/actions-CwG-b7fR.d.ts +519 -0
  3. package/dist/core/index.d.ts +884 -0
  4. package/dist/core/index.js +2941 -0
  5. package/dist/core/index.js.map +1 -0
  6. package/dist/enums/index.d.ts +130 -0
  7. package/dist/enums/index.js +167 -0
  8. package/dist/enums/index.js.map +1 -0
  9. package/dist/index-BnJWVXuw.d.ts +378 -0
  10. package/dist/index-ChVD3P9k.d.ts +504 -0
  11. package/dist/index.d.ts +42 -0
  12. package/dist/index.js +4353 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/providers/index.d.ts +132 -0
  15. package/dist/providers/index.js +122 -0
  16. package/dist/providers/index.js.map +1 -0
  17. package/dist/retry-80lBCmSe.d.ts +234 -0
  18. package/dist/schemas/index.d.ts +894 -0
  19. package/dist/schemas/index.js +524 -0
  20. package/dist/schemas/index.js.map +1 -0
  21. package/dist/schemas/validation.d.ts +309 -0
  22. package/dist/schemas/validation.js +249 -0
  23. package/dist/schemas/validation.js.map +1 -0
  24. package/dist/services/index.d.ts +3 -0
  25. package/dist/services/index.js +1632 -0
  26. package/dist/services/index.js.map +1 -0
  27. package/dist/split.enums-DHdM1YAV.d.ts +255 -0
  28. package/dist/split.schema-BPdFZMbU.d.ts +958 -0
  29. package/dist/utils/index.d.ts +24 -0
  30. package/dist/utils/index.js +1067 -0
  31. package/dist/utils/index.js.map +1 -0
  32. package/package.json +48 -32
  33. package/core/builder.js +0 -219
  34. package/core/container.js +0 -119
  35. package/core/errors.js +0 -262
  36. package/dist/types/core/builder.d.ts +0 -97
  37. package/dist/types/core/container.d.ts +0 -57
  38. package/dist/types/core/errors.d.ts +0 -122
  39. package/dist/types/enums/escrow.enums.d.ts +0 -24
  40. package/dist/types/enums/index.d.ts +0 -69
  41. package/dist/types/enums/monetization.enums.d.ts +0 -6
  42. package/dist/types/enums/payment.enums.d.ts +0 -16
  43. package/dist/types/enums/split.enums.d.ts +0 -25
  44. package/dist/types/enums/subscription.enums.d.ts +0 -15
  45. package/dist/types/enums/transaction.enums.d.ts +0 -24
  46. package/dist/types/index.d.ts +0 -22
  47. package/dist/types/providers/base.d.ts +0 -126
  48. package/dist/types/schemas/escrow/hold.schema.d.ts +0 -54
  49. package/dist/types/schemas/escrow/index.d.ts +0 -6
  50. package/dist/types/schemas/index.d.ts +0 -506
  51. package/dist/types/schemas/split/index.d.ts +0 -8
  52. package/dist/types/schemas/split/split.schema.d.ts +0 -142
  53. package/dist/types/schemas/subscription/index.d.ts +0 -152
  54. package/dist/types/schemas/subscription/info.schema.d.ts +0 -128
  55. package/dist/types/schemas/subscription/plan.schema.d.ts +0 -39
  56. package/dist/types/schemas/transaction/common.schema.d.ts +0 -12
  57. package/dist/types/schemas/transaction/gateway.schema.d.ts +0 -86
  58. package/dist/types/schemas/transaction/index.d.ts +0 -202
  59. package/dist/types/schemas/transaction/payment.schema.d.ts +0 -145
  60. package/dist/types/services/escrow.service.d.ts +0 -51
  61. package/dist/types/services/monetization.service.d.ts +0 -193
  62. package/dist/types/services/payment.service.d.ts +0 -112
  63. package/dist/types/services/transaction.service.d.ts +0 -40
  64. package/dist/types/utils/category-resolver.d.ts +0 -46
  65. package/dist/types/utils/commission-split.d.ts +0 -56
  66. package/dist/types/utils/commission.d.ts +0 -29
  67. package/dist/types/utils/hooks.d.ts +0 -17
  68. package/dist/types/utils/index.d.ts +0 -6
  69. package/dist/types/utils/logger.d.ts +0 -12
  70. package/dist/types/utils/subscription/actions.d.ts +0 -28
  71. package/dist/types/utils/subscription/index.d.ts +0 -2
  72. package/dist/types/utils/subscription/period.d.ts +0 -47
  73. package/dist/types/utils/transaction-type.d.ts +0 -102
  74. package/enums/escrow.enums.js +0 -36
  75. package/enums/index.d.ts +0 -116
  76. package/enums/index.js +0 -110
  77. package/enums/monetization.enums.js +0 -15
  78. package/enums/payment.enums.js +0 -64
  79. package/enums/split.enums.js +0 -37
  80. package/enums/subscription.enums.js +0 -33
  81. package/enums/transaction.enums.js +0 -69
  82. package/index.js +0 -76
  83. package/providers/base.js +0 -162
  84. package/schemas/escrow/hold.schema.js +0 -62
  85. package/schemas/escrow/index.js +0 -15
  86. package/schemas/index.d.ts +0 -33
  87. package/schemas/index.js +0 -27
  88. package/schemas/split/index.js +0 -16
  89. package/schemas/split/split.schema.js +0 -86
  90. package/schemas/subscription/index.js +0 -17
  91. package/schemas/subscription/info.schema.js +0 -115
  92. package/schemas/subscription/plan.schema.js +0 -48
  93. package/schemas/transaction/common.schema.js +0 -22
  94. package/schemas/transaction/gateway.schema.js +0 -69
  95. package/schemas/transaction/index.js +0 -20
  96. package/schemas/transaction/payment.schema.js +0 -110
  97. package/services/escrow.service.js +0 -353
  98. package/services/monetization.service.js +0 -671
  99. package/services/payment.service.js +0 -517
  100. package/services/transaction.service.js +0 -142
  101. package/utils/category-resolver.js +0 -74
  102. package/utils/commission-split.js +0 -180
  103. package/utils/commission.js +0 -83
  104. package/utils/hooks.js +0 -44
  105. package/utils/index.d.ts +0 -164
  106. package/utils/index.js +0 -16
  107. package/utils/logger.js +0 -36
  108. package/utils/subscription/actions.js +0 -68
  109. package/utils/subscription/index.js +0 -20
  110. package/utils/subscription/period.js +0 -123
  111. package/utils/transaction-type.js +0 -254
@@ -0,0 +1,958 @@
1
+ import * as mongoose from 'mongoose';
2
+ import { Schema } from 'mongoose';
3
+
4
+ /**
5
+ * Base metadata schema for transactions
6
+ */
7
+ declare const baseMetadataSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
8
+ _id: false;
9
+ strict: false;
10
+ }, {}, mongoose.Document<unknown, {}, {}, {
11
+ id: string;
12
+ }, mongoose.ResolveSchemaOptions<{
13
+ _id: false;
14
+ strict: false;
15
+ }>> & Omit<Required<{
16
+ _id: unknown;
17
+ }> & {
18
+ __v: number;
19
+ }, "id"> & {
20
+ id: string;
21
+ }, {
22
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
23
+ } | {
24
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {}, {
25
+ id: string;
26
+ }, mongoose.ResolveSchemaOptions<{
27
+ _id: false;
28
+ strict: false;
29
+ }>> & Omit<Required<{
30
+ _id: unknown;
31
+ }> & {
32
+ __v: number;
33
+ }, "id"> & {
34
+ id: string;
35
+ }> | undefined;
36
+ }, {} & Required<{
37
+ _id: unknown;
38
+ }> & {
39
+ __v: number;
40
+ }>;
41
+ /**
42
+ * Reference schema for polymorphic associations
43
+ */
44
+ declare const referenceSchema: {
45
+ referenceId: {
46
+ type: typeof Schema.Types.ObjectId;
47
+ refPath: string;
48
+ index: boolean;
49
+ };
50
+ referenceModel: {
51
+ type: StringConstructor;
52
+ enum: string[];
53
+ };
54
+ };
55
+
56
+ /**
57
+ * Gateway Schema - Embedded in Transaction
58
+ * Tracks payment gateway details
59
+ */
60
+ declare const gatewaySchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
61
+ _id: false;
62
+ }, {
63
+ type: string;
64
+ metadata: any;
65
+ sessionId?: string | null | undefined;
66
+ paymentIntentId?: string | null | undefined;
67
+ provider?: string | null | undefined;
68
+ verificationData?: any;
69
+ }, mongoose.Document<unknown, {}, {
70
+ type: string;
71
+ metadata: any;
72
+ sessionId?: string | null | undefined;
73
+ paymentIntentId?: string | null | undefined;
74
+ provider?: string | null | undefined;
75
+ verificationData?: any;
76
+ }, {
77
+ id: string;
78
+ }, mongoose.ResolveSchemaOptions<{
79
+ _id: false;
80
+ }>> & Omit<{
81
+ type: string;
82
+ metadata: any;
83
+ sessionId?: string | null | undefined;
84
+ paymentIntentId?: string | null | undefined;
85
+ provider?: string | null | undefined;
86
+ verificationData?: any;
87
+ } & {
88
+ _id: mongoose.Types.ObjectId;
89
+ } & {
90
+ __v: number;
91
+ }, "id"> & {
92
+ id: string;
93
+ }, {
94
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
95
+ } | {
96
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
97
+ type: string;
98
+ metadata: any;
99
+ sessionId?: string | null | undefined;
100
+ paymentIntentId?: string | null | undefined;
101
+ provider?: string | null | undefined;
102
+ verificationData?: any;
103
+ }, {
104
+ id: string;
105
+ }, mongoose.ResolveSchemaOptions<{
106
+ _id: false;
107
+ }>> & Omit<{
108
+ type: string;
109
+ metadata: any;
110
+ sessionId?: string | null | undefined;
111
+ paymentIntentId?: string | null | undefined;
112
+ provider?: string | null | undefined;
113
+ verificationData?: any;
114
+ } & {
115
+ _id: mongoose.Types.ObjectId;
116
+ } & {
117
+ __v: number;
118
+ }, "id"> & {
119
+ id: string;
120
+ }> | undefined;
121
+ }, {
122
+ type: string;
123
+ metadata: any;
124
+ sessionId?: string | null | undefined;
125
+ paymentIntentId?: string | null | undefined;
126
+ provider?: string | null | undefined;
127
+ verificationData?: any;
128
+ } & {
129
+ _id: mongoose.Types.ObjectId;
130
+ } & {
131
+ __v: number;
132
+ }>;
133
+
134
+ /**
135
+ * Current Payment Schema
136
+ * Use this in your model: currentPayment: { type: currentPaymentSchema }
137
+ *
138
+ * Tracks the latest payment transaction for an entity
139
+ */
140
+ declare const currentPaymentSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
141
+ _id: false;
142
+ }, {
143
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
144
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
145
+ amount?: number | null | undefined;
146
+ method?: string | null | undefined;
147
+ verifiedAt?: NativeDate | null | undefined;
148
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
149
+ reference?: string | null | undefined;
150
+ }, mongoose.Document<unknown, {}, {
151
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
152
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
153
+ amount?: number | null | undefined;
154
+ method?: string | null | undefined;
155
+ verifiedAt?: NativeDate | null | undefined;
156
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
157
+ reference?: string | null | undefined;
158
+ }, {
159
+ id: string;
160
+ }, mongoose.ResolveSchemaOptions<{
161
+ _id: false;
162
+ }>> & Omit<{
163
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
164
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
165
+ amount?: number | null | undefined;
166
+ method?: string | null | undefined;
167
+ verifiedAt?: NativeDate | null | undefined;
168
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
169
+ reference?: string | null | undefined;
170
+ } & {
171
+ _id: mongoose.Types.ObjectId;
172
+ } & {
173
+ __v: number;
174
+ }, "id"> & {
175
+ id: string;
176
+ }, {
177
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
178
+ } | {
179
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
180
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
181
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
182
+ amount?: number | null | undefined;
183
+ method?: string | null | undefined;
184
+ verifiedAt?: NativeDate | null | undefined;
185
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
186
+ reference?: string | null | undefined;
187
+ }, {
188
+ id: string;
189
+ }, mongoose.ResolveSchemaOptions<{
190
+ _id: false;
191
+ }>> & Omit<{
192
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
193
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
194
+ amount?: number | null | undefined;
195
+ method?: string | null | undefined;
196
+ verifiedAt?: NativeDate | null | undefined;
197
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
198
+ reference?: string | null | undefined;
199
+ } & {
200
+ _id: mongoose.Types.ObjectId;
201
+ } & {
202
+ __v: number;
203
+ }, "id"> & {
204
+ id: string;
205
+ }> | undefined;
206
+ }, {
207
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
208
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
209
+ amount?: number | null | undefined;
210
+ method?: string | null | undefined;
211
+ verifiedAt?: NativeDate | null | undefined;
212
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
213
+ reference?: string | null | undefined;
214
+ } & {
215
+ _id: mongoose.Types.ObjectId;
216
+ } & {
217
+ __v: number;
218
+ }>;
219
+ /**
220
+ * Payment Summary Schema
221
+ * Use this in your model: paymentSummary: { type: paymentSummarySchema }
222
+ *
223
+ * Tracks payment history and totals
224
+ */
225
+ declare const paymentSummarySchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
226
+ _id: false;
227
+ }, {
228
+ totalPayments: number;
229
+ totalAmountPaid: number;
230
+ lastPaymentDate?: NativeDate | null | undefined;
231
+ lastPaymentAmount?: number | null | undefined;
232
+ }, mongoose.Document<unknown, {}, {
233
+ totalPayments: number;
234
+ totalAmountPaid: number;
235
+ lastPaymentDate?: NativeDate | null | undefined;
236
+ lastPaymentAmount?: number | null | undefined;
237
+ }, {
238
+ id: string;
239
+ }, mongoose.ResolveSchemaOptions<{
240
+ _id: false;
241
+ }>> & Omit<{
242
+ totalPayments: number;
243
+ totalAmountPaid: number;
244
+ lastPaymentDate?: NativeDate | null | undefined;
245
+ lastPaymentAmount?: number | null | undefined;
246
+ } & {
247
+ _id: mongoose.Types.ObjectId;
248
+ } & {
249
+ __v: number;
250
+ }, "id"> & {
251
+ id: string;
252
+ }, {
253
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
254
+ } | {
255
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
256
+ totalPayments: number;
257
+ totalAmountPaid: number;
258
+ lastPaymentDate?: NativeDate | null | undefined;
259
+ lastPaymentAmount?: number | null | undefined;
260
+ }, {
261
+ id: string;
262
+ }, mongoose.ResolveSchemaOptions<{
263
+ _id: false;
264
+ }>> & Omit<{
265
+ totalPayments: number;
266
+ totalAmountPaid: number;
267
+ lastPaymentDate?: NativeDate | null | undefined;
268
+ lastPaymentAmount?: number | null | undefined;
269
+ } & {
270
+ _id: mongoose.Types.ObjectId;
271
+ } & {
272
+ __v: number;
273
+ }, "id"> & {
274
+ id: string;
275
+ }> | undefined;
276
+ }, {
277
+ totalPayments: number;
278
+ totalAmountPaid: number;
279
+ lastPaymentDate?: NativeDate | null | undefined;
280
+ lastPaymentAmount?: number | null | undefined;
281
+ } & {
282
+ _id: mongoose.Types.ObjectId;
283
+ } & {
284
+ __v: number;
285
+ }>;
286
+ /**
287
+ * Payment Details Schema (for manual payments)
288
+ * Embedded in Transaction model
289
+ */
290
+ declare const paymentDetailsSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
291
+ _id: false;
292
+ }, {
293
+ provider?: string | null | undefined;
294
+ walletNumber?: string | null | undefined;
295
+ walletType?: string | null | undefined;
296
+ trxId?: string | null | undefined;
297
+ bankName?: string | null | undefined;
298
+ accountNumber?: string | null | undefined;
299
+ accountName?: string | null | undefined;
300
+ proofUrl?: string | null | undefined;
301
+ }, mongoose.Document<unknown, {}, {
302
+ provider?: string | null | undefined;
303
+ walletNumber?: string | null | undefined;
304
+ walletType?: string | null | undefined;
305
+ trxId?: string | null | undefined;
306
+ bankName?: string | null | undefined;
307
+ accountNumber?: string | null | undefined;
308
+ accountName?: string | null | undefined;
309
+ proofUrl?: string | null | undefined;
310
+ }, {
311
+ id: string;
312
+ }, mongoose.ResolveSchemaOptions<{
313
+ _id: false;
314
+ }>> & Omit<{
315
+ provider?: string | null | undefined;
316
+ walletNumber?: string | null | undefined;
317
+ walletType?: string | null | undefined;
318
+ trxId?: string | null | undefined;
319
+ bankName?: string | null | undefined;
320
+ accountNumber?: string | null | undefined;
321
+ accountName?: string | null | undefined;
322
+ proofUrl?: string | null | undefined;
323
+ } & {
324
+ _id: mongoose.Types.ObjectId;
325
+ } & {
326
+ __v: number;
327
+ }, "id"> & {
328
+ id: string;
329
+ }, {
330
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
331
+ } | {
332
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
333
+ provider?: string | null | undefined;
334
+ walletNumber?: string | null | undefined;
335
+ walletType?: string | null | undefined;
336
+ trxId?: string | null | undefined;
337
+ bankName?: string | null | undefined;
338
+ accountNumber?: string | null | undefined;
339
+ accountName?: string | null | undefined;
340
+ proofUrl?: string | null | undefined;
341
+ }, {
342
+ id: string;
343
+ }, mongoose.ResolveSchemaOptions<{
344
+ _id: false;
345
+ }>> & Omit<{
346
+ provider?: string | null | undefined;
347
+ walletNumber?: string | null | undefined;
348
+ walletType?: string | null | undefined;
349
+ trxId?: string | null | undefined;
350
+ bankName?: string | null | undefined;
351
+ accountNumber?: string | null | undefined;
352
+ accountName?: string | null | undefined;
353
+ proofUrl?: string | null | undefined;
354
+ } & {
355
+ _id: mongoose.Types.ObjectId;
356
+ } & {
357
+ __v: number;
358
+ }, "id"> & {
359
+ id: string;
360
+ }> | undefined;
361
+ }, {
362
+ provider?: string | null | undefined;
363
+ walletNumber?: string | null | undefined;
364
+ walletType?: string | null | undefined;
365
+ trxId?: string | null | undefined;
366
+ bankName?: string | null | undefined;
367
+ accountNumber?: string | null | undefined;
368
+ accountName?: string | null | undefined;
369
+ proofUrl?: string | null | undefined;
370
+ } & {
371
+ _id: mongoose.Types.ObjectId;
372
+ } & {
373
+ __v: number;
374
+ }>;
375
+ /**
376
+ * Tenant Snapshot Schema
377
+ * Captures organization payment details at transaction time (audit trail)
378
+ */
379
+ declare const tenantSnapshotSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
380
+ _id: false;
381
+ }, {
382
+ paymentInstructions?: string | null | undefined;
383
+ bkashNumber?: string | null | undefined;
384
+ nagadNumber?: string | null | undefined;
385
+ bankAccount?: string | null | undefined;
386
+ }, mongoose.Document<unknown, {}, {
387
+ paymentInstructions?: string | null | undefined;
388
+ bkashNumber?: string | null | undefined;
389
+ nagadNumber?: string | null | undefined;
390
+ bankAccount?: string | null | undefined;
391
+ }, {
392
+ id: string;
393
+ }, mongoose.ResolveSchemaOptions<{
394
+ _id: false;
395
+ }>> & Omit<{
396
+ paymentInstructions?: string | null | undefined;
397
+ bkashNumber?: string | null | undefined;
398
+ nagadNumber?: string | null | undefined;
399
+ bankAccount?: string | null | undefined;
400
+ } & {
401
+ _id: mongoose.Types.ObjectId;
402
+ } & {
403
+ __v: number;
404
+ }, "id"> & {
405
+ id: string;
406
+ }, {
407
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
408
+ } | {
409
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
410
+ paymentInstructions?: string | null | undefined;
411
+ bkashNumber?: string | null | undefined;
412
+ nagadNumber?: string | null | undefined;
413
+ bankAccount?: string | null | undefined;
414
+ }, {
415
+ id: string;
416
+ }, mongoose.ResolveSchemaOptions<{
417
+ _id: false;
418
+ }>> & Omit<{
419
+ paymentInstructions?: string | null | undefined;
420
+ bkashNumber?: string | null | undefined;
421
+ nagadNumber?: string | null | undefined;
422
+ bankAccount?: string | null | undefined;
423
+ } & {
424
+ _id: mongoose.Types.ObjectId;
425
+ } & {
426
+ __v: number;
427
+ }, "id"> & {
428
+ id: string;
429
+ }> | undefined;
430
+ }, {
431
+ paymentInstructions?: string | null | undefined;
432
+ bkashNumber?: string | null | undefined;
433
+ nagadNumber?: string | null | undefined;
434
+ bankAccount?: string | null | undefined;
435
+ } & {
436
+ _id: mongoose.Types.ObjectId;
437
+ } & {
438
+ __v: number;
439
+ }>;
440
+
441
+ /**
442
+ * Commission Schema - Embedded in Transaction
443
+ * Tracks platform commission with gateway fee deduction
444
+ *
445
+ * Usage: commission: commissionSchema
446
+ */
447
+ declare const commissionSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
448
+ _id: false;
449
+ }, {
450
+ status: "pending" | "paid" | "waived" | "reversed";
451
+ splits: string[];
452
+ grossAmount?: number | null | undefined;
453
+ netAmount?: number | null | undefined;
454
+ rate?: number | null | undefined;
455
+ gatewayFeeRate?: number | null | undefined;
456
+ gatewayFeeAmount?: number | null | undefined;
457
+ affiliate?: {
458
+ recipientId?: string | null | undefined;
459
+ grossAmount?: number | null | undefined;
460
+ netAmount?: number | null | undefined;
461
+ rate?: number | null | undefined;
462
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
463
+ } | null | undefined;
464
+ }, mongoose.Document<unknown, {}, {
465
+ status: "pending" | "paid" | "waived" | "reversed";
466
+ splits: string[];
467
+ grossAmount?: number | null | undefined;
468
+ netAmount?: number | null | undefined;
469
+ rate?: number | null | undefined;
470
+ gatewayFeeRate?: number | null | undefined;
471
+ gatewayFeeAmount?: number | null | undefined;
472
+ affiliate?: {
473
+ recipientId?: string | null | undefined;
474
+ grossAmount?: number | null | undefined;
475
+ netAmount?: number | null | undefined;
476
+ rate?: number | null | undefined;
477
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
478
+ } | null | undefined;
479
+ }, {
480
+ id: string;
481
+ }, mongoose.ResolveSchemaOptions<{
482
+ _id: false;
483
+ }>> & Omit<{
484
+ status: "pending" | "paid" | "waived" | "reversed";
485
+ splits: string[];
486
+ grossAmount?: number | null | undefined;
487
+ netAmount?: number | null | undefined;
488
+ rate?: number | null | undefined;
489
+ gatewayFeeRate?: number | null | undefined;
490
+ gatewayFeeAmount?: number | null | undefined;
491
+ affiliate?: {
492
+ recipientId?: string | null | undefined;
493
+ grossAmount?: number | null | undefined;
494
+ netAmount?: number | null | undefined;
495
+ rate?: number | null | undefined;
496
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
497
+ } | null | undefined;
498
+ } & {
499
+ _id: mongoose.Types.ObjectId;
500
+ } & {
501
+ __v: number;
502
+ }, "id"> & {
503
+ id: string;
504
+ }, {
505
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
506
+ } | {
507
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
508
+ status: "pending" | "paid" | "waived" | "reversed";
509
+ splits: string[];
510
+ grossAmount?: number | null | undefined;
511
+ netAmount?: number | null | undefined;
512
+ rate?: number | null | undefined;
513
+ gatewayFeeRate?: number | null | undefined;
514
+ gatewayFeeAmount?: number | null | undefined;
515
+ affiliate?: {
516
+ recipientId?: string | null | undefined;
517
+ grossAmount?: number | null | undefined;
518
+ netAmount?: number | null | undefined;
519
+ rate?: number | null | undefined;
520
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
521
+ } | null | undefined;
522
+ }, {
523
+ id: string;
524
+ }, mongoose.ResolveSchemaOptions<{
525
+ _id: false;
526
+ }>> & Omit<{
527
+ status: "pending" | "paid" | "waived" | "reversed";
528
+ splits: string[];
529
+ grossAmount?: number | null | undefined;
530
+ netAmount?: number | null | undefined;
531
+ rate?: number | null | undefined;
532
+ gatewayFeeRate?: number | null | undefined;
533
+ gatewayFeeAmount?: number | null | undefined;
534
+ affiliate?: {
535
+ recipientId?: string | null | undefined;
536
+ grossAmount?: number | null | undefined;
537
+ netAmount?: number | null | undefined;
538
+ rate?: number | null | undefined;
539
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
540
+ } | null | undefined;
541
+ } & {
542
+ _id: mongoose.Types.ObjectId;
543
+ } & {
544
+ __v: number;
545
+ }, "id"> & {
546
+ id: string;
547
+ }> | undefined;
548
+ }, {
549
+ status: "pending" | "paid" | "waived" | "reversed";
550
+ splits: string[];
551
+ grossAmount?: number | null | undefined;
552
+ netAmount?: number | null | undefined;
553
+ rate?: number | null | undefined;
554
+ gatewayFeeRate?: number | null | undefined;
555
+ gatewayFeeAmount?: number | null | undefined;
556
+ affiliate?: {
557
+ recipientId?: string | null | undefined;
558
+ grossAmount?: number | null | undefined;
559
+ netAmount?: number | null | undefined;
560
+ rate?: number | null | undefined;
561
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
562
+ } | null | undefined;
563
+ } & {
564
+ _id: mongoose.Types.ObjectId;
565
+ } & {
566
+ __v: number;
567
+ }>;
568
+
569
+ /**
570
+ * Plan Schema - for defining subscription plans
571
+ */
572
+ declare const planSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
573
+ _id: false;
574
+ }, {
575
+ amount: number;
576
+ currency: string;
577
+ metadata: any;
578
+ name: string;
579
+ key: "monthly" | "quarterly" | "yearly";
580
+ isActive: boolean;
581
+ interval: "day" | "week" | "month" | "year";
582
+ intervalCount: number;
583
+ features: string[];
584
+ description?: string | null | undefined;
585
+ }, mongoose.Document<unknown, {}, {
586
+ amount: number;
587
+ currency: string;
588
+ metadata: any;
589
+ name: string;
590
+ key: "monthly" | "quarterly" | "yearly";
591
+ isActive: boolean;
592
+ interval: "day" | "week" | "month" | "year";
593
+ intervalCount: number;
594
+ features: string[];
595
+ description?: string | null | undefined;
596
+ }, {
597
+ id: string;
598
+ }, mongoose.ResolveSchemaOptions<{
599
+ _id: false;
600
+ }>> & Omit<{
601
+ amount: number;
602
+ currency: string;
603
+ metadata: any;
604
+ name: string;
605
+ key: "monthly" | "quarterly" | "yearly";
606
+ isActive: boolean;
607
+ interval: "day" | "week" | "month" | "year";
608
+ intervalCount: number;
609
+ features: string[];
610
+ description?: string | null | undefined;
611
+ } & {
612
+ _id: mongoose.Types.ObjectId;
613
+ } & {
614
+ __v: number;
615
+ }, "id"> & {
616
+ id: string;
617
+ }, {
618
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
619
+ } | {
620
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
621
+ amount: number;
622
+ currency: string;
623
+ metadata: any;
624
+ name: string;
625
+ key: "monthly" | "quarterly" | "yearly";
626
+ isActive: boolean;
627
+ interval: "day" | "week" | "month" | "year";
628
+ intervalCount: number;
629
+ features: string[];
630
+ description?: string | null | undefined;
631
+ }, {
632
+ id: string;
633
+ }, mongoose.ResolveSchemaOptions<{
634
+ _id: false;
635
+ }>> & Omit<{
636
+ amount: number;
637
+ currency: string;
638
+ metadata: any;
639
+ name: string;
640
+ key: "monthly" | "quarterly" | "yearly";
641
+ isActive: boolean;
642
+ interval: "day" | "week" | "month" | "year";
643
+ intervalCount: number;
644
+ features: string[];
645
+ description?: string | null | undefined;
646
+ } & {
647
+ _id: mongoose.Types.ObjectId;
648
+ } & {
649
+ __v: number;
650
+ }, "id"> & {
651
+ id: string;
652
+ }> | undefined;
653
+ }, {
654
+ amount: number;
655
+ currency: string;
656
+ metadata: any;
657
+ name: string;
658
+ key: "monthly" | "quarterly" | "yearly";
659
+ isActive: boolean;
660
+ interval: "day" | "week" | "month" | "year";
661
+ intervalCount: number;
662
+ features: string[];
663
+ description?: string | null | undefined;
664
+ } & {
665
+ _id: mongoose.Types.ObjectId;
666
+ } & {
667
+ __v: number;
668
+ }>;
669
+
670
+ /**
671
+ * Subscription Info Schema
672
+ * Use this in your entity models that have subscriptions
673
+ *
674
+ * @example
675
+ * const OrganizationSchema = new Schema({
676
+ * name: String,
677
+ * subscription: { type: subscriptionInfoSchema },
678
+ * });
679
+ */
680
+ declare const subscriptionInfoSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
681
+ _id: false;
682
+ }, {
683
+ planKey: "monthly" | "quarterly" | "yearly";
684
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
685
+ isActive: boolean;
686
+ renewalCount: number;
687
+ pausedAt?: NativeDate | null | undefined;
688
+ endDate?: NativeDate | null | undefined;
689
+ lastPaymentDate?: NativeDate | null | undefined;
690
+ lastPaymentAmount?: number | null | undefined;
691
+ startDate?: NativeDate | null | undefined;
692
+ canceledAt?: NativeDate | null | undefined;
693
+ cancelAt?: NativeDate | null | undefined;
694
+ }, mongoose.Document<unknown, {}, {
695
+ planKey: "monthly" | "quarterly" | "yearly";
696
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
697
+ isActive: boolean;
698
+ renewalCount: number;
699
+ pausedAt?: NativeDate | null | undefined;
700
+ endDate?: NativeDate | null | undefined;
701
+ lastPaymentDate?: NativeDate | null | undefined;
702
+ lastPaymentAmount?: number | null | undefined;
703
+ startDate?: NativeDate | null | undefined;
704
+ canceledAt?: NativeDate | null | undefined;
705
+ cancelAt?: NativeDate | null | undefined;
706
+ }, {
707
+ id: string;
708
+ }, mongoose.ResolveSchemaOptions<{
709
+ _id: false;
710
+ }>> & Omit<{
711
+ planKey: "monthly" | "quarterly" | "yearly";
712
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
713
+ isActive: boolean;
714
+ renewalCount: number;
715
+ pausedAt?: NativeDate | null | undefined;
716
+ endDate?: NativeDate | null | undefined;
717
+ lastPaymentDate?: NativeDate | null | undefined;
718
+ lastPaymentAmount?: number | null | undefined;
719
+ startDate?: NativeDate | null | undefined;
720
+ canceledAt?: NativeDate | null | undefined;
721
+ cancelAt?: NativeDate | null | undefined;
722
+ } & {
723
+ _id: mongoose.Types.ObjectId;
724
+ } & {
725
+ __v: number;
726
+ }, "id"> & {
727
+ id: string;
728
+ }, {
729
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
730
+ } | {
731
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
732
+ planKey: "monthly" | "quarterly" | "yearly";
733
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
734
+ isActive: boolean;
735
+ renewalCount: number;
736
+ pausedAt?: NativeDate | null | undefined;
737
+ endDate?: NativeDate | null | undefined;
738
+ lastPaymentDate?: NativeDate | null | undefined;
739
+ lastPaymentAmount?: number | null | undefined;
740
+ startDate?: NativeDate | null | undefined;
741
+ canceledAt?: NativeDate | null | undefined;
742
+ cancelAt?: NativeDate | null | undefined;
743
+ }, {
744
+ id: string;
745
+ }, mongoose.ResolveSchemaOptions<{
746
+ _id: false;
747
+ }>> & Omit<{
748
+ planKey: "monthly" | "quarterly" | "yearly";
749
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
750
+ isActive: boolean;
751
+ renewalCount: number;
752
+ pausedAt?: NativeDate | null | undefined;
753
+ endDate?: NativeDate | null | undefined;
754
+ lastPaymentDate?: NativeDate | null | undefined;
755
+ lastPaymentAmount?: number | null | undefined;
756
+ startDate?: NativeDate | null | undefined;
757
+ canceledAt?: NativeDate | null | undefined;
758
+ cancelAt?: NativeDate | null | undefined;
759
+ } & {
760
+ _id: mongoose.Types.ObjectId;
761
+ } & {
762
+ __v: number;
763
+ }, "id"> & {
764
+ id: string;
765
+ }> | undefined;
766
+ }, {
767
+ planKey: "monthly" | "quarterly" | "yearly";
768
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
769
+ isActive: boolean;
770
+ renewalCount: number;
771
+ pausedAt?: NativeDate | null | undefined;
772
+ endDate?: NativeDate | null | undefined;
773
+ lastPaymentDate?: NativeDate | null | undefined;
774
+ lastPaymentAmount?: number | null | undefined;
775
+ startDate?: NativeDate | null | undefined;
776
+ canceledAt?: NativeDate | null | undefined;
777
+ cancelAt?: NativeDate | null | undefined;
778
+ } & {
779
+ _id: mongoose.Types.ObjectId;
780
+ } & {
781
+ __v: number;
782
+ }>;
783
+
784
+ /**
785
+ * Hold/Escrow Schema
786
+ * @classytic/revenue
787
+ *
788
+ * Schema for platform-as-intermediary escrow flow
789
+ * Spread into transaction schema when needed
790
+ */
791
+ declare const holdSchema: {
792
+ readonly status: {
793
+ readonly type: StringConstructor;
794
+ readonly enum: ("pending" | "cancelled" | "expired" | "held" | "released" | "partially_released")[];
795
+ readonly default: "pending";
796
+ readonly index: true;
797
+ };
798
+ readonly heldAmount: {
799
+ readonly type: NumberConstructor;
800
+ readonly required: false;
801
+ };
802
+ readonly releasedAmount: {
803
+ readonly type: NumberConstructor;
804
+ readonly default: 0;
805
+ };
806
+ readonly reason: {
807
+ readonly type: StringConstructor;
808
+ readonly enum: ("payment_verification" | "fraud_check" | "manual_review" | "dispute" | "compliance")[];
809
+ readonly required: false;
810
+ };
811
+ readonly holdUntil: {
812
+ readonly type: DateConstructor;
813
+ readonly required: false;
814
+ };
815
+ readonly heldAt: DateConstructor;
816
+ readonly releasedAt: DateConstructor;
817
+ readonly cancelledAt: DateConstructor;
818
+ readonly releases: readonly [{
819
+ readonly amount: NumberConstructor;
820
+ readonly recipientId: StringConstructor;
821
+ readonly recipientType: StringConstructor;
822
+ readonly releasedAt: DateConstructor;
823
+ readonly releasedBy: StringConstructor;
824
+ readonly reason: StringConstructor;
825
+ readonly metadata: ObjectConstructor;
826
+ }];
827
+ readonly metadata: {
828
+ readonly type: ObjectConstructor;
829
+ readonly default: {};
830
+ };
831
+ };
832
+
833
+ /**
834
+ * Split Schema - Embedded in Transaction
835
+ */
836
+ declare const splitSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
837
+ _id: false;
838
+ }, {
839
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
840
+ metadata: any;
841
+ recipientId: string;
842
+ grossAmount: number;
843
+ netAmount: number;
844
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
845
+ rate: number;
846
+ gatewayFeeRate: number;
847
+ gatewayFeeAmount: number;
848
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
849
+ dueDate?: NativeDate | null | undefined;
850
+ paidDate?: NativeDate | null | undefined;
851
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
852
+ payoutTransactionId?: string | null | undefined;
853
+ }, mongoose.Document<unknown, {}, {
854
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
855
+ metadata: any;
856
+ recipientId: string;
857
+ grossAmount: number;
858
+ netAmount: number;
859
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
860
+ rate: number;
861
+ gatewayFeeRate: number;
862
+ gatewayFeeAmount: number;
863
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
864
+ dueDate?: NativeDate | null | undefined;
865
+ paidDate?: NativeDate | null | undefined;
866
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
867
+ payoutTransactionId?: string | null | undefined;
868
+ }, {
869
+ id: string;
870
+ }, mongoose.ResolveSchemaOptions<{
871
+ _id: false;
872
+ }>> & Omit<{
873
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
874
+ metadata: any;
875
+ recipientId: string;
876
+ grossAmount: number;
877
+ netAmount: number;
878
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
879
+ rate: number;
880
+ gatewayFeeRate: number;
881
+ gatewayFeeAmount: number;
882
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
883
+ dueDate?: NativeDate | null | undefined;
884
+ paidDate?: NativeDate | null | undefined;
885
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
886
+ payoutTransactionId?: string | null | undefined;
887
+ } & {
888
+ _id: mongoose.Types.ObjectId;
889
+ } & {
890
+ __v: number;
891
+ }, "id"> & {
892
+ id: string;
893
+ }, {
894
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
895
+ } | {
896
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
897
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
898
+ metadata: any;
899
+ recipientId: string;
900
+ grossAmount: number;
901
+ netAmount: number;
902
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
903
+ rate: number;
904
+ gatewayFeeRate: number;
905
+ gatewayFeeAmount: number;
906
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
907
+ dueDate?: NativeDate | null | undefined;
908
+ paidDate?: NativeDate | null | undefined;
909
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
910
+ payoutTransactionId?: string | null | undefined;
911
+ }, {
912
+ id: string;
913
+ }, mongoose.ResolveSchemaOptions<{
914
+ _id: false;
915
+ }>> & Omit<{
916
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
917
+ metadata: any;
918
+ recipientId: string;
919
+ grossAmount: number;
920
+ netAmount: number;
921
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
922
+ rate: number;
923
+ gatewayFeeRate: number;
924
+ gatewayFeeAmount: number;
925
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
926
+ dueDate?: NativeDate | null | undefined;
927
+ paidDate?: NativeDate | null | undefined;
928
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
929
+ payoutTransactionId?: string | null | undefined;
930
+ } & {
931
+ _id: mongoose.Types.ObjectId;
932
+ } & {
933
+ __v: number;
934
+ }, "id"> & {
935
+ id: string;
936
+ }> | undefined;
937
+ }, {
938
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
939
+ metadata: any;
940
+ recipientId: string;
941
+ grossAmount: number;
942
+ netAmount: number;
943
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
944
+ rate: number;
945
+ gatewayFeeRate: number;
946
+ gatewayFeeAmount: number;
947
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
948
+ dueDate?: NativeDate | null | undefined;
949
+ paidDate?: NativeDate | null | undefined;
950
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
951
+ payoutTransactionId?: string | null | undefined;
952
+ } & {
953
+ _id: mongoose.Types.ObjectId;
954
+ } & {
955
+ __v: number;
956
+ }>;
957
+
958
+ export { paymentDetailsSchema as a, baseMetadataSchema as b, currentPaymentSchema as c, commissionSchema as d, planSchema as e, splitSchema as f, gatewaySchema as g, holdSchema as h, paymentSummarySchema as p, referenceSchema as r, subscriptionInfoSchema as s, tenantSnapshotSchema as t };