shred-api-client 1.11.19 → 1.12.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.
|
@@ -10,7 +10,8 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
|
|
|
10
10
|
getCharges(ctx: Context): Promise<Charge[]>;
|
|
11
11
|
getSubscription(context: Context, userId?: string): Promise<Subscription | null>;
|
|
12
12
|
charge(ctx: Context): Promise<boolean>;
|
|
13
|
-
|
|
13
|
+
pause(ctx: Context): Promise<boolean>;
|
|
14
|
+
resume(ctx: Context): Promise<boolean>;
|
|
14
15
|
getProducts(ctx?: Context): Promise<Product[]>;
|
|
15
16
|
createCheckout(planId: string | null, ctx: Context): Promise<string>;
|
|
16
17
|
}
|
|
@@ -43,8 +43,13 @@ class SubscriptionAPI {
|
|
|
43
43
|
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
|
|
44
44
|
return data.success;
|
|
45
45
|
}
|
|
46
|
-
async
|
|
47
|
-
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.
|
|
46
|
+
async pause(ctx) {
|
|
47
|
+
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.Pause;
|
|
48
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
async resume(ctx) {
|
|
52
|
+
const endpointInfo = Subscription_schema_1.SubscriptionEndpoints.Resume;
|
|
48
53
|
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, null, ctx);
|
|
49
54
|
return data;
|
|
50
55
|
}
|
|
@@ -5,7 +5,8 @@ interface SubscriptionAPISchema {
|
|
|
5
5
|
getProduct: (id: string, context?: Context) => Promise<Product>;
|
|
6
6
|
getProducts: (ctx?: Context) => Promise<Product[]>;
|
|
7
7
|
charge: (ctx: Context) => Promise<boolean>;
|
|
8
|
-
|
|
8
|
+
pause: (ctx: Context) => Promise<boolean>;
|
|
9
|
+
resume: (ctx: Context) => Promise<boolean>;
|
|
9
10
|
updatePlan: (ctx: Context, planId: string) => Promise<boolean>;
|
|
10
11
|
createCheckout: (planId: string | null, ctx: Context) => Promise<string>;
|
|
11
12
|
}
|
|
@@ -42,7 +43,11 @@ declare const SubscriptionEndpoints: {
|
|
|
42
43
|
uri: string;
|
|
43
44
|
method: string;
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
+
Pause: {
|
|
47
|
+
uri: string;
|
|
48
|
+
method: string;
|
|
49
|
+
};
|
|
50
|
+
Resume: {
|
|
46
51
|
uri: string;
|
|
47
52
|
method: string;
|
|
48
53
|
};
|
|
@@ -34,9 +34,13 @@ const SubscriptionEndpoints = {
|
|
|
34
34
|
uri: "/subscriptions/payment/charge/",
|
|
35
35
|
method: "POST",
|
|
36
36
|
},
|
|
37
|
-
|
|
38
|
-
uri: "/subscriptions/
|
|
39
|
-
method: "
|
|
37
|
+
Pause: {
|
|
38
|
+
uri: "/subscriptions/pause/",
|
|
39
|
+
method: "PUT",
|
|
40
|
+
},
|
|
41
|
+
Resume: {
|
|
42
|
+
uri: "/subscriptions/resume/",
|
|
43
|
+
method: "PUT",
|
|
40
44
|
},
|
|
41
45
|
UpdatePlan: {
|
|
42
46
|
uri: "/subscriptions/plan/update/",
|