@classytic/revenue 1.0.6 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +582 -633
- package/dist/application/services/index.d.mts +4 -0
- package/dist/application/services/index.mjs +3 -0
- package/dist/base-CsTlVQJe.d.mts +136 -0
- package/dist/base-DCoyIUj6.mjs +152 -0
- package/dist/category-resolver-DV83N8ok.mjs +284 -0
- package/dist/commission-split-BzB8cd39.mjs +485 -0
- package/dist/core/events.d.mts +294 -0
- package/dist/core/events.mjs +100 -0
- package/dist/core/index.d.mts +9 -0
- package/dist/core/index.mjs +8 -0
- package/dist/enums/index.d.mts +157 -0
- package/dist/enums/index.mjs +56 -0
- package/dist/errors-CorrWz7A.d.mts +787 -0
- package/dist/escrow.enums-CZGrrdg7.mjs +101 -0
- package/dist/escrow.enums-DwdLuuve.d.mts +78 -0
- package/dist/idempotency-DaYcUGY1.mjs +172 -0
- package/dist/index-Dsp7H5Wb.d.mts +471 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +38 -0
- package/dist/infrastructure/plugins/index.d.mts +239 -0
- package/dist/infrastructure/plugins/index.mjs +345 -0
- package/dist/money-CvrDOijQ.mjs +271 -0
- package/dist/money-DPG8AtJ8.d.mts +112 -0
- package/dist/payment.enums-HAuAS9Pp.d.mts +70 -0
- package/dist/payment.enums-tEFVa-Xp.mjs +69 -0
- package/dist/plugin-BbK0OVHy.d.mts +327 -0
- package/dist/plugin-Cd_V04Em.mjs +210 -0
- package/dist/providers/index.d.mts +3 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/reconciliation/index.d.mts +193 -0
- package/dist/reconciliation/index.mjs +192 -0
- package/dist/retry-HHCOXYdn.d.mts +186 -0
- package/dist/revenue-9scqKSef.mjs +553 -0
- package/dist/schemas/index.d.mts +2665 -0
- package/dist/schemas/index.mjs +717 -0
- package/dist/schemas/validation.d.mts +375 -0
- package/dist/schemas/validation.mjs +325 -0
- package/dist/settlement.enums-DFhkqZEY.d.mts +132 -0
- package/dist/settlement.schema-D5uWB5tP.d.mts +344 -0
- package/dist/settlement.service-BxuiHpNC.d.mts +594 -0
- package/dist/settlement.service-CUxbUTzT.mjs +2510 -0
- package/dist/split.enums-BrjabxIX.mjs +86 -0
- package/dist/split.enums-DmskfLOM.d.mts +43 -0
- package/dist/tax-BoCt5cEd.d.mts +61 -0
- package/dist/tax-EQ15DO81.mjs +162 -0
- package/dist/transaction.enums-pCyMFT4Z.mjs +96 -0
- package/dist/utils/index.d.mts +428 -0
- package/dist/utils/index.mjs +346 -0
- package/package.json +48 -33
- package/dist/actions-Ctf2XUL-.d.ts +0 -519
- package/dist/core/index.d.ts +0 -890
- package/dist/core/index.js +0 -3005
- package/dist/core/index.js.map +0 -1
- package/dist/enums/index.d.ts +0 -138
- package/dist/enums/index.js +0 -263
- package/dist/enums/index.js.map +0 -1
- package/dist/index-BnEXsnLJ.d.ts +0 -378
- package/dist/index-C5SsOrV0.d.ts +0 -534
- package/dist/index.d.ts +0 -43
- package/dist/index.js +0 -4498
- package/dist/index.js.map +0 -1
- package/dist/payment.enums-B_RwB8iR.d.ts +0 -184
- package/dist/providers/index.d.ts +0 -132
- package/dist/providers/index.js +0 -122
- package/dist/providers/index.js.map +0 -1
- package/dist/retry-80lBCmSe.d.ts +0 -234
- package/dist/schemas/index.d.ts +0 -1051
- package/dist/schemas/index.js +0 -627
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/validation.d.ts +0 -384
- package/dist/schemas/validation.js +0 -302
- package/dist/schemas/validation.js.map +0 -1
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +0 -1702
- package/dist/services/index.js.map +0 -1
- package/dist/split.schema-DLVF3XBI.d.ts +0 -1122
- package/dist/transaction.enums-7uBnuswI.d.ts +0 -87
- package/dist/utils/index.d.ts +0 -24
- package/dist/utils/index.js +0 -1140
- package/dist/utils/index.js.map +0 -1
package/dist/schemas/index.js
DELETED
|
@@ -1,627 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
// @classytic/revenue - Enterprise Revenue Management System
|
|
4
|
-
|
|
5
|
-
var baseMetadataSchema = new Schema(
|
|
6
|
-
{
|
|
7
|
-
// Flexible key-value metadata
|
|
8
|
-
},
|
|
9
|
-
{ _id: false, strict: false }
|
|
10
|
-
);
|
|
11
|
-
var referenceSchema = {
|
|
12
|
-
referenceId: {
|
|
13
|
-
type: Schema.Types.ObjectId,
|
|
14
|
-
refPath: "referenceModel"
|
|
15
|
-
},
|
|
16
|
-
referenceModel: {
|
|
17
|
-
type: String,
|
|
18
|
-
enum: ["Subscription", "Order", "Membership", "Booking", "Invoice"]
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var gatewaySchema = new Schema(
|
|
22
|
-
{
|
|
23
|
-
type: {
|
|
24
|
-
type: String,
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
sessionId: {
|
|
28
|
-
type: String,
|
|
29
|
-
sparse: true
|
|
30
|
-
},
|
|
31
|
-
paymentIntentId: {
|
|
32
|
-
type: String,
|
|
33
|
-
sparse: true
|
|
34
|
-
},
|
|
35
|
-
provider: {
|
|
36
|
-
type: String
|
|
37
|
-
},
|
|
38
|
-
metadata: {
|
|
39
|
-
type: Schema.Types.Mixed,
|
|
40
|
-
default: {}
|
|
41
|
-
},
|
|
42
|
-
verificationData: {
|
|
43
|
-
type: Schema.Types.Mixed
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{ _id: false }
|
|
47
|
-
);
|
|
48
|
-
var gateway_schema_default = gatewaySchema;
|
|
49
|
-
|
|
50
|
-
// src/enums/transaction.enums.ts
|
|
51
|
-
var TRANSACTION_TYPE = {
|
|
52
|
-
INCOME: "income",
|
|
53
|
-
EXPENSE: "expense"
|
|
54
|
-
};
|
|
55
|
-
var TRANSACTION_TYPE_VALUES = Object.values(
|
|
56
|
-
TRANSACTION_TYPE
|
|
57
|
-
);
|
|
58
|
-
var TRANSACTION_STATUS = {
|
|
59
|
-
PENDING: "pending",
|
|
60
|
-
PAYMENT_INITIATED: "payment_initiated",
|
|
61
|
-
PROCESSING: "processing",
|
|
62
|
-
REQUIRES_ACTION: "requires_action",
|
|
63
|
-
VERIFIED: "verified",
|
|
64
|
-
COMPLETED: "completed",
|
|
65
|
-
FAILED: "failed",
|
|
66
|
-
CANCELLED: "cancelled",
|
|
67
|
-
EXPIRED: "expired",
|
|
68
|
-
REFUNDED: "refunded",
|
|
69
|
-
PARTIALLY_REFUNDED: "partially_refunded"
|
|
70
|
-
};
|
|
71
|
-
var TRANSACTION_STATUS_VALUES = Object.values(
|
|
72
|
-
TRANSACTION_STATUS
|
|
73
|
-
);
|
|
74
|
-
var LIBRARY_CATEGORIES = {
|
|
75
|
-
SUBSCRIPTION: "subscription",
|
|
76
|
-
PURCHASE: "purchase"
|
|
77
|
-
};
|
|
78
|
-
var LIBRARY_CATEGORY_VALUES = Object.values(
|
|
79
|
-
LIBRARY_CATEGORIES
|
|
80
|
-
);
|
|
81
|
-
new Set(TRANSACTION_TYPE_VALUES);
|
|
82
|
-
new Set(
|
|
83
|
-
TRANSACTION_STATUS_VALUES
|
|
84
|
-
);
|
|
85
|
-
new Set(LIBRARY_CATEGORY_VALUES);
|
|
86
|
-
|
|
87
|
-
// src/enums/payment.enums.ts
|
|
88
|
-
var PAYMENT_STATUS = {
|
|
89
|
-
PENDING: "pending",
|
|
90
|
-
VERIFIED: "verified",
|
|
91
|
-
FAILED: "failed",
|
|
92
|
-
REFUNDED: "refunded",
|
|
93
|
-
CANCELLED: "cancelled"
|
|
94
|
-
};
|
|
95
|
-
var PAYMENT_STATUS_VALUES = Object.values(
|
|
96
|
-
PAYMENT_STATUS
|
|
97
|
-
);
|
|
98
|
-
var PAYMENT_GATEWAY_TYPE = {
|
|
99
|
-
MANUAL: "manual",
|
|
100
|
-
STRIPE: "stripe",
|
|
101
|
-
SSLCOMMERZ: "sslcommerz"
|
|
102
|
-
};
|
|
103
|
-
var PAYMENT_GATEWAY_TYPE_VALUES = Object.values(
|
|
104
|
-
PAYMENT_GATEWAY_TYPE
|
|
105
|
-
);
|
|
106
|
-
new Set(PAYMENT_STATUS_VALUES);
|
|
107
|
-
new Set(
|
|
108
|
-
PAYMENT_GATEWAY_TYPE_VALUES
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
// src/enums/subscription.enums.ts
|
|
112
|
-
var SUBSCRIPTION_STATUS = {
|
|
113
|
-
ACTIVE: "active",
|
|
114
|
-
PAUSED: "paused",
|
|
115
|
-
CANCELLED: "cancelled",
|
|
116
|
-
EXPIRED: "expired",
|
|
117
|
-
PENDING: "pending",
|
|
118
|
-
INACTIVE: "inactive"
|
|
119
|
-
};
|
|
120
|
-
var SUBSCRIPTION_STATUS_VALUES = Object.values(
|
|
121
|
-
SUBSCRIPTION_STATUS
|
|
122
|
-
);
|
|
123
|
-
var PLAN_KEYS = {
|
|
124
|
-
MONTHLY: "monthly",
|
|
125
|
-
QUARTERLY: "quarterly",
|
|
126
|
-
YEARLY: "yearly"
|
|
127
|
-
};
|
|
128
|
-
var PLAN_KEY_VALUES = Object.values(PLAN_KEYS);
|
|
129
|
-
new Set(
|
|
130
|
-
SUBSCRIPTION_STATUS_VALUES
|
|
131
|
-
);
|
|
132
|
-
new Set(PLAN_KEY_VALUES);
|
|
133
|
-
|
|
134
|
-
// src/enums/monetization.enums.ts
|
|
135
|
-
var MONETIZATION_TYPES = {
|
|
136
|
-
FREE: "free",
|
|
137
|
-
PURCHASE: "purchase",
|
|
138
|
-
SUBSCRIPTION: "subscription"
|
|
139
|
-
};
|
|
140
|
-
var MONETIZATION_TYPE_VALUES = Object.values(
|
|
141
|
-
MONETIZATION_TYPES
|
|
142
|
-
);
|
|
143
|
-
new Set(MONETIZATION_TYPE_VALUES);
|
|
144
|
-
|
|
145
|
-
// src/enums/escrow.enums.ts
|
|
146
|
-
var HOLD_STATUS = {
|
|
147
|
-
PENDING: "pending",
|
|
148
|
-
HELD: "held",
|
|
149
|
-
RELEASED: "released",
|
|
150
|
-
CANCELLED: "cancelled",
|
|
151
|
-
EXPIRED: "expired",
|
|
152
|
-
PARTIALLY_RELEASED: "partially_released"
|
|
153
|
-
};
|
|
154
|
-
var HOLD_STATUS_VALUES = Object.values(HOLD_STATUS);
|
|
155
|
-
var RELEASE_REASON = {
|
|
156
|
-
PAYMENT_VERIFIED: "payment_verified",
|
|
157
|
-
MANUAL_RELEASE: "manual_release",
|
|
158
|
-
AUTO_RELEASE: "auto_release",
|
|
159
|
-
DISPUTE_RESOLVED: "dispute_resolved"
|
|
160
|
-
};
|
|
161
|
-
var RELEASE_REASON_VALUES = Object.values(
|
|
162
|
-
RELEASE_REASON
|
|
163
|
-
);
|
|
164
|
-
var HOLD_REASON = {
|
|
165
|
-
PAYMENT_VERIFICATION: "payment_verification",
|
|
166
|
-
FRAUD_CHECK: "fraud_check",
|
|
167
|
-
MANUAL_REVIEW: "manual_review",
|
|
168
|
-
DISPUTE: "dispute",
|
|
169
|
-
COMPLIANCE: "compliance"
|
|
170
|
-
};
|
|
171
|
-
var HOLD_REASON_VALUES = Object.values(HOLD_REASON);
|
|
172
|
-
new Set(HOLD_STATUS_VALUES);
|
|
173
|
-
new Set(RELEASE_REASON_VALUES);
|
|
174
|
-
new Set(HOLD_REASON_VALUES);
|
|
175
|
-
|
|
176
|
-
// src/enums/split.enums.ts
|
|
177
|
-
var SPLIT_TYPE = {
|
|
178
|
-
PLATFORM_COMMISSION: "platform_commission",
|
|
179
|
-
AFFILIATE_COMMISSION: "affiliate_commission",
|
|
180
|
-
REFERRAL_COMMISSION: "referral_commission",
|
|
181
|
-
PARTNER_COMMISSION: "partner_commission",
|
|
182
|
-
CUSTOM: "custom"
|
|
183
|
-
};
|
|
184
|
-
var SPLIT_TYPE_VALUES = Object.values(SPLIT_TYPE);
|
|
185
|
-
var SPLIT_STATUS = {
|
|
186
|
-
PENDING: "pending",
|
|
187
|
-
DUE: "due",
|
|
188
|
-
PAID: "paid",
|
|
189
|
-
WAIVED: "waived",
|
|
190
|
-
CANCELLED: "cancelled"
|
|
191
|
-
};
|
|
192
|
-
var SPLIT_STATUS_VALUES = Object.values(
|
|
193
|
-
SPLIT_STATUS
|
|
194
|
-
);
|
|
195
|
-
var PAYOUT_METHOD = {
|
|
196
|
-
BANK_TRANSFER: "bank_transfer",
|
|
197
|
-
MOBILE_WALLET: "mobile_wallet",
|
|
198
|
-
PLATFORM_BALANCE: "platform_balance",
|
|
199
|
-
CRYPTO: "crypto",
|
|
200
|
-
CHECK: "check",
|
|
201
|
-
MANUAL: "manual"
|
|
202
|
-
};
|
|
203
|
-
var PAYOUT_METHOD_VALUES = Object.values(PAYOUT_METHOD);
|
|
204
|
-
new Set(SPLIT_TYPE_VALUES);
|
|
205
|
-
new Set(SPLIT_STATUS_VALUES);
|
|
206
|
-
new Set(PAYOUT_METHOD_VALUES);
|
|
207
|
-
|
|
208
|
-
// src/schemas/transaction/payment.schema.ts
|
|
209
|
-
var paymentEntrySchema = new Schema(
|
|
210
|
-
{
|
|
211
|
-
method: {
|
|
212
|
-
type: String,
|
|
213
|
-
required: true
|
|
214
|
-
},
|
|
215
|
-
amount: {
|
|
216
|
-
type: Number,
|
|
217
|
-
required: true,
|
|
218
|
-
min: 0
|
|
219
|
-
},
|
|
220
|
-
reference: {
|
|
221
|
-
type: String,
|
|
222
|
-
trim: true
|
|
223
|
-
},
|
|
224
|
-
details: {
|
|
225
|
-
type: Schema.Types.Mixed
|
|
226
|
-
// For method-specific data: walletNumber, bankName, trxId, etc.
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{ _id: false }
|
|
230
|
-
);
|
|
231
|
-
var currentPaymentSchema = new Schema(
|
|
232
|
-
{
|
|
233
|
-
transactionId: {
|
|
234
|
-
type: Schema.Types.ObjectId,
|
|
235
|
-
ref: "Transaction"
|
|
236
|
-
},
|
|
237
|
-
amount: {
|
|
238
|
-
type: Number,
|
|
239
|
-
min: 0
|
|
240
|
-
// Total amount (sum of all payments for split payments)
|
|
241
|
-
},
|
|
242
|
-
status: {
|
|
243
|
-
type: String,
|
|
244
|
-
enum: PAYMENT_STATUS_VALUES,
|
|
245
|
-
default: "pending"
|
|
246
|
-
},
|
|
247
|
-
method: {
|
|
248
|
-
type: String
|
|
249
|
-
// Primary method for single payments, or 'split' when multiple methods
|
|
250
|
-
},
|
|
251
|
-
reference: {
|
|
252
|
-
type: String,
|
|
253
|
-
trim: true
|
|
254
|
-
},
|
|
255
|
-
// Split payments support - array of individual payment entries
|
|
256
|
-
payments: {
|
|
257
|
-
type: [paymentEntrySchema],
|
|
258
|
-
default: void 0
|
|
259
|
-
// Not set for single payments (backward compat)
|
|
260
|
-
},
|
|
261
|
-
verifiedAt: {
|
|
262
|
-
type: Date
|
|
263
|
-
},
|
|
264
|
-
verifiedBy: {
|
|
265
|
-
type: Schema.Types.ObjectId,
|
|
266
|
-
ref: "User"
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
{ _id: false }
|
|
270
|
-
);
|
|
271
|
-
var paymentSummarySchema = new Schema(
|
|
272
|
-
{
|
|
273
|
-
totalPayments: {
|
|
274
|
-
type: Number,
|
|
275
|
-
default: 0,
|
|
276
|
-
min: 0
|
|
277
|
-
},
|
|
278
|
-
totalAmountPaid: {
|
|
279
|
-
type: Number,
|
|
280
|
-
default: 0,
|
|
281
|
-
min: 0
|
|
282
|
-
},
|
|
283
|
-
lastPaymentDate: {
|
|
284
|
-
type: Date
|
|
285
|
-
},
|
|
286
|
-
lastPaymentAmount: {
|
|
287
|
-
type: Number,
|
|
288
|
-
min: 0
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
{ _id: false }
|
|
292
|
-
);
|
|
293
|
-
var paymentDetailsSchema = new Schema(
|
|
294
|
-
{
|
|
295
|
-
provider: { type: String },
|
|
296
|
-
walletNumber: { type: String },
|
|
297
|
-
walletType: { type: String },
|
|
298
|
-
trxId: { type: String },
|
|
299
|
-
bankName: { type: String },
|
|
300
|
-
accountNumber: { type: String },
|
|
301
|
-
accountName: { type: String },
|
|
302
|
-
proofUrl: { type: String }
|
|
303
|
-
},
|
|
304
|
-
{ _id: false }
|
|
305
|
-
);
|
|
306
|
-
var tenantSnapshotSchema = new Schema(
|
|
307
|
-
{
|
|
308
|
-
paymentInstructions: { type: String },
|
|
309
|
-
bkashNumber: { type: String },
|
|
310
|
-
nagadNumber: { type: String },
|
|
311
|
-
bankAccount: { type: String }
|
|
312
|
-
},
|
|
313
|
-
{ _id: false }
|
|
314
|
-
);
|
|
315
|
-
var payment_schema_default = {
|
|
316
|
-
paymentEntrySchema,
|
|
317
|
-
currentPaymentSchema,
|
|
318
|
-
paymentSummarySchema,
|
|
319
|
-
paymentDetailsSchema,
|
|
320
|
-
tenantSnapshotSchema
|
|
321
|
-
};
|
|
322
|
-
var commissionSchema = new Schema(
|
|
323
|
-
{
|
|
324
|
-
// Commission rate (e.g., 0.10 for 10%)
|
|
325
|
-
rate: {
|
|
326
|
-
type: Number,
|
|
327
|
-
min: 0,
|
|
328
|
-
max: 1
|
|
329
|
-
},
|
|
330
|
-
// Gross commission amount (before gateway fees)
|
|
331
|
-
grossAmount: {
|
|
332
|
-
type: Number,
|
|
333
|
-
min: 0
|
|
334
|
-
},
|
|
335
|
-
// Gateway fee rate (e.g., 0.029 for 2.9%)
|
|
336
|
-
gatewayFeeRate: {
|
|
337
|
-
type: Number,
|
|
338
|
-
min: 0,
|
|
339
|
-
max: 1
|
|
340
|
-
},
|
|
341
|
-
// Gateway fee amount deducted from commission
|
|
342
|
-
gatewayFeeAmount: {
|
|
343
|
-
type: Number,
|
|
344
|
-
min: 0
|
|
345
|
-
},
|
|
346
|
-
// Net commission (grossAmount - gatewayFeeAmount)
|
|
347
|
-
netAmount: {
|
|
348
|
-
type: Number,
|
|
349
|
-
min: 0
|
|
350
|
-
},
|
|
351
|
-
// Commission status
|
|
352
|
-
status: {
|
|
353
|
-
type: String,
|
|
354
|
-
enum: ["pending", "paid", "waived", "reversed"],
|
|
355
|
-
default: "pending"
|
|
356
|
-
},
|
|
357
|
-
// For affiliate tracking
|
|
358
|
-
affiliate: {
|
|
359
|
-
recipientId: String,
|
|
360
|
-
recipientType: {
|
|
361
|
-
type: String,
|
|
362
|
-
enum: ["user", "organization", "partner"]
|
|
363
|
-
},
|
|
364
|
-
rate: Number,
|
|
365
|
-
grossAmount: Number,
|
|
366
|
-
netAmount: Number
|
|
367
|
-
},
|
|
368
|
-
// For multi-party splits
|
|
369
|
-
splits: [
|
|
370
|
-
{
|
|
371
|
-
type: String,
|
|
372
|
-
recipientId: String,
|
|
373
|
-
rate: Number,
|
|
374
|
-
grossAmount: Number,
|
|
375
|
-
netAmount: Number
|
|
376
|
-
}
|
|
377
|
-
]
|
|
378
|
-
},
|
|
379
|
-
{ _id: false }
|
|
380
|
-
);
|
|
381
|
-
var commission_schema_default = commissionSchema;
|
|
382
|
-
|
|
383
|
-
// src/schemas/transaction/index.ts
|
|
384
|
-
var transaction_default = {
|
|
385
|
-
baseMetadataSchema,
|
|
386
|
-
referenceSchema,
|
|
387
|
-
gatewaySchema: gateway_schema_default,
|
|
388
|
-
commissionSchema: commission_schema_default,
|
|
389
|
-
...payment_schema_default
|
|
390
|
-
};
|
|
391
|
-
var planSchema = new Schema(
|
|
392
|
-
{
|
|
393
|
-
key: {
|
|
394
|
-
type: String,
|
|
395
|
-
enum: PLAN_KEY_VALUES,
|
|
396
|
-
required: true
|
|
397
|
-
},
|
|
398
|
-
name: {
|
|
399
|
-
type: String,
|
|
400
|
-
required: true
|
|
401
|
-
},
|
|
402
|
-
description: {
|
|
403
|
-
type: String
|
|
404
|
-
},
|
|
405
|
-
amount: {
|
|
406
|
-
type: Number,
|
|
407
|
-
required: true,
|
|
408
|
-
min: 0
|
|
409
|
-
},
|
|
410
|
-
currency: {
|
|
411
|
-
type: String,
|
|
412
|
-
default: "BDT"
|
|
413
|
-
},
|
|
414
|
-
interval: {
|
|
415
|
-
type: String,
|
|
416
|
-
enum: ["day", "week", "month", "year"],
|
|
417
|
-
default: "month"
|
|
418
|
-
},
|
|
419
|
-
intervalCount: {
|
|
420
|
-
type: Number,
|
|
421
|
-
default: 1,
|
|
422
|
-
min: 1
|
|
423
|
-
},
|
|
424
|
-
features: [
|
|
425
|
-
{
|
|
426
|
-
type: String
|
|
427
|
-
}
|
|
428
|
-
],
|
|
429
|
-
metadata: {
|
|
430
|
-
type: Schema.Types.Mixed,
|
|
431
|
-
default: {}
|
|
432
|
-
},
|
|
433
|
-
isActive: {
|
|
434
|
-
type: Boolean,
|
|
435
|
-
default: true
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
{ _id: false }
|
|
439
|
-
);
|
|
440
|
-
var plan_schema_default = planSchema;
|
|
441
|
-
var subscriptionInfoSchema = new Schema(
|
|
442
|
-
{
|
|
443
|
-
planKey: {
|
|
444
|
-
type: String,
|
|
445
|
-
enum: PLAN_KEY_VALUES,
|
|
446
|
-
required: true
|
|
447
|
-
},
|
|
448
|
-
status: {
|
|
449
|
-
type: String,
|
|
450
|
-
enum: SUBSCRIPTION_STATUS_VALUES,
|
|
451
|
-
default: "pending"
|
|
452
|
-
},
|
|
453
|
-
isActive: {
|
|
454
|
-
type: Boolean,
|
|
455
|
-
default: false
|
|
456
|
-
},
|
|
457
|
-
startDate: {
|
|
458
|
-
type: Date
|
|
459
|
-
},
|
|
460
|
-
endDate: {
|
|
461
|
-
type: Date
|
|
462
|
-
},
|
|
463
|
-
canceledAt: {
|
|
464
|
-
type: Date
|
|
465
|
-
},
|
|
466
|
-
cancelAt: {
|
|
467
|
-
type: Date
|
|
468
|
-
},
|
|
469
|
-
pausedAt: {
|
|
470
|
-
type: Date
|
|
471
|
-
},
|
|
472
|
-
lastPaymentDate: {
|
|
473
|
-
type: Date
|
|
474
|
-
},
|
|
475
|
-
lastPaymentAmount: {
|
|
476
|
-
type: Number
|
|
477
|
-
},
|
|
478
|
-
renewalCount: {
|
|
479
|
-
type: Number,
|
|
480
|
-
default: 0
|
|
481
|
-
}
|
|
482
|
-
},
|
|
483
|
-
{ _id: false }
|
|
484
|
-
);
|
|
485
|
-
var info_schema_default = subscriptionInfoSchema;
|
|
486
|
-
|
|
487
|
-
// src/schemas/subscription/index.ts
|
|
488
|
-
var subscription_default = {
|
|
489
|
-
planSchema: plan_schema_default,
|
|
490
|
-
subscriptionInfoSchema: info_schema_default
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
// src/schemas/escrow/hold.schema.ts
|
|
494
|
-
var holdSchema = {
|
|
495
|
-
status: {
|
|
496
|
-
type: String,
|
|
497
|
-
enum: HOLD_STATUS_VALUES,
|
|
498
|
-
default: HOLD_STATUS.PENDING
|
|
499
|
-
},
|
|
500
|
-
heldAmount: {
|
|
501
|
-
type: Number,
|
|
502
|
-
required: false
|
|
503
|
-
},
|
|
504
|
-
releasedAmount: {
|
|
505
|
-
type: Number,
|
|
506
|
-
default: 0
|
|
507
|
-
},
|
|
508
|
-
reason: {
|
|
509
|
-
type: String,
|
|
510
|
-
enum: HOLD_REASON_VALUES,
|
|
511
|
-
required: false
|
|
512
|
-
},
|
|
513
|
-
holdUntil: {
|
|
514
|
-
type: Date,
|
|
515
|
-
required: false
|
|
516
|
-
},
|
|
517
|
-
heldAt: Date,
|
|
518
|
-
releasedAt: Date,
|
|
519
|
-
cancelledAt: Date,
|
|
520
|
-
releases: [
|
|
521
|
-
{
|
|
522
|
-
amount: Number,
|
|
523
|
-
recipientId: String,
|
|
524
|
-
recipientType: String,
|
|
525
|
-
releasedAt: Date,
|
|
526
|
-
releasedBy: String,
|
|
527
|
-
reason: String,
|
|
528
|
-
metadata: Object
|
|
529
|
-
}
|
|
530
|
-
],
|
|
531
|
-
metadata: {
|
|
532
|
-
type: Object,
|
|
533
|
-
default: {}
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
var hold_schema_default = holdSchema;
|
|
537
|
-
|
|
538
|
-
// src/schemas/escrow/index.ts
|
|
539
|
-
var escrow_default = {
|
|
540
|
-
holdSchema: hold_schema_default
|
|
541
|
-
};
|
|
542
|
-
var splitSchema = new Schema(
|
|
543
|
-
{
|
|
544
|
-
type: {
|
|
545
|
-
type: String,
|
|
546
|
-
enum: SPLIT_TYPE_VALUES,
|
|
547
|
-
required: true
|
|
548
|
-
},
|
|
549
|
-
recipientId: {
|
|
550
|
-
type: String,
|
|
551
|
-
required: true
|
|
552
|
-
},
|
|
553
|
-
recipientType: {
|
|
554
|
-
type: String,
|
|
555
|
-
enum: ["platform", "organization", "user", "affiliate", "partner"],
|
|
556
|
-
required: true
|
|
557
|
-
},
|
|
558
|
-
rate: {
|
|
559
|
-
type: Number,
|
|
560
|
-
required: true,
|
|
561
|
-
min: 0,
|
|
562
|
-
max: 1
|
|
563
|
-
},
|
|
564
|
-
grossAmount: {
|
|
565
|
-
type: Number,
|
|
566
|
-
required: true,
|
|
567
|
-
min: 0
|
|
568
|
-
},
|
|
569
|
-
gatewayFeeRate: {
|
|
570
|
-
type: Number,
|
|
571
|
-
default: 0,
|
|
572
|
-
min: 0,
|
|
573
|
-
max: 1
|
|
574
|
-
},
|
|
575
|
-
gatewayFeeAmount: {
|
|
576
|
-
type: Number,
|
|
577
|
-
default: 0,
|
|
578
|
-
min: 0
|
|
579
|
-
},
|
|
580
|
-
netAmount: {
|
|
581
|
-
type: Number,
|
|
582
|
-
required: true,
|
|
583
|
-
min: 0
|
|
584
|
-
},
|
|
585
|
-
status: {
|
|
586
|
-
type: String,
|
|
587
|
-
enum: SPLIT_STATUS_VALUES,
|
|
588
|
-
default: SPLIT_STATUS.PENDING
|
|
589
|
-
},
|
|
590
|
-
dueDate: {
|
|
591
|
-
type: Date
|
|
592
|
-
},
|
|
593
|
-
paidDate: {
|
|
594
|
-
type: Date
|
|
595
|
-
},
|
|
596
|
-
payoutMethod: {
|
|
597
|
-
type: String,
|
|
598
|
-
enum: PAYOUT_METHOD_VALUES
|
|
599
|
-
},
|
|
600
|
-
payoutTransactionId: {
|
|
601
|
-
type: String
|
|
602
|
-
},
|
|
603
|
-
metadata: {
|
|
604
|
-
type: Schema.Types.Mixed,
|
|
605
|
-
default: {}
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
{ _id: false }
|
|
609
|
-
);
|
|
610
|
-
var split_schema_default = splitSchema;
|
|
611
|
-
|
|
612
|
-
// src/schemas/split/index.ts
|
|
613
|
-
var split_default = {
|
|
614
|
-
splitSchema: split_schema_default
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
// src/schemas/index.ts
|
|
618
|
-
var schemas_default = {
|
|
619
|
-
...transaction_default,
|
|
620
|
-
...subscription_default,
|
|
621
|
-
...escrow_default,
|
|
622
|
-
...split_default
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
export { baseMetadataSchema, commissionSchema, currentPaymentSchema, schemas_default as default, gatewaySchema, holdSchema, paymentDetailsSchema, paymentEntrySchema, paymentSummarySchema, planSchema, referenceSchema, splitSchema, subscriptionInfoSchema, tenantSnapshotSchema };
|
|
626
|
-
//# sourceMappingURL=index.js.map
|
|
627
|
-
//# sourceMappingURL=index.js.map
|