@oxy.so/core 7.21.1 → 7.22.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.
package/dist/cjs/api/billing.js
CHANGED
|
@@ -20,8 +20,9 @@ class BillingApi {
|
|
|
20
20
|
constructor(ctx) {
|
|
21
21
|
this.ctx = ctx;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/** The payment provider's customer portal for one named source the caller pays for. */
|
|
24
|
+
async openProductSubscriptionPortal(request) {
|
|
25
|
+
return (0, client_1.parseContract)(client_1.productSubscriptionPortalResponseCheck, await this.ctx.request('POST', '/billing/product-subscriptions/portal', (0, client_1.parseContract)(client_1.productSubscriptionPortalRequestCheck, request), { cache: false }));
|
|
25
26
|
}
|
|
26
27
|
async startProductPlanCheckout(request) {
|
|
27
28
|
return (0, client_1.parseContract)(client_1.personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/checkout/product-plan', (0, client_1.parseContract)(client_1.productPlanCheckoutRequestCheck, request), { cache: false }));
|
package/dist/esm/api/billing.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `payment.controller`, `wallet.routes` in `packages/api`); `Date` columns
|
|
10
10
|
* arrive as ISO-8601 strings.
|
|
11
11
|
*/
|
|
12
|
-
import { cancelProductSubscriptionCheck, parseContract, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck,
|
|
12
|
+
import { cancelProductSubscriptionCheck, parseContract, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from '@oxy.so/contracts/client';
|
|
13
13
|
const enc = encodeURIComponent;
|
|
14
14
|
const SUBSCRIPTION_TTL = 2 * 60 * 1000;
|
|
15
15
|
const WALLET_TTL = 60 * 1000;
|
|
@@ -17,8 +17,9 @@ export class BillingApi {
|
|
|
17
17
|
constructor(ctx) {
|
|
18
18
|
this.ctx = ctx;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/** The payment provider's customer portal for one named source the caller pays for. */
|
|
21
|
+
async openProductSubscriptionPortal(request) {
|
|
22
|
+
return parseContract(productSubscriptionPortalResponseCheck, await this.ctx.request('POST', '/billing/product-subscriptions/portal', parseContract(productSubscriptionPortalRequestCheck, request), { cache: false }));
|
|
22
23
|
}
|
|
23
24
|
async startProductPlanCheckout(request) {
|
|
24
25
|
return parseContract(personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/checkout/product-plan', parseContract(productPlanCheckoutRequestCheck, request), { cache: false }));
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `payment.controller`, `wallet.routes` in `packages/api`); `Date` columns
|
|
10
10
|
* arrive as ISO-8601 strings.
|
|
11
11
|
*/
|
|
12
|
-
import type { PersonalPlanCatalogue, PersonalPlanCheckoutRequest, PersonalPlanCheckoutResult, ProductPlanCatalogue, ProductPlanCheckoutRequest, ProductSubscriptionCancellationResult,
|
|
12
|
+
import type { PersonalPlanCatalogue, PersonalPlanCheckoutRequest, PersonalPlanCheckoutResult, ProductPlanCatalogue, ProductPlanCheckoutRequest, ProductSubscriptionCancellationResult, ProductSubscriptionPortalRequest, ProductSubscriptionPortalResponse, ProductSubscriptionSummary, SubjectProductAccess, SubjectProductAccessQuery, SubscriptionCreditGrant } from '@oxy.so/contracts';
|
|
13
13
|
import type { OxyContext } from '../client/context';
|
|
14
14
|
/** Subscription tier. */
|
|
15
15
|
export type SubscriptionPlan = 'basic' | 'pro' | 'business';
|
|
@@ -98,7 +98,8 @@ export interface WalletTransactionsPage {
|
|
|
98
98
|
export declare class BillingApi {
|
|
99
99
|
protected readonly ctx: OxyContext;
|
|
100
100
|
constructor(ctx: OxyContext);
|
|
101
|
-
|
|
101
|
+
/** The payment provider's customer portal for one named source the caller pays for. */
|
|
102
|
+
openProductSubscriptionPortal(request: ProductSubscriptionPortalRequest): Promise<ProductSubscriptionPortalResponse>;
|
|
102
103
|
startProductPlanCheckout(request: ProductPlanCheckoutRequest): Promise<PersonalPlanCheckoutResult>;
|
|
103
104
|
productPlans(productId: string): Promise<ProductPlanCatalogue>;
|
|
104
105
|
startPersonalPlanCheckout(request: PersonalPlanCheckoutRequest): Promise<PersonalPlanCheckoutResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.0",
|
|
4
4
|
"description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"@noble/ciphers": "^2.4.0",
|
|
183
183
|
"@noble/hashes": "^2.4.0",
|
|
184
|
-
"@oxy.so/contracts": "6.
|
|
184
|
+
"@oxy.so/contracts": "6.9.0",
|
|
185
185
|
"@oxy.so/protocol": "^1.6.1",
|
|
186
186
|
"@oxy.so/telemetry": "^2.1.0",
|
|
187
187
|
"@scure/bip39": "^2.4.0",
|
package/src/api/billing.ts
CHANGED
|
@@ -17,7 +17,8 @@ import type {
|
|
|
17
17
|
ProductPlanCatalogue,
|
|
18
18
|
ProductPlanCheckoutRequest,
|
|
19
19
|
ProductSubscriptionCancellationResult,
|
|
20
|
-
|
|
20
|
+
ProductSubscriptionPortalRequest,
|
|
21
|
+
ProductSubscriptionPortalResponse,
|
|
21
22
|
ProductSubscriptionSummary,
|
|
22
23
|
SubjectProductAccess,
|
|
23
24
|
SubjectProductAccessQuery,
|
|
@@ -32,7 +33,8 @@ import {
|
|
|
32
33
|
productPlanCatalogueCheck,
|
|
33
34
|
productPlanCheckoutRequestCheck,
|
|
34
35
|
productSubscriptionCancellationResultCheck,
|
|
35
|
-
|
|
36
|
+
productSubscriptionPortalRequestCheck,
|
|
37
|
+
productSubscriptionPortalResponseCheck,
|
|
36
38
|
productSubscriptionsResponseCheck,
|
|
37
39
|
subjectProductAccessCheck,
|
|
38
40
|
subjectProductAccessQueryCheck,
|
|
@@ -136,15 +138,16 @@ export interface WalletTransactionsPage {
|
|
|
136
138
|
export class BillingApi {
|
|
137
139
|
constructor(protected readonly ctx: OxyContext) {}
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
/** The payment provider's customer portal for one named source the caller pays for. */
|
|
142
|
+
async openProductSubscriptionPortal(
|
|
143
|
+
request: ProductSubscriptionPortalRequest,
|
|
144
|
+
): Promise<ProductSubscriptionPortalResponse> {
|
|
142
145
|
return parseContract(
|
|
143
|
-
|
|
146
|
+
productSubscriptionPortalResponseCheck,
|
|
144
147
|
await this.ctx.request<unknown>(
|
|
145
148
|
'POST',
|
|
146
|
-
'/billing/product-subscriptions/
|
|
147
|
-
parseContract(
|
|
149
|
+
'/billing/product-subscriptions/portal',
|
|
150
|
+
parseContract(productSubscriptionPortalRequestCheck, request),
|
|
148
151
|
{ cache: false },
|
|
149
152
|
),
|
|
150
153
|
);
|