@emilgroup/discount-sdk-node 1.12.1-beta.18 → 1.12.1-beta.20

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.
@@ -35,6 +35,7 @@ models/inline-response200.ts
35
35
  models/inline-response503.ts
36
36
  models/list-campaigns-response-class.ts
37
37
  models/list-eligible-accounts-response-class.ts
38
+ models/list-policy-voucher-transactions-response-class.ts
38
39
  models/list-policy-vouchers-response-class.ts
39
40
  models/list-vouchers-response-class.ts
40
41
  models/policy-voucher-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/discount-sdk-node@1.12.1-beta.18 --save
20
+ npm install @emilgroup/discount-sdk-node@1.12.1-beta.20 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/discount-sdk-node@1.12.1-beta.18
24
+ yarn add @emilgroup/discount-sdk-node@1.12.1-beta.20
25
25
  ```
26
26
 
27
27
  And then you can import `CampaignApi`.
@@ -35,6 +35,8 @@ import { CreatePolicyVoucherResponseClass } from '../models';
35
35
  // @ts-ignore
36
36
  import { GetPolicyVoucherResponseClass } from '../models';
37
37
  // @ts-ignore
38
+ import { ListPolicyVoucherTransactionsResponseClass } from '../models';
39
+ // @ts-ignore
38
40
  import { ListPolicyVouchersResponseClass } from '../models';
39
41
  // @ts-ignore
40
42
  import { RedeemPolicyVoucherRequestDto } from '../models';
@@ -306,6 +308,87 @@ export const PolicyVouchersApiAxiosParamCreator = function (configuration?: Conf
306
308
 
307
309
 
308
310
 
311
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
312
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
313
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
314
+
315
+ return {
316
+ url: toPathString(localVarUrlObj),
317
+ options: localVarRequestOptions,
318
+ };
319
+ },
320
+ /**
321
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
322
+ * @summary List policy voucher transactions
323
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
324
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
325
+ * @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.
326
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
327
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
328
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
329
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
330
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
331
+ * @param {*} [options] Override http request option.
332
+ * @throws {RequiredError}
333
+ */
334
+ listPolicyVoucherTransactions: async (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
335
+ const localVarPath = `/discountservice/v1/policy-voucher-transactions`;
336
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
337
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
338
+ let baseOptions;
339
+ let baseAccessToken;
340
+ if (configuration) {
341
+ baseOptions = configuration.baseOptions;
342
+ baseAccessToken = configuration.accessToken;
343
+ }
344
+
345
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
346
+ const localVarHeaderParameter = {} as any;
347
+ const localVarQueryParameter = {} as any;
348
+
349
+ // authentication bearer required
350
+ // http bearer authentication required
351
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
352
+
353
+ if (pageSize !== undefined) {
354
+ localVarQueryParameter['pageSize'] = pageSize;
355
+ }
356
+
357
+ if (pageToken !== undefined) {
358
+ localVarQueryParameter['pageToken'] = pageToken;
359
+ }
360
+
361
+ if (filter !== undefined) {
362
+ localVarQueryParameter['filter'] = filter;
363
+ }
364
+
365
+ if (search !== undefined) {
366
+ localVarQueryParameter['search'] = search;
367
+ }
368
+
369
+ if (order !== undefined) {
370
+ localVarQueryParameter['order'] = order;
371
+ }
372
+
373
+ if (expand !== undefined) {
374
+ localVarQueryParameter['expand'] = expand;
375
+ }
376
+
377
+ if (filters !== undefined) {
378
+ localVarQueryParameter['filters'] = filters;
379
+ }
380
+
381
+ // Only Authorization falls back to the configured token. Without a session it is sent as before, empty when
382
+ // no token is stored, so a refused call still refreshes; a session call (account header) sends none.
383
+ const authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
384
+ const authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
385
+ const authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !baseOptions?.headers?.['X-Emil-Account'];
386
+ if (authorizationValue || authorizationKeepEmpty) {
387
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
388
+ }
389
+
390
+
391
+
309
392
  setSearchParams(localVarUrlObj, localVarQueryParameter);
310
393
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
311
394
  localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
@@ -571,6 +654,24 @@ export const PolicyVouchersApiFp = function(configuration?: Configuration) {
571
654
  const localVarAxiosArgs = await localVarAxiosParamCreator.getPolicyVoucher(code, authorization, expand, options);
572
655
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
573
656
  },
657
+ /**
658
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
659
+ * @summary List policy voucher transactions
660
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
661
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
662
+ * @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.
663
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
664
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
665
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
666
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
667
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
668
+ * @param {*} [options] Override http request option.
669
+ * @throws {RequiredError}
670
+ */
671
+ async listPolicyVoucherTransactions(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPolicyVoucherTransactionsResponseClass>> {
672
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listPolicyVoucherTransactions(authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
673
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
674
+ },
574
675
  /**
575
676
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
576
677
  * @summary List policy vouchers
@@ -679,6 +780,23 @@ export const PolicyVouchersApiFactory = function (configuration?: Configuration,
679
780
  getPolicyVoucher(code: string, authorization?: string, expand?: 'transactions' | 'campaign' | 'voucher', options?: any): AxiosPromise<GetPolicyVoucherResponseClass> {
680
781
  return localVarFp.getPolicyVoucher(code, authorization, expand, options).then((request) => request(axios, basePath));
681
782
  },
783
+ /**
784
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
785
+ * @summary List policy voucher transactions
786
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
787
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
788
+ * @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.
789
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
790
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
791
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
792
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
793
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
794
+ * @param {*} [options] Override http request option.
795
+ * @throws {RequiredError}
796
+ */
797
+ listPolicyVoucherTransactions(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListPolicyVoucherTransactionsResponseClass> {
798
+ return localVarFp.listPolicyVoucherTransactions(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
799
+ },
682
800
  /**
683
801
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
684
802
  * @summary List policy vouchers
@@ -833,6 +951,69 @@ export interface PolicyVouchersApiGetPolicyVoucherRequest {
833
951
  readonly expand?: 'transactions' | 'campaign' | 'voucher'
834
952
  }
835
953
 
954
+ /**
955
+ * Request parameters for listPolicyVoucherTransactions operation in PolicyVouchersApi.
956
+ * @export
957
+ * @interface PolicyVouchersApiListPolicyVoucherTransactionsRequest
958
+ */
959
+ export interface PolicyVouchersApiListPolicyVoucherTransactionsRequest {
960
+ /**
961
+ * Bearer Token: provided by the login endpoint under the name accessToken.
962
+ * @type {string}
963
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
964
+ */
965
+ readonly authorization?: string
966
+
967
+ /**
968
+ * A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
969
+ * @type {number}
970
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
971
+ */
972
+ readonly pageSize?: number
973
+
974
+ /**
975
+ * 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.
976
+ * @type {string}
977
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
978
+ */
979
+ readonly pageToken?: string
980
+
981
+ /**
982
+ * Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
983
+ * @type {string}
984
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
985
+ */
986
+ readonly filter?: string
987
+
988
+ /**
989
+ * Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
990
+ * @type {string}
991
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
992
+ */
993
+ readonly search?: string
994
+
995
+ /**
996
+ * Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
997
+ * @type {string}
998
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
999
+ */
1000
+ readonly order?: string
1001
+
1002
+ /**
1003
+ * Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
1004
+ * @type {string}
1005
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
1006
+ */
1007
+ readonly expand?: string
1008
+
1009
+ /**
1010
+ * Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
1011
+ * @type {string}
1012
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
1013
+ */
1014
+ readonly filters?: string
1015
+ }
1016
+
836
1017
  /**
837
1018
  * Request parameters for listPolicyVouchers operation in PolicyVouchersApi.
838
1019
  * @export
@@ -1005,6 +1186,18 @@ export class PolicyVouchersApi extends BaseAPI {
1005
1186
  return PolicyVouchersApiFp(this.configuration).getPolicyVoucher(requestParameters.code, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then((request) => request(this.axios, this.basePath));
1006
1187
  }
1007
1188
 
1189
+ /**
1190
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
1191
+ * @summary List policy voucher transactions
1192
+ * @param {PolicyVouchersApiListPolicyVoucherTransactionsRequest} requestParameters Request parameters.
1193
+ * @param {*} [options] Override http request option.
1194
+ * @throws {RequiredError}
1195
+ * @memberof PolicyVouchersApi
1196
+ */
1197
+ public listPolicyVoucherTransactions(requestParameters: PolicyVouchersApiListPolicyVoucherTransactionsRequest = {}, options?: AxiosRequestConfig) {
1198
+ return PolicyVouchersApiFp(this.configuration).listPolicyVoucherTransactions(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));
1199
+ }
1200
+
1008
1201
  /**
1009
1202
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
1010
1203
  * @summary List policy vouchers
package/base.ts CHANGED
@@ -82,6 +82,9 @@ export interface RequestArgs {
82
82
 
83
83
  const NETWORK_ERROR_MESSAGE = "Network Error";
84
84
 
85
+ // Refreshes in flight per configuration (BaseAPI.shareRefresh): SDK objects that share a configuration share its token.
86
+ const refreshesInFlight = new Map<Configuration, Promise<string>>();
87
+
85
88
  /**
86
89
  *
87
90
  * @export
@@ -92,10 +95,29 @@ export class BaseAPI {
92
95
  private username?: string;
93
96
  private password?: string;
94
97
 
98
+ // Marks each request with the account (username) of the SDK object that sent it: only SDK objects of that
99
+ // account refresh and resend it, never an object of another account in the same app.
100
+ private static readonly REQUEST_OWNER = '_emilSdkOwner';
101
+
102
+ private ownAccount(): string {
103
+ return (this.configuration.username || '').toLowerCase();
104
+ }
105
+
95
106
  protected withOwner(options?: AxiosRequestConfig): AxiosRequestConfig {
96
- return { ...options };
107
+ // An object without a username cannot refresh itself: its requests stay unmarked, as before.
108
+ if (!this.ownAccount()) {
109
+ return { ...options };
110
+ }
111
+ return { ...options, [BaseAPI.REQUEST_OWNER]: this.ownAccount() } as AxiosRequestConfig;
112
+ }
113
+
114
+ // Sent for another account: only that account's SDK objects handle it. Unmarked requests as before.
115
+ private sentByOtherAccount(config?: AxiosRequestConfig): boolean {
116
+ const owner = (config as Record<string, unknown> | undefined)?.[BaseAPI.REQUEST_OWNER];
117
+ return owner !== undefined && owner !== this.ownAccount();
97
118
  }
98
119
 
120
+
99
121
  constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
100
122
  if (configuration) {
101
123
  this.configuration = configuration;
@@ -226,7 +248,8 @@ export class BaseAPI {
226
248
  return '';
227
249
  }
228
250
 
229
- const options: AxiosRequestConfig = {
251
+ // Sent through globalAxios like any call; marked as retried, so a refused refresh is not refreshed again.
252
+ const options = {
230
253
  method: 'POST',
231
254
  url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
232
255
  headers: {
@@ -235,7 +258,8 @@ export class BaseAPI {
235
258
  },
236
259
  data: { username: username },
237
260
  withCredentials: true,
238
- };
261
+ _retry: true,
262
+ } as AxiosRequestConfig;
239
263
 
240
264
  const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
241
265
 
@@ -256,6 +280,43 @@ export class BaseAPI {
256
280
  return this.configuration;
257
281
  }
258
282
 
283
+ private sharedRefresh(): Promise<string> {
284
+ return BaseAPI.shareRefresh(refreshesInFlight, this.configuration, () => this.refreshTokenInternal());
285
+ }
286
+
287
+ private refreshRunning(): boolean {
288
+ return refreshesInFlight.has(this.configuration);
289
+ }
290
+
291
+ // Joins the refresh already in flight for this key, or starts one: calls refused at the same time wait for
292
+ // one refresh instead of each starting their own (a refresh token may be single-use). The entry is removed
293
+ // when the refresh settles.
294
+ private static shareRefresh<K, T>(inFlight: Map<K, Promise<T>>, key: K, start: () => Promise<T>): Promise<T> {
295
+ const running = inFlight.get(key);
296
+ if (running) {
297
+ return running;
298
+ }
299
+ const refresh = start();
300
+ inFlight.set(key, refresh);
301
+ const settled = () => { inFlight.delete(key); };
302
+ refresh.then(settled, settled);
303
+ return refresh;
304
+ }
305
+
306
+ // A refused call that joins a refresh already running is not a new try: only started refreshes count toward
307
+ // the limit, so every call refused at the same time is retried.
308
+ private mayRefreshAfterNetworkError(): boolean {
309
+ if (this.refreshRunning()) {
310
+ return true;
311
+ }
312
+ if (_retry_count >= 4) {
313
+ return false;
314
+ }
315
+ _retry_count++;
316
+ return true;
317
+ }
318
+
319
+
259
320
  private attachInterceptor(axios: AxiosInstance) {
260
321
  axios.interceptors.response.use(
261
322
  (res) => {
@@ -263,12 +324,15 @@ export class BaseAPI {
263
324
  },
264
325
  async (err) => {
265
326
  let originalConfig = err.config;
327
+ if (this.sentByOtherAccount(originalConfig)) {
328
+ return Promise.reject(err);
329
+ }
266
330
  if (err.response) {
267
331
  // Access Token was expired
268
332
  if (err.response.status === 401 && !originalConfig._retry) {
269
333
  originalConfig._retry = true;
270
334
  try {
271
- const tokenString = await this.refreshTokenInternal();
335
+ const tokenString = await this.sharedRefresh();
272
336
  const accessToken = `Bearer ${tokenString}`;
273
337
 
274
338
  originalConfig.headers['Authorization'] = accessToken;
@@ -288,12 +352,12 @@ export class BaseAPI {
288
352
  }
289
353
  } else if(err.message === NETWORK_ERROR_MESSAGE
290
354
  && err.isAxiosError
355
+ && !originalConfig._retry
291
356
  && originalConfig.headers.hasOwnProperty('Authorization')
292
- && _retry_count < 4
357
+ && this.mayRefreshAfterNetworkError()
293
358
  ){
294
- _retry_count++;
295
359
  try {
296
- const tokenString = await this.refreshTokenInternal();
360
+ const tokenString = await this.sharedRefresh();
297
361
  const accessToken = `Bearer ${tokenString}`;
298
362
 
299
363
  _retry = true;
@@ -19,6 +19,7 @@ import { CheckAccountEligibilityResponseClass } from '../models';
19
19
  import { CreatePolicyVoucherRequestDto } from '../models';
20
20
  import { CreatePolicyVoucherResponseClass } from '../models';
21
21
  import { GetPolicyVoucherResponseClass } from '../models';
22
+ import { ListPolicyVoucherTransactionsResponseClass } from '../models';
22
23
  import { ListPolicyVouchersResponseClass } from '../models';
23
24
  import { RedeemPolicyVoucherRequestDto } from '../models';
24
25
  import { RedeemPolicyVoucherResponseClass } from '../models';
@@ -75,6 +76,21 @@ export declare const PolicyVouchersApiAxiosParamCreator: (configuration?: Config
75
76
  * @throws {RequiredError}
76
77
  */
77
78
  getPolicyVoucher: (code: string, authorization?: string, expand?: 'transactions' | 'campaign' | 'voucher', options?: AxiosRequestConfig) => Promise<RequestArgs>;
79
+ /**
80
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
81
+ * @summary List policy voucher transactions
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.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
86
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
87
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
88
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
89
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
90
+ * @param {*} [options] Override http request option.
91
+ * @throws {RequiredError}
92
+ */
93
+ listPolicyVoucherTransactions: (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
78
94
  /**
79
95
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
80
96
  * @summary List policy vouchers
@@ -160,6 +176,21 @@ export declare const PolicyVouchersApiFp: (configuration?: Configuration) => {
160
176
  * @throws {RequiredError}
161
177
  */
162
178
  getPolicyVoucher(code: string, authorization?: string, expand?: 'transactions' | 'campaign' | 'voucher', options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPolicyVoucherResponseClass>>;
179
+ /**
180
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
181
+ * @summary List policy voucher transactions
182
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
183
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
184
+ * @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.
185
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
186
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
187
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
188
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
189
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
190
+ * @param {*} [options] Override http request option.
191
+ * @throws {RequiredError}
192
+ */
193
+ listPolicyVoucherTransactions(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPolicyVoucherTransactionsResponseClass>>;
163
194
  /**
164
195
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
165
196
  * @summary List policy vouchers
@@ -245,6 +276,21 @@ export declare const PolicyVouchersApiFactory: (configuration?: Configuration, b
245
276
  * @throws {RequiredError}
246
277
  */
247
278
  getPolicyVoucher(code: string, authorization?: string, expand?: 'transactions' | 'campaign' | 'voucher', options?: any): AxiosPromise<GetPolicyVoucherResponseClass>;
279
+ /**
280
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
281
+ * @summary List policy voucher transactions
282
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
283
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
284
+ * @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.
285
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
286
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
287
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
288
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
289
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
290
+ * @param {*} [options] Override http request option.
291
+ * @throws {RequiredError}
292
+ */
293
+ listPolicyVoucherTransactions(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListPolicyVoucherTransactionsResponseClass>;
248
294
  /**
249
295
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
250
296
  * @summary List policy vouchers
@@ -380,6 +426,61 @@ export interface PolicyVouchersApiGetPolicyVoucherRequest {
380
426
  */
381
427
  readonly expand?: 'transactions' | 'campaign' | 'voucher';
382
428
  }
429
+ /**
430
+ * Request parameters for listPolicyVoucherTransactions operation in PolicyVouchersApi.
431
+ * @export
432
+ * @interface PolicyVouchersApiListPolicyVoucherTransactionsRequest
433
+ */
434
+ export interface PolicyVouchersApiListPolicyVoucherTransactionsRequest {
435
+ /**
436
+ * Bearer Token: provided by the login endpoint under the name accessToken.
437
+ * @type {string}
438
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
439
+ */
440
+ readonly authorization?: string;
441
+ /**
442
+ * A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
443
+ * @type {number}
444
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
445
+ */
446
+ readonly pageSize?: number;
447
+ /**
448
+ * 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.
449
+ * @type {string}
450
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
451
+ */
452
+ readonly pageToken?: string;
453
+ /**
454
+ * Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
455
+ * @type {string}
456
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
457
+ */
458
+ readonly filter?: string;
459
+ /**
460
+ * Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
461
+ * @type {string}
462
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
463
+ */
464
+ readonly search?: string;
465
+ /**
466
+ * Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
467
+ * @type {string}
468
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
469
+ */
470
+ readonly order?: string;
471
+ /**
472
+ * Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
473
+ * @type {string}
474
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
475
+ */
476
+ readonly expand?: string;
477
+ /**
478
+ * Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
479
+ * @type {string}
480
+ * @memberof PolicyVouchersApiListPolicyVoucherTransactions
481
+ */
482
+ readonly filters?: string;
483
+ }
383
484
  /**
384
485
  * Request parameters for listPolicyVouchers operation in PolicyVouchersApi.
385
486
  * @export
@@ -525,6 +626,15 @@ export declare class PolicyVouchersApi extends BaseAPI {
525
626
  * @memberof PolicyVouchersApi
526
627
  */
527
628
  getPolicyVoucher(requestParameters: PolicyVouchersApiGetPolicyVoucherRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPolicyVoucherResponseClass, any, {}, any>>;
629
+ /**
630
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
631
+ * @summary List policy voucher transactions
632
+ * @param {PolicyVouchersApiListPolicyVoucherTransactionsRequest} requestParameters Request parameters.
633
+ * @param {*} [options] Override http request option.
634
+ * @throws {RequiredError}
635
+ * @memberof PolicyVouchersApi
636
+ */
637
+ listPolicyVoucherTransactions(requestParameters?: PolicyVouchersApiListPolicyVoucherTransactionsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListPolicyVoucherTransactionsResponseClass, any, {}, any>>;
528
638
  /**
529
639
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
530
640
  * @summary List policy vouchers
@@ -375,6 +375,82 @@ var PolicyVouchersApiAxiosParamCreator = function (configuration) {
375
375
  });
376
376
  });
377
377
  },
378
+ /**
379
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
380
+ * @summary List policy voucher transactions
381
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
382
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
383
+ * @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.
384
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
385
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
386
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
387
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
388
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
389
+ * @param {*} [options] Override http request option.
390
+ * @throws {RequiredError}
391
+ */
392
+ listPolicyVoucherTransactions: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
393
+ if (options === void 0) { options = {}; }
394
+ return __awaiter(_this, void 0, void 0, function () {
395
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, authorizationIsAuth, authorizationValue, authorizationKeepEmpty, headersFromBaseOptions;
396
+ var _a;
397
+ return __generator(this, function (_b) {
398
+ switch (_b.label) {
399
+ case 0:
400
+ localVarPath = "/discountservice/v1/policy-voucher-transactions";
401
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
402
+ if (configuration) {
403
+ baseOptions = configuration.baseOptions;
404
+ baseAccessToken = configuration.accessToken;
405
+ }
406
+ localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
407
+ localVarHeaderParameter = {};
408
+ localVarQueryParameter = {};
409
+ // authentication bearer required
410
+ // http bearer authentication required
411
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
412
+ case 1:
413
+ // authentication bearer required
414
+ // http bearer authentication required
415
+ _b.sent();
416
+ if (pageSize !== undefined) {
417
+ localVarQueryParameter['pageSize'] = pageSize;
418
+ }
419
+ if (pageToken !== undefined) {
420
+ localVarQueryParameter['pageToken'] = pageToken;
421
+ }
422
+ if (filter !== undefined) {
423
+ localVarQueryParameter['filter'] = filter;
424
+ }
425
+ if (search !== undefined) {
426
+ localVarQueryParameter['search'] = search;
427
+ }
428
+ if (order !== undefined) {
429
+ localVarQueryParameter['order'] = order;
430
+ }
431
+ if (expand !== undefined) {
432
+ localVarQueryParameter['expand'] = expand;
433
+ }
434
+ if (filters !== undefined) {
435
+ localVarQueryParameter['filters'] = filters;
436
+ }
437
+ authorizationIsAuth = 'Authorization'.toLowerCase() === 'authorization';
438
+ authorizationValue = authorizationIsAuth ? (authorization || baseAccessToken) : authorization;
439
+ authorizationKeepEmpty = authorizationIsAuth && authorizationValue === '' && !((_a = baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.headers) === null || _a === void 0 ? void 0 : _a['X-Emil-Account']);
440
+ if (authorizationValue || authorizationKeepEmpty) {
441
+ localVarHeaderParameter['Authorization'] = String(authorizationValue);
442
+ }
443
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
444
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
445
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
446
+ return [2 /*return*/, {
447
+ url: (0, common_1.toPathString)(localVarUrlObj),
448
+ options: localVarRequestOptions,
449
+ }];
450
+ }
451
+ });
452
+ });
453
+ },
378
454
  /**
379
455
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
380
456
  * @summary List policy vouchers
@@ -679,6 +755,33 @@ var PolicyVouchersApiFp = function (configuration) {
679
755
  });
680
756
  });
681
757
  },
758
+ /**
759
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
760
+ * @summary List policy voucher transactions
761
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
762
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
763
+ * @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.
764
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
765
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
766
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
767
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
768
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
769
+ * @param {*} [options] Override http request option.
770
+ * @throws {RequiredError}
771
+ */
772
+ listPolicyVoucherTransactions: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
773
+ return __awaiter(this, void 0, void 0, function () {
774
+ var localVarAxiosArgs;
775
+ return __generator(this, function (_a) {
776
+ switch (_a.label) {
777
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.listPolicyVoucherTransactions(authorization, pageSize, pageToken, filter, search, order, expand, filters, options)];
778
+ case 1:
779
+ localVarAxiosArgs = _a.sent();
780
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
781
+ }
782
+ });
783
+ });
784
+ },
682
785
  /**
683
786
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
684
787
  * @summary List policy vouchers
@@ -814,6 +917,23 @@ var PolicyVouchersApiFactory = function (configuration, basePath, axios) {
814
917
  getPolicyVoucher: function (code, authorization, expand, options) {
815
918
  return localVarFp.getPolicyVoucher(code, authorization, expand, options).then(function (request) { return request(axios, basePath); });
816
919
  },
920
+ /**
921
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
922
+ * @summary List policy voucher transactions
923
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
924
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
925
+ * @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.
926
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
927
+ * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: invoiceNumber, policyNumber&lt;/i&gt;
928
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, createdAt, invoiceNumber, policyNumber&lt;/i&gt;
929
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt;
930
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, policyVoucherId, invoiceNumber, policyNumber, createdAt&lt;/i&gt;
931
+ * @param {*} [options] Override http request option.
932
+ * @throws {RequiredError}
933
+ */
934
+ listPolicyVoucherTransactions: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
935
+ return localVarFp.listPolicyVoucherTransactions(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
936
+ },
817
937
  /**
818
938
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
819
939
  * @summary List policy vouchers
@@ -927,6 +1047,19 @@ var PolicyVouchersApi = /** @class */ (function (_super) {
927
1047
  var _this = this;
928
1048
  return (0, exports.PolicyVouchersApiFp)(this.configuration).getPolicyVoucher(requestParameters.code, requestParameters.authorization, requestParameters.expand, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
929
1049
  };
1050
+ /**
1051
+ * Lists policy voucher transactions (charges, redemptions, withdrawals), e.g. filters=createdAt>=2026-10-01;createdAt<=2026-10-31
1052
+ * @summary List policy voucher transactions
1053
+ * @param {PolicyVouchersApiListPolicyVoucherTransactionsRequest} requestParameters Request parameters.
1054
+ * @param {*} [options] Override http request option.
1055
+ * @throws {RequiredError}
1056
+ * @memberof PolicyVouchersApi
1057
+ */
1058
+ PolicyVouchersApi.prototype.listPolicyVoucherTransactions = function (requestParameters, options) {
1059
+ var _this = this;
1060
+ if (requestParameters === void 0) { requestParameters = {}; }
1061
+ return (0, exports.PolicyVouchersApiFp)(this.configuration).listPolicyVoucherTransactions(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, this.withOwner(options)).then(function (request) { return request(_this.axios, _this.basePath); });
1062
+ };
930
1063
  /**
931
1064
  * Returns a list of policy vouchers you have previously created. The policy vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
932
1065
  * @summary List policy vouchers
package/dist/base.d.ts CHANGED
@@ -63,7 +63,10 @@ export declare class BaseAPI {
63
63
  protected configuration: Configuration;
64
64
  private username?;
65
65
  private password?;
66
+ private static readonly REQUEST_OWNER;
67
+ private ownAccount;
66
68
  protected withOwner(options?: AxiosRequestConfig): AxiosRequestConfig;
69
+ private sentByOtherAccount;
67
70
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
68
71
  initialize(env?: Environment, targetWorkspace?: string): Promise<void>;
69
72
  private loadCredentials;
@@ -75,6 +78,10 @@ export declare class BaseAPI {
75
78
  refreshTokenInternal(): Promise<string>;
76
79
  private extractRefreshToken;
77
80
  getConfiguration(): Configuration;
81
+ private sharedRefresh;
82
+ private refreshRunning;
83
+ private static shareRefresh;
84
+ private mayRefreshAfterNetworkError;
78
85
  private attachInterceptor;
79
86
  }
80
87
  /**
package/dist/base.js CHANGED
@@ -141,6 +141,8 @@ function resetRetry() {
141
141
  }
142
142
  exports.resetRetry = resetRetry;
143
143
  var NETWORK_ERROR_MESSAGE = "Network Error";
144
+ // Refreshes in flight per configuration (BaseAPI.shareRefresh): SDK objects that share a configuration share its token.
145
+ var refreshesInFlight = new Map();
144
146
  /**
145
147
  *
146
148
  * @export
@@ -163,8 +165,21 @@ var BaseAPI = /** @class */ (function () {
163
165
  }
164
166
  this.attachInterceptor(axios);
165
167
  }
168
+ BaseAPI.prototype.ownAccount = function () {
169
+ return (this.configuration.username || '').toLowerCase();
170
+ };
166
171
  BaseAPI.prototype.withOwner = function (options) {
167
- return __assign({}, options);
172
+ var _a;
173
+ // An object without a username cannot refresh itself: its requests stay unmarked, as before.
174
+ if (!this.ownAccount()) {
175
+ return __assign({}, options);
176
+ }
177
+ return __assign(__assign({}, options), (_a = {}, _a[BaseAPI.REQUEST_OWNER] = this.ownAccount(), _a));
178
+ };
179
+ // Sent for another account: only that account's SDK objects handle it. Unmarked requests as before.
180
+ BaseAPI.prototype.sentByOtherAccount = function (config) {
181
+ var owner = config === null || config === void 0 ? void 0 : config[BaseAPI.REQUEST_OWNER];
182
+ return owner !== undefined && owner !== this.ownAccount();
168
183
  };
169
184
  BaseAPI.prototype.initialize = function (env, targetWorkspace) {
170
185
  if (env === void 0) { env = Environment.Production; }
@@ -334,6 +349,7 @@ var BaseAPI = /** @class */ (function () {
334
349
  },
335
350
  data: { username: username },
336
351
  withCredentials: true,
352
+ _retry: true,
337
353
  };
338
354
  return [4 /*yield*/, axios_1.default.request(options)];
339
355
  case 1:
@@ -353,6 +369,39 @@ var BaseAPI = /** @class */ (function () {
353
369
  BaseAPI.prototype.getConfiguration = function () {
354
370
  return this.configuration;
355
371
  };
372
+ BaseAPI.prototype.sharedRefresh = function () {
373
+ var _this = this;
374
+ return BaseAPI.shareRefresh(refreshesInFlight, this.configuration, function () { return _this.refreshTokenInternal(); });
375
+ };
376
+ BaseAPI.prototype.refreshRunning = function () {
377
+ return refreshesInFlight.has(this.configuration);
378
+ };
379
+ // Joins the refresh already in flight for this key, or starts one: calls refused at the same time wait for
380
+ // one refresh instead of each starting their own (a refresh token may be single-use). The entry is removed
381
+ // when the refresh settles.
382
+ BaseAPI.shareRefresh = function (inFlight, key, start) {
383
+ var running = inFlight.get(key);
384
+ if (running) {
385
+ return running;
386
+ }
387
+ var refresh = start();
388
+ inFlight.set(key, refresh);
389
+ var settled = function () { inFlight.delete(key); };
390
+ refresh.then(settled, settled);
391
+ return refresh;
392
+ };
393
+ // A refused call that joins a refresh already running is not a new try: only started refreshes count toward
394
+ // the limit, so every call refused at the same time is retried.
395
+ BaseAPI.prototype.mayRefreshAfterNetworkError = function () {
396
+ if (this.refreshRunning()) {
397
+ return true;
398
+ }
399
+ if (_retry_count >= 4) {
400
+ return false;
401
+ }
402
+ _retry_count++;
403
+ return true;
404
+ };
356
405
  BaseAPI.prototype.attachInterceptor = function (axios) {
357
406
  var _this = this;
358
407
  axios.interceptors.response.use(function (res) {
@@ -363,13 +412,16 @@ var BaseAPI = /** @class */ (function () {
363
412
  switch (_a.label) {
364
413
  case 0:
365
414
  originalConfig = err.config;
415
+ if (this.sentByOtherAccount(originalConfig)) {
416
+ return [2 /*return*/, Promise.reject(err)];
417
+ }
366
418
  if (!err.response) return [3 /*break*/, 5];
367
419
  if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
368
420
  originalConfig._retry = true;
369
421
  _a.label = 1;
370
422
  case 1:
371
423
  _a.trys.push([1, 3, , 4]);
372
- return [4 /*yield*/, this.refreshTokenInternal()];
424
+ return [4 /*yield*/, this.sharedRefresh()];
373
425
  case 2:
374
426
  tokenString = _a.sent();
375
427
  accessToken = "Bearer ".concat(tokenString);
@@ -390,13 +442,13 @@ var BaseAPI = /** @class */ (function () {
390
442
  case 5:
391
443
  if (!(err.message === NETWORK_ERROR_MESSAGE
392
444
  && err.isAxiosError
445
+ && !originalConfig._retry
393
446
  && originalConfig.headers.hasOwnProperty('Authorization')
394
- && _retry_count < 4)) return [3 /*break*/, 9];
395
- _retry_count++;
447
+ && this.mayRefreshAfterNetworkError())) return [3 /*break*/, 9];
396
448
  _a.label = 6;
397
449
  case 6:
398
450
  _a.trys.push([6, 8, , 9]);
399
- return [4 /*yield*/, this.refreshTokenInternal()];
451
+ return [4 /*yield*/, this.sharedRefresh()];
400
452
  case 7:
401
453
  tokenString = _a.sent();
402
454
  accessToken = "Bearer ".concat(tokenString);
@@ -415,6 +467,9 @@ var BaseAPI = /** @class */ (function () {
415
467
  });
416
468
  }); });
417
469
  };
470
+ // Marks each request with the account (username) of the SDK object that sent it: only SDK objects of that
471
+ // account refresh and resend it, never an object of another account in the same app.
472
+ BaseAPI.REQUEST_OWNER = '_emilSdkOwner';
418
473
  return BaseAPI;
419
474
  }());
420
475
  exports.BaseAPI = BaseAPI;
@@ -20,6 +20,7 @@ export * from './inline-response200';
20
20
  export * from './inline-response503';
21
21
  export * from './list-campaigns-response-class';
22
22
  export * from './list-eligible-accounts-response-class';
23
+ export * from './list-policy-voucher-transactions-response-class';
23
24
  export * from './list-policy-vouchers-response-class';
24
25
  export * from './list-vouchers-response-class';
25
26
  export * from './policy-voucher-class';
@@ -36,6 +36,7 @@ __exportStar(require("./inline-response200"), exports);
36
36
  __exportStar(require("./inline-response503"), exports);
37
37
  __exportStar(require("./list-campaigns-response-class"), exports);
38
38
  __exportStar(require("./list-eligible-accounts-response-class"), exports);
39
+ __exportStar(require("./list-policy-voucher-transactions-response-class"), exports);
39
40
  __exportStar(require("./list-policy-vouchers-response-class"), exports);
40
41
  __exportStar(require("./list-vouchers-response-class"), exports);
41
42
  __exportStar(require("./policy-voucher-class"), exports);
@@ -0,0 +1,43 @@
1
+ /**
2
+ * EMIL DiscountService
3
+ * The EMIL DiscountService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ * Contact: kontakt@emil.de
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 { PolicyVoucherTransactionClass } from './policy-voucher-transaction-class';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface ListPolicyVoucherTransactionsResponseClass
17
+ */
18
+ export interface ListPolicyVoucherTransactionsResponseClass {
19
+ /**
20
+ * Next page token.
21
+ * @type {string}
22
+ * @memberof ListPolicyVoucherTransactionsResponseClass
23
+ */
24
+ 'nextPageToken': string;
25
+ /**
26
+ * Total amount of items.
27
+ * @type {number}
28
+ * @memberof ListPolicyVoucherTransactionsResponseClass
29
+ */
30
+ 'totalItems': number;
31
+ /**
32
+ * Items per page.
33
+ * @type {number}
34
+ * @memberof ListPolicyVoucherTransactionsResponseClass
35
+ */
36
+ 'itemsPerPage': number;
37
+ /**
38
+ * policy voucher transactions
39
+ * @type {Array<PolicyVoucherTransactionClass>}
40
+ * @memberof ListPolicyVoucherTransactionsResponseClass
41
+ */
42
+ 'items': Array<PolicyVoucherTransactionClass>;
43
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL DiscountService
6
+ * The EMIL DiscountService API description
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ * Contact: kontakt@emil.de
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
+ Object.defineProperty(exports, "__esModule", { value: true });
package/models/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from './inline-response200';
20
20
  export * from './inline-response503';
21
21
  export * from './list-campaigns-response-class';
22
22
  export * from './list-eligible-accounts-response-class';
23
+ export * from './list-policy-voucher-transactions-response-class';
23
24
  export * from './list-policy-vouchers-response-class';
24
25
  export * from './list-vouchers-response-class';
25
26
  export * from './policy-voucher-class';
@@ -0,0 +1,49 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL DiscountService
5
+ * The EMIL DiscountService 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 { PolicyVoucherTransactionClass } from './policy-voucher-transaction-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface ListPolicyVoucherTransactionsResponseClass
22
+ */
23
+ export interface ListPolicyVoucherTransactionsResponseClass {
24
+ /**
25
+ * Next page token.
26
+ * @type {string}
27
+ * @memberof ListPolicyVoucherTransactionsResponseClass
28
+ */
29
+ 'nextPageToken': string;
30
+ /**
31
+ * Total amount of items.
32
+ * @type {number}
33
+ * @memberof ListPolicyVoucherTransactionsResponseClass
34
+ */
35
+ 'totalItems': number;
36
+ /**
37
+ * Items per page.
38
+ * @type {number}
39
+ * @memberof ListPolicyVoucherTransactionsResponseClass
40
+ */
41
+ 'itemsPerPage': number;
42
+ /**
43
+ * policy voucher transactions
44
+ * @type {Array<PolicyVoucherTransactionClass>}
45
+ * @memberof ListPolicyVoucherTransactionsResponseClass
46
+ */
47
+ 'items': Array<PolicyVoucherTransactionClass>;
48
+ }
49
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/discount-sdk-node",
3
- "version": "1.12.1-beta.18",
3
+ "version": "1.12.1-beta.20",
4
4
  "description": "OpenAPI client for @emilgroup/discount-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  "prepare": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "axios": "1.20.0",
21
+ "axios": "1.21.1",
22
22
  "form-data": "^4.0.0",
23
23
  "url": "^0.11.0"
24
24
  },