@frontegg/rest-api 2.10.57 → 2.10.60

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.10.60](https://github.com/frontegg/typescript-rest-api/compare/v2.10.59...v2.10.60) (2022-02-24)
6
+
7
+ ### [2.10.59](https://github.com/frontegg/typescript-rest-api/compare/v2.10.58...v2.10.59) (2022-02-24)
8
+
9
+ ### [2.10.58](https://github.com/frontegg/typescript-rest-api/compare/v2.10.57...v2.10.58) (2022-02-22)
10
+
5
11
  ### [2.10.57](https://github.com/frontegg/typescript-rest-api/compare/v2.10.56...v2.10.57) (2022-02-20)
6
12
 
7
13
  ### [2.10.56](https://github.com/frontegg/typescript-rest-api/compare/v2.10.55...v2.10.56) (2022-02-20)
@@ -16,6 +16,7 @@ export interface IPlanResponsePriceResponse {
16
16
  export interface ISubscriptionResponse {
17
17
  id: string;
18
18
  externalId: string;
19
+ externallyManaged: boolean;
19
20
  startDate: string;
20
21
  currentPeriodStart: string;
21
22
  currentPeriodEnd: string;
@@ -116,9 +117,15 @@ export interface IPaymentProviderResponse {
116
117
  }
117
118
  export interface IUpdateSubscriptionRequest {
118
119
  paymentMethodId: string;
120
+ planId: string;
119
121
  items: IUpdateSubscriptionItemRequest[];
120
122
  }
121
123
  export interface IUpdateSubscriptionItemRequest {
122
124
  id: string;
123
125
  planId: string;
124
126
  }
127
+ export interface IUpdateManagedSubscriptionRequest {
128
+ paymentMethodId: string;
129
+ planId: string;
130
+ items: IUpdateSubscriptionItemRequest[];
131
+ }
@@ -1,3 +1,7 @@
1
- import { ISubscriptionResponse } from "./interfaces";
1
+ import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from "./interfaces";
2
2
  export declare function getManagedSubscription(subscriptionId: string): Promise<ISubscriptionResponse>;
3
3
  export declare function getManagedSubscriptions(): Promise<ISubscriptionResponse[]>;
4
+ /**
5
+ * Upgrade/Downgrade tenant subscription plan
6
+ */
7
+ export declare function updateManagedSubscription(subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest): Promise<void>;
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { Get } from "../fetch";
10
+ import { Get, Put } from "../fetch";
11
11
  import { urls } from "../constants";
12
12
  export function getManagedSubscription(subscriptionId) {
13
13
  return __awaiter(this, void 0, void 0, function* () {
@@ -21,4 +21,13 @@ export function getManagedSubscriptions() {
21
21
  return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
22
22
  });
23
23
  }
24
+ /**
25
+ * Upgrade/Downgrade tenant subscription plan
26
+ */
27
+ export function updateManagedSubscription(subscriptionId, { paymentMethodId, planId }) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ console.debug("updateManagedSubscription()", { subscriptionId });
30
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId });
31
+ });
32
+ }
24
33
  //# sourceMappingURL=managedSubscriptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"managedSubscriptions.js","sourceRoot":"","sources":["../../../src/subscriptions/managedSubscriptions.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,UAAgB,sBAAsB,CAAC,cAAsB;;QAC/D,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAC,cAAc,EAAC,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAED,MAAM,UAAgB,uBAAuB;;QACzC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CAAA"}
1
+ {"version":3,"file":"managedSubscriptions.js","sourceRoot":"","sources":["../../../src/subscriptions/managedSubscriptions.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,UAAgB,sBAAsB,CAAC,cAAsB;;QAC/D,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAC,cAAc,EAAC,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAED,MAAM,UAAgB,uBAAuB;;QACzC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,yBAAyB,CAC7C,cAAsB,EACtB,EAAE,eAAe,EAAE,MAAM,EAAqC;;QAE5D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACjE,OAAO,GAAG,CACR,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,EACjE,EAAE,eAAe,EAAE,MAAM,EAAE,CAC5B,CAAC;IACN,CAAC;CAAA"}
@@ -18,4 +18,4 @@ export declare function renewSubscription(subscriptionId: string): Promise<void>
18
18
  /**
19
19
  * Upgrade/Downgrade tenant subscription plan
20
20
  */
21
- export declare function updateSubscription(subscriptionId: string, { paymentMethodId, items }: IUpdateSubscriptionRequest): Promise<void>;
21
+ export declare function updateSubscription(subscriptionId: string, { paymentMethodId, planId, items }: IUpdateSubscriptionRequest): Promise<void>;
@@ -48,10 +48,10 @@ export function renewSubscription(subscriptionId) {
48
48
  /**
49
49
  * Upgrade/Downgrade tenant subscription plan
50
50
  */
51
- export function updateSubscription(subscriptionId, { paymentMethodId, items }) {
51
+ export function updateSubscription(subscriptionId, { paymentMethodId, planId, items }) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
53
  console.debug("updateSubscription()", { subscriptionId });
54
- return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, items });
54
+ return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId, items });
55
55
  });
