@hcengineering/payment-client 0.7.382
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/lib/client.js +158 -0
- package/lib/client.js.map +7 -0
- package/lib/error.js +44 -0
- package/lib/error.js.map +7 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +7 -0
- package/lib/types.js +39 -0
- package/lib/types.js.map +7 -0
- package/package.json +57 -0
- package/tsconfig.json +12 -0
- package/types/client.d.ts +61 -0
- package/types/client.d.ts.map +1 -0
- package/types/error.d.ts +9 -0
- package/types/error.d.ts.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts +64 -0
- package/types/types.d.ts.map +1 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var client_exports = {};
|
|
21
|
+
__export(client_exports, {
|
|
22
|
+
PaymentClient: () => PaymentClient,
|
|
23
|
+
getClient: () => getClient
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(client_exports);
|
|
26
|
+
var import_core = require("@hcengineering/core");
|
|
27
|
+
var import_error = require("./error");
|
|
28
|
+
function getClient(paymentUrl, token) {
|
|
29
|
+
if (paymentUrl === void 0 || paymentUrl == null || paymentUrl === "") {
|
|
30
|
+
throw new Error("Payment service URL not specified");
|
|
31
|
+
}
|
|
32
|
+
if (token === void 0 || token == null || token === "") {
|
|
33
|
+
throw new Error("Authentication token not specified");
|
|
34
|
+
}
|
|
35
|
+
return new PaymentClient(paymentUrl, token);
|
|
36
|
+
}
|
|
37
|
+
__name(getClient, "getClient");
|
|
38
|
+
class PaymentClient {
|
|
39
|
+
constructor(endpoint, token) {
|
|
40
|
+
this.endpoint = endpoint;
|
|
41
|
+
this.token = token;
|
|
42
|
+
this.headers = {
|
|
43
|
+
Authorization: "Bearer " + token,
|
|
44
|
+
"Content-Type": "application/json"
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static {
|
|
48
|
+
__name(this, "PaymentClient");
|
|
49
|
+
}
|
|
50
|
+
headers;
|
|
51
|
+
/**
|
|
52
|
+
* Create a subscription for a workspace
|
|
53
|
+
* @param workspace - Workspace UUID
|
|
54
|
+
* @param request - Subscription request details
|
|
55
|
+
* @returns Checkout details with URL for payment
|
|
56
|
+
*/
|
|
57
|
+
async createSubscription(workspace, request) {
|
|
58
|
+
const path = `/api/v1/subscriptions/${workspace}/subscribe`;
|
|
59
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
60
|
+
const body = JSON.stringify(request);
|
|
61
|
+
const response = await fetchSafe(url, {
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: { ...this.headers },
|
|
64
|
+
body
|
|
65
|
+
});
|
|
66
|
+
return await response.json();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get subscription details
|
|
70
|
+
* @param subscriptionId - Subscription ID
|
|
71
|
+
* @returns Subscription details from payment provider
|
|
72
|
+
*/
|
|
73
|
+
async getSubscription(subscriptionId) {
|
|
74
|
+
const path = `/api/v1/subscriptions/${subscriptionId}`;
|
|
75
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
76
|
+
const response = await fetchSafe(url, { headers: { ...this.headers } });
|
|
77
|
+
return await response.json();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Cancel a subscription
|
|
81
|
+
* @param subscriptionId - Subscription ID to cancel
|
|
82
|
+
* @returns Cancellation confirmation
|
|
83
|
+
*/
|
|
84
|
+
async cancelSubscription(subscriptionId) {
|
|
85
|
+
const path = `/api/v1/subscriptions/${subscriptionId}/cancel`;
|
|
86
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
87
|
+
const response = await fetchSafe(url, {
|
|
88
|
+
method: "POST",
|
|
89
|
+
headers: { ...this.headers }
|
|
90
|
+
});
|
|
91
|
+
return await response.json();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Uncancel a subscription (reactivate a previously canceled subscription)
|
|
95
|
+
* @param subscriptionId - Subscription ID to uncancel
|
|
96
|
+
* @returns Reactivation confirmation
|
|
97
|
+
*/
|
|
98
|
+
async uncancelSubscription(subscriptionId) {
|
|
99
|
+
const path = `/api/v1/subscriptions/${subscriptionId}/uncancel`;
|
|
100
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
101
|
+
const response = await fetchSafe(url, {
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers: { ...this.headers }
|
|
104
|
+
});
|
|
105
|
+
return await response.json();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update a subscription to a different plan
|
|
109
|
+
* For free-to-paid upgrades, returns CheckoutResponse (requires checkout)
|
|
110
|
+
* For paid-to-paid updates, returns SubscriptionData (direct update)
|
|
111
|
+
* @param subscriptionId - Subscription ID to update
|
|
112
|
+
* @param plan - New plan name
|
|
113
|
+
* @returns CheckoutResponse for free-to-paid upgrades or updated SubscriptionData for direct updates
|
|
114
|
+
*/
|
|
115
|
+
async updateSubscriptionPlan(subscriptionId, plan) {
|
|
116
|
+
const path = `/api/v1/subscriptions/${subscriptionId}/updatePlan`;
|
|
117
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
118
|
+
const body = JSON.stringify({ plan });
|
|
119
|
+
const response = await fetchSafe(url, {
|
|
120
|
+
method: "POST",
|
|
121
|
+
headers: { ...this.headers },
|
|
122
|
+
body
|
|
123
|
+
});
|
|
124
|
+
return await response.json();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get checkout status
|
|
128
|
+
* Poll this endpoint after user returns from payment provider to check if subscription is ready
|
|
129
|
+
* @param checkoutId - Checkout ID returned from createSubscription
|
|
130
|
+
* @returns Checkout status with subscription details if completed
|
|
131
|
+
*/
|
|
132
|
+
async getCheckoutStatus(checkoutId) {
|
|
133
|
+
const path = `/api/v1/checkouts/${checkoutId}/status`;
|
|
134
|
+
const url = new URL((0, import_core.concatLink)(this.endpoint, path));
|
|
135
|
+
const response = await fetchSafe(url, { headers: { ...this.headers } });
|
|
136
|
+
return await response.json();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function fetchSafe(url, init) {
|
|
140
|
+
let response;
|
|
141
|
+
try {
|
|
142
|
+
response = await fetch(url, init);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
throw new import_error.NetworkError(`Network error: ${String(err)}`);
|
|
145
|
+
}
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
const text = await response.text();
|
|
148
|
+
try {
|
|
149
|
+
const error = JSON.parse(text);
|
|
150
|
+
throw new import_error.PaymentError(error.error ?? text);
|
|
151
|
+
} catch {
|
|
152
|
+
throw new import_error.PaymentError(`Payment service error: ${response.status} ${text}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return response;
|
|
156
|
+
}
|
|
157
|
+
__name(fetchSafe, "fetchSafe");
|
|
158
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2025 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport { concatLink, type WorkspaceUuid } from '@hcengineering/core'\nimport { CheckoutResponse, SubscribeRequest, CheckoutStatus, SubscriptionData } from './types'\nimport { PaymentError, NetworkError } from './error'\n\n/**\n * Create a payment client instance\n * @param paymentUrl - URL of the payment service\n * @param token - Authentication token\n * @returns PaymentClient instance\n */\nexport function getClient (paymentUrl?: string, token?: string): PaymentClient {\n if (paymentUrl === undefined || paymentUrl == null || paymentUrl === '') {\n throw new Error('Payment service URL not specified')\n }\n if (token === undefined || token == null || token === '') {\n throw new Error('Authentication token not specified')\n }\n\n return new PaymentClient(paymentUrl, token)\n}\n\n/**\n * Payment service client\n * Handles all subscription and payment operations\n */\nexport class PaymentClient {\n private readonly headers: Record<string, string>\n\n constructor (\n private readonly endpoint: string,\n private readonly token: string\n ) {\n this.headers = {\n Authorization: 'Bearer ' + token,\n 'Content-Type': 'application/json'\n }\n }\n\n /**\n * Create a subscription for a workspace\n * @param workspace - Workspace UUID\n * @param request - Subscription request details\n * @returns Checkout details with URL for payment\n */\n async createSubscription (workspace: WorkspaceUuid, request: SubscribeRequest): Promise<CheckoutResponse> {\n const path = `/api/v1/subscriptions/${workspace}/subscribe`\n const url = new URL(concatLink(this.endpoint, path))\n const body = JSON.stringify(request)\n const response = await fetchSafe(url, {\n method: 'POST',\n headers: { ...this.headers },\n body\n })\n return (await response.json()) as CheckoutResponse\n }\n\n /**\n * Get subscription details\n * @param subscriptionId - Subscription ID\n * @returns Subscription details from payment provider\n */\n async getSubscription (subscriptionId: string): Promise<any> {\n const path = `/api/v1/subscriptions/${subscriptionId}`\n const url = new URL(concatLink(this.endpoint, path))\n const response = await fetchSafe(url, { headers: { ...this.headers } })\n return await response.json()\n }\n\n /**\n * Cancel a subscription\n * @param subscriptionId - Subscription ID to cancel\n * @returns Cancellation confirmation\n */\n async cancelSubscription (subscriptionId: string): Promise<SubscriptionData> {\n const path = `/api/v1/subscriptions/${subscriptionId}/cancel`\n const url = new URL(concatLink(this.endpoint, path))\n const response = await fetchSafe(url, {\n method: 'POST',\n headers: { ...this.headers }\n })\n return (await response.json()) as SubscriptionData\n }\n\n /**\n * Uncancel a subscription (reactivate a previously canceled subscription)\n * @param subscriptionId - Subscription ID to uncancel\n * @returns Reactivation confirmation\n */\n async uncancelSubscription (subscriptionId: string): Promise<SubscriptionData> {\n const path = `/api/v1/subscriptions/${subscriptionId}/uncancel`\n const url = new URL(concatLink(this.endpoint, path))\n const response = await fetchSafe(url, {\n method: 'POST',\n headers: { ...this.headers }\n })\n return (await response.json()) as SubscriptionData\n }\n\n /**\n * Update a subscription to a different plan\n * For free-to-paid upgrades, returns CheckoutResponse (requires checkout)\n * For paid-to-paid updates, returns SubscriptionData (direct update)\n * @param subscriptionId - Subscription ID to update\n * @param plan - New plan name\n * @returns CheckoutResponse for free-to-paid upgrades or updated SubscriptionData for direct updates\n */\n async updateSubscriptionPlan (subscriptionId: string, plan: string): Promise<SubscriptionData | CheckoutResponse> {\n const path = `/api/v1/subscriptions/${subscriptionId}/updatePlan`\n const url = new URL(concatLink(this.endpoint, path))\n const body = JSON.stringify({ plan })\n const response = await fetchSafe(url, {\n method: 'POST',\n headers: { ...this.headers },\n body\n })\n return (await response.json()) as SubscriptionData | CheckoutResponse\n }\n\n /**\n * Get checkout status\n * Poll this endpoint after user returns from payment provider to check if subscription is ready\n * @param checkoutId - Checkout ID returned from createSubscription\n * @returns Checkout status with subscription details if completed\n */\n async getCheckoutStatus (checkoutId: string): Promise<CheckoutStatus> {\n const path = `/api/v1/checkouts/${checkoutId}/status`\n const url = new URL(concatLink(this.endpoint, path))\n const response = await fetchSafe(url, { headers: { ...this.headers } })\n return (await response.json()) as CheckoutStatus\n }\n}\n\n/**\n * Safe fetch wrapper that handles errors consistently\n * @param url - URL to fetch\n * @param init - Fetch options\n * @returns Response\n * @throws NetworkError on network issues\n * @throws PaymentError on non-ok responses\n */\nasync function fetchSafe (url: string | URL, init?: RequestInit): Promise<Response> {\n let response\n try {\n response = await fetch(url, init)\n } catch (err: any) {\n throw new NetworkError(`Network error: ${String(err)}`)\n }\n\n if (!response.ok) {\n const text = await response.text()\n try {\n const error = JSON.parse(text)\n throw new PaymentError(error.error ?? text)\n } catch {\n throw new PaymentError(`Payment service error: ${response.status} ${text}`)\n }\n }\n\n return response\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,kBAA+C;AAE/C,mBAA2C;AAQpC,SAAS,UAAW,YAAqB,OAA+B;AAC7E,MAAI,eAAe,UAAa,cAAc,QAAQ,eAAe,IAAI;AACvE,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AACA,MAAI,UAAU,UAAa,SAAS,QAAQ,UAAU,IAAI;AACxD,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AAEA,SAAO,IAAI,cAAc,YAAY,KAAK;AAC5C;AATgB;AAeT,MAAM,cAAc;AAAA,EAGzB,YACmB,UACA,OACjB;AAFiB;AACA;AAEjB,SAAK,UAAU;AAAA,MACb,eAAe,YAAY;AAAA,MAC3B,gBAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EAnDF,OAwC2B;AAAA;AAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA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|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/error.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var error_exports = {};
|
|
21
|
+
__export(error_exports, {
|
|
22
|
+
NetworkError: () => NetworkError,
|
|
23
|
+
PaymentError: () => PaymentError
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(error_exports);
|
|
26
|
+
class PaymentError extends Error {
|
|
27
|
+
static {
|
|
28
|
+
__name(this, "PaymentError");
|
|
29
|
+
}
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "PaymentError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class NetworkError extends Error {
|
|
36
|
+
static {
|
|
37
|
+
__name(this, "NetworkError");
|
|
38
|
+
}
|
|
39
|
+
constructor(message) {
|
|
40
|
+
super(message);
|
|
41
|
+
this.name = "NetworkError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=error.js.map
|
package/lib/error.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/error.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2025 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\n/** Error for payment service errors */\nexport class PaymentError extends Error {\n constructor (message: string) {\n super(message)\n this.name = 'PaymentError'\n }\n}\n\n/** Error for network/connectivity issues */\nexport class NetworkError extends Error {\n constructor (message: string) {\n super(message)\n this.name = 'NetworkError'\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,MAAM,qBAAqB,MAAM;AAAA,EAhBxC,OAgBwC;AAAA;AAAA;AAAA,EACtC,YAAa,SAAiB;AAC5B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAGO,MAAM,qBAAqB,MAAM;AAAA,EAxBxC,OAwBwC;AAAA;AAAA;AAAA,EACtC,YAAa,SAAiB;AAC5B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require("./client"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./types"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./error"), module.exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
package/lib/types.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
SubscriptionStatus: () => SubscriptionStatus,
|
|
22
|
+
SubscriptionType: () => SubscriptionType
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
|
25
|
+
var SubscriptionType = /* @__PURE__ */ ((SubscriptionType2) => {
|
|
26
|
+
SubscriptionType2["Tier"] = "tier";
|
|
27
|
+
SubscriptionType2["Support"] = "support";
|
|
28
|
+
return SubscriptionType2;
|
|
29
|
+
})(SubscriptionType || {});
|
|
30
|
+
var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
31
|
+
SubscriptionStatus2["Active"] = "active";
|
|
32
|
+
SubscriptionStatus2["Trialing"] = "trialing";
|
|
33
|
+
SubscriptionStatus2["PastDue"] = "past_due";
|
|
34
|
+
SubscriptionStatus2["Canceled"] = "canceled";
|
|
35
|
+
SubscriptionStatus2["Paused"] = "paused";
|
|
36
|
+
SubscriptionStatus2["Expired"] = "expired";
|
|
37
|
+
return SubscriptionStatus2;
|
|
38
|
+
})(SubscriptionStatus || {});
|
|
39
|
+
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2025 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport type { AccountUuid, WorkspaceUuid } from '@hcengineering/core'\n\nexport enum SubscriptionType {\n Tier = 'tier', // Main workspace tier (free, starter, pro, enterprise)\n Support = 'support' // Voluntary support/donation subscription\n}\n\nexport enum SubscriptionStatus {\n Active = 'active', // Subscription is active and paid\n Trialing = 'trialing', // In trial period (free usage)\n PastDue = 'past_due', // Payment failed but subscription not yet canceled\n Canceled = 'canceled', // Subscription was canceled by user or admin\n Paused = 'paused', // Subscription is temporarily paused (some providers support this)\n Expired = 'expired' // Subscription or trial has expired\n}\n\n/**\n * Subscription request parameters\n * Used when creating a new subscription\n */\nexport interface SubscribeRequest {\n type: SubscriptionType\n plan: string // Plan identifier\n customerEmail?: string // Optional customer email\n customerName?: string // Optional customer name\n}\n\n/**\n * Checkout creation response\n * Contains checkout details for payment\n */\nexport interface CheckoutResponse {\n checkoutId: string // Checkout session ID\n checkoutUrl: string // URL to redirect user to for payment\n}\n\n/**\n * Subscription data for checkout status\n * Matches @hcengineering/account-client Subscription type\n * @see @hcengineering/account-client\n */\nexport interface SubscriptionData {\n id: string // Internal unique subscription ID\n workspaceUuid: WorkspaceUuid\n accountUuid: AccountUuid\n provider: string\n providerSubscriptionId: string\n providerCheckoutId?: string\n type: SubscriptionType\n status: SubscriptionStatus\n plan: string\n amount?: number\n periodStart?: number\n periodEnd?: number\n trialEnd?: number\n canceledAt?: number\n providerData?: Record<string, any>\n}\n\n/**\n * Checkout status response\n * Contains information about the checkout and subscription status\n */\nexport interface CheckoutStatus {\n checkoutId: string // Checkout session ID\n subscriptionId: string | null // Subscription ID if completed\n status: 'pending' | 'completed' // Checkout status\n subscription: SubscriptionData | null // Full subscription data if available\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;AAKL,IAAK,qBAAL,kBAAKC,wBAAL;AACL,EAAAA,oBAAA,YAAS;AACT,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,YAAS;AACT,EAAAA,oBAAA,aAAU;AANA,SAAAA;AAAA,GAAA;",
|
|
6
|
+
"names": ["SubscriptionType", "SubscriptionStatus"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hcengineering/payment-client",
|
|
3
|
+
"version": "0.7.382",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"svelte": "src/index.ts",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/**/*",
|
|
9
|
+
"types/**/*",
|
|
10
|
+
"tsconfig.json"
|
|
11
|
+
],
|
|
12
|
+
"author": "Hardcore Engineering Inc.",
|
|
13
|
+
"license": "EPL-2.0",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "compile",
|
|
16
|
+
"build:watch": "compile",
|
|
17
|
+
"format": "format src",
|
|
18
|
+
"test": "jest --passWithNoTests --silent",
|
|
19
|
+
"_phase:build": "compile transpile src",
|
|
20
|
+
"_phase:test": "jest --passWithNoTests --silent",
|
|
21
|
+
"_phase:format": "format src",
|
|
22
|
+
"_phase:validate": "compile validate"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"cross-env": "~7.0.3",
|
|
26
|
+
"@hcengineering/platform-rig": "workspace:^0.7.382",
|
|
27
|
+
"@types/node": "^22.18.1",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
29
|
+
"eslint-plugin-import": "^2.26.0",
|
|
30
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
31
|
+
"eslint-plugin-n": "^15.4.0",
|
|
32
|
+
"eslint": "^8.54.0",
|
|
33
|
+
"esbuild": "^0.25.10",
|
|
34
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
35
|
+
"eslint-config-standard-with-typescript": "^40.0.0",
|
|
36
|
+
"prettier": "^3.6.2",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"jest": "^29.7.0",
|
|
39
|
+
"ts-jest": "^29.1.1",
|
|
40
|
+
"@types/jest": "^29.5.5"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@hcengineering/core": "workspace:^0.7.382",
|
|
44
|
+
"@hcengineering/platform": "workspace:^0.7.382"
|
|
45
|
+
},
|
|
46
|
+
"repository": "https://github.com/hcengineering/platform",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./types/index.d.ts",
|
|
53
|
+
"require": "./lib/index.js",
|
|
54
|
+
"import": "./lib/index.js"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json",
|
|
3
|
+
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./lib",
|
|
7
|
+
"declarationDir": "./types",
|
|
8
|
+
"tsBuildInfoFile": ".build/build.tsbuildinfo"
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*"],
|
|
11
|
+
"exclude": ["node_modules", "lib", "dist", "types", "bundle"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type WorkspaceUuid } from '@hcengineering/core';
|
|
2
|
+
import { CheckoutResponse, SubscribeRequest, CheckoutStatus, SubscriptionData } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a payment client instance
|
|
5
|
+
* @param paymentUrl - URL of the payment service
|
|
6
|
+
* @param token - Authentication token
|
|
7
|
+
* @returns PaymentClient instance
|
|
8
|
+
*/
|
|
9
|
+
export declare function getClient(paymentUrl?: string, token?: string): PaymentClient;
|
|
10
|
+
/**
|
|
11
|
+
* Payment service client
|
|
12
|
+
* Handles all subscription and payment operations
|
|
13
|
+
*/
|
|
14
|
+
export declare class PaymentClient {
|
|
15
|
+
private readonly endpoint;
|
|
16
|
+
private readonly token;
|
|
17
|
+
private readonly headers;
|
|
18
|
+
constructor(endpoint: string, token: string);
|
|
19
|
+
/**
|
|
20
|
+
* Create a subscription for a workspace
|
|
21
|
+
* @param workspace - Workspace UUID
|
|
22
|
+
* @param request - Subscription request details
|
|
23
|
+
* @returns Checkout details with URL for payment
|
|
24
|
+
*/
|
|
25
|
+
createSubscription(workspace: WorkspaceUuid, request: SubscribeRequest): Promise<CheckoutResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Get subscription details
|
|
28
|
+
* @param subscriptionId - Subscription ID
|
|
29
|
+
* @returns Subscription details from payment provider
|
|
30
|
+
*/
|
|
31
|
+
getSubscription(subscriptionId: string): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Cancel a subscription
|
|
34
|
+
* @param subscriptionId - Subscription ID to cancel
|
|
35
|
+
* @returns Cancellation confirmation
|
|
36
|
+
*/
|
|
37
|
+
cancelSubscription(subscriptionId: string): Promise<SubscriptionData>;
|
|
38
|
+
/**
|
|
39
|
+
* Uncancel a subscription (reactivate a previously canceled subscription)
|
|
40
|
+
* @param subscriptionId - Subscription ID to uncancel
|
|
41
|
+
* @returns Reactivation confirmation
|
|
42
|
+
*/
|
|
43
|
+
uncancelSubscription(subscriptionId: string): Promise<SubscriptionData>;
|
|
44
|
+
/**
|
|
45
|
+
* Update a subscription to a different plan
|
|
46
|
+
* For free-to-paid upgrades, returns CheckoutResponse (requires checkout)
|
|
47
|
+
* For paid-to-paid updates, returns SubscriptionData (direct update)
|
|
48
|
+
* @param subscriptionId - Subscription ID to update
|
|
49
|
+
* @param plan - New plan name
|
|
50
|
+
* @returns CheckoutResponse for free-to-paid upgrades or updated SubscriptionData for direct updates
|
|
51
|
+
*/
|
|
52
|
+
updateSubscriptionPlan(subscriptionId: string, plan: string): Promise<SubscriptionData | CheckoutResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Get checkout status
|
|
55
|
+
* Poll this endpoint after user returns from payment provider to check if subscription is ready
|
|
56
|
+
* @param checkoutId - Checkout ID returned from createSubscription
|
|
57
|
+
* @returns Checkout status with subscription details if completed
|
|
58
|
+
*/
|
|
59
|
+
getCheckoutStatus(checkoutId: string): Promise<CheckoutStatus>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAeA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG9F;;;;;GAKG;AACH,wBAAgB,SAAS,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,aAAa,CAS7E;AAED;;;GAGG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;gBAG7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM;IAQhC;;;;;OAKG;IACG,kBAAkB,CAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAYzG;;;;OAIG;IACG,eAAe,CAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAO5D;;;;OAIG;IACG,kBAAkB,CAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU5E;;;;OAIG;IACG,oBAAoB,CAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU9E;;;;;;;OAOG;IACG,sBAAsB,CAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAYjH;;;;;OAKG;IACG,iBAAiB,CAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAMtE"}
|
package/types/error.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Error for payment service errors */
|
|
2
|
+
export declare class PaymentError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/** Error for network/connectivity issues */
|
|
6
|
+
export declare class NetworkError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAeA,uCAAuC;AACvC,qBAAa,YAAa,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI7B;AAED,4CAA4C;AAC5C,qBAAa,YAAa,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI7B"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AccountUuid, WorkspaceUuid } from '@hcengineering/core';
|
|
2
|
+
export declare enum SubscriptionType {
|
|
3
|
+
Tier = "tier",// Main workspace tier (free, starter, pro, enterprise)
|
|
4
|
+
Support = "support"
|
|
5
|
+
}
|
|
6
|
+
export declare enum SubscriptionStatus {
|
|
7
|
+
Active = "active",// Subscription is active and paid
|
|
8
|
+
Trialing = "trialing",// In trial period (free usage)
|
|
9
|
+
PastDue = "past_due",// Payment failed but subscription not yet canceled
|
|
10
|
+
Canceled = "canceled",// Subscription was canceled by user or admin
|
|
11
|
+
Paused = "paused",// Subscription is temporarily paused (some providers support this)
|
|
12
|
+
Expired = "expired"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Subscription request parameters
|
|
16
|
+
* Used when creating a new subscription
|
|
17
|
+
*/
|
|
18
|
+
export interface SubscribeRequest {
|
|
19
|
+
type: SubscriptionType;
|
|
20
|
+
plan: string;
|
|
21
|
+
customerEmail?: string;
|
|
22
|
+
customerName?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Checkout creation response
|
|
26
|
+
* Contains checkout details for payment
|
|
27
|
+
*/
|
|
28
|
+
export interface CheckoutResponse {
|
|
29
|
+
checkoutId: string;
|
|
30
|
+
checkoutUrl: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Subscription data for checkout status
|
|
34
|
+
* Matches @hcengineering/account-client Subscription type
|
|
35
|
+
* @see @hcengineering/account-client
|
|
36
|
+
*/
|
|
37
|
+
export interface SubscriptionData {
|
|
38
|
+
id: string;
|
|
39
|
+
workspaceUuid: WorkspaceUuid;
|
|
40
|
+
accountUuid: AccountUuid;
|
|
41
|
+
provider: string;
|
|
42
|
+
providerSubscriptionId: string;
|
|
43
|
+
providerCheckoutId?: string;
|
|
44
|
+
type: SubscriptionType;
|
|
45
|
+
status: SubscriptionStatus;
|
|
46
|
+
plan: string;
|
|
47
|
+
amount?: number;
|
|
48
|
+
periodStart?: number;
|
|
49
|
+
periodEnd?: number;
|
|
50
|
+
trialEnd?: number;
|
|
51
|
+
canceledAt?: number;
|
|
52
|
+
providerData?: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checkout status response
|
|
56
|
+
* Contains information about the checkout and subscription status
|
|
57
|
+
*/
|
|
58
|
+
export interface CheckoutStatus {
|
|
59
|
+
checkoutId: string;
|
|
60
|
+
subscriptionId: string | null;
|
|
61
|
+
status: 'pending' | 'completed';
|
|
62
|
+
subscription: SubscriptionData | null;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAErE,oBAAY,gBAAgB;IAC1B,IAAI,SAAS,CAAE,uDAAuD;IACtE,OAAO,YAAY;CACpB;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW,CAAE,kCAAkC;IACrD,QAAQ,aAAa,CAAE,+BAA+B;IACtD,OAAO,aAAa,CAAE,mDAAmD;IACzE,QAAQ,aAAa,CAAE,6CAA6C;IACpE,MAAM,WAAW,CAAE,mEAAmE;IACtF,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE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