@emilgroup/accounting-sdk 1.34.1-beta.114 → 1.34.1-beta.116

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 (30) hide show
  1. package/.openapi-generator/FILES +5 -0
  2. package/README.md +2 -2
  3. package/api/bank-transaction-account-links-api.ts +346 -0
  4. package/api.ts +2 -0
  5. package/base.ts +80 -20
  6. package/dist/api/bank-transaction-account-links-api.d.ts +197 -0
  7. package/dist/api/bank-transaction-account-links-api.js +358 -0
  8. package/dist/api.d.ts +1 -0
  9. package/dist/api.js +1 -0
  10. package/dist/base.d.ts +7 -0
  11. package/dist/base.js +74 -21
  12. package/dist/models/bank-transaction-account-link-carrier-class.d.ts +36 -0
  13. package/dist/models/bank-transaction-account-link-carrier-class.js +15 -0
  14. package/dist/models/bank-transaction-account-link-row-class.d.ts +71 -0
  15. package/dist/models/bank-transaction-account-link-row-class.js +20 -0
  16. package/dist/models/booking-entry-class.d.ts +1 -0
  17. package/dist/models/booking-entry-class.js +1 -0
  18. package/dist/models/get-bank-transaction-account-link-options-response-class.d.ts +25 -0
  19. package/dist/models/get-bank-transaction-account-link-options-response-class.js +15 -0
  20. package/dist/models/index.d.ts +4 -0
  21. package/dist/models/index.js +4 -0
  22. package/dist/models/list-bank-transaction-account-link-carriers-response-class.d.ts +43 -0
  23. package/dist/models/list-bank-transaction-account-link-carriers-response-class.js +15 -0
  24. package/models/bank-transaction-account-link-carrier-class.ts +42 -0
  25. package/models/bank-transaction-account-link-row-class.ts +80 -0
  26. package/models/booking-entry-class.ts +1 -0
  27. package/models/get-bank-transaction-account-link-options-response-class.ts +31 -0
  28. package/models/index.ts +4 -0
  29. package/models/list-bank-transaction-account-link-carriers-response-class.ts +49 -0
  30. package/package.json +2 -2
@@ -4,6 +4,7 @@
4
4
  README.md
5
5
  api.ts
6
6
  api/accounting-configs-api.ts
7
+ api/bank-transaction-account-links-api.ts
7
8
  api/booking-entries-api.ts
8
9
  api/commission-account-mappings-api.ts
9
10
  api/financial-accounts-api.ts
@@ -25,6 +26,8 @@ models/accounting-config-data-dto-accounting-configuration.ts
25
26
  models/accounting-config-data-dto-default-account-mappings.ts
26
27
  models/accounting-config-data-dto.ts
27
28
  models/accounting-configuration-class.ts
29
+ models/bank-transaction-account-link-carrier-class.ts
30
+ models/bank-transaction-account-link-row-class.ts
28
31
  models/booking-entry-class.ts
29
32
  models/commission-account-mapping-class.ts
30
33
  models/commission-agreement-account-mapping-detail-class.ts
@@ -49,6 +52,7 @@ models/financial-transaction-class.ts
49
52
  models/financial-transaction-data-dto.ts
50
53
  models/get-accounting-categories-response-class.ts
51
54
  models/get-activation-snapshot-response-class.ts
55
+ models/get-bank-transaction-account-link-options-response-class.ts
52
56
  models/get-booking-entry-response-class.ts
53
57
  models/get-financial-account-response-class.ts
54
58
  models/get-financial-transaction-response-class.ts
@@ -57,6 +61,7 @@ models/get-personal-account-response-class.ts
57
61
  models/index.ts
58
62
  models/inline-response200.ts
59
63
  models/inline-response503.ts
64
+ models/list-bank-transaction-account-link-carriers-response-class.ts
60
65
  models/list-booking-entries-response-class.ts
61
66
  models/list-commission-account-mappings-response-class.ts
62
67
  models/list-commission-agreements-with-account-mappings-response-class.ts