56
56
  }
57
57
  //# sourceMappingURL=subscriptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/subscriptions/subscriptions.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAgB,gBAAgB;;QACpC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,eAAe,CACnC,cAAsB;;QAEtB,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,CACR,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAA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E,CACnC,CAAC;IACJ,CAAC;CAAA"}
@@ -16,6 +16,7 @@ export interface IPlanResponsePriceResponse {
16
16
  export interface ISubscriptionResponse {
17
17
  id: string;
18
18
  externalId: string;
19
+ externallyManaged: boolean;
19
20
  startDate: string;
20
21
  currentPeriodStart: string;
21
22
  currentPeriodEnd: string;
@@ -116,9 +117,15 @@ export interface IPaymentProviderResponse {
116
117
  }
117
118
  export interface IUpdateSubscriptionRequest {
118
119
  paymentMethodId: string;
120
+ planId: string;
119
121
  items: IUpdateSubscriptionItemRequest[];
120
122
  }
121
123
  export interface IUpdateSubscriptionItemRequest {
122
124
  id: string;
123
125
  planId: string;
124
126
  }
127
+ export interface IUpdateManagedSubscriptionRequest {
128
+ paymentMethodId: string;
129
+ planId: string;
130
+ items: IUpdateSubscriptionItemRequest[];
131
+ }
@@ -1,3 +1,7 @@
1
- import { ISubscriptionResponse } from "./interfaces";
1
+ import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from "./interfaces";
2
2
  export declare function getManagedSubscription(subscriptionId: string): Promise<ISubscriptionResponse>;
3
3
  export declare function getManagedSubscriptions(): Promise<ISubscriptionResponse[]>;
4
+ /**
5
+ * Upgrade/Downgrade tenant subscription plan
6
+ */
7
+ export declare function updateManagedSubscription(subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest): Promise<void>;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getManagedSubscriptions = exports.getManagedSubscription = void 0;
12
+ exports.updateManagedSubscription = exports.getManagedSubscriptions = exports.getManagedSubscription = void 0;
13
13
  const fetch_1 = require("../fetch");
14
14
  const constants_1 = require("../constants");
15
15
  function getManagedSubscription(subscriptionId) {
@@ -26,4 +26,14 @@ function getManagedSubscriptions() {
26
26
  });
27
27
  }
28
28
  exports.getManagedSubscriptions = getManagedSubscriptions;
29
+ /**
30
+ * Upgrade/Downgrade tenant subscription plan
31
+ */
32
+ function updateManagedSubscription(subscriptionId, { paymentMethodId, planId }) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ console.debug("updateManagedSubscription()", { subscriptionId });
35
+ return fetch_1.Put(`${constants_1.urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId });
36
+ });
37
+ }
38
+ exports.updateManagedSubscription = updateManagedSubscription;
29
39
  //# sourceMappingURL=managedSubscriptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"managedSubscriptions.js","sourceRoot":"","sources":["../../src/subscriptions/managedSubscriptions.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAA+B;AAC/B,4CAAoC;AAEpC,SAAsB,sBAAsB,CAAC,cAAsB;;QAC/D,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAC,cAAc,EAAC,CAAC,CAAC;QAC5D,OAAO,WAAG,CAAC,GAAG,gBAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAHD,wDAGC;AAED,SAAsB,uBAAuB;;QACzC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,WAAG,CAAC,GAAG,gBAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CAAA;AAHD,0DAGC"}
1
+ {"version":3,"file":"managedSubscriptions.js","sourceRoot":"","sources":["../../src/subscriptions/managedSubscriptions.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAoC;AACpC,4CAAoC;AAEpC,SAAsB,sBAAsB,CAAC,cAAsB;;QAC/D,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAC,cAAc,EAAC,CAAC,CAAC;QAC5D,OAAO,WAAG,CAAC,GAAG,gBAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,CAAC,CAAA;IACjF,CAAC;CAAA;AAHD,wDAGC;AAED,SAAsB,uBAAuB;;QACzC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,WAAG,CAAC,GAAG,gBAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CAAA;AAHD,0DAGC;AAED;;GAEG;AACH,SAAsB,yBAAyB,CAC7C,cAAsB,EACtB,EAAE,eAAe,EAAE,MAAM,EAAqC;;QAE5D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACjE,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,IAAI,cAAc,EAAE,EACjE,EAAE,eAAe,EAAE,MAAM,EAAE,CAC5B,CAAC;IACN,CAAC;CAAA;AATD,8DASC"}
@@ -18,4 +18,4 @@ export declare function renewSubscription(subscriptionId: string): Promise<void>
18
18
  /**
19
19
  * Upgrade/Downgrade tenant subscription plan
20
20
  */
21
- export declare function updateSubscription(subscriptionId: string, { paymentMethodId, items }: IUpdateSubscriptionRequest): Promise<void>;
21
+ export declare function updateSubscription(subscriptionId: string, { paymentMethodId, planId, items }: IUpdateSubscriptionRequest): Promise<void>;
@@ -55,10 +55,10 @@ exports.renewSubscription = renewSubscription;
55
55
  /**
56
56
  * Upgrade/Downgrade tenant subscription plan
57
57
  */
58
- function updateSubscription(subscriptionId, { paymentMethodId, items }) {
58
+ function updateSubscription(subscriptionId, { paymentMethodId, planId, items }) {
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
60
  console.debug("updateSubscription()", { subscriptionId });
61
- return fetch_1.Put(`${constants_1.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, items });
61
+ return fetch_1.Put(`${constants_1.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId, items });
62
62
  });
63
63
  }
64
64
  exports.updateSubscription = updateSubscription;
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/subscriptions/subscriptions.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAoC;AACpC,4CAAoC;AAEpC;;GAEG;AACH,SAAsB,gBAAgB;;QACpC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,OAAO,WAAG,CAAC,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CAAA;AAHD,4CAGC;AAED;;GAEG;AACH,SAAsB,eAAe,CACnC,cAAsB;;QAEtB,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACvD,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,cAAc,EAAE,CACnE,CAAC;IACJ,CAAC;CAAA;AAPD,0CAOC;AAED;;GAEG;AACH,SAAsB,kBAAkB,CACtC,cAAsB;;QAEtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QAC1D,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,cAAc,iBAAiB,EACjF,EAAE,CACH,CAAC;IACJ,CAAC;CAAA;AARD,gDAQC;AAED;;GAEG;AACH,SAAsB,iBAAiB,CACrC,cAAsB;;QAEtB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACzD,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,cAAc,YAAY,EAC5E,EAAE,CACH,CAAC;IACJ,CAAC;CAAA;AARD,8CAQC;AAED;;GAEG;AACH,SAAsB,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ACrC,cAAsB;;QAEtB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACzD,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,cAAc,YAAY,EAC5E,EAAE,CACH,CAAC;IACJ,CAAC;CAAA;AARD,8CAQC;AAED;;GAEG;AACH,SAAsB,kBAAkB,CACtC,cAAsB,EACtB,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAA8B;;QAE9D,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QAC1D,OAAO,WAAG,CACR,GAAG,gBAAI,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,cAAc,EAAE,EAClE,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,CACnC,CAAC;IACJ,CAAC;CAAA;AATD,gDASC"}
package/dist/umd/index.js CHANGED
@@ -2314,10 +2314,10 @@
2314
2314
  /**
2315
2315
  * Upgrade/Downgrade tenant subscription plan
2316
2316
  */
2317
- function updateSubscription(subscriptionId, { paymentMethodId, items }) {
2317
+ function updateSubscription(subscriptionId, { paymentMethodId, planId, items }) {
2318
2318
  return __awaiter(this, void 0, void 0, function* () {
2319
2319
  console.debug("updateSubscription()", { subscriptionId });
2320
- return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, items });
2320
+ return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId, items });
2321
2321
  });
2322
2322
  }
2323
2323
 
@@ -2332,6 +2332,15 @@
2332
2332
  console.debug('getManagedSubscriptions()');
2333
2333
  return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
2334
2334
  });
2335
+ }
2336
+ /**
2337
+ * Upgrade/Downgrade tenant subscription plan
2338
+ */
2339
+ function updateManagedSubscription(subscriptionId, { paymentMethodId, planId }) {
2340
+ return __awaiter(this, void 0, void 0, function* () {
2341
+ console.debug("updateManagedSubscription()", { subscriptionId });
2342
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, { paymentMethodId, planId });
2343
+ });
2335
2344
  }
2336
2345
 
2337
2346
  /**
@@ -2528,6 +2537,7 @@
2528
2537
  updateSubscription: updateSubscription,
2529
2538
  getManagedSubscription: getManagedSubscription,
2530
2539
  getManagedSubscriptions: getManagedSubscriptions,
2540
+ updateManagedSubscription: updateManagedSubscription,
2531
2541
  getSubscriptionPlans: getSubscriptionPlans,
2532
2542
  getSubscriptionPlan: getSubscriptionPlan,
2533
2543
  getSubscriptionInvoices: getSubscriptionInvoices,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
3
  "libName": "FronteggRestApi",
4
- "version": "2.10.57",
4
+ "version": "2.10.60",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,6 +20,7 @@ export interface IPlanResponsePriceResponse {
20
20
  export interface ISubscriptionResponse {
21
21
  id: string;
22
22
  externalId: string;
23
+ externallyManaged: boolean;
23
24
  startDate: string;
24
25
  currentPeriodStart: string;
25
26
  currentPeriodEnd: string;
@@ -138,6 +139,7 @@ export interface IPaymentProviderResponse {
138
139
 
139
140
  export interface IUpdateSubscriptionRequest {
140
141
  paymentMethodId: string;
142
+ planId: string;
141
143
  items: IUpdateSubscriptionItemRequest[];
142
144
  }
143
145
 
@@ -145,3 +147,9 @@ export interface IUpdateSubscriptionItemRequest {
145
147
  id: string;
146
148
  planId: string;
147
149
  }
150
+
151
+ export interface IUpdateManagedSubscriptionRequest {
152
+ paymentMethodId: string;
153
+ planId: string;
154
+ items: IUpdateSubscriptionItemRequest[];
155
+ }
@@ -1,5 +1,5 @@
1
- import { ISubscriptionResponse } from "./interfaces";
2
- import { Get } from "../fetch";
1
+ import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from "./interfaces";
2
+ import { Get, Put } from "../fetch";
3
3
  import { urls } from "../constants";
4
4
 
5
5
  export async function getManagedSubscription(subscriptionId: string): Promise<ISubscriptionResponse> {
@@ -11,3 +11,17 @@ export async function getManagedSubscriptions(): Promise<ISubscriptionResponse[]
11
11
  console.debug('getManagedSubscriptions()');
12
12
  return Get(`${urls.subscriptions.managedSubscriptions.v1}`)
13
13
  }
14
+
15
+ /**
16
+ * Upgrade/Downgrade tenant subscription plan
17
+ */
18
+ export async function updateManagedSubscription(
19
+ subscriptionId: string,
20
+ { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest
21
+ ): Promise<void> {
22
+ console.debug("updateManagedSubscription()", { subscriptionId });
23
+ return Put(
24
+ `${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`,
25
+ { paymentMethodId, planId }
26
+ );
27
+ }
@@ -53,11 +53,11 @@ export async function renewSubscription(
53
53
  */
54
54
  export async function updateSubscription(
55
55
  subscriptionId: string,
56
- { paymentMethodId, items }: IUpdateSubscriptionRequest
56
+ { paymentMethodId, planId, items }: IUpdateSubscriptionRequest
57
57
  ): Promise<void> {
58
58
  console.debug("updateSubscription()", { subscriptionId });
59
59
  return Put(
60
60
  `${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`,
61
- { paymentMethodId, items }
61
+ { paymentMethodId, planId, items }
62
62
  );
63
63
  }