@emilgroup/payment-sdk-node 1.21.1-beta.131 → 1.21.1-beta.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +6 -0
- package/README.md +2 -2
- package/api/credit-allocation-api.ts +460 -0
- package/api.ts +2 -0
- package/base.ts +49 -6
- package/common.ts +2 -2
- package/configuration.ts +9 -0
- package/dist/api/credit-allocation-api.d.ts +263 -0
- package/dist/api/credit-allocation-api.js +449 -0
- package/dist/api.d.ts +1 -0
- package/dist/api.js +1 -0
- package/dist/base.d.ts +13 -3
- package/dist/base.js +44 -4
- package/dist/common.js +2 -2
- package/dist/configuration.d.ts +6 -0
- package/dist/configuration.js +8 -0
- package/dist/models/create-credit-allocation-request-dto.d.ts +54 -0
- package/dist/models/create-credit-allocation-request-dto.js +21 -0
- package/dist/models/create-credit-allocation-response-class.d.ts +25 -0
- package/dist/models/create-credit-allocation-response-class.js +15 -0
- package/dist/models/credit-allocation-class.d.ts +115 -0
- package/dist/models/credit-allocation-class.js +21 -0
- package/dist/models/exceeding-credit-class.d.ts +6 -0
- package/dist/models/get-credit-allocation-response-class.d.ts +25 -0
- package/dist/models/get-credit-allocation-response-class.js +15 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +5 -0
- package/dist/models/list-credit-allocations-response-class.d.ts +43 -0
- package/dist/models/list-credit-allocations-response-class.js +15 -0
- package/models/create-credit-allocation-request-dto.ts +63 -0
- package/models/create-credit-allocation-response-class.ts +31 -0
- package/models/credit-allocation-class.ts +124 -0
- package/models/exceeding-credit-class.ts +6 -0
- package/models/get-credit-allocation-response-class.ts +31 -0
- package/models/index.ts +5 -0
- package/models/list-credit-allocations-response-class.ts +49 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -6,6 +6,7 @@ api.ts
|
|
|
6
6
|
api/bank-accounts-api.ts
|
|
7
7
|
api/bank-orders-api.ts
|
|
8
8
|
api/bank-transaction-api.ts
|
|
9
|
+
api/credit-allocation-api.ts
|
|
9
10
|
api/exceeding-credits-api.ts
|
|
10
11
|
api/health-check-api.ts
|
|
11
12
|
api/payment-methods-api.ts
|
|
@@ -44,6 +45,8 @@ models/create-bank-account-request-dto.ts
|
|
|
44
45
|
models/create-bank-account-response-class.ts
|
|
45
46
|
models/create-bank-order-request-dto.ts
|
|
46
47
|
models/create-bank-order-response-class.ts
|
|
48
|
+
models/create-credit-allocation-request-dto.ts
|
|
49
|
+
models/create-credit-allocation-response-class.ts
|
|
47
50
|
models/create-payment-method-response-class.ts
|
|
48
51
|
models/create-payment-order-dto.ts
|
|
49
52
|
models/create-payment-order-request-dto.ts
|
|
@@ -58,6 +61,7 @@ models/create-refund-request-dto.ts
|
|
|
58
61
|
models/create-refund-response-class.ts
|
|
59
62
|
models/create-tenant-bank-account-request-dto.ts
|
|
60
63
|
models/create-tenant-bank-account-response-class.ts
|
|
64
|
+
models/credit-allocation-class.ts
|
|
61
65
|
models/deactivate-payment-reminder-request-dto.ts
|
|
62
66
|
models/deactivate-payment-reminder-response-class.ts
|
|
63
67
|
models/deactivated-payment-reminder-class.ts
|
|
@@ -68,6 +72,7 @@ models/generate-invoice-match-suggestions-response-class.ts
|
|
|
68
72
|
models/get-bank-account-response-class.ts
|
|
69
73
|
models/get-bank-order-response-class.ts
|
|
70
74
|
models/get-bank-transactions-response-class.ts
|
|
75
|
+
models/get-credit-allocation-response-class.ts
|
|
71
76
|
models/get-exceeding-credit-response-class.ts
|
|
72
77
|
models/get-payment-method-response-class.ts
|
|
73
78
|
models/get-payment-reminder-response-class.ts
|
|
@@ -94,6 +99,7 @@ models/link-bank-transactions-response-class.ts
|
|
|
94
99
|
models/list-bank-accounts-response-class.ts
|
|
95
100
|
models/list-bank-orders-response-class.ts
|
|
96
101
|
models/list-bank-transactions-response-class.ts
|
|
102
|
+
models/list-credit-allocations-response-class.ts
|
|
97
103
|
models/list-exceeding-credits-response-class.ts
|
|
98
104
|
models/list-payment-methods-response-class.ts
|
|
99
105
|
models/list-payment-reminders-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/payment-sdk-node@1.21.1-beta.
|
|
20
|
+
npm install @emilgroup/payment-sdk-node@1.21.1-beta.133 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/payment-sdk-node@1.21.1-beta.
|
|
24
|
+
yarn add @emilgroup/payment-sdk-node@1.21.1-beta.133
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PaymentsApi`.
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Emil Payment Service
|
|
5
|
+
* This service directly communicates with the various Payment Service Providers (PSPs) in order to charge or refund customers. This service will automatically connect to the PSP linked in your admin configuration; meaning if you configured Stripe, it will automatically create a payment on Stripe when you create it in Emil.
|
|
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 { CreateCreditAllocationRequestDto } from '../models';
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
import { CreateCreditAllocationResponseClass } from '../models';
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
import { GetCreditAllocationResponseClass } from '../models';
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
import { ListCreditAllocationsResponseClass } from '../models';
|
|
31
|
+
// URLSearchParams not necessarily used
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
import { URL, URLSearchParams } from 'url';
|
|
34
|
+
const FormData = require('form-data');
|
|
35
|
+
/**
|
|
36
|
+
* CreditAllocationApi - axios parameter creator
|
|
37
|
+
* @export
|
|
38
|
+
*/
|
|
39
|
+
export const CreditAllocationApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
40
|
+
return {
|
|
41
|
+
/**
|
|
42
|
+
* Create a credit allocation for existing exceeding credits. **Required Permissions** \"payment-management.payments.create\", \"accounting-management.financial-accounts.view\"
|
|
43
|
+
* @summary Create the credit allocation
|
|
44
|
+
* @param {CreateCreditAllocationRequestDto} createCreditAllocationRequestDto
|
|
45
|
+
* @param {string} [authorization] Bearer Token
|
|
46
|
+
* @param {*} [options] Override http request option.
|
|
47
|
+
* @throws {RequiredError}
|
|
48
|
+
*/
|
|
49
|
+
createAllocateCredit: async (createCreditAllocationRequestDto: CreateCreditAllocationRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
50
|
+
// verify required parameter 'createCreditAllocationRequestDto' is not null or undefined
|
|
51
|
+
assertParamExists('createAllocateCredit', 'createCreditAllocationRequestDto', createCreditAllocationRequestDto)
|
|
52
|
+
const localVarPath = `/paymentservice/v1/credit-allocations`;
|
|
53
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
54
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
55
|
+
let baseOptions;
|
|
56
|
+
let baseAccessToken;
|
|
57
|
+
if (configuration) {
|
|
58
|
+
baseOptions = configuration.baseOptions;
|
|
59
|
+
baseAccessToken = configuration.accessToken;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
|
63
|
+
const localVarHeaderParameter = {} as any;
|
|
64
|
+
const localVarQueryParameter = {} as any;
|
|
65
|
+
|
|
66
|
+
// authentication bearer required
|
|
67
|
+
// http bearer authentication required
|
|
68
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
69
|
+
|
|
70
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
71
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
77
|
+
|
|
78
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
79
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
80
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
81
|
+
localVarRequestOptions.data = serializeDataIfNeeded(createCreditAllocationRequestDto, localVarRequestOptions, configuration)
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
url: toPathString(localVarUrlObj),
|
|
85
|
+
options: localVarRequestOptions,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* Get a credit allocation entry by code. **Required Permissions** \"payment-management.payments.view\"
|
|
90
|
+
* @summary Retrieve the credit allocation entry
|
|
91
|
+
* @param {string} code Code of the credit allocation to get
|
|
92
|
+
* @param {string} [authorization] Bearer Token
|
|
93
|
+
* @param {*} [options] Override http request option.
|
|
94
|
+
* @throws {RequiredError}
|
|
95
|
+
*/
|
|
96
|
+
getCreditAllocation: async (code: string, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
97
|
+
// verify required parameter 'code' is not null or undefined
|
|
98
|
+
assertParamExists('getCreditAllocation', 'code', code)
|
|
99
|
+
const localVarPath = `/paymentservice/v1/credit-allocations/{code}`
|
|
100
|
+
.replace(`{${"code"}}`, encodeURIComponent(String(code)));
|
|
101
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
102
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
103
|
+
let baseOptions;
|
|
104
|
+
let baseAccessToken;
|
|
105
|
+
if (configuration) {
|
|
106
|
+
baseOptions = configuration.baseOptions;
|
|
107
|
+
baseAccessToken = configuration.accessToken;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
111
|
+
const localVarHeaderParameter = {} as any;
|
|
112
|
+
const localVarQueryParameter = {} as any;
|
|
113
|
+
|
|
114
|
+
// authentication bearer required
|
|
115
|
+
// http bearer authentication required
|
|
116
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
117
|
+
|
|
118
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
119
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
125
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
126
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
url: toPathString(localVarUrlObj),
|
|
130
|
+
options: localVarRequestOptions,
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Returns a list of credit allocations you have previously created. The credit allocations are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"payment-management.payments.view\"
|
|
135
|
+
* @summary List credit allocations
|
|
136
|
+
* @param {string} [authorization] Bearer Token
|
|
137
|
+
* @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
138
|
+
* @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=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
139
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
140
|
+
* @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.<br/> <br/> <i>Searchable fields: code, policyCode</i>
|
|
141
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, createdAt, updatedAt</i>
|
|
142
|
+
* @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.<br/> <br/> <i>Allowed values: exceedingCredits<i>
|
|
143
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
144
|
+
* @param {*} [options] Override http request option.
|
|
145
|
+
* @throws {RequiredError}
|
|
146
|
+
*/
|
|
147
|
+
listCreditAllocations: async (authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
148
|
+
const localVarPath = `/paymentservice/v1/credit-allocations`;
|
|
149
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
150
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
151
|
+
let baseOptions;
|
|
152
|
+
let baseAccessToken;
|
|
153
|
+
if (configuration) {
|
|
154
|
+
baseOptions = configuration.baseOptions;
|
|
155
|
+
baseAccessToken = configuration.accessToken;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
159
|
+
const localVarHeaderParameter = {} as any;
|
|
160
|
+
const localVarQueryParameter = {} as any;
|
|
161
|
+
|
|
162
|
+
// authentication bearer required
|
|
163
|
+
// http bearer authentication required
|
|
164
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
165
|
+
|
|
166
|
+
if (pageSize !== undefined) {
|
|
167
|
+
localVarQueryParameter['pageSize'] = pageSize;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (pageToken !== undefined) {
|
|
171
|
+
localVarQueryParameter['pageToken'] = pageToken;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (filter !== undefined) {
|
|
175
|
+
localVarQueryParameter['filter'] = filter;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (search !== undefined) {
|
|
179
|
+
localVarQueryParameter['search'] = search;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (order !== undefined) {
|
|
183
|
+
localVarQueryParameter['order'] = order;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (expand !== undefined) {
|
|
187
|
+
localVarQueryParameter['expand'] = expand;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (filters !== undefined) {
|
|
191
|
+
localVarQueryParameter['filters'] = filters;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
195
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
201
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
202
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
203
|
+
|
|
204
|
+
return {
|
|
205
|
+
url: toPathString(localVarUrlObj),
|
|
206
|
+
options: localVarRequestOptions,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* CreditAllocationApi - functional programming interface
|
|
214
|
+
* @export
|
|
215
|
+
*/
|
|
216
|
+
export const CreditAllocationApiFp = function(configuration?: Configuration) {
|
|
217
|
+
const localVarAxiosParamCreator = CreditAllocationApiAxiosParamCreator(configuration)
|
|
218
|
+
return {
|
|
219
|
+
/**
|
|
220
|
+
* Create a credit allocation for existing exceeding credits. **Required Permissions** \"payment-management.payments.create\", \"accounting-management.financial-accounts.view\"
|
|
221
|
+
* @summary Create the credit allocation
|
|
222
|
+
* @param {CreateCreditAllocationRequestDto} createCreditAllocationRequestDto
|
|
223
|
+
* @param {string} [authorization] Bearer Token
|
|
224
|
+
* @param {*} [options] Override http request option.
|
|
225
|
+
* @throws {RequiredError}
|
|
226
|
+
*/
|
|
227
|
+
async createAllocateCredit(createCreditAllocationRequestDto: CreateCreditAllocationRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCreditAllocationResponseClass>> {
|
|
228
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createAllocateCredit(createCreditAllocationRequestDto, authorization, options);
|
|
229
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Get a credit allocation entry by code. **Required Permissions** \"payment-management.payments.view\"
|
|
233
|
+
* @summary Retrieve the credit allocation entry
|
|
234
|
+
* @param {string} code Code of the credit allocation to get
|
|
235
|
+
* @param {string} [authorization] Bearer Token
|
|
236
|
+
* @param {*} [options] Override http request option.
|
|
237
|
+
* @throws {RequiredError}
|
|
238
|
+
*/
|
|
239
|
+
async getCreditAllocation(code: string, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetCreditAllocationResponseClass>> {
|
|
240
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getCreditAllocation(code, authorization, options);
|
|
241
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Returns a list of credit allocations you have previously created. The credit allocations are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"payment-management.payments.view\"
|
|
245
|
+
* @summary List credit allocations
|
|
246
|
+
* @param {string} [authorization] Bearer Token
|
|
247
|
+
* @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
248
|
+
* @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=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
249
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
250
|
+
* @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.<br/> <br/> <i>Searchable fields: code, policyCode</i>
|
|
251
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, createdAt, updatedAt</i>
|
|
252
|
+
* @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.<br/> <br/> <i>Allowed values: exceedingCredits<i>
|
|
253
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
254
|
+
* @param {*} [options] Override http request option.
|
|
255
|
+
* @throws {RequiredError}
|
|
256
|
+
*/
|
|
257
|
+
async listCreditAllocations(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListCreditAllocationsResponseClass>> {
|
|
258
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listCreditAllocations(authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
|
|
259
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* CreditAllocationApi - factory interface
|
|
266
|
+
* @export
|
|
267
|
+
*/
|
|
268
|
+
export const CreditAllocationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
269
|
+
const localVarFp = CreditAllocationApiFp(configuration)
|
|
270
|
+
return {
|
|
271
|
+
/**
|
|
272
|
+
* Create a credit allocation for existing exceeding credits. **Required Permissions** \"payment-management.payments.create\", \"accounting-management.financial-accounts.view\"
|
|
273
|
+
* @summary Create the credit allocation
|
|
274
|
+
* @param {CreateCreditAllocationRequestDto} createCreditAllocationRequestDto
|
|
275
|
+
* @param {string} [authorization] Bearer Token
|
|
276
|
+
* @param {*} [options] Override http request option.
|
|
277
|
+
* @throws {RequiredError}
|
|
278
|
+
*/
|
|
279
|
+
createAllocateCredit(createCreditAllocationRequestDto: CreateCreditAllocationRequestDto, authorization?: string, options?: any): AxiosPromise<CreateCreditAllocationResponseClass> {
|
|
280
|
+
return localVarFp.createAllocateCredit(createCreditAllocationRequestDto, authorization, options).then((request) => request(axios, basePath));
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* Get a credit allocation entry by code. **Required Permissions** \"payment-management.payments.view\"
|
|
284
|
+
* @summary Retrieve the credit allocation entry
|
|
285
|
+
* @param {string} code Code of the credit allocation to get
|
|
286
|
+
* @param {string} [authorization] Bearer Token
|
|
287
|
+
* @param {*} [options] Override http request option.
|
|
288
|
+
* @throws {RequiredError}
|
|
289
|
+
*/
|
|
290
|
+
getCreditAllocation(code: string, authorization?: string, options?: any): AxiosPromise<GetCreditAllocationResponseClass> {
|
|
291
|
+
return localVarFp.getCreditAllocation(code, authorization, options).then((request) => request(axios, basePath));
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* Returns a list of credit allocations you have previously created. The credit allocations are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"payment-management.payments.view\"
|
|
295
|
+
* @summary List credit allocations
|
|
296
|
+
* @param {string} [authorization] Bearer Token
|
|
297
|
+
* @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
298
|
+
* @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=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
299
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
300
|
+
* @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.<br/> <br/> <i>Searchable fields: code, policyCode</i>
|
|
301
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, createdAt, updatedAt</i>
|
|
302
|
+
* @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.<br/> <br/> <i>Allowed values: exceedingCredits<i>
|
|
303
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
304
|
+
* @param {*} [options] Override http request option.
|
|
305
|
+
* @throws {RequiredError}
|
|
306
|
+
*/
|
|
307
|
+
listCreditAllocations(authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListCreditAllocationsResponseClass> {
|
|
308
|
+
return localVarFp.listCreditAllocations(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Request parameters for createAllocateCredit operation in CreditAllocationApi.
|
|
315
|
+
* @export
|
|
316
|
+
* @interface CreditAllocationApiCreateAllocateCreditRequest
|
|
317
|
+
*/
|
|
318
|
+
export interface CreditAllocationApiCreateAllocateCreditRequest {
|
|
319
|
+
/**
|
|
320
|
+
*
|
|
321
|
+
* @type {CreateCreditAllocationRequestDto}
|
|
322
|
+
* @memberof CreditAllocationApiCreateAllocateCredit
|
|
323
|
+
*/
|
|
324
|
+
readonly createCreditAllocationRequestDto: CreateCreditAllocationRequestDto
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Bearer Token
|
|
328
|
+
* @type {string}
|
|
329
|
+
* @memberof CreditAllocationApiCreateAllocateCredit
|
|
330
|
+
*/
|
|
331
|
+
readonly authorization?: string
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Request parameters for getCreditAllocation operation in CreditAllocationApi.
|
|
336
|
+
* @export
|
|
337
|
+
* @interface CreditAllocationApiGetCreditAllocationRequest
|
|
338
|
+
*/
|
|
339
|
+
export interface CreditAllocationApiGetCreditAllocationRequest {
|
|
340
|
+
/**
|
|
341
|
+
* Code of the credit allocation to get
|
|
342
|
+
* @type {string}
|
|
343
|
+
* @memberof CreditAllocationApiGetCreditAllocation
|
|
344
|
+
*/
|
|
345
|
+
readonly code: string
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Bearer Token
|
|
349
|
+
* @type {string}
|
|
350
|
+
* @memberof CreditAllocationApiGetCreditAllocation
|
|
351
|
+
*/
|
|
352
|
+
readonly authorization?: string
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Request parameters for listCreditAllocations operation in CreditAllocationApi.
|
|
357
|
+
* @export
|
|
358
|
+
* @interface CreditAllocationApiListCreditAllocationsRequest
|
|
359
|
+
*/
|
|
360
|
+
export interface CreditAllocationApiListCreditAllocationsRequest {
|
|
361
|
+
/**
|
|
362
|
+
* Bearer Token
|
|
363
|
+
* @type {string}
|
|
364
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
365
|
+
*/
|
|
366
|
+
readonly authorization?: string
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
370
|
+
* @type {number}
|
|
371
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
372
|
+
*/
|
|
373
|
+
readonly pageSize?: number
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* 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=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
377
|
+
* @type {string}
|
|
378
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
379
|
+
*/
|
|
380
|
+
readonly pageToken?: string
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
384
|
+
* @type {string}
|
|
385
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
386
|
+
*/
|
|
387
|
+
readonly filter?: string
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Search the response for matches in any searchable field. Use filter instead where possible for improved performance.<br/> <br/> <i>Searchable fields: code, policyCode</i>
|
|
391
|
+
* @type {string}
|
|
392
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
393
|
+
*/
|
|
394
|
+
readonly search?: string
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, createdAt, updatedAt</i>
|
|
398
|
+
* @type {string}
|
|
399
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
400
|
+
*/
|
|
401
|
+
readonly order?: string
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* 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.<br/> <br/> <i>Allowed values: exceedingCredits<i>
|
|
405
|
+
* @type {string}
|
|
406
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
407
|
+
*/
|
|
408
|
+
readonly expand?: string
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: code, id, policyCode, createdAt, updatedAt</i>
|
|
412
|
+
* @type {string}
|
|
413
|
+
* @memberof CreditAllocationApiListCreditAllocations
|
|
414
|
+
*/
|
|
415
|
+
readonly filters?: string
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* CreditAllocationApi - object-oriented interface
|
|
420
|
+
* @export
|
|
421
|
+
* @class CreditAllocationApi
|
|
422
|
+
* @extends {BaseAPI}
|
|
423
|
+
*/
|
|
424
|
+
export class CreditAllocationApi extends BaseAPI {
|
|
425
|
+
/**
|
|
426
|
+
* Create a credit allocation for existing exceeding credits. **Required Permissions** \"payment-management.payments.create\", \"accounting-management.financial-accounts.view\"
|
|
427
|
+
* @summary Create the credit allocation
|
|
428
|
+
* @param {CreditAllocationApiCreateAllocateCreditRequest} requestParameters Request parameters.
|
|
429
|
+
* @param {*} [options] Override http request option.
|
|
430
|
+
* @throws {RequiredError}
|
|
431
|
+
* @memberof CreditAllocationApi
|
|
432
|
+
*/
|
|
433
|
+
public createAllocateCredit(requestParameters: CreditAllocationApiCreateAllocateCreditRequest, options?: AxiosRequestConfig) {
|
|
434
|
+
return CreditAllocationApiFp(this.configuration).createAllocateCredit(requestParameters.createCreditAllocationRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Get a credit allocation entry by code. **Required Permissions** \"payment-management.payments.view\"
|
|
439
|
+
* @summary Retrieve the credit allocation entry
|
|
440
|
+
* @param {CreditAllocationApiGetCreditAllocationRequest} requestParameters Request parameters.
|
|
441
|
+
* @param {*} [options] Override http request option.
|
|
442
|
+
* @throws {RequiredError}
|
|
443
|
+
* @memberof CreditAllocationApi
|
|
444
|
+
*/
|
|
445
|
+
public getCreditAllocation(requestParameters: CreditAllocationApiGetCreditAllocationRequest, options?: AxiosRequestConfig) {
|
|
446
|
+
return CreditAllocationApiFp(this.configuration).getCreditAllocation(requestParameters.code, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Returns a list of credit allocations you have previously created. The credit allocations are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation. **Required Permissions** \"payment-management.payments.view\"
|
|
451
|
+
* @summary List credit allocations
|
|
452
|
+
* @param {CreditAllocationApiListCreditAllocationsRequest} requestParameters Request parameters.
|
|
453
|
+
* @param {*} [options] Override http request option.
|
|
454
|
+
* @throws {RequiredError}
|
|
455
|
+
* @memberof CreditAllocationApi
|
|
456
|
+
*/
|
|
457
|
+
public listCreditAllocations(requestParameters: CreditAllocationApiListCreditAllocationsRequest = {}, options?: AxiosRequestConfig) {
|
|
458
|
+
return CreditAllocationApiFp(this.configuration).listCreditAllocations(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
|
|
459
|
+
}
|
|
460
|
+
}
|
package/api.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
|
|
|
27
27
|
import { BankAccountsApi } from './api';
|
|
28
28
|
import { BankOrdersApi } from './api';
|
|
29
29
|
import { BankTransactionApi } from './api';
|
|
30
|
+
import { CreditAllocationApi } from './api';
|
|
30
31
|
import { ExceedingCreditsApi } from './api';
|
|
31
32
|
import { HealthCheckApi } from './api';
|
|
32
33
|
import { PaymentMethodsApi } from './api';
|
|
@@ -42,6 +43,7 @@ import { WebhooksApi } from './api';
|
|
|
42
43
|
export * from './api/bank-accounts-api';
|
|
43
44
|
export * from './api/bank-orders-api';
|
|
44
45
|
export * from './api/bank-transaction-api';
|
|
46
|
+
export * from './api/credit-allocation-api';
|
|
45
47
|
export * from './api/exceeding-credits-api';
|
|
46
48
|
export * from './api/health-check-api';
|
|
47
49
|
export * from './api/payment-methods-api';
|
package/base.ts
CHANGED
|
@@ -41,12 +41,23 @@ export const COLLECTION_FORMATS = {
|
|
|
41
41
|
|
|
42
42
|
export interface LoginClass {
|
|
43
43
|
accessToken: string;
|
|
44
|
-
permissions:
|
|
44
|
+
permissions: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface SwitchWorkspaceRequest {
|
|
48
|
+
username: string;
|
|
49
|
+
targetWorkspace: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface SwitchWorkspaceResponseClass {
|
|
53
|
+
accessToken: string;
|
|
54
|
+
permissions: string;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
export enum Environment {
|
|
48
58
|
Production = 'https://apiv2.emil.de',
|
|
49
59
|
Test = 'https://apiv2-test.emil.de',
|
|
60
|
+
Staging = 'https://apiv2-staging.emil.de',
|
|
50
61
|
Development = 'https://apiv2-dev.emil.de',
|
|
51
62
|
ProductionZurich = 'https://eu-central-2.apiv2.emil.de',
|
|
52
63
|
}
|
|
@@ -93,13 +104,13 @@ export class BaseAPI {
|
|
|
93
104
|
this.attachInterceptor(axios);
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
async initialize(env: Environment = Environment.Production) {
|
|
107
|
+
async initialize(env: Environment = Environment.Production, targetWorkspace?: string) {
|
|
97
108
|
this.configuration.basePath = env;
|
|
98
109
|
|
|
99
110
|
await this.loadCredentials();
|
|
100
111
|
|
|
101
112
|
if (this.username) {
|
|
102
|
-
await this.authorize(this.username, this.password);
|
|
113
|
+
await this.authorize(this.username, this.password, targetWorkspace);
|
|
103
114
|
this.password = null; // to avoid keeping password loaded in memory.
|
|
104
115
|
}
|
|
105
116
|
}
|
|
@@ -149,7 +160,7 @@ export class BaseAPI {
|
|
|
149
160
|
this.configuration.basePath = env;
|
|
150
161
|
}
|
|
151
162
|
|
|
152
|
-
async authorize(username: string, password: string): Promise<void> {
|
|
163
|
+
async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
|
|
153
164
|
const options: AxiosRequestConfig = {
|
|
154
165
|
method: 'POST',
|
|
155
166
|
url: `${this.configuration.basePath}/authservice/v1/login`,
|
|
@@ -169,6 +180,38 @@ export class BaseAPI {
|
|
|
169
180
|
|
|
170
181
|
const refreshToken = this.extractRefreshToken(response)
|
|
171
182
|
this.configuration.refreshToken = refreshToken;
|
|
183
|
+
|
|
184
|
+
// Switch workspace if provided
|
|
185
|
+
if (targetWorkspace) {
|
|
186
|
+
await this.switchWorkspace(targetWorkspace);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async switchWorkspace(targetWorkspace: string): Promise<void> {
|
|
191
|
+
const options: AxiosRequestConfig = {
|
|
192
|
+
method: 'POST',
|
|
193
|
+
url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
|
|
194
|
+
headers: {
|
|
195
|
+
'Content-Type': 'application/json',
|
|
196
|
+
'Authorization': `Bearer ${this.configuration.accessToken}`,
|
|
197
|
+
'Cookie': this.configuration.refreshToken,
|
|
198
|
+
},
|
|
199
|
+
data: {
|
|
200
|
+
username: this.configuration.username,
|
|
201
|
+
targetWorkspace,
|
|
202
|
+
} as SwitchWorkspaceRequest,
|
|
203
|
+
withCredentials: true,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
|
|
207
|
+
|
|
208
|
+
const { data: { accessToken } } = response;
|
|
209
|
+
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
210
|
+
|
|
211
|
+
const refreshToken = this.extractRefreshToken(response);
|
|
212
|
+
if (refreshToken) {
|
|
213
|
+
this.configuration.refreshToken = refreshToken;
|
|
214
|
+
}
|
|
172
215
|
}
|
|
173
216
|
|
|
174
217
|
async refreshTokenInternal(): Promise<string> {
|
|
@@ -224,7 +267,7 @@ export class BaseAPI {
|
|
|
224
267
|
const tokenString = await this.refreshTokenInternal();
|
|
225
268
|
const accessToken = `Bearer ${tokenString}`;
|
|
226
269
|
|
|
227
|
-
originalConfig.headers['Authorization'] =
|
|
270
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
228
271
|
|
|
229
272
|
this.configuration.accessToken = accessToken;
|
|
230
273
|
|
|
@@ -277,7 +320,7 @@ export class BaseAPI {
|
|
|
277
320
|
* @extends {Error}
|
|
278
321
|
*/
|
|
279
322
|
export class RequiredError extends Error {
|
|
280
|
-
name: "RequiredError" = "RequiredError";
|
|
323
|
+
override name: "RequiredError" = "RequiredError";
|
|
281
324
|
constructor(public field: string, msg?: string) {
|
|
282
325
|
super(msg);
|
|
283
326
|
}
|
package/common.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const setBearerAuthToObject = async function (object: any, configuration?
|
|
|
66
66
|
const accessToken = typeof configuration.accessToken === 'function'
|
|
67
67
|
? await configuration.accessToken()
|
|
68
68
|
: await configuration.accessToken;
|
|
69
|
-
object["Authorization"] =
|
|
69
|
+
object["Authorization"] = configuration.getBearerToken(accessToken);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -79,7 +79,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope
|
|
|
79
79
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
80
80
|
? await configuration.accessToken(name, scopes)
|
|
81
81
|
: await configuration.accessToken;
|
|
82
|
-
object["Authorization"] =
|
|
82
|
+
object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|