@lcdp/api-react-rest-client 2.14.3-develop.18164509826 → 2.14.3-develop.18496590089

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.
Files changed (81) hide show
  1. package/chargebee-hook/index.d.ts +1 -0
  2. package/chargebee-hook/index.js +17 -0
  3. package/chargebee-hook/src/apis/ChargebeeHookApi.d.ts +31 -0
  4. package/chargebee-hook/src/apis/ChargebeeHookApi.js +134 -0
  5. package/chargebee-hook/src/apis/index.d.ts +1 -0
  6. package/chargebee-hook/src/apis/index.js +19 -0
  7. package/chargebee-hook/src/index.d.ts +3 -0
  8. package/chargebee-hook/src/index.js +21 -0
  9. package/chargebee-hook/src/models/HookRequest.d.ts +85 -0
  10. package/chargebee-hook/src/models/HookRequest.js +67 -0
  11. package/{subscription → chargebee-hook}/src/models/RestError.d.ts +1 -1
  12. package/{subscription → chargebee-hook}/src/models/RestError.js +1 -1
  13. package/chargebee-hook/src/models/index.d.ts +2 -0
  14. package/chargebee-hook/src/models/index.js +20 -0
  15. package/chargebee-hook/src/runtime.d.ts +190 -0
  16. package/chargebee-hook/src/runtime.js +598 -0
  17. package/invoice/src/apis/SearchInvoiceApi.d.ts +2 -2
  18. package/invoice/src/apis/SearchInvoiceApi.js +2 -2
  19. package/invoice/src/models/InvoiceType.d.ts +0 -1
  20. package/invoice/src/models/InvoiceType.js +0 -1
  21. package/notification/src/models/NotificationTypeId.d.ts +1 -2
  22. package/notification/src/models/NotificationTypeId.js +1 -2
  23. package/package.json +1 -1
  24. package/rfx/src/apis/ManageRffApi.d.ts +29 -0
  25. package/{subscription/src/apis/ManageSubscriptionPlanApi.js → rfx/src/apis/ManageRffApi.js} +21 -39
  26. package/rfx/src/apis/index.d.ts +1 -0
  27. package/rfx/src/apis/index.js +1 -0
  28. package/rfx/src/models/RffCreationParameters.d.ts +37 -0
  29. package/rfx/src/models/RffCreationParameters.js +51 -0
  30. package/rfx/src/models/index.d.ts +1 -0
  31. package/rfx/src/models/index.js +1 -0
  32. package/subscription/src/apis/SearchSubscriptionsApi.d.ts +29 -0
  33. package/subscription/src/apis/{SearchSubscriptionPlanFeatureApi.js → SearchSubscriptionsApi.js} +19 -13
  34. package/subscription/src/apis/index.d.ts +1 -5
  35. package/subscription/src/apis/index.js +1 -5
  36. package/subscription/src/models/Subscription.d.ts +6 -38
  37. package/subscription/src/models/Subscription.js +6 -19
  38. package/subscription/src/models/index.d.ts +0 -14
  39. package/subscription/src/models/index.js +0 -14
  40. package/third-party/src/models/ThirdPartyLinkCreationParameters.d.ts +5 -2
  41. package/third-party/src/models/ThirdPartyLinkCreationParameters.js +5 -2
  42. package/user/src/models/NotificationTypeId.d.ts +1 -2
  43. package/user/src/models/NotificationTypeId.js +1 -2
  44. package/user/src/models/OffisanteStatus.d.ts +3 -1
  45. package/user/src/models/OffisanteStatus.js +4 -2
  46. package/user/src/models/User.d.ts +8 -0
  47. package/user/src/models/User.js +2 -0
  48. package/subscription/src/apis/ManageSubscriptionApi.d.ts +0 -56
  49. package/subscription/src/apis/ManageSubscriptionApi.js +0 -315
  50. package/subscription/src/apis/ManageSubscriptionPlanApi.d.ts +0 -30
  51. package/subscription/src/apis/SearchSubscriptionApi.d.ts +0 -53
  52. package/subscription/src/apis/SearchSubscriptionApi.js +0 -208
  53. package/subscription/src/apis/SearchSubscriptionPlanApi.d.ts +0 -49
  54. package/subscription/src/apis/SearchSubscriptionPlanApi.js +0 -249
  55. package/subscription/src/apis/SearchSubscriptionPlanFeatureApi.d.ts +0 -26
  56. package/subscription/src/models/HttpLink.d.ts +0 -31
  57. package/subscription/src/models/HttpLink.js +0 -47
  58. package/subscription/src/models/PaginatedObject.d.ts +0 -32
  59. package/subscription/src/models/PaginatedObject.js +0 -48
  60. package/subscription/src/models/PaginatedSubscriptions.d.ts +0 -39
  61. package/subscription/src/models/PaginatedSubscriptions.js +0 -51
  62. package/subscription/src/models/PagingMetadata.d.ts +0 -49
  63. package/subscription/src/models/PagingMetadata.js +0 -55
  64. package/subscription/src/models/SubscriberLink.d.ts +0 -37
  65. package/subscription/src/models/SubscriberLink.js +0 -49
  66. package/subscription/src/models/SubscriptionCreationParameters.d.ts +0 -44
  67. package/subscription/src/models/SubscriptionCreationParameters.js +0 -56
  68. package/subscription/src/models/SubscriptionPlan.d.ts +0 -69
  69. package/subscription/src/models/SubscriptionPlan.js +0 -59
  70. package/subscription/src/models/SubscriptionPlanFeature.d.ts +0 -44
  71. package/subscription/src/models/SubscriptionPlanFeature.js +0 -50
  72. package/subscription/src/models/SubscriptionPlanFeatureId.d.ts +0 -26
  73. package/subscription/src/models/SubscriptionPlanFeatureId.js +0 -49
  74. package/subscription/src/models/SubscriptionPlanId.d.ts +0 -25
  75. package/subscription/src/models/SubscriptionPlanId.js +0 -48
  76. package/subscription/src/models/SubscriptionPlanLink.d.ts +0 -38
  77. package/subscription/src/models/SubscriptionPlanLink.js +0 -50
  78. package/subscription/src/models/SubscriptionPlanUpdateParameters.d.ts +0 -62
  79. package/subscription/src/models/SubscriptionPlanUpdateParameters.js +0 -56
  80. package/subscription/src/models/SubscriptionUpdateParameters.d.ts +0 -62
  81. package/subscription/src/models/SubscriptionUpdateParameters.js +0 -57
