@classytic/revenue 0.2.4 → 1.0.1

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 -501
  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 +4362 -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 +906 -0
  19. package/dist/schemas/index.js +533 -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-CETjPq10.d.ts +976 -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 -128
  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 -117
  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 -675
  99. package/services/payment.service.js +0 -535
  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,976 @@
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
+ * Refund tracking:
141
+ * - refundedAmount: Total amount refunded (caps refundable = amount - refundedAmount)
142
+ * - refundedAt: When the (last) refund occurred
143
+ * - Partial refunds: status remains 'verified' with refundedAmount > 0
144
+ * - Full refunds: status should be updated to 'refunded'
145
+ */
146
+ declare const currentPaymentSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
147
+ _id: false;
148
+ }, {
149
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
150
+ refundedAmount: number;
151
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
152
+ amount?: number | null | undefined;
153
+ method?: string | null | undefined;
154
+ verifiedAt?: NativeDate | null | undefined;
155
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
156
+ refundedAt?: NativeDate | null | undefined;
157
+ reference?: string | null | undefined;
158
+ }, mongoose.Document<unknown, {}, {
159
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
160
+ refundedAmount: number;
161
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
162
+ amount?: number | null | undefined;
163
+ method?: string | null | undefined;
164
+ verifiedAt?: NativeDate | null | undefined;
165
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
166
+ refundedAt?: NativeDate | null | undefined;
167
+ reference?: string | null | undefined;
168
+ }, {
169
+ id: string;
170
+ }, mongoose.ResolveSchemaOptions<{
171
+ _id: false;
172
+ }>> & Omit<{
173
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
174
+ refundedAmount: number;
175
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
176
+ amount?: number | null | undefined;
177
+ method?: string | null | undefined;
178
+ verifiedAt?: NativeDate | null | undefined;
179
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
180
+ refundedAt?: NativeDate | null | undefined;
181
+ reference?: string | null | undefined;
182
+ } & {
183
+ _id: mongoose.Types.ObjectId;
184
+ } & {
185
+ __v: number;
186
+ }, "id"> & {
187
+ id: string;
188
+ }, {
189
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
190
+ } | {
191
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
192
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
193
+ refundedAmount: number;
194
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
195
+ amount?: number | null | undefined;
196
+ method?: string | null | undefined;
197
+ verifiedAt?: NativeDate | null | undefined;
198
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
199
+ refundedAt?: NativeDate | null | undefined;
200
+ reference?: string | null | undefined;
201
+ }, {
202
+ id: string;
203
+ }, mongoose.ResolveSchemaOptions<{
204
+ _id: false;
205
+ }>> & Omit<{
206
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
207
+ refundedAmount: number;
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
+ refundedAt?: NativeDate | null | undefined;
214
+ reference?: string | null | undefined;
215
+ } & {
216
+ _id: mongoose.Types.ObjectId;
217
+ } & {
218
+ __v: number;
219
+ }, "id"> & {
220
+ id: string;
221
+ }> | undefined;
222
+ }, {
223
+ status: "pending" | "verified" | "failed" | "cancelled" | "refunded";
224
+ refundedAmount: number;
225
+ transactionId?: mongoose.Types.ObjectId | null | undefined;
226
+ amount?: number | null | undefined;
227
+ method?: string | null | undefined;
228
+ verifiedAt?: NativeDate | null | undefined;
229
+ verifiedBy?: mongoose.Types.ObjectId | null | undefined;
230
+ refundedAt?: NativeDate | null | undefined;
231
+ reference?: string | null | undefined;
232
+ } & {
233
+ _id: mongoose.Types.ObjectId;
234
+ } & {
235
+ __v: number;
236
+ }>;
237
+ /**
238
+ * Payment Summary Schema
239
+ * Use this in your model: paymentSummary: { type: paymentSummarySchema }
240
+ *
241
+ * Tracks payment history and totals
242
+ */
243
+ declare const paymentSummarySchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
244
+ _id: false;
245
+ }, {
246
+ totalPayments: number;
247
+ totalAmountPaid: number;
248
+ lastPaymentDate?: NativeDate | null | undefined;
249
+ lastPaymentAmount?: number | null | undefined;
250
+ }, mongoose.Document<unknown, {}, {
251
+ totalPayments: number;
252
+ totalAmountPaid: number;
253
+ lastPaymentDate?: NativeDate | null | undefined;
254
+ lastPaymentAmount?: number | null | undefined;
255
+ }, {
256
+ id: string;
257
+ }, mongoose.ResolveSchemaOptions<{
258
+ _id: false;
259
+ }>> & Omit<{
260
+ totalPayments: number;
261
+ totalAmountPaid: number;
262
+ lastPaymentDate?: NativeDate | null | undefined;
263
+ lastPaymentAmount?: number | null | undefined;
264
+ } & {
265
+ _id: mongoose.Types.ObjectId;
266
+ } & {
267
+ __v: number;
268
+ }, "id"> & {
269
+ id: string;
270
+ }, {
271
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
272
+ } | {
273
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
274
+ totalPayments: number;
275
+ totalAmountPaid: number;
276
+ lastPaymentDate?: NativeDate | null | undefined;
277
+ lastPaymentAmount?: number | null | undefined;
278
+ }, {
279
+ id: string;
280
+ }, mongoose.ResolveSchemaOptions<{
281
+ _id: false;
282
+ }>> & Omit<{
283
+ totalPayments: number;
284
+ totalAmountPaid: number;
285
+ lastPaymentDate?: NativeDate | null | undefined;
286
+ lastPaymentAmount?: number | null | undefined;
287
+ } & {
288
+ _id: mongoose.Types.ObjectId;
289
+ } & {
290
+ __v: number;
291
+ }, "id"> & {
292
+ id: string;
293
+ }> | undefined;
294
+ }, {
295
+ totalPayments: number;
296
+ totalAmountPaid: number;
297
+ lastPaymentDate?: NativeDate | null | undefined;
298
+ lastPaymentAmount?: number | null | undefined;
299
+ } & {
300
+ _id: mongoose.Types.ObjectId;
301
+ } & {
302
+ __v: number;
303
+ }>;
304
+ /**
305
+ * Payment Details Schema (for manual payments)
306
+ * Embedded in Transaction model
307
+ */
308
+ declare const paymentDetailsSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
309
+ _id: false;
310
+ }, {
311
+ provider?: string | null | undefined;
312
+ walletNumber?: string | null | undefined;
313
+ walletType?: string | null | undefined;
314
+ trxId?: string | null | undefined;
315
+ bankName?: string | null | undefined;
316
+ accountNumber?: string | null | undefined;
317
+ accountName?: string | null | undefined;
318
+ proofUrl?: string | null | undefined;
319
+ }, mongoose.Document<unknown, {}, {
320
+ provider?: string | null | undefined;
321
+ walletNumber?: string | null | undefined;
322
+ walletType?: string | null | undefined;
323
+ trxId?: string | null | undefined;
324
+ bankName?: string | null | undefined;
325
+ accountNumber?: string | null | undefined;
326
+ accountName?: string | null | undefined;
327
+ proofUrl?: string | null | undefined;
328
+ }, {
329
+ id: string;
330
+ }, mongoose.ResolveSchemaOptions<{
331
+ _id: false;
332
+ }>> & Omit<{
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: mongoose.Types.ObjectId;
343
+ } & {
344
+ __v: number;
345
+ }, "id"> & {
346
+ id: string;
347
+ }, {
348
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
349
+ } | {
350
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
351
+ provider?: string | null | undefined;
352
+ walletNumber?: string | null | undefined;
353
+ walletType?: string | null | undefined;
354
+ trxId?: string | null | undefined;
355
+ bankName?: string | null | undefined;
356
+ accountNumber?: string | null | undefined;
357
+ accountName?: string | null | undefined;
358
+ proofUrl?: string | null | undefined;
359
+ }, {
360
+ id: string;
361
+ }, mongoose.ResolveSchemaOptions<{
362
+ _id: false;
363
+ }>> & Omit<{
364
+ provider?: string | null | undefined;
365
+ walletNumber?: string | null | undefined;
366
+ walletType?: string | null | undefined;
367
+ trxId?: string | null | undefined;
368
+ bankName?: string | null | undefined;
369
+ accountNumber?: string | null | undefined;
370
+ accountName?: string | null | undefined;
371
+ proofUrl?: string | null | undefined;
372
+ } & {
373
+ _id: mongoose.Types.ObjectId;
374
+ } & {
375
+ __v: number;
376
+ }, "id"> & {
377
+ id: string;
378
+ }> | undefined;
379
+ }, {
380
+ provider?: string | null | undefined;
381
+ walletNumber?: string | null | undefined;
382
+ walletType?: string | null | undefined;
383
+ trxId?: string | null | undefined;
384
+ bankName?: string | null | undefined;
385
+ accountNumber?: string | null | undefined;
386
+ accountName?: string | null | undefined;
387
+ proofUrl?: string | null | undefined;
388
+ } & {
389
+ _id: mongoose.Types.ObjectId;
390
+ } & {
391
+ __v: number;
392
+ }>;
393
+ /**
394
+ * Tenant Snapshot Schema
395
+ * Captures organization payment details at transaction time (audit trail)
396
+ */
397
+ declare const tenantSnapshotSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
398
+ _id: false;
399
+ }, {
400
+ paymentInstructions?: string | null | undefined;
401
+ bkashNumber?: string | null | undefined;
402
+ nagadNumber?: string | null | undefined;
403
+ bankAccount?: string | null | undefined;
404
+ }, mongoose.Document<unknown, {}, {
405
+ paymentInstructions?: string | null | undefined;
406
+ bkashNumber?: string | null | undefined;
407
+ nagadNumber?: string | null | undefined;
408
+ bankAccount?: string | null | undefined;
409
+ }, {
410
+ id: string;
411
+ }, mongoose.ResolveSchemaOptions<{
412
+ _id: false;
413
+ }>> & Omit<{
414
+ paymentInstructions?: string | null | undefined;
415
+ bkashNumber?: string | null | undefined;
416
+ nagadNumber?: string | null | undefined;
417
+ bankAccount?: string | null | undefined;
418
+ } & {
419
+ _id: mongoose.Types.ObjectId;
420
+ } & {
421
+ __v: number;
422
+ }, "id"> & {
423
+ id: string;
424
+ }, {
425
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
426
+ } | {
427
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
428
+ paymentInstructions?: string | null | undefined;
429
+ bkashNumber?: string | null | undefined;
430
+ nagadNumber?: string | null | undefined;
431
+ bankAccount?: string | null | undefined;
432
+ }, {
433
+ id: string;
434
+ }, mongoose.ResolveSchemaOptions<{
435
+ _id: false;
436
+ }>> & Omit<{
437
+ paymentInstructions?: string | null | undefined;
438
+ bkashNumber?: string | null | undefined;
439
+ nagadNumber?: string | null | undefined;
440
+ bankAccount?: string | null | undefined;
441
+ } & {
442
+ _id: mongoose.Types.ObjectId;
443
+ } & {
444
+ __v: number;
445
+ }, "id"> & {
446
+ id: string;
447
+ }> | undefined;
448
+ }, {
449
+ paymentInstructions?: string | null | undefined;
450
+ bkashNumber?: string | null | undefined;
451
+ nagadNumber?: string | null | undefined;
452
+ bankAccount?: string | null | undefined;
453
+ } & {
454
+ _id: mongoose.Types.ObjectId;
455
+ } & {
456
+ __v: number;
457
+ }>;
458
+
459
+ /**
460
+ * Commission Schema - Embedded in Transaction
461
+ * Tracks platform commission with gateway fee deduction
462
+ *
463
+ * Usage: commission: commissionSchema
464
+ */
465
+ declare const commissionSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
466
+ _id: false;
467
+ }, {
468
+ status: "pending" | "paid" | "waived" | "reversed";
469
+ splits: string[];
470
+ grossAmount?: number | null | undefined;
471
+ netAmount?: number | null | undefined;
472
+ rate?: number | null | undefined;
473
+ gatewayFeeRate?: number | null | undefined;
474
+ gatewayFeeAmount?: number | null | undefined;
475
+ affiliate?: {
476
+ recipientId?: string | null | undefined;
477
+ grossAmount?: number | null | undefined;
478
+ netAmount?: number | null | undefined;
479
+ rate?: number | null | undefined;
480
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
481
+ } | null | undefined;
482
+ }, mongoose.Document<unknown, {}, {
483
+ status: "pending" | "paid" | "waived" | "reversed";
484
+ splits: string[];
485
+ grossAmount?: number | null | undefined;
486
+ netAmount?: number | null | undefined;
487
+ rate?: number | null | undefined;
488
+ gatewayFeeRate?: number | null | undefined;
489
+ gatewayFeeAmount?: number | null | undefined;
490
+ affiliate?: {
491
+ recipientId?: string | null | undefined;
492
+ grossAmount?: number | null | undefined;
493
+ netAmount?: number | null | undefined;
494
+ rate?: number | null | undefined;
495
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
496
+ } | null | undefined;
497
+ }, {
498
+ id: string;
499
+ }, mongoose.ResolveSchemaOptions<{
500
+ _id: false;
501
+ }>> & Omit<{
502
+ status: "pending" | "paid" | "waived" | "reversed";
503
+ splits: string[];
504
+ grossAmount?: number | null | undefined;
505
+ netAmount?: number | null | undefined;
506
+ rate?: number | null | undefined;
507
+ gatewayFeeRate?: number | null | undefined;
508
+ gatewayFeeAmount?: number | null | undefined;
509
+ affiliate?: {
510
+ recipientId?: string | null | undefined;
511
+ grossAmount?: number | null | undefined;
512
+ netAmount?: number | null | undefined;
513
+ rate?: number | null | undefined;
514
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
515
+ } | null | undefined;
516
+ } & {
517
+ _id: mongoose.Types.ObjectId;
518
+ } & {
519
+ __v: number;
520
+ }, "id"> & {
521
+ id: string;
522
+ }, {
523
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
524
+ } | {
525
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
526
+ status: "pending" | "paid" | "waived" | "reversed";
527
+ splits: string[];
528
+ grossAmount?: number | null | undefined;
529
+ netAmount?: number | null | undefined;
530
+ rate?: number | null | undefined;
531
+ gatewayFeeRate?: number | null | undefined;
532
+ gatewayFeeAmount?: number | null | undefined;
533
+ affiliate?: {
534
+ recipientId?: string | null | undefined;
535
+ grossAmount?: number | null | undefined;
536
+ netAmount?: number | null | undefined;
537
+ rate?: number | null | undefined;
538
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
539
+ } | null | undefined;
540
+ }, {
541
+ id: string;
542
+ }, mongoose.ResolveSchemaOptions<{
543
+ _id: false;
544
+ }>> & Omit<{
545
+ status: "pending" | "paid" | "waived" | "reversed";
546
+ splits: string[];
547
+ grossAmount?: number | null | undefined;
548
+ netAmount?: number | null | undefined;
549
+ rate?: number | null | undefined;
550
+ gatewayFeeRate?: number | null | undefined;
551
+ gatewayFeeAmount?: number | null | undefined;
552
+ affiliate?: {
553
+ recipientId?: string | null | undefined;
554
+ grossAmount?: number | null | undefined;
555
+ netAmount?: number | null | undefined;
556
+ rate?: number | null | undefined;
557
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
558
+ } | null | undefined;
559
+ } & {
560
+ _id: mongoose.Types.ObjectId;
561
+ } & {
562
+ __v: number;
563
+ }, "id"> & {
564
+ id: string;
565
+ }> | undefined;
566
+ }, {
567
+ status: "pending" | "paid" | "waived" | "reversed";
568
+ splits: string[];
569
+ grossAmount?: number | null | undefined;
570
+ netAmount?: number | null | undefined;
571
+ rate?: number | null | undefined;
572
+ gatewayFeeRate?: number | null | undefined;
573
+ gatewayFeeAmount?: number | null | undefined;
574
+ affiliate?: {
575
+ recipientId?: string | null | undefined;
576
+ grossAmount?: number | null | undefined;
577
+ netAmount?: number | null | undefined;
578
+ rate?: number | null | undefined;
579
+ recipientType?: "user" | "organization" | "partner" | null | undefined;
580
+ } | null | undefined;
581
+ } & {
582
+ _id: mongoose.Types.ObjectId;
583
+ } & {
584
+ __v: number;
585
+ }>;
586
+
587
+ /**
588
+ * Plan Schema - for defining subscription plans
589
+ */
590
+ declare const planSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
591
+ _id: false;
592
+ }, {
593
+ amount: number;
594
+ currency: string;
595
+ metadata: any;
596
+ name: string;
597
+ key: "monthly" | "quarterly" | "yearly";
598
+ isActive: boolean;
599
+ interval: "day" | "week" | "month" | "year";
600
+ intervalCount: number;
601
+ features: string[];
602
+ description?: string | null | undefined;
603
+ }, mongoose.Document<unknown, {}, {
604
+ amount: number;
605
+ currency: string;
606
+ metadata: any;
607
+ name: string;
608
+ key: "monthly" | "quarterly" | "yearly";
609
+ isActive: boolean;
610
+ interval: "day" | "week" | "month" | "year";
611
+ intervalCount: number;
612
+ features: string[];
613
+ description?: string | null | undefined;
614
+ }, {
615
+ id: string;
616
+ }, mongoose.ResolveSchemaOptions<{
617
+ _id: false;
618
+ }>> & Omit<{
619
+ amount: number;
620
+ currency: string;
621
+ metadata: any;
622
+ name: string;
623
+ key: "monthly" | "quarterly" | "yearly";
624
+ isActive: boolean;
625
+ interval: "day" | "week" | "month" | "year";
626
+ intervalCount: number;
627
+ features: string[];
628
+ description?: string | null | undefined;
629
+ } & {
630
+ _id: mongoose.Types.ObjectId;
631
+ } & {
632
+ __v: number;
633
+ }, "id"> & {
634
+ id: string;
635
+ }, {
636
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
637
+ } | {
638
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
639
+ amount: number;
640
+ currency: string;
641
+ metadata: any;
642
+ name: string;
643
+ key: "monthly" | "quarterly" | "yearly";
644
+ isActive: boolean;
645
+ interval: "day" | "week" | "month" | "year";
646
+ intervalCount: number;
647
+ features: string[];
648
+ description?: string | null | undefined;
649
+ }, {
650
+ id: string;
651
+ }, mongoose.ResolveSchemaOptions<{
652
+ _id: false;
653
+ }>> & Omit<{
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
+ }, "id"> & {
669
+ id: string;
670
+ }> | undefined;
671
+ }, {
672
+ amount: number;
673
+ currency: string;
674
+ metadata: any;
675
+ name: string;
676
+ key: "monthly" | "quarterly" | "yearly";
677
+ isActive: boolean;
678
+ interval: "day" | "week" | "month" | "year";
679
+ intervalCount: number;
680
+ features: string[];
681
+ description?: string | null | undefined;
682
+ } & {
683
+ _id: mongoose.Types.ObjectId;
684
+ } & {
685
+ __v: number;
686
+ }>;
687
+
688
+ /**
689
+ * Subscription Info Schema
690
+ * Use this in your entity models that have subscriptions
691
+ *
692
+ * @example
693
+ * const OrganizationSchema = new Schema({
694
+ * name: String,
695
+ * subscription: { type: subscriptionInfoSchema },
696
+ * });
697
+ */
698
+ declare const subscriptionInfoSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
699
+ _id: false;
700
+ }, {
701
+ planKey: "monthly" | "quarterly" | "yearly";
702
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
703
+ isActive: boolean;
704
+ renewalCount: number;
705
+ pausedAt?: NativeDate | null | undefined;
706
+ endDate?: NativeDate | null | undefined;
707
+ lastPaymentDate?: NativeDate | null | undefined;
708
+ lastPaymentAmount?: number | null | undefined;
709
+ startDate?: NativeDate | null | undefined;
710
+ canceledAt?: NativeDate | null | undefined;
711
+ cancelAt?: NativeDate | null | undefined;
712
+ }, mongoose.Document<unknown, {}, {
713
+ planKey: "monthly" | "quarterly" | "yearly";
714
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
715
+ isActive: boolean;
716
+ renewalCount: number;
717
+ pausedAt?: NativeDate | null | undefined;
718
+ endDate?: NativeDate | null | undefined;
719
+ lastPaymentDate?: NativeDate | null | undefined;
720
+ lastPaymentAmount?: number | null | undefined;
721
+ startDate?: NativeDate | null | undefined;
722
+ canceledAt?: NativeDate | null | undefined;
723
+ cancelAt?: NativeDate | null | undefined;
724
+ }, {
725
+ id: string;
726
+ }, mongoose.ResolveSchemaOptions<{
727
+ _id: false;
728
+ }>> & Omit<{
729
+ planKey: "monthly" | "quarterly" | "yearly";
730
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
731
+ isActive: boolean;
732
+ renewalCount: number;
733
+ pausedAt?: NativeDate | null | undefined;
734
+ endDate?: NativeDate | null | undefined;
735
+ lastPaymentDate?: NativeDate | null | undefined;
736
+ lastPaymentAmount?: number | null | undefined;
737
+ startDate?: NativeDate | null | undefined;
738
+ canceledAt?: NativeDate | null | undefined;
739
+ cancelAt?: NativeDate | null | undefined;
740
+ } & {
741
+ _id: mongoose.Types.ObjectId;
742
+ } & {
743
+ __v: number;
744
+ }, "id"> & {
745
+ id: string;
746
+ }, {
747
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
748
+ } | {
749
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
750
+ planKey: "monthly" | "quarterly" | "yearly";
751
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
752
+ isActive: boolean;
753
+ renewalCount: number;
754
+ pausedAt?: NativeDate | null | undefined;
755
+ endDate?: NativeDate | null | undefined;
756
+ lastPaymentDate?: NativeDate | null | undefined;
757
+ lastPaymentAmount?: number | null | undefined;
758
+ startDate?: NativeDate | null | undefined;
759
+ canceledAt?: NativeDate | null | undefined;
760
+ cancelAt?: NativeDate | null | undefined;
761
+ }, {
762
+ id: string;
763
+ }, mongoose.ResolveSchemaOptions<{
764
+ _id: false;
765
+ }>> & Omit<{
766
+ planKey: "monthly" | "quarterly" | "yearly";
767
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
768
+ isActive: boolean;
769
+ renewalCount: number;
770
+ pausedAt?: NativeDate | null | undefined;
771
+ endDate?: NativeDate | null | undefined;
772
+ lastPaymentDate?: NativeDate | null | undefined;
773
+ lastPaymentAmount?: number | null | undefined;
774
+ startDate?: NativeDate | null | undefined;
775
+ canceledAt?: NativeDate | null | undefined;
776
+ cancelAt?: NativeDate | null | undefined;
777
+ } & {
778
+ _id: mongoose.Types.ObjectId;
779
+ } & {
780
+ __v: number;
781
+ }, "id"> & {
782
+ id: string;
783
+ }> | undefined;
784
+ }, {
785
+ planKey: "monthly" | "quarterly" | "yearly";
786
+ status: "pending" | "cancelled" | "expired" | "active" | "paused" | "inactive";
787
+ isActive: boolean;
788
+ renewalCount: number;
789
+ pausedAt?: NativeDate | null | undefined;
790
+ endDate?: NativeDate | null | undefined;
791
+ lastPaymentDate?: NativeDate | null | undefined;
792
+ lastPaymentAmount?: number | null | undefined;
793
+ startDate?: NativeDate | null | undefined;
794
+ canceledAt?: NativeDate | null | undefined;
795
+ cancelAt?: NativeDate | null | undefined;
796
+ } & {
797
+ _id: mongoose.Types.ObjectId;
798
+ } & {
799
+ __v: number;
800
+ }>;
801
+
802
+ /**
803
+ * Hold/Escrow Schema
804
+ * @classytic/revenue
805
+ *
806
+ * Schema for platform-as-intermediary escrow flow
807
+ * Spread into transaction schema when needed
808
+ */
809
+ declare const holdSchema: {
810
+ readonly status: {
811
+ readonly type: StringConstructor;
812
+ readonly enum: ("pending" | "cancelled" | "expired" | "held" | "released" | "partially_released")[];
813
+ readonly default: "pending";
814
+ readonly index: true;
815
+ };
816
+ readonly heldAmount: {
817
+ readonly type: NumberConstructor;
818
+ readonly required: false;
819
+ };
820
+ readonly releasedAmount: {
821
+ readonly type: NumberConstructor;
822
+ readonly default: 0;
823
+ };
824
+ readonly reason: {
825
+ readonly type: StringConstructor;
826
+ readonly enum: ("payment_verification" | "fraud_check" | "manual_review" | "dispute" | "compliance")[];
827
+ readonly required: false;
828
+ };
829
+ readonly holdUntil: {
830
+ readonly type: DateConstructor;
831
+ readonly required: false;
832
+ };
833
+ readonly heldAt: DateConstructor;
834
+ readonly releasedAt: DateConstructor;
835
+ readonly cancelledAt: DateConstructor;
836
+ readonly releases: readonly [{
837
+ readonly amount: NumberConstructor;
838
+ readonly recipientId: StringConstructor;
839
+ readonly recipientType: StringConstructor;
840
+ readonly releasedAt: DateConstructor;
841
+ readonly releasedBy: StringConstructor;
842
+ readonly reason: StringConstructor;
843
+ readonly metadata: ObjectConstructor;
844
+ }];
845
+ readonly metadata: {
846
+ readonly type: ObjectConstructor;
847
+ readonly default: {};
848
+ };
849
+ };
850
+
851
+ /**
852
+ * Split Schema - Embedded in Transaction
853
+ */
854
+ declare const splitSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
855
+ _id: false;
856
+ }, {
857
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
858
+ metadata: any;
859
+ recipientId: string;
860
+ grossAmount: number;
861
+ netAmount: number;
862
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
863
+ rate: number;
864
+ gatewayFeeRate: number;
865
+ gatewayFeeAmount: number;
866
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
867
+ dueDate?: NativeDate | null | undefined;
868
+ paidDate?: NativeDate | null | undefined;
869
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
870
+ payoutTransactionId?: string | null | undefined;
871
+ }, mongoose.Document<unknown, {}, {
872
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
873
+ metadata: any;
874
+ recipientId: string;
875
+ grossAmount: number;
876
+ netAmount: number;
877
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
878
+ rate: number;
879
+ gatewayFeeRate: number;
880
+ gatewayFeeAmount: number;
881
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
882
+ dueDate?: NativeDate | null | undefined;
883
+ paidDate?: NativeDate | null | undefined;
884
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
885
+ payoutTransactionId?: string | null | undefined;
886
+ }, {
887
+ id: string;
888
+ }, mongoose.ResolveSchemaOptions<{
889
+ _id: false;
890
+ }>> & Omit<{
891
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
892
+ metadata: any;
893
+ recipientId: string;
894
+ grossAmount: number;
895
+ netAmount: number;
896
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
897
+ rate: number;
898
+ gatewayFeeRate: number;
899
+ gatewayFeeAmount: number;
900
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
901
+ dueDate?: NativeDate | null | undefined;
902
+ paidDate?: NativeDate | null | undefined;
903
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
904
+ payoutTransactionId?: string | null | undefined;
905
+ } & {
906
+ _id: mongoose.Types.ObjectId;
907
+ } & {
908
+ __v: number;
909
+ }, "id"> & {
910
+ id: string;
911
+ }, {
912
+ [path: string]: mongoose.SchemaDefinitionProperty<undefined, any, any>;
913
+ } | {
914
+ [x: string]: mongoose.SchemaDefinitionProperty<any, any, mongoose.Document<unknown, {}, {
915
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
916
+ metadata: any;
917
+ recipientId: string;
918
+ grossAmount: number;
919
+ netAmount: number;
920
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
921
+ rate: number;
922
+ gatewayFeeRate: number;
923
+ gatewayFeeAmount: number;
924
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
925
+ dueDate?: NativeDate | null | undefined;
926
+ paidDate?: NativeDate | null | undefined;
927
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
928
+ payoutTransactionId?: string | null | undefined;
929
+ }, {
930
+ id: string;
931
+ }, mongoose.ResolveSchemaOptions<{
932
+ _id: false;
933
+ }>> & Omit<{
934
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
935
+ metadata: any;
936
+ recipientId: string;
937
+ grossAmount: number;
938
+ netAmount: number;
939
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
940
+ rate: number;
941
+ gatewayFeeRate: number;
942
+ gatewayFeeAmount: number;
943
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
944
+ dueDate?: NativeDate | null | undefined;
945
+ paidDate?: NativeDate | null | undefined;
946
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
947
+ payoutTransactionId?: string | null | undefined;
948
+ } & {
949
+ _id: mongoose.Types.ObjectId;
950
+ } & {
951
+ __v: number;
952
+ }, "id"> & {
953
+ id: string;
954
+ }> | undefined;
955
+ }, {
956
+ type: "platform_commission" | "affiliate_commission" | "referral_commission" | "partner_commission" | "custom";
957
+ metadata: any;
958
+ recipientId: string;
959
+ grossAmount: number;
960
+ netAmount: number;
961
+ status: "pending" | "cancelled" | "paid" | "waived" | "due";
962
+ rate: number;
963
+ gatewayFeeRate: number;
964
+ gatewayFeeAmount: number;
965
+ recipientType: "user" | "platform" | "organization" | "affiliate" | "partner";
966
+ dueDate?: NativeDate | null | undefined;
967
+ paidDate?: NativeDate | null | undefined;
968
+ payoutMethod?: "manual" | "bank_transfer" | "mobile_wallet" | "platform_balance" | "crypto" | "check" | null | undefined;
969
+ payoutTransactionId?: string | null | undefined;
970
+ } & {
971
+ _id: mongoose.Types.ObjectId;
972
+ } & {
973
+ __v: number;
974
+ }>;
975
+
976
+ 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 };