@qelos/global-types 3.11.8 → 3.11.9
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/index.ts +2 -1
- package/integration-sources.ts +49 -0
- package/package.json +1 -1
- package/payments.ts +131 -0
package/index.ts
CHANGED
|
@@ -13,4 +13,5 @@ export * from './app-configuration-metadata'
|
|
|
13
13
|
export * from './integration-sources'
|
|
14
14
|
export * from './integration'
|
|
15
15
|
export * from './integration-targets'
|
|
16
|
-
export * from './no-code-components';
|
|
16
|
+
export * from './no-code-components';
|
|
17
|
+
export * from './payments';
|
package/integration-sources.ts
CHANGED
|
@@ -12,6 +12,8 @@ export enum IntegrationSourceKind {
|
|
|
12
12
|
GitHub = 'github',
|
|
13
13
|
Gemini = 'gemini',
|
|
14
14
|
Sumit = 'sumit',
|
|
15
|
+
PayPal = 'paypal',
|
|
16
|
+
Paddle = 'paddle',
|
|
15
17
|
AWS = 'aws',
|
|
16
18
|
Cloudflare = 'cloudflare',
|
|
17
19
|
}
|
|
@@ -91,6 +93,30 @@ export const SumitTargetOperation = {
|
|
|
91
93
|
deleteRecurringPayment: 'deleteRecurringPayment',
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
export const PayPalTargetOperation = {
|
|
97
|
+
createOrder: 'createOrder',
|
|
98
|
+
captureOrder: 'captureOrder',
|
|
99
|
+
refundPayment: 'refundPayment',
|
|
100
|
+
createProduct: 'createProduct',
|
|
101
|
+
createSubscription: 'createSubscription',
|
|
102
|
+
listTransactions: 'listTransactions',
|
|
103
|
+
} as const;
|
|
104
|
+
|
|
105
|
+
export const PaddleTargetOperation = {
|
|
106
|
+
createProduct: 'createProduct',
|
|
107
|
+
listProducts: 'listProducts',
|
|
108
|
+
createPrice: 'createPrice',
|
|
109
|
+
listPrices: 'listPrices',
|
|
110
|
+
createSubscription: 'createSubscription',
|
|
111
|
+
getSubscription: 'getSubscription',
|
|
112
|
+
listSubscriptions: 'listSubscriptions',
|
|
113
|
+
cancelSubscription: 'cancelSubscription',
|
|
114
|
+
listTransactions: 'listTransactions',
|
|
115
|
+
getTransaction: 'getTransaction',
|
|
116
|
+
createCustomer: 'createCustomer',
|
|
117
|
+
listCustomers: 'listCustomers',
|
|
118
|
+
} as const;
|
|
119
|
+
|
|
94
120
|
export const AWSTargetOperation = {
|
|
95
121
|
callFunction: 'callFunction',
|
|
96
122
|
getFunction: 'getFunction',
|
|
@@ -154,6 +180,29 @@ export interface ISumitSource extends IIntegrationSource {
|
|
|
154
180
|
};
|
|
155
181
|
}
|
|
156
182
|
|
|
183
|
+
export interface IPayPalSource extends IIntegrationSource {
|
|
184
|
+
_id?: string;
|
|
185
|
+
kind: IntegrationSourceKind.PayPal;
|
|
186
|
+
authentication: {
|
|
187
|
+
clientSecret: string;
|
|
188
|
+
};
|
|
189
|
+
metadata: {
|
|
190
|
+
clientId: string;
|
|
191
|
+
environment: 'sandbox' | 'live';
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface IPaddleSource extends IIntegrationSource {
|
|
196
|
+
_id?: string;
|
|
197
|
+
kind: IntegrationSourceKind.Paddle;
|
|
198
|
+
authentication: {
|
|
199
|
+
apiKey: string;
|
|
200
|
+
};
|
|
201
|
+
metadata: {
|
|
202
|
+
environment: 'sandbox' | 'live';
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
157
206
|
export interface IQelosSource extends IIntegrationSource {
|
|
158
207
|
_id?: string;
|
|
159
208
|
kind: IntegrationSourceKind.Qelos;
|
package/package.json
CHANGED
package/payments.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/** Determines whether billing is tied to individual users (B2C) or workspaces (B2B). */
|
|
2
|
+
export type BillableEntityType = 'user' | 'workspace';
|
|
3
|
+
|
|
4
|
+
/** Lifecycle states of a subscription. */
|
|
5
|
+
export type SubscriptionStatus = 'pending' | 'active' | 'canceled' | 'past_due' | 'trialing' | 'expired';
|
|
6
|
+
|
|
7
|
+
/** Supported billing intervals. */
|
|
8
|
+
export type BillingCycle = 'monthly' | 'yearly';
|
|
9
|
+
|
|
10
|
+
/** Payment status of an invoice. */
|
|
11
|
+
export type InvoiceStatus = 'paid' | 'pending' | 'failed' | 'refunded';
|
|
12
|
+
|
|
13
|
+
/** Type of discount a coupon provides. */
|
|
14
|
+
export type CouponDiscountType = 'percentage' | 'fixed';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Arbitrary limits associated with a plan (e.g. max users, storage quota).
|
|
18
|
+
* Keys are limit names; values can be numbers, booleans, or strings.
|
|
19
|
+
*/
|
|
20
|
+
export interface IPlanLimits {
|
|
21
|
+
[key: string]: number | boolean | string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Maps payment provider kinds to their external product/price identifiers.
|
|
26
|
+
* Used to link internal plans to provider-specific entities.
|
|
27
|
+
*/
|
|
28
|
+
export interface IPlanExternalIds {
|
|
29
|
+
[providerKind: string]: {
|
|
30
|
+
productId?: string;
|
|
31
|
+
monthlyPriceId?: string;
|
|
32
|
+
yearlyPriceId?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A pricing plan that users or workspaces can subscribe to. */
|
|
37
|
+
export interface IPlan {
|
|
38
|
+
_id?: string;
|
|
39
|
+
/** Tenant identifier for multi-tenant isolation. */
|
|
40
|
+
tenant: string;
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
/** Human-readable feature descriptions displayed on pricing pages. */
|
|
44
|
+
features: string[];
|
|
45
|
+
monthlyPrice: number;
|
|
46
|
+
yearlyPrice: number;
|
|
47
|
+
/** ISO 4217 currency code (e.g. "USD", "EUR"). */
|
|
48
|
+
currency: string;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
/** Controls display order — lower numbers appear first. */
|
|
51
|
+
sortOrder: number;
|
|
52
|
+
limits?: IPlanLimits;
|
|
53
|
+
externalIds?: IPlanExternalIds;
|
|
54
|
+
metadata?: Record<string, any>;
|
|
55
|
+
created?: Date;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A subscription linking a billable entity to a plan. */
|
|
59
|
+
export interface ISubscription {
|
|
60
|
+
_id?: string;
|
|
61
|
+
tenant: string;
|
|
62
|
+
/** Reference to the subscribed plan. */
|
|
63
|
+
planId: string;
|
|
64
|
+
billableEntityType: BillableEntityType;
|
|
65
|
+
billableEntityId: string;
|
|
66
|
+
status: SubscriptionStatus;
|
|
67
|
+
billingCycle: BillingCycle;
|
|
68
|
+
currentPeriodStart?: Date;
|
|
69
|
+
currentPeriodEnd?: Date;
|
|
70
|
+
/** Provider-side subscription identifier for reconciliation. */
|
|
71
|
+
externalSubscriptionId?: string;
|
|
72
|
+
/** Integration source ID used for this subscription's provider calls. */
|
|
73
|
+
providerId?: string;
|
|
74
|
+
/** Payment provider kind (e.g. "paddle", "paypal", "sumit"). */
|
|
75
|
+
providerKind?: string;
|
|
76
|
+
couponId?: string;
|
|
77
|
+
metadata?: Record<string, any>;
|
|
78
|
+
created?: Date;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A single line item within an invoice. */
|
|
82
|
+
export interface IInvoiceItem {
|
|
83
|
+
description: string;
|
|
84
|
+
amount: number;
|
|
85
|
+
quantity: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** An invoice record for a payment event. */
|
|
89
|
+
export interface IInvoice {
|
|
90
|
+
_id?: string;
|
|
91
|
+
tenant: string;
|
|
92
|
+
subscriptionId?: string;
|
|
93
|
+
billableEntityType: BillableEntityType;
|
|
94
|
+
billableEntityId: string;
|
|
95
|
+
amount: number;
|
|
96
|
+
/** ISO 4217 currency code. */
|
|
97
|
+
currency: string;
|
|
98
|
+
status: InvoiceStatus;
|
|
99
|
+
/** Provider-side invoice identifier. */
|
|
100
|
+
externalInvoiceId?: string;
|
|
101
|
+
providerKind?: string;
|
|
102
|
+
/** URL to download/view the invoice from the provider. */
|
|
103
|
+
invoiceUrl?: string;
|
|
104
|
+
paidAt?: Date;
|
|
105
|
+
periodStart?: Date;
|
|
106
|
+
periodEnd?: Date;
|
|
107
|
+
items: IInvoiceItem[];
|
|
108
|
+
created?: Date;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A discount coupon that can be applied during checkout. */
|
|
112
|
+
export interface ICoupon {
|
|
113
|
+
_id?: string;
|
|
114
|
+
tenant: string;
|
|
115
|
+
/** Unique coupon code entered by users. */
|
|
116
|
+
code: string;
|
|
117
|
+
discountType: CouponDiscountType;
|
|
118
|
+
/** For percentage: 0–100. For fixed: absolute amount in the coupon's currency. */
|
|
119
|
+
discountValue: number;
|
|
120
|
+
/** ISO 4217 currency code — relevant for fixed-amount discounts. */
|
|
121
|
+
currency?: string;
|
|
122
|
+
/** `null` or `undefined` means unlimited redemptions. */
|
|
123
|
+
maxRedemptions?: number;
|
|
124
|
+
currentRedemptions: number;
|
|
125
|
+
validFrom?: Date;
|
|
126
|
+
validUntil?: Date;
|
|
127
|
+
/** Empty array means the coupon applies to all plans. */
|
|
128
|
+
applicablePlanIds: string[];
|
|
129
|
+
isActive: boolean;
|
|
130
|
+
created?: Date;
|
|
131
|
+
}
|