@classytic/revenue 0.0.24 → 0.2.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 (57) hide show
  1. package/README.md +184 -24
  2. package/core/builder.js +51 -4
  3. package/dist/types/core/builder.d.ts +95 -0
  4. package/dist/types/core/container.d.ts +57 -0
  5. package/dist/types/core/errors.d.ts +122 -0
  6. package/dist/types/enums/escrow.enums.d.ts +24 -0
  7. package/dist/types/enums/index.d.ts +69 -0
  8. package/dist/types/enums/monetization.enums.d.ts +6 -0
  9. package/dist/types/enums/payment.enums.d.ts +16 -0
  10. package/dist/types/enums/split.enums.d.ts +25 -0
  11. package/dist/types/enums/subscription.enums.d.ts +15 -0
  12. package/dist/types/enums/transaction.enums.d.ts +24 -0
  13. package/dist/types/index.d.ts +22 -0
  14. package/dist/types/providers/base.d.ts +126 -0
  15. package/dist/types/schemas/escrow/hold.schema.d.ts +54 -0
  16. package/dist/types/schemas/escrow/index.d.ts +6 -0
  17. package/dist/types/schemas/index.d.ts +506 -0
  18. package/dist/types/schemas/split/index.d.ts +8 -0
  19. package/dist/types/schemas/split/split.schema.d.ts +142 -0
  20. package/dist/types/schemas/subscription/index.d.ts +152 -0
  21. package/dist/types/schemas/subscription/info.schema.d.ts +128 -0
  22. package/dist/types/schemas/subscription/plan.schema.d.ts +39 -0
  23. package/dist/types/schemas/transaction/common.schema.d.ts +12 -0
  24. package/dist/types/schemas/transaction/gateway.schema.d.ts +86 -0
  25. package/dist/types/schemas/transaction/index.d.ts +202 -0
  26. package/dist/types/schemas/transaction/payment.schema.d.ts +145 -0
  27. package/dist/types/services/escrow.service.d.ts +51 -0
  28. package/dist/types/services/payment.service.d.ts +80 -0
  29. package/dist/types/services/subscription.service.d.ts +139 -0
  30. package/dist/types/services/transaction.service.d.ts +40 -0
  31. package/dist/types/utils/category-resolver.d.ts +46 -0
  32. package/dist/types/utils/commission-split.d.ts +56 -0
  33. package/dist/types/utils/commission.d.ts +29 -0
  34. package/dist/types/utils/hooks.d.ts +17 -0
  35. package/dist/types/utils/index.d.ts +6 -0
  36. package/dist/types/utils/logger.d.ts +12 -0
  37. package/dist/types/utils/subscription/actions.d.ts +28 -0
  38. package/dist/types/utils/subscription/index.d.ts +2 -0
  39. package/dist/types/utils/subscription/period.d.ts +47 -0
  40. package/dist/types/utils/transaction-type.d.ts +102 -0
  41. package/enums/escrow.enums.js +36 -0
  42. package/enums/index.js +36 -0
  43. package/enums/payment.enums.js +26 -5
  44. package/enums/split.enums.js +37 -0
  45. package/index.js +8 -2
  46. package/package.json +91 -74
  47. package/schemas/escrow/hold.schema.js +62 -0
  48. package/schemas/escrow/index.js +15 -0
  49. package/schemas/index.js +6 -0
  50. package/schemas/split/index.js +16 -0
  51. package/schemas/split/split.schema.js +86 -0
  52. package/services/escrow.service.js +353 -0
  53. package/services/payment.service.js +64 -3
  54. package/services/subscription.service.js +36 -16
  55. package/utils/commission-split.js +180 -0
  56. package/utils/index.js +6 -0
  57. package/revenue.d.ts +0 -350
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Subscription Period Utilities
3
+ * @classytic/revenue/utils/subscription
4
+ *
5
+ * Universal period calculation, proration, and date utilities
6
+ */
7
+ /**
8
+ * Add duration to date
9
+ */
10
+ export function addDuration(startDate: any, duration: any, unit?: string): Date;
11
+ /**
12
+ * Calculate subscription period start/end dates
13
+ */
14
+ export function calculatePeriodRange({ currentEndDate, startDate, duration, unit, now, }: {
15
+ currentEndDate?: any;
16
+ startDate?: any;
17
+ duration: any;
18
+ unit?: string;
19
+ now?: Date;
20
+ }): {
21
+ startDate: Date;
22
+ endDate: Date;
23
+ };
24
+ /**
25
+ * Calculate prorated refund amount for unused period
26
+ */
27
+ export function calculateProratedAmount({ amountPaid, startDate, endDate, asOfDate, precision, }: {
28
+ amountPaid: any;
29
+ startDate: any;
30
+ endDate: any;
31
+ asOfDate?: Date;
32
+ precision?: number;
33
+ }): number;
34
+ /**
35
+ * Convert interval + count to duration/unit
36
+ */
37
+ export function resolveIntervalToDuration(interval?: string, intervalCount?: number): {
38
+ duration: number;
39
+ unit: string;
40
+ };
41
+ declare namespace _default {
42
+ export { addDuration };
43
+ export { calculatePeriodRange };
44
+ export { calculateProratedAmount };
45
+ export { resolveIntervalToDuration };
46
+ }
47
+ export default _default;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Check if transaction is monetization-managed
3
+ *
4
+ * Monetization-managed means:
5
+ * - Created through subscription/purchase flows via the library
6
+ * - Status controlled by payment webhooks/verification
7
+ * - Amount/commission calculated by library
8
+ * - Protected fields: status, amount, commission, gateway, verifiedAt, verifiedBy
9
+ *
10
+ * @param {Object} transaction - Transaction document or data
11
+ * @param {Object} options - Options
12
+ * @param {Array<string>} options.targetModels - Target models from config (default: ['Subscription', 'Membership'])
13
+ * @param {Array<string>} options.additionalCategories - Additional categories from user config
14
+ * @returns {boolean}
15
+ */
16
+ export function isMonetizationTransaction(transaction: any, options?: {
17
+ targetModels: Array<string>;
18
+ additionalCategories: Array<string>;
19
+ }): boolean;
20
+ /**
21
+ * Check if transaction is manual admin transaction
22
+ *
23
+ * Manual transactions:
24
+ * - Created directly by admins for operational expenses/income
25
+ * - Can be self-verified by admins
26
+ * - More flexible updates allowed
27
+ * - No commission/gateway complexity
28
+ *
29
+ * @param {Object} transaction - Transaction document or data
30
+ * @param {Object} options - Options (same as isMonetizationTransaction)
31
+ * @returns {boolean}
32
+ */
33
+ export function isManualTransaction(transaction: any, options?: any): boolean;
34
+ /**
35
+ * Get transaction type
36
+ *
37
+ * @param {Object} transaction - Transaction document or data
38
+ * @param {Object} options - Options (same as isMonetizationTransaction)
39
+ * @returns {string} TRANSACTION_TYPE.MONETIZATION or TRANSACTION_TYPE.MANUAL
40
+ */
41
+ export function getTransactionType(transaction: any, options?: any): string;
42
+ /**
43
+ * Get allowed update fields based on transaction type and status
44
+ *
45
+ * @param {Object} transaction - Transaction document
46
+ * @param {Object} options - Options for transaction type detection
47
+ * @returns {Array<string>} Allowed field names
48
+ */
49
+ export function getAllowedUpdateFields(transaction: any, options?: any): Array<string>;
50
+ /**
51
+ * Validate if field update is allowed
52
+ *
53
+ * @param {Object} transaction - Transaction document
54
+ * @param {string} fieldName - Field being updated
55
+ * @param {Object} options - Options for transaction type detection
56
+ * @returns {Object} { allowed: boolean, reason?: string }
57
+ */
58
+ export function validateFieldUpdate(transaction: any, fieldName: string, options?: any): any;
59
+ /**
60
+ * Check if transaction can be self-verified by admin
61
+ *
62
+ * @param {Object} transaction - Transaction document
63
+ * @param {Object} options - Options for transaction type detection
64
+ * @returns {boolean}
65
+ */
66
+ export function canSelfVerify(transaction: any, options?: any): boolean;
67
+ export namespace TRANSACTION_TYPE {
68
+ let MONETIZATION: string;
69
+ let MANUAL: string;
70
+ }
71
+ /**
72
+ * Protected fields for monetization transactions
73
+ * These fields cannot be updated directly by admins
74
+ */
75
+ export const PROTECTED_MONETIZATION_FIELDS: string[];
76
+ /**
77
+ * Editable fields for monetization transactions (before verification)
78
+ * These fields can be updated by frontend/customer before payment is verified
79
+ */
80
+ export const EDITABLE_MONETIZATION_FIELDS_PRE_VERIFICATION: string[];
81
+ /**
82
+ * Allowed fields for manual transaction creation
83
+ */
84
+ export const MANUAL_TRANSACTION_CREATE_FIELDS: string[];
85
+ /**
86
+ * Allowed fields for manual transaction updates
87
+ */
88
+ export const MANUAL_TRANSACTION_UPDATE_FIELDS: string[];
89
+ declare namespace _default {
90
+ export { TRANSACTION_TYPE };
91
+ export { isMonetizationTransaction };
92
+ export { isManualTransaction };
93
+ export { getTransactionType };
94
+ export { PROTECTED_MONETIZATION_FIELDS };
95
+ export { EDITABLE_MONETIZATION_FIELDS_PRE_VERIFICATION };
96
+ export { MANUAL_TRANSACTION_CREATE_FIELDS };
97
+ export { MANUAL_TRANSACTION_UPDATE_FIELDS };
98
+ export { getAllowedUpdateFields };
99
+ export { validateFieldUpdate };
100
+ export { canSelfVerify };
101
+ }
102
+ export default _default;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Escrow/Hold Enums
3
+ * @classytic/revenue
4
+ *
5
+ * Enums for platform-as-intermediary payment flow
6
+ */
7
+
8
+ export const HOLD_STATUS = {
9
+ PENDING: 'pending',
10
+ HELD: 'held',
11
+ RELEASED: 'released',
12
+ CANCELLED: 'cancelled',
13
+ EXPIRED: 'expired',
14
+ PARTIALLY_RELEASED: 'partially_released',
15
+ };
16
+
17
+ export const HOLD_STATUS_VALUES = Object.values(HOLD_STATUS);
18
+
19
+ export const RELEASE_REASON = {
20
+ PAYMENT_VERIFIED: 'payment_verified',
21
+ MANUAL_RELEASE: 'manual_release',
22
+ AUTO_RELEASE: 'auto_release',
23
+ DISPUTE_RESOLVED: 'dispute_resolved',
24
+ };
25
+
26
+ export const RELEASE_REASON_VALUES = Object.values(RELEASE_REASON);
27
+
28
+ export const HOLD_REASON = {
29
+ PAYMENT_VERIFICATION: 'payment_verification',
30
+ FRAUD_CHECK: 'fraud_check',
31
+ MANUAL_REVIEW: 'manual_review',
32
+ DISPUTE: 'dispute',
33
+ COMPLIANCE: 'compliance',
34
+ };
35
+
36
+ export const HOLD_REASON_VALUES = Object.values(HOLD_REASON);
package/enums/index.js CHANGED
@@ -13,6 +13,8 @@ export * from './transaction.enums.js';
13
13
  export * from './payment.enums.js';