@@ -57,6 +57,14 @@ export interface User {
57
57
  * @memberof User
58
58
  */
59
59
  role: UserRole;
60
+ /**
61
+ *
62
+ * @type {{ [key: string]: string; }}
63
+ * @memberof User
64
+ */
65
+ capabilities?: {
66
+ [key: string]: string;
67
+ };
60
68
  /**
61
69
  * True if the user have unpaid invoice
62
70
  * @type {boolean}
@@ -69,6 +69,7 @@ function UserFromJSONTyped(json, ignoreDiscriminator) {
69
69
  'mangopayTarget': (json['mangopayTarget'] === null || json['mangopayTarget'] === undefined) ? json['mangopayTarget'] : (0, UserMangopayTarget_1.UserMangopayTargetFromJSON)(json['mangopayTarget']),
70
70
  'chargebeeTarget': (json['chargebeeTarget'] === null || json['chargebeeTarget'] === undefined) ? json['chargebeeTarget'] : (0, UserChargebeeTarget_1.UserChargebeeTargetFromJSON)(json['chargebeeTarget']),
71
71
  'role': (json['role'] === null || json['role'] === undefined) ? json['role'] : (0, UserRole_1.UserRoleFromJSON)(json['role']),
72
+ 'capabilities': json['capabilities'],
72
73
  'haveUnpaid': json['haveUnpaid'],
73
74
  'holidayModeEnabled': json['holidayModeEnabled'],
74
75
  'nickname': json['nickname'],
@@ -127,6 +128,7 @@ function UserToJSON(value) {
127
128
  'mangopayTarget': (0, UserMangopayTarget_1.UserMangopayTargetToJSON)(value['mangopayTarget']),
128
129
  'chargebeeTarget': (0, UserChargebeeTarget_1.UserChargebeeTargetToJSON)(value['chargebeeTarget']),
129
130
  'role': (0, UserRole_1.UserRoleToJSON)(value['role']),
131
+ 'capabilities': value['capabilities'],
130
132
  'haveUnpaid': value['haveUnpaid'],
131
133
  'holidayModeEnabled': value['holidayModeEnabled'],
132
134
  'nickname': value['nickname'],
@@ -1,56 +0,0 @@
1
- /**
2
- * lcdp-monolith-service
3
- * This is the REST API of LCDP products
4
- *
5
- * The version of the OpenAPI document: 1.0.0
6
- * Contact: contact@lecomptoirdespharmacies.fr
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime';
13
- import type { Subscription, SubscriptionCreationParameters, SubscriptionUpdateParameters } from '../models/index';
14
- export interface CreateSubscriptionRequest {
15
- subscriptionCreationParameters: SubscriptionCreationParameters;
16
- }
17
- export interface DeleteSubscriptionRequest {
18
- subscriptionId: number;
19
- }
20
- export interface UpdateSubscriptionRequest {
21
- subscriptionId: number;
22
- subscriptionUpdateParameters: SubscriptionUpdateParameters;
23
- }
24
- /**
25
- *
26
- */
27
- export declare class ManageSubscriptionApi extends runtime.BaseAPI {
28
- /**
29
- * Create subscription for a specific user. This operation is useful to change current plan of user. Note : - Upgrade user plan is immediate - Downgrade user plan wait termination of current subscription # Preconditions : - If plan \'price\' > 0, client \'mandate\' of id \'clientId\' should exists. - If user have offisante status \'NOT_SET\' : - User email is filled - User firstname is filled - User lastname is filled - User company SIRET is filled - User Company CIP is filled - User Company finess is filled - User Company management software is filled - User Company location type is filled - User Company group is filled # Limitations : - \'isTrial\' can only be true if no subscription on the user yet or executor is ADMINISTRATOR
30
- * Subscribe to a plan
31
- */
32
- createSubscriptionRaw(requestParameters: CreateSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Subscription | runtime.BlobWithMeta>>;
33
- /**
34
- * Create subscription for a specific user. This operation is useful to change current plan of user. Note : - Upgrade user plan is immediate - Downgrade user plan wait termination of current subscription # Preconditions : - If plan \'price\' > 0, client \'mandate\' of id \'clientId\' should exists. - If user have offisante status \'NOT_SET\' : - User email is filled - User firstname is filled - User lastname is filled - User company SIRET is filled - User Company CIP is filled - User Company finess is filled - User Company management software is filled - User Company location type is filled - User Company group is filled # Limitations : - \'isTrial\' can only be true if no subscription on the user yet or executor is ADMINISTRATOR
35
- * Subscribe to a plan
36
- */
37
- createSubscription(requestParameters: CreateSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Subscription | runtime.BlobWithMeta>;
38
- /**
39
- * Unsubscribe user from subscription
40
- */
41
- deleteSubscriptionRaw(requestParameters: DeleteSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
42
- /**
43
- * Unsubscribe user from subscription
44
- */
45
- deleteSubscription(requestParameters: DeleteSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
46
- /**
47
- * # Preconditions : - You are the subscriber or ADMINISTRATOR - \'nextBillingDate\' > \'validFrom\' - \'nextBillingDate\' <= \'validTo\' - \'validTo\' > \'validFrom\' # Limitations (Subscriber) : - Can only update current subscription - Can only update \'validTo\' or set \'isTrial\' false # How to \"Extend trial period\" : - Delete next subscription - Update current subscription : - billingPrice = 0 - validTo = Any date to set trial end date - isTrial = true # How to \"Unsubscribe immediately\" : (Warning : No billing will occured) - Delete next subscription - Update current subscription : - validTo = TODAY - nextBillingDate = null - isTrial = false # How to \"Unsubscribe at subscription end\" : - Delete next subscription - Update current subscription : - validTo = subscription.validTo || subscription.nextBillingDate || TODAY - isTrial = false
48
- * Update user subscription
49
- */
50
- updateSubscriptionRaw(requestParameters: UpdateSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Subscription | runtime.BlobWithMeta>>;
51
- /**
52
- * # Preconditions : - You are the subscriber or ADMINISTRATOR - \'nextBillingDate\' > \'validFrom\' - \'nextBillingDate\' <= \'validTo\' - \'validTo\' > \'validFrom\' # Limitations (Subscriber) : - Can only update current subscription - Can only update \'validTo\' or set \'isTrial\' false # How to \"Extend trial period\" : - Delete next subscription - Update current subscription : - billingPrice = 0 - validTo = Any date to set trial end date - isTrial = true # How to \"Unsubscribe immediately\" : (Warning : No billing will occured) - Delete next subscription - Update current subscription : - validTo = TODAY - nextBillingDate = null - isTrial = false # How to \"Unsubscribe at subscription end\" : - Delete next subscription - Update current subscription : - validTo = subscription.validTo || subscription.nextBillingDate || TODAY - isTrial = false
53
- * Update user subscription
54
- */
55
- updateSubscription(requestParameters: UpdateSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Subscription | runtime.BlobWithMeta>;
56
- }
@@ -1,315 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * lcdp-monolith-service
6
- * This is the REST API of LCDP products
7
- *
8
- * The version of the OpenAPI document: 1.0.0
9
- * Contact: contact@lecomptoirdespharmacies.fr
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- var __extends = (this && this.__extends) || (function () {
16
- var extendStatics = function (d, b) {
17
- extendStatics = Object.setPrototypeOf ||
18
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
- return extendStatics(d, b);
21
- };
22
- return function (d, b) {
23
- if (typeof b !== "function" && b !== null)
24
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
- extendStatics(d, b);
26
- function __() { this.constructor = d; }
27
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
- };
29
- })();
30
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
- return new (P || (P = Promise))(function (resolve, reject) {
33
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- };
39
- var __generator = (this && this.__generator) || function (thisArg, body) {
40
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
41
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
42
- function verb(n) { return function (v) { return step([n, v]); }; }
43
- function step(op) {
44
- if (f) throw new TypeError("Generator is already executing.");
45
- while (_) try {
46
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
47
- if (y = 0, t) op = [op[0] & 2, t.value];
48
- switch (op[0]) {
49
- case 0: case 1: t = op; break;
50
- case 4: _.label++; return { value: op[1], done: false };
51
- case 5: _.label++; y = op[1]; op = [0]; continue;
52
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
53
- default:
54
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
55
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
56
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
57
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58
- if (t[2]) _.ops.pop();
59
- _.trys.pop(); continue;
60
- }
61
- op = body.call(thisArg, _);
62
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
63
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
64
- }
65
- };
66
- Object.defineProperty(exports, "__esModule", { value: true });
67
- exports.ManageSubscriptionApi = void 0;
68
- var runtime = require("../runtime");
69
- var index_1 = require("../models/index");
70
- /**
71
- *
72
- */
73
- var ManageSubscriptionApi = /** @class */ (function (_super) {
74
- __extends(ManageSubscriptionApi, _super);
75
- function ManageSubscriptionApi() {
76
- return _super !== null && _super.apply(this, arguments) || this;
77
- }
78
- /**
79
- * Create subscription for a specific user. This operation is useful to change current plan of user. Note : - Upgrade user plan is immediate - Downgrade user plan wait termination of current subscription # Preconditions : - If plan \'price\' > 0, client \'mandate\' of id \'clientId\' should exists. - If user have offisante status \'NOT_SET\' : - User email is filled - User firstname is filled - User lastname is filled - User company SIRET is filled - User Company CIP is filled - User Company finess is filled - User Company management software is filled - User Company location type is filled - User Company group is filled # Limitations : - \'isTrial\' can only be true if no subscription on the user yet or executor is ADMINISTRATOR
80
- * Subscribe to a plan
81
- */
82
- ManageSubscriptionApi.prototype.createSubscriptionRaw = function (requestParameters, initOverrides) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- var queryParameters, headerParameters, _a, _b, token, tokenString, response, contentType, response_1;
85
- return __generator(this, function (_c) {
86
- switch (_c.label) {
87
- case 0:
88
- if (requestParameters['subscriptionCreationParameters'] == null) {
89
- throw new runtime.RequiredError('subscriptionCreationParameters', 'Required parameter "subscriptionCreationParameters" was null or undefined when calling createSubscription().');
90
- }
91
- queryParameters = {};
92
- headerParameters = {};
93
- headerParameters['Content-Type'] = 'application/json';
94
- if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
95
- _a = headerParameters;
96
- _b = "x-api-key";
97
- return [4 /*yield*/, this.configuration.apiKey("x-api-key")];
98
- case 1:
99
- _a[_b] = _c.sent(); // apiKeyAuth authentication
100
- _c.label = 2;
101
- case 2:
102
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
103
- token = this.configuration.accessToken;
104
- return [4 /*yield*/, token("bearerAuth", [])];
105
- case 3:
106
- tokenString = _c.sent();
107
- if (tokenString) {
108
- headerParameters["Authorization"] = "Bearer ".concat(tokenString);
109
- }
110
- _c.label = 4;
111
- case 4:
112
- _c.trys.push([4, 6, , 7]);
113
- return [4 /*yield*/, this.request({
114
- path: "/subscriptions",
115
- method: 'POST',
116
- headers: headerParameters,
117
- query: queryParameters,
118
- body: (0, index_1.SubscriptionCreationParametersToJSON)(requestParameters['subscriptionCreationParameters']),
119
- }, initOverrides)];
120
- case 5:
121
- response = _c.sent();
122
- contentType = response.headers.get("content-type");
123
- if (contentType && contentType.indexOf("application/json") !== -1) {
124
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.SubscriptionFromJSON)(jsonValue); })];
125
- }
126
- else if (contentType && contentType.indexOf("text/plain") !== -1) {
127
- return [2 /*return*/, new runtime.TextApiResponse(response)];
128
- }
129
- else {
130
- // TODO : Better handling of others application types
131
- return [2 /*return*/, new runtime.BlobWithMetaApiResponse(response)];
132
- }
133
- return [3 /*break*/, 7];
134
- case 6:
135
- response_1 = _c.sent();
136
- console.debug(response_1);
137
- throw response_1;
138
- case 7: return [2 /*return*/];
139
- }
140
- });
141
- });
142
- };
143
- /**
144
- * Create subscription for a specific user. This operation is useful to change current plan of user. Note : - Upgrade user plan is immediate - Downgrade user plan wait termination of current subscription # Preconditions : - If plan \'price\' > 0, client \'mandate\' of id \'clientId\' should exists. - If user have offisante status \'NOT_SET\' : - User email is filled - User firstname is filled - User lastname is filled - User company SIRET is filled - User Company CIP is filled - User Company finess is filled - User Company management software is filled - User Company location type is filled - User Company group is filled # Limitations : - \'isTrial\' can only be true if no subscription on the user yet or executor is ADMINISTRATOR
145
- * Subscribe to a plan
146
- */
147
- ManageSubscriptionApi.prototype.createSubscription = function (requestParameters, initOverrides) {
148
- return __awaiter(this, void 0, void 0, function () {
149
- var response;
150
- return __generator(this, function (_a) {
151
- switch (_a.label) {
152
- case 0: return [4 /*yield*/, this.createSubscriptionRaw(requestParameters, initOverrides)];
153
- case 1:
154
- response = _a.sent();
155
- return [4 /*yield*/, response.value()];
156
- case 2: return [2 /*return*/, _a.sent()];
157
- }
158
- });
159
- });
160
- };
161
- /**
162
- * Unsubscribe user from subscription
163
- */
164
- ManageSubscriptionApi.prototype.deleteSubscriptionRaw = function (requestParameters, initOverrides) {
165
- return __awaiter(this, void 0, void 0, function () {
166
- var queryParameters, headerParameters, _a, _b, token, tokenString, response, response_2;
167
- return __generator(this, function (_c) {
168
- switch (_c.label) {
169
- case 0:
170
- if (requestParameters['subscriptionId'] == null) {
171
- throw new runtime.RequiredError('subscriptionId', 'Required parameter "subscriptionId" was null or undefined when calling deleteSubscription().');
172
- }
173
- queryParameters = {};
174
- headerParameters = {};
175
- if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
176
- _a = headerParameters;
177
- _b = "x-api-key";
178
- return [4 /*yield*/, this.configuration.apiKey("x-api-key")];
179
- case 1:
180
- _a[_b] = _c.sent(); // apiKeyAuth authentication
181
- _c.label = 2;
182
- case 2:
183
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
184
- token = this.configuration.accessToken;
185
- return [4 /*yield*/, token("bearerAuth", [])];
186
- case 3:
187
- tokenString = _c.sent();
188
- if (tokenString) {
189
- headerParameters["Authorization"] = "Bearer ".concat(tokenString);
190
- }
191
- _c.label = 4;
192
- case 4:
193
- _c.trys.push([4, 6, , 7]);
194
- return [4 /*yield*/, this.request({
195
- path: "/subscriptions/{subscriptionId}".replace("{".concat("subscriptionId", "}"), encodeURIComponent(String(requestParameters['subscriptionId']))),
196
- method: 'DELETE',
197
- headers: headerParameters,
198
- query: queryParameters,
199
- }, initOverrides)];
200
- case 5:
201
- response = _c.sent();
202
- return [2 /*return*/, new runtime.VoidApiResponse(response)];
203
- case 6:
204
- response_2 = _c.sent();
205
- console.debug(response_2);
206
- throw response_2;
207
- case 7: return [2 /*return*/];
208
- }
209
- });
210
- });
211
- };
212
- /**
213
- * Unsubscribe user from subscription
214
- */
215
- ManageSubscriptionApi.prototype.deleteSubscription = function (requestParameters, initOverrides) {
216
- return __awaiter(this, void 0, void 0, function () {
217
- return __generator(this, function (_a) {
218
- switch (_a.label) {
219
- case 0: return [4 /*yield*/, this.deleteSubscriptionRaw(requestParameters, initOverrides)];
220
- case 1:
221
- _a.sent();
222
- return [2 /*return*/];
223
- }
224
- });
225
- });
226
- };
227
- /**
228
- * # Preconditions : - You are the subscriber or ADMINISTRATOR - \'nextBillingDate\' > \'validFrom\' - \'nextBillingDate\' <= \'validTo\' - \'validTo\' > \'validFrom\' # Limitations (Subscriber) : - Can only update current subscription - Can only update \'validTo\' or set \'isTrial\' false # How to \"Extend trial period\" : - Delete next subscription - Update current subscription : - billingPrice = 0 - validTo = Any date to set trial end date - isTrial = true # How to \"Unsubscribe immediately\" : (Warning : No billing will occured) - Delete next subscription - Update current subscription : - validTo = TODAY - nextBillingDate = null - isTrial = false # How to \"Unsubscribe at subscription end\" : - Delete next subscription - Update current subscription : - validTo = subscription.validTo || subscription.nextBillingDate || TODAY - isTrial = false
229
- * Update user subscription
230
- */
231
- ManageSubscriptionApi.prototype.updateSubscriptionRaw = function (requestParameters, initOverrides) {
232
- return __awaiter(this, void 0, void 0, function () {
233
- var queryParameters, headerParameters, _a, _b, token, tokenString, response, contentType, response_3;
234
- return __generator(this, function (_c) {
235
- switch (_c.label) {
236
- case 0:
237
- if (requestParameters['subscriptionId'] == null) {
238
- throw new runtime.RequiredError('subscriptionId', 'Required parameter "subscriptionId" was null or undefined when calling updateSubscription().');
239
- }
240
- if (requestParameters['subscriptionUpdateParameters'] == null) {
241
- throw new runtime.RequiredError('subscriptionUpdateParameters', 'Required parameter "subscriptionUpdateParameters" was null or undefined when calling updateSubscription().');
242
- }
243
- queryParameters = {};
244
- headerParameters = {};
245
- headerParameters['Content-Type'] = 'application/merge-patch+json';
246
- if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
247
- _a = headerParameters;
248
- _b = "x-api-key";
249
- return [4 /*yield*/, this.configuration.apiKey("x-api-key")];
250
- case 1:
251
- _a[_b] = _c.sent(); // apiKeyAuth authentication
252
- _c.label = 2;
253
- case 2:
254
- if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
255
- token = this.configuration.accessToken;
256
- return [4 /*yield*/, token("bearerAuth", [])];
257
- case 3:
258
- tokenString = _c.sent();
259
- if (tokenString) {
260
- headerParameters["Authorization"] = "Bearer ".concat(tokenString);
261
- }
262
- _c.label = 4;
263
- case 4:
264
- _c.trys.push([4, 6, , 7]);
265
- return [4 /*yield*/, this.request({
266
- path: "/subscriptions/{subscriptionId}".replace("{".concat("subscriptionId", "}"), encodeURIComponent(String(requestParameters['subscriptionId']))),
267
- method: 'PATCH',
268
- headers: headerParameters,
269
- query: queryParameters,
270
- body: (0, index_1.SubscriptionUpdateParametersToJSON)(requestParameters['subscriptionUpdateParameters']),
271
- }, initOverrides)];
272
- case 5:
273
- response = _c.sent();
274
- contentType = response.headers.get("content-type");
275
- if (contentType && contentType.indexOf("application/json") !== -1) {
276
- return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.SubscriptionFromJSON)(jsonValue); })];
277
- }
278
- else if (contentType && contentType.indexOf("text/plain") !== -1) {
279
- return [2 /*return*/, new runtime.TextApiResponse(response)];
280
- }
281
- else {
282
- // TODO : Better handling of others application types
283
- return [2 /*return*/, new runtime.BlobWithMetaApiResponse(response)];
284
- }
285
- return [3 /*break*/, 7];
286
- case 6:
287
- response_3 = _c.sent();
288
- console.debug(response_3);
289
- throw response_3;
290
- case 7: return [2 /*return*/];
291
- }
292
- });
293
- });
294
- };
295
- /**
296
- * # Preconditions : - You are the subscriber or ADMINISTRATOR - \'nextBillingDate\' > \'validFrom\' - \'nextBillingDate\' <= \'validTo\' - \'validTo\' > \'validFrom\' # Limitations (Subscriber) : - Can only update current subscription - Can only update \'validTo\' or set \'isTrial\' false # How to \"Extend trial period\" : - Delete next subscription - Update current subscription : - billingPrice = 0 - validTo = Any date to set trial end date - isTrial = true # How to \"Unsubscribe immediately\" : (Warning : No billing will occured) - Delete next subscription - Update current subscription : - validTo = TODAY - nextBillingDate = null - isTrial = false # How to \"Unsubscribe at subscription end\" : - Delete next subscription - Update current subscription : - validTo = subscription.validTo || subscription.nextBillingDate || TODAY - isTrial = false
297
- * Update user subscription
298
- */
299
- ManageSubscriptionApi.prototype.updateSubscription = function (requestParameters, initOverrides) {
300
- return __awaiter(this, void 0, void 0, function () {
301
- var response;
302
- return __generator(this, function (_a) {
303
- switch (_a.label) {
304
- case 0: return [4 /*yield*/, this.updateSubscriptionRaw(requestParameters, initOverrides)];
305
- case 1:
306
- response = _a.sent();
307
- return [4 /*yield*/, response.value()];
308
- case 2: return [2 /*return*/, _a.sent()];
309
- }
310
- });
311
- });
312
- };
313
- return ManageSubscriptionApi;
314
- }(runtime.BaseAPI));
315
- exports.ManageSubscriptionApi = ManageSubscriptionApi;
@@ -1,30 +0,0 @@
1
- /**
2
- * lcdp-monolith-service
3
- * This is the REST API of LCDP products
4
- *
5
- * The version of the OpenAPI document: 1.0.0
6
- * Contact: contact@lecomptoirdespharmacies.fr
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime';
13
- import type { SubscriptionPlan, SubscriptionPlanId, SubscriptionPlanUpdateParameters } from '../models/index';
14
- export interface UpdateSubscriptionPlanRequest {
15
- subscriptionPlanId: SubscriptionPlanId;
16
- subscriptionPlanUpdateParameters: SubscriptionPlanUpdateParameters;
17
- }
18
- /**
19
- *
20
- */
21
- export declare class ManageSubscriptionPlanApi extends runtime.BaseAPI {
22
- /**
23
- * Update subscription plan
24
- */
25
- updateSubscriptionPlanRaw(requestParameters: UpdateSubscriptionPlanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPlan | runtime.BlobWithMeta>>;
26
- /**
27
- * Update subscription plan
28
- */
29
- updateSubscriptionPlan(requestParameters: UpdateSubscriptionPlanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPlan | runtime.BlobWithMeta>;
30
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * lcdp-monolith-service
3
- * This is the REST API of LCDP products
4
- *
5
- * The version of the OpenAPI document: 1.0.0
6
- * Contact: contact@lecomptoirdespharmacies.fr
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import * as runtime from '../runtime';
13
- import type { PaginatedSubscriptions, SubscriptionPlanId } from '../models/index';
14
- export interface GetSubscriptionsRequest {
15
- p: number;
16
- pp: number;
17
- sEq?: Array<number>;
18
- idEq?: Array<number>;
19
- isTrialEq?: boolean;
20
- validFromLte?: Date;
21
- validFromGt?: Date;
22
- validToLte?: Date;
23
- validToGt?: Date;
24
- pEq?: Array<SubscriptionPlanId>;
25
- orderBy?: GetSubscriptionsOrderByEnum;
26
- }
27
- /**
28
- *
29
- */
30
- export declare class SearchSubscriptionApi extends runtime.BaseAPI {
31
- /**
32
- * Get subscriptions
33
- */
34
- getSubscriptionsRaw(requestParameters: GetSubscriptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedSubscriptions | runtime.BlobWithMeta>>;
35
- /**
36
- * Get subscriptions
37
- */
38
- getSubscriptions(requestParameters: GetSubscriptionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedSubscriptions | runtime.BlobWithMeta>;
39
- }
40
- /**
41
- * @export
42
- */
43
- export declare const GetSubscriptionsOrderByEnum: {
44
- readonly VALID_FROM_ASC: "VALID_FROM:ASC";
45
- readonly VALID_FROM_DESC: "VALID_FROM:DESC";
46
- readonly VALID_TO_ASC: "VALID_TO:ASC";
47
- readonly VALID_TO_DESC: "VALID_TO:DESC";
48
- readonly NEXT_BILLING_DATE_ASC: "NEXT_BILLING_DATE:ASC";
49
- readonly NEXT_BILLING_DATE_DESC: "NEXT_BILLING_DATE:DESC";
50
- readonly PLAN_ID_ASC: "PLAN_ID:ASC";
51
- readonly PLAN_ID_DESC: "PLAN_ID:DESC";
52
- };
53
- export declare type GetSubscriptionsOrderByEnum = typeof GetSubscriptionsOrderByEnum[keyof typeof GetSubscriptionsOrderByEnum];