package/README.md CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/accounting-sdk@1.34.1-beta.114 --save
20
+ npm install @emilgroup/accounting-sdk@1.34.1-beta.116 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/accounting-sdk@1.34.1-beta.114
24
+ yarn add @emilgroup/accounting-sdk@1.34.1-beta.116
25
25
  ```
26
26
 
27
27
  And then you can import `FinancialAccountsApi`.
@@ -0,0 +1,346 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL AccountingService
5
+ * The EMIL AccountingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
17
+ import { Configuration } from '../configuration';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
+ // @ts-ignore
24
+ import { GetBankTransactionAccountLinkOptionsResponseClass } from '../models';
25
+ // @ts-ignore
26
+ import { ListBankTransactionAccountLinkCarriersResponseClass } from '../models';
27
+ /**
28
+ * BankTransactionAccountLinksApi - axios parameter creator
29
+ * @export
30
+ */
31
+ export const BankTransactionAccountLinksApiAxiosParamCreator = function (configuration?: Configuration) {
32
+ return {
33
+ /**
34
+ * Lists the rows a bank transaction can be linked to: one per active account of each whitelisted category, default account first, plus the carrier row for an MGA tenant. Which tax rows appear follows the tenant\'s tax handling. **Required Permissions** \"payment-management.bank-accounts.create\"
35
+ * @summary Retrieve the bank transaction account link options
36
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
37
+ * @param {*} [options] Override http request option.
38
+ * @throws {RequiredError}
39
+ */
40
+ getBankTransactionAccountLinkOptions: async (authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
41
+ const localVarPath = `/accountingservice/v1/bank-transaction-account-links/accounts`;
42
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
43
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
44
+ let baseOptions;
45
+ let baseAccessToken;
46
+ if (configuration) {
47
+ baseOptions = configuration.baseOptions;
48
+ baseAccessToken = configuration.accessToken;
49
+ }
50
+
51
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
52
+ const localVarHeaderParameter = {} as any;
53
+ const localVarQueryParameter = {} as any;
54
+
55
+ // authentication bearer required
56
+ // http bearer authentication required
57
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
58
+
59
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
60
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
61
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
62
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
63
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
64
+ if (authorizationValue || authorizationKeepEmpty) {
65
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
66
+ }
67
+
68
+
69
+
70
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
71
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
72
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
73
+
74
+ return {
75
+ url: toPathString(localVarUrlObj),
76
+ options: localVarRequestOptions,
77
+ };
78
+ },
79
+ /**
80
+ * Lists the risk carriers a bank transaction can be linked to: partners with the risk carrier role in partnerservice and partners that already hold a carrier personal account, one row per partner, ordered by partner number then code. Returns codes and numbers only; read the names from partnerservice. Search matches carrier names, partner numbers or personal account numbers before pagination. For an exact chip lookup, filters supports partnerCode=(code|code), at most 50 codes. Other filters and custom ordering are not supported. **Required Permissions** \"payment-management.bank-accounts.view\"
81
+ * @summary List bank transaction account link carriers
82
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
83
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
84
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
85
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
86
+ * @param {string} [search] To search the list by any field, pass search&#x3D;xxx to fetch the result.
87
+ * @param {string} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
88
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
89
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
90
+ * @param {*} [options] Override http request option.
91
+ * @throws {RequiredError}
92
+ */
93
+ listBankTransactionAccountLinkCarriers: async (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
94
+ const localVarPath = `/accountingservice/v1/bank-transaction-account-links/carriers`;
95
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
96
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
97
+ let baseOptions;
98
+ let baseAccessToken;
99
+ if (configuration) {
100
+ baseOptions = configuration.baseOptions;
101
+ baseAccessToken = configuration.accessToken;
102
+ }
103
+
104
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
105
+ const localVarHeaderParameter = {} as any;
106
+ const localVarQueryParameter = {} as any;
107
+
108
+ // authentication bearer required
109
+ // http bearer authentication required
110
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
111
+
112
+ if (pageSize !== undefined) {
113
+ localVarQueryParameter['pageSize'] = pageSize;
114
+ }
115
+
116
+ if (pageToken !== undefined) {
117
+ localVarQueryParameter['pageToken'] = pageToken;
118
+ }
119
+
120
+ if (filter !== undefined) {
121
+ localVarQueryParameter['filter'] = filter;
122
+ }
123
+
124
+ if (search !== undefined) {
125
+ localVarQueryParameter['search'] = search;
126
+ }
127
+
128
+ if (order !== undefined) {
129
+ localVarQueryParameter['order'] = order;
130
+ }
131
+
132
+ if (expand !== undefined) {
133
+ localVarQueryParameter['expand'] = expand;
134
+ }
135
+
136
+ if (filters !== undefined) {
137
+ localVarQueryParameter['filters'] = filters;
138
+ }
139
+
140
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
141
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
142
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
143
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
144
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
145
+ if (authorizationValue || authorizationKeepEmpty) {
146
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
147
+ }
148
+
149
+
150
+
151
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
152
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
153
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
154
+
155
+ return {
156
+ url: toPathString(localVarUrlObj),
157
+ options: localVarRequestOptions,
158
+ };
159
+ },
160
+ }
161
+ };
162
+
163
+ /**
164
+ * BankTransactionAccountLinksApi - functional programming interface
165
+ * @export
166
+ */
167
+ export const BankTransactionAccountLinksApiFp = function(configuration?: Configuration) {
168
+ const localVarAxiosParamCreator = BankTransactionAccountLinksApiAxiosParamCreator(configuration)
169
+ return {
170
+ /**
171
+ * Lists the rows a bank transaction can be linked to: one per active account of each whitelisted category, default account first, plus the carrier row for an MGA tenant. Which tax rows appear follows the tenant\'s tax handling. **Required Permissions** \"payment-management.bank-accounts.create\"
172
+ * @summary Retrieve the bank transaction account link options
173
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
174
+ * @param {*} [options] Override http request option.
175
+ * @throws {RequiredError}
176
+ */
177
+ async getBankTransactionAccountLinkOptions(authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetBankTransactionAccountLinkOptionsResponseClass>> {
178
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getBankTransactionAccountLinkOptions(authorization, options);
179
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
180
+ },
181
+ /**
182
+ * Lists the risk carriers a bank transaction can be linked to: partners with the risk carrier role in partnerservice and partners that already hold a carrier personal account, one row per partner, ordered by partner number then code. Returns codes and numbers only; read the names from partnerservice. Search matches carrier names, partner numbers or personal account numbers before pagination. For an exact chip lookup, filters supports partnerCode=(code|code), at most 50 codes. Other filters and custom ordering are not supported. **Required Permissions** \"payment-management.bank-accounts.view\"
183
+ * @summary List bank transaction account link carriers
184
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
185
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
186
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
187
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
188
+ * @param {string} [search] To search the list by any field, pass search&#x3D;xxx to fetch the result.
189
+ * @param {string} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
190
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
191
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
192
+ * @param {*} [options] Override http request option.
193
+ * @throws {RequiredError}
194
+ */
195
+ async listBankTransactionAccountLinkCarriers(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListBankTransactionAccountLinkCarriersResponseClass>> {
196
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listBankTransactionAccountLinkCarriers(authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
197
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
198
+ },
199
+ }
200
+ };
201
+
202
+ /**
203
+ * BankTransactionAccountLinksApi - factory interface
204
+ * @export
205
+ */
206
+ export const BankTransactionAccountLinksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
207
+ const localVarFp = BankTransactionAccountLinksApiFp(configuration)
208
+ return {
209
+ /**
210
+ * Lists the rows a bank transaction can be linked to: one per active account of each whitelisted category, default account first, plus the carrier row for an MGA tenant. Which tax rows appear follows the tenant\'s tax handling. **Required Permissions** \"payment-management.bank-accounts.create\"
211
+ * @summary Retrieve the bank transaction account link options
212
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
213
+ * @param {*} [options] Override http request option.
214
+ * @throws {RequiredError}
215
+ */
216
+ getBankTransactionAccountLinkOptions(authorization?: string, options?: any): AxiosPromise<GetBankTransactionAccountLinkOptionsResponseClass> {
217
+ return localVarFp.getBankTransactionAccountLinkOptions(authorization, options).then((request) => request(axios, basePath));
218
+ },
219
+ /**
220
+ * Lists the risk carriers a bank transaction can be linked to: partners with the risk carrier role in partnerservice and partners that already hold a carrier personal account, one row per partner, ordered by partner number then code. Returns codes and numbers only; read the names from partnerservice. Search matches carrier names, partner numbers or personal account numbers before pagination. For an exact chip lookup, filters supports partnerCode=(code|code), at most 50 codes. Other filters and custom ordering are not supported. **Required Permissions** \"payment-management.bank-accounts.view\"
221
+ * @summary List bank transaction account link carriers
222
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
223
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
224
+ * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
225
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
226
+ * @param {string} [search] To search the list by any field, pass search&#x3D;xxx to fetch the result.
227
+ * @param {string} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
228
+ * @param {string} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
229
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
230
+ * @param {*} [options] Override http request option.
231
+ * @throws {RequiredError}
232
+ */
233
+ listBankTransactionAccountLinkCarriers(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListBankTransactionAccountLinkCarriersResponseClass> {
234
+ return localVarFp.listBankTransactionAccountLinkCarriers(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
235
+ },
236
+ };
237
+ };
238
+
239
+ /**
240
+ * Request parameters for getBankTransactionAccountLinkOptions operation in BankTransactionAccountLinksApi.
241
+ * @export
242
+ * @interface BankTransactionAccountLinksApiGetBankTransactionAccountLinkOptionsRequest
243
+ */
244
+ export interface BankTransactionAccountLinksApiGetBankTransactionAccountLinkOptionsRequest {
245
+ /**
246
+ * Bearer Token: provided by the login endpoint under the name accessToken.
247
+ * @type {string}
248
+ * @memberof BankTransactionAccountLinksApiGetBankTransactionAccountLinkOptions
249
+ */
250
+ readonly authorization?: string
251
+ }
252
+
253
+ /**
254
+ * Request parameters for listBankTransactionAccountLinkCarriers operation in BankTransactionAccountLinksApi.
255
+ * @export
256
+ * @interface BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriersRequest
257
+ */
258
+ export interface BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriersRequest {
259
+ /**
260
+ * Bearer Token: provided by the login endpoint under the name accessToken.
261
+ * @type {string}
262
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
263
+ */
264
+ readonly authorization?: string
265
+
266
+ /**
267
+ * A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
268
+ * @type {number}
269
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
270
+ */
271
+ readonly pageSize?: number
272
+
273
+ /**
274
+ * A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
275
+ * @type {string}
276
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
277
+ */
278
+ readonly pageToken?: string
279
+
280
+ /**
281
+ * Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
282
+ * @type {string}
283
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
284
+ */
285
+ readonly filter?: string
286
+
287
+ /**
288
+ * To search the list by any field, pass search&#x3D;xxx to fetch the result.
289
+ * @type {string}
290
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
291
+ */
292
+ readonly search?: string
293
+
294
+ /**
295
+ * The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
296
+ * @type {string}
297
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
298
+ */
299
+ readonly order?: string
300
+
301
+ /**
302
+ * Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
303
+ * @type {string}
304
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
305
+ */
306
+ readonly expand?: string
307
+
308
+ /**
309
+ * Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
310
+ * @type {string}
311
+ * @memberof BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriers
312
+ */
313
+ readonly filters?: string
314
+ }
315
+
316
+ /**
317
+ * BankTransactionAccountLinksApi - object-oriented interface
318
+ * @export
319
+ * @class BankTransactionAccountLinksApi
320
+ * @extends {BaseAPI}
321
+ */
322
+ export class BankTransactionAccountLinksApi extends BaseAPI {
323
+ /**
324
+ * Lists the rows a bank transaction can be linked to: one per active account of each whitelisted category, default account first, plus the carrier row for an MGA tenant. Which tax rows appear follows the tenant\'s tax handling. **Required Permissions** \"payment-management.bank-accounts.create\"
325
+ * @summary Retrieve the bank transaction account link options
326
+ * @param {BankTransactionAccountLinksApiGetBankTransactionAccountLinkOptionsRequest} requestParameters Request parameters.
327
+ * @param {*} [options] Override http request option.
328
+ * @throws {RequiredError}
329
+ * @memberof BankTransactionAccountLinksApi
330
+ */
331
+ public getBankTransactionAccountLinkOptions(requestParameters: BankTransactionAccountLinksApiGetBankTransactionAccountLinkOptionsRequest = {}, options?: AxiosRequestConfig) {
332
+ return BankTransactionAccountLinksApiFp(this.configuration).getBankTransactionAccountLinkOptions(requestParameters.authorization, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
333
+ }
334
+
335
+ /**
336
+ * Lists the risk carriers a bank transaction can be linked to: partners with the risk carrier role in partnerservice and partners that already hold a carrier personal account, one row per partner, ordered by partner number then code. Returns codes and numbers only; read the names from partnerservice. Search matches carrier names, partner numbers or personal account numbers before pagination. For an exact chip lookup, filters supports partnerCode=(code|code), at most 50 codes. Other filters and custom ordering are not supported. **Required Permissions** \"payment-management.bank-accounts.view\"
337
+ * @summary List bank transaction account link carriers
338
+ * @param {BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriersRequest} requestParameters Request parameters.
339
+ * @param {*} [options] Override http request option.
340
+ * @throws {RequiredError}
341
+ * @memberof BankTransactionAccountLinksApi
342
+ */
343
+ public listBankTransactionAccountLinkCarriers(requestParameters: BankTransactionAccountLinksApiListBankTransactionAccountLinkCarriersRequest = {}, options?: AxiosRequestConfig) {
344
+ return BankTransactionAccountLinksApiFp(this.configuration).listBankTransactionAccountLinkCarriers(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
345
+ }
346
+ }
package/api.ts CHANGED
@@ -21,6 +21,7 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj
21
21
  // @ts-ignore
22
22
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
23
23
  import { AccountingConfigsApi } from './api';
24
+ import { BankTransactionAccountLinksApi } from './api';
24
25
  import { BookingEntriesApi } from './api';
25
26
  import { CommissionAccountMappingsApi } from './api';
26
27
  import { FinancialAccountsApi } from './api';
@@ -32,6 +33,7 @@ import { ProductAccountMappingsApi } from './api';
32
33
 
33
34
 
34
35
  export * from './api/accounting-configs-api';
36
+ export * from './api/bank-transaction-account-links-api';
35
37
  export * from './api/booking-entries-api';
36
38
  export * from './api/commission-account-mappings-api';
37
39
  export * from './api/financial-accounts-api';
package/base.ts CHANGED
@@ -72,9 +72,8 @@ export enum Environment {
72
72
  let _retry_count = 0
73
73
  let _retry = null
74
74
 
75
- // Marks each request with the account (username) of the SDK object that sent it: only SDK objects of that
76
- // account refresh and resend it, never an object of another account open in the same browser.
77
- const REQUEST_OWNER = '_emilSdkOwner';
75
+ // Refreshes in flight per account (BaseAPI.shareRefresh).
76
+ const refreshesInFlight = new Map<string, Promise<LoginClass>>();
78
77
 
79
78
  export function resetRetry() {
80
79
  _retry_count = 0
@@ -346,7 +345,10 @@ export class BaseAPI {
346
345
  const { username } = this.configuration;
347
346
 
348
347
  if (!username) {
349
- throw new Error('Failed to refresh token.');
348
+ // This object cannot refresh at all, so the session it relied on is over for it.
349
+ const cannotRefresh: any = new Error('Failed to refresh token.');
350
+ cannotRefresh.sessionExpired = true;
351
+ throw cannotRefresh;
350
352
  }
351
353
 
352
354
  const refreshTokenAxios = globalAxios.create()
@@ -417,6 +419,10 @@ export class BaseAPI {
417
419
  this.storeTokenData(null);
418
420
  }
419
421
 
422
+ // Marks each request with the account (username) of the SDK object that sent it: only SDK objects of that
423
+ // account refresh and resend it, never an object of another account in the same app.
424
+ private static readonly REQUEST_OWNER = '_emilSdkOwner';
425
+
420
426
  private ownAccount(): string {
421
427
  return (this.configuration.username || '').toLowerCase();
422
428
  }
@@ -426,7 +432,70 @@ export class BaseAPI {
426
432
  if (!this.ownAccount()) {
427
433
  return { ...options };
428
434
  }
429
- return { ...options, [REQUEST_OWNER]: this.ownAccount() } as AxiosRequestConfig;
435
+ return { ...options, [BaseAPI.REQUEST_OWNER]: this.ownAccount() } as AxiosRequestConfig;
436
+ }
437
+
438
+ // Sent for another account: only that account's SDK objects handle it. Unmarked requests as before.
439
+ private sentByOtherAccount(config?: AxiosRequestConfig): boolean {
440
+ const owner = (config as Record<string, unknown> | undefined)?.[BaseAPI.REQUEST_OWNER];
441
+ return owner !== undefined && owner !== this.ownAccount();
442
+ }
443
+
444
+
445
+ // One refresh per account; an object without a username keeps its own, which fails as before.
446
+ private sharedRefresh(): Promise<LoginClass> {
447
+ const account = this.ownAccount();
448
+ if (!account) {
449
+ return this.refreshTokenInternal();
450
+ }
451
+ return BaseAPI.shareRefresh(refreshesInFlight, account, () => this.refreshTokenInternal());
452
+ }
453
+
454
+ private refreshRunning(): boolean {
455
+ const account = this.ownAccount();
456
+ return !!account && refreshesInFlight.has(account);
457
+ }
458
+
459
+ // Joins the refresh already in flight for this key, or starts one: calls refused at the same time wait for
460
+ // one refresh instead of each starting their own (a refresh token may be single-use). The entry is removed
461
+ // when the refresh settles.
462
+ private static shareRefresh<K, T>(inFlight: Map<K, Promise<T>>, key: K, start: () => Promise<T>): Promise<T> {
463
+ const running = inFlight.get(key);
464
+ if (running) {
465
+ return running;
466
+ }
467
+ const refresh = start();
468
+ inFlight.set(key, refresh);
469
+ const settled = () => { inFlight.delete(key); };
470
+ refresh.then(settled, settled);
471
+ return refresh;
472
+ }
473
+
474
+ // A refused call that joins a refresh already running is not a new try: only started refreshes count toward
475
+ // the limit, so every call refused at the same time is retried.
476
+ private mayRefreshAfterNetworkError(): boolean {
477
+ if (this.refreshRunning()) {
478
+ return true;
479
+ }
480
+ if (_retry_count >= 4) {
481
+ return false;
482
+ }
483
+ _retry_count++;
484
+ return true;
485
+ }
486
+
487
+
488
+ // Rejects as before (the refresh's response body, or its error). Marks it as an ended session only when the
489
+ // refresh was refused (401 or 403) or could not run (no username, marked where it is thrown); a server error
490
+ // or a network error says nothing about the session, so an app must not log the user out for it. A body that
491
+ // is not an object cannot carry the mark and is kept as it is.
492
+ private rejectEndedSession(error: any): Promise<never> {
493
+ const rejection = error.response?.data || error;
494
+ const status = error.response?.status;
495
+ if (typeof rejection === 'object' && (status === 401 || status === 403)) {
496
+ rejection.sessionExpired = true;
497
+ }
498
+ return Promise.reject(rejection);
430
499
  }
431
500
 
432
501
  private attachInterceptor(axios: AxiosInstance) {
@@ -436,9 +505,7 @@ export class BaseAPI {
436
505
  },
437
506
  async (err) => {
438
507
  let originalConfig = err.config;
439
- // Sent for another account: only that account's SDK objects handle it. Unmarked requests as before.
440
- const owner = originalConfig?.[REQUEST_OWNER];
441
- if (owner !== undefined && owner !== this.ownAccount()) {
508
+ if (this.sentByOtherAccount(originalConfig)) {
442
509
  return Promise.reject(err);
443
510
  }
444
511
  if (err.response && !(err.response instanceof XMLHttpRequest)) { // sometimes buggy and is of type request
@@ -447,7 +514,7 @@ export class BaseAPI {
447
514
  && !originalConfig._retry) {
448
515
  originalConfig._retry = true;
449
516
  try {
450
- const reply = await this.refreshTokenInternal();
517
+ const reply = await this.sharedRefresh();
451
518
  this.tokenData.permissions = reply.permissions;
452
519
  this.applyTokenReply(reply, true);
453
520
  this.storeTokenData(this.tokenData);
@@ -464,10 +531,7 @@ export class BaseAPI {
464
531
  return this.retryWithToken(axios, originalConfig);
465
532
  });
466
533
  } catch (_error) {
467
- if (_error.response && _error.response.data) {
468
- return Promise.reject(_error.response.data);
469
- }
470
- return Promise.reject(_error);
534
+ return this.rejectEndedSession(_error);
471
535
  }
472
536
  }
473
537
  } else if (err.message === NETWORK_ERROR_MESSAGE && this.canRetryWithToken(originalConfig)) {
@@ -480,12 +544,11 @@ export class BaseAPI {
480
544
  } else if (err.message === NETWORK_ERROR_MESSAGE
481
545
  && (originalConfig.headers.hasOwnProperty('Authorization')
482
546
  || (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
483
- && _retry_count < 4
547
+ && this.mayRefreshAfterNetworkError()
484
548
  ) {
485
- _retry_count++;
486
549
  try {
487
550
  // In session mode an unreadable 401 (no CORS headers on the error reply) also lands here.
488
- const reply = await this.refreshTokenInternal();
551
+ const reply = await this.sharedRefresh();
489
552
  this.tokenData.permissions = reply.permissions;
490
553
 
491
554
  _retry = true;
@@ -501,10 +564,7 @@ export class BaseAPI {
501
564
  return retried;
502
565
  });
503
566
  } catch (_error) {
504
- if (_error.response && _error.response.data) {
505
- return Promise.reject(_error.response.data);
506
- }
507
- return Promise.reject(_error);
567
+ return this.rejectEndedSession(_error);
508
568
  }
509
569
  }
510
570
  return Promise.reject(err);