14
14
  export * from './subscription.enums.js';
15
15
  export * from './monetization.enums.js';
16
+ export * from './escrow.enums.js';
17
+ export * from './split.enums.js';
16
18
 
17
19
  // Default export for convenience
18
20
  import {
@@ -45,6 +47,24 @@ import {
45
47
  MONETIZATION_TYPE_VALUES,
46
48
  } from './monetization.enums.js';
47
49
 
50
+ import {
51
+ HOLD_STATUS,
52
+ HOLD_STATUS_VALUES,
53
+ RELEASE_REASON,
54
+ RELEASE_REASON_VALUES,
55
+ HOLD_REASON,
56
+ HOLD_REASON_VALUES,
57
+ } from './escrow.enums.js';
58
+
59
+ import {
60
+ SPLIT_TYPE,
61
+ SPLIT_TYPE_VALUES,
62
+ SPLIT_STATUS,
63
+ SPLIT_STATUS_VALUES,
64
+ PAYOUT_METHOD,
65
+ PAYOUT_METHOD_VALUES,
66
+ } from './split.enums.js';
67
+
48
68
  export default {
49
69
  // Transaction enums
50
70
  TRANSACTION_TYPE,
@@ -71,4 +91,20 @@ export default {
71
91
  // Monetization enums
72
92
  MONETIZATION_TYPES,
73
93
  MONETIZATION_TYPE_VALUES,
94
+
95
+ // Escrow enums
96
+ HOLD_STATUS,
97
+ HOLD_STATUS_VALUES,
98
+ RELEASE_REASON,
99
+ RELEASE_REASON_VALUES,
100
+ HOLD_REASON,
101
+ HOLD_REASON_VALUES,
102
+
103
+ // Split enums
104
+ SPLIT_TYPE,
105
+ SPLIT_TYPE_VALUES,
106
+ SPLIT_STATUS,
107
+ SPLIT_STATUS_VALUES,
108
+ PAYOUT_METHOD,
109
+ PAYOUT_METHOD_VALUES,
74
110
  };
@@ -22,13 +22,34 @@ export const PAYMENT_STATUS_VALUES = Object.values(PAYMENT_STATUS);
22
22
 
23
23
  // ============ PAYMENT GATEWAY TYPES ============
24
24
  /**
25
- * Gateway types that providers can be built for
25
+ * Common gateway type constants for convenience
26
26
  *
27
- * MANUAL: Built-in manual provider
28
- * STRIPE: Stripe provider (build with @classytic/revenue-stripe)
29
- * SSLCOMMERZ: SSLCommerz provider (build with @classytic/revenue-sslcommerz)
27
+ * ⚠️ IMPORTANT: These are NOT restrictions - just common reference values
30
28
  *
31
- * Users can register custom providers for any gateway type
29
+ * You can register ANY custom gateway provider by passing it to createRevenue():
30
+ *
31
+ * @example
32
+ * ```javascript
33
+ * const revenue = createRevenue({
34
+ * providers: {
35
+ * manual: new ManualProvider(),
36
+ * bkash: new BkashProvider(), // ✅ Custom gateway
37
+ * nagad: new NagadProvider(), // ✅ Custom gateway
38
+ * stripe: new StripeProvider(), // ✅ Custom gateway
39
+ * paypal: new PaypalProvider(), // ✅ Any gateway you want
40
+ * }
41
+ * });
42
+ *
43
+ * // Use by name
44
+ * await revenue.subscriptions.create({ gateway: 'bkash', ... });
45
+ * ```
46
+ *
47
+ * Reference values:
48
+ * - MANUAL: Built-in manual provider (@classytic/revenue-manual)
49
+ * - STRIPE: Stripe provider (build with @classytic/revenue-stripe)
50
+ * - SSLCOMMERZ: SSLCommerz provider (build with @classytic/revenue-sslcommerz)
51
+ *
52
+ * Add your own: bkash, nagad, rocket, paypal, razorpay, flutterwave, etc.
32
53
  */
33
54
  export const PAYMENT_GATEWAY_TYPE = {
34
55
  MANUAL: 'manual',
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Split Payment Enums
3
+ * @classytic/revenue
4
+ *
5
+ * Enums for multi-party commission splits
6
+ */
7
+
8
+ export const SPLIT_TYPE = {
9
+ PLATFORM_COMMISSION: 'platform_commission',
10
+ AFFILIATE_COMMISSION: 'affiliate_commission',
11
+ REFERRAL_COMMISSION: 'referral_commission',
12
+ PARTNER_COMMISSION: 'partner_commission',
13
+ CUSTOM: 'custom',
14
+ };
15
+
16
+ export const SPLIT_TYPE_VALUES = Object.values(SPLIT_TYPE);
17
+
18
+ export const SPLIT_STATUS = {
19
+ PENDING: 'pending',
20
+ DUE: 'due',
21
+ PAID: 'paid',
22
+ WAIVED: 'waived',
23
+ CANCELLED: 'cancelled',
24
+ };
25
+
26
+ export const SPLIT_STATUS_VALUES = Object.values(SPLIT_STATUS);
27
+
28
+ export const PAYOUT_METHOD = {
29
+ BANK_TRANSFER: 'bank_transfer',
30
+ MOBILE_WALLET: 'mobile_wallet',
31
+ PLATFORM_BALANCE: 'platform_balance',
32
+ CRYPTO: 'crypto',
33
+ CHECK: 'check',
34
+ MANUAL: 'manual',
35
+ };
36
+
37
+ export const PAYOUT_METHOD_VALUES = Object.values(PAYOUT_METHOD);
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @classytic/revenue
3
- * Enterprise Revenue Management System
3
+ * Revenue Management System
4
4
  *
5
5
  * A unified, enterprise-grade revenue management system combining
6
6
  * monetization (subscriptions, purchases, proration) and payment processing
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Thin, focused, production-ready library with smart defaults.
10
10
  *
11
- * @version 1.0.0
11
+ * @version 0.2.0
12
12
  * @author Classytic (Classytic)
13
13
  * @license MIT
14
14
  */
@@ -38,6 +38,7 @@ import { PaymentProvider as _PaymentProvider } from './providers/base.js';
38
38
  export { SubscriptionService } from './services/subscription.service.js';
39
39
  export { PaymentService } from './services/payment.service.js';
40
40
  export { TransactionService } from './services/transaction.service.js';
41
+ export { EscrowService } from './services/escrow.service.js';
41
42
 
42
43
  // ============ ENUMS & SCHEMAS (FOR INJECTION) ============
43
44
  export * from './enums/index.js';
@@ -49,6 +50,11 @@ export {
49
50
  setLogger,
50
51
  calculateCommission,
51
52
  reverseCommission,
53
+ // Split/Escrow utilities
54
+ calculateSplits,
55
+ calculateOrganizationPayout,
56
+ reverseSplits,
57
+ calculateCommissionWithSplits,
52
58
  // Subscription utilities
53
59
  addDuration,
54
60
  calculatePeriodRange,
package/package.json CHANGED
@@ -1,74 +1,91 @@
1
- {
2
- "name": "@classytic/revenue",
3
- "version": "0.0.24",
4
- "description": "Enterprise revenue management system with subscriptions, purchases, proration, and payment processing",
5
- "main": "index.js",
6
- "types": "revenue.d.ts",
7
- "type": "module",
8
- "keywords": [
9
- "revenue",
10
- "monetization",
11
- "subscription",
12
- "payment",
13
- "saas",
14
- "billing",
15
- "proration",
16
- "recurring",
17
- "gateway",
18
- "webhook",
19
- "stripe",
20
- "sslcommerz",
21
- "bkash",
22
- "transaction",
23
- "invoice"
24
- ],
25
- "author": "Sadman Chowdhury",
26
- "license": "MIT",
27
- "repository": {
28
- "type": "git",
29
- "url": "https://github.com/classytic/revenue"
30
- },
31
- "bugs": {
32
- "url": "https://github.com/classytic/revenue/issues"
33
- },
34
- "homepage": "https://github.com/classytic/revenue#readme",
35
- "peerDependencies": {
36
- "mongoose": "^8.0.0"
37
- },
38
- "engines": {
39
- "node": ">=18.0.0"
40
- },
41
- "exports": {
42
- ".": {
43
- "types": "./revenue.d.ts",
44
- "default": "./index.js"
45
- },
46
- "./enums": {
47
- "types": "./enums/index.d.ts",
48
- "default": "./enums/index.js"
49
- },
50
- "./schemas": {
51
- "types": "./schemas/index.d.ts",
52
- "default": "./schemas/index.js"
53
- },
54
- "./utils": {
55
- "types": "./utils/index.d.ts",
56
- "default": "./utils/index.js"
57
- }
58
- },
59
- "files": [
60
- "index.js",
61
- "revenue.d.ts",
62
- "LICENSE",
63
- "README.md",
64
- "core/",
65
- "providers/",
66
- "services/",
67
- "enums/",
68
- "schemas/",
69
- "utils/"
70
- ],
71
- "dependencies": {
72
- "nanoid": "^5.1.6"
73
- }
74
- }
1
+ {
2
+ "name": "@classytic/revenue",
3
+ "version": "0.2.0",
4
+ "description": "Enterprise revenue management system with subscriptions, purchases, proration, payment processing, escrow, and multi-party splits",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "keywords": [
8
+ "revenue",
9
+ "monetization",
10
+ "subscription",
11
+ "payment",
12
+ "saas",
13
+ "billing",
14
+ "proration",
15
+ "recurring",
16
+ "gateway",
17
+ "webhook",
18
+ "stripe",
19
+ "sslcommerz",
20
+ "bkash",
21
+ "transaction",
22
+ "invoice",
23
+ "escrow",
24
+ "hold",
25
+ "release",
26
+ "split",
27
+ "affiliate",
28
+ "commission",
29
+ "marketplace"
30
+ ],
31
+ "author": "Sadman Chowdhury",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/classytic/revenue.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/classytic/revenue/issues"
39
+ },
40
+ "homepage": "https://github.com/classytic/revenue#readme",
41
+ "scripts": {
42
+ "types": "tsc -p tsconfig.types.json",
43
+ "build": "npm run types",
44
+ "prepublishOnly": "npm run build",
45
+ "test": "node ../tests/run-all.js"
46
+ },
47
+ "peerDependencies": {
48
+ "mongoose": "^8.0.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.0.0"
52
+ },
53
+ "exports": {
54
+ ".": {
55
+ "types": "./dist/types/index.d.ts",
56
+ "default": "./index.js"
57
+ },
58
+ "./enums": {
59
+ "types": "./dist/types/enums/index.d.ts",
60
+ "default": "./enums/index.js"
61
+ },
62
+ "./schemas": {
63
+ "types": "./dist/types/schemas/index.d.ts",
64
+ "default": "./schemas/index.js"
65
+ },
66
+ "./utils": {
67
+ "types": "./dist/types/utils/index.d.ts",
68
+ "default": "./utils/index.js"
69
+ }
70
+ },
71
+ "types": "./dist/types/index.d.ts",
72
+ "files": [
73
+ "index.js",
74
+ "LICENSE",
75
+ "README.md",
76
+ "core/",
77
+ "providers/",
78
+ "services/",
79
+ "enums/",
80
+ "schemas/",
81
+ "utils/",
82
+ "dist/types/"
83
+ ],
84
+ "devDependencies": {
85
+ "@types/node": "^22.8.7",
86
+ "typescript": "^5.6.3"
87
+ },
88
+ "dependencies": {
89
+ "nanoid": "^5.1.6"
90
+ }
91
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Hold/Escrow Schema
3
+ * @classytic/revenue
4
+ *
5
+ * Schema for platform-as-intermediary escrow flow
6
+ * Spread into transaction schema when needed
7
+ */
8
+
9
+ import { HOLD_STATUS, HOLD_STATUS_VALUES, HOLD_REASON, HOLD_REASON_VALUES } from '../../enums/escrow.enums.js';
10
+
11
+ export const holdSchema = {
12
+ status: {
13
+ type: String,
14
+ enum: HOLD_STATUS_VALUES,
15
+ default: HOLD_STATUS.PENDING,
16
+ index: true,
17
+ },
18
+
19
+ heldAmount: {
20
+ type: Number,
21
+ required: false,
22
+ },
23
+
24
+ releasedAmount: {
25
+ type: Number,
26
+ default: 0,
27
+ },
28
+
29
+ reason: {
30
+ type: String,
31
+ enum: HOLD_REASON_VALUES,
32
+ required: false,
33
+ },
34
+
35
+ holdUntil: {
36
+ type: Date,
37
+ required: false,
38
+ },
39
+
40
+ heldAt: Date,
41
+ releasedAt: Date,
42
+ cancelledAt: Date,
43
+
44
+ releases: [
45
+ {
46
+ amount: Number,
47
+ recipientId: String,
48
+ recipientType: String,
49
+ releasedAt: Date,
50
+ releasedBy: String,
51
+ reason: String,
52
+ metadata: Object,
53
+ },
54
+ ],
55
+
56
+ metadata: {
57
+ type: Object,
58
+ default: {},
59
+ },
60
+ };
61
+
62
+ export default holdSchema;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Escrow Schemas
3
+ * @classytic/revenue
4
+ */
5
+
6
+ // Import first
7
+ import { holdSchema } from './hold.schema.js';
8
+
9
+ // Then re-export
10
+ export { holdSchema };
11
+
12
+ // Now it's in scope for default export
13
+ export default {
14
+ holdSchema,
15
+ };
package/schemas/index.js CHANGED
@@ -10,12 +10,18 @@
10
10
  // Re-export core schemas only
11
11
  export * from './transaction/index.js';
12
12
  export * from './subscription/index.js';
13
+ export * from './escrow/index.js';
14
+ export * from './split/index.js';
13
15
 
14
16
  // Default export with core schemas
15
17
  import transactionSchemas from './transaction/index.js';
16
18
  import subscriptionSchemas from './subscription/index.js';
19
+ import escrowSchemas from './escrow/index.js';
20
+ import splitSchemas from './split/index.js';
17
21
 
18
22
  export default {
19
23
  ...transactionSchemas,
20
24
  ...subscriptionSchemas,
25
+ ...escrowSchemas,
26
+ ...splitSchemas,
21
27
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Split Payment Schemas
3
+ * @classytic/revenue
4
+ */
5
+
6
+ // Import first
7
+ import { splitItemSchema, splitsSchema } from './split.schema.js';
8
+
9
+ // Then re-export
10
+ export { splitItemSchema, splitsSchema };
11
+
12
+ // Now they're in scope for default export
13
+ export default {
14
+ splitItemSchema,
15
+ splitsSchema,
16
+ };