@emilgroup/payment-sdk 1.22.1-beta.76 → 1.22.1-beta.77
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 +0 -6
- package/README.md +2 -2
- package/api/bank-accounts-api.ts +12 -24
- package/api/bank-orders-api.ts +10 -20
- package/api/bank-transaction-api.ts +20 -154
- package/api/billing-addresses-api.ts +10 -20
- package/api/credit-allocation-api.ts +6 -12
- package/api/exceeding-credits-api.ts +4 -117
- package/api/ibanvalidator-api.ts +2 -4
- package/api/payment-methods-api.ts +6 -12
- package/api/payment-receipts-api.ts +10 -20
- package/api/payment-reminders-api.ts +8 -16
- package/api/payment-requests-api.ts +22 -32
- package/api/payment-setup-api.ts +4 -8
- package/api/payments-api.ts +12 -24
- package/api/payout-methods-api.ts +12 -24
- package/api/policy-payment-methods-api.ts +6 -12
- package/api/refunds-api.ts +6 -12
- package/api/tenant-bank-account-api.ts +10 -20
- package/base.ts +41 -174
- package/common.ts +2 -3
- package/configuration.ts +0 -20
- package/dist/api/bank-accounts-api.d.ts +6 -6
- package/dist/api/bank-accounts-api.js +22 -36
- package/dist/api/bank-orders-api.d.ts +5 -5
- package/dist/api/bank-orders-api.js +18 -29
- package/dist/api/bank-transaction-api.d.ts +14 -80
- package/dist/api/bank-transaction-api.js +28 -144
- package/dist/api/billing-addresses-api.d.ts +5 -5
- package/dist/api/billing-addresses-api.js +19 -32
- package/dist/api/credit-allocation-api.d.ts +3 -3
- package/dist/api/credit-allocation-api.js +11 -18
- package/dist/api/exceeding-credits-api.d.ts +2 -59
- package/dist/api/exceeding-credits-api.js +7 -107
- package/dist/api/health-check-api.d.ts +1 -1
- package/dist/api/ibanvalidator-api.d.ts +1 -1
- package/dist/api/ibanvalidator-api.js +4 -7
- package/dist/api/payment-methods-api.d.ts +3 -3
- package/dist/api/payment-methods-api.js +11 -18
- package/dist/api/payment-receipts-api.d.ts +5 -5
- package/dist/api/payment-receipts-api.js +18 -29
- package/dist/api/payment-reminders-api.d.ts +4 -4
- package/dist/api/payment-reminders-api.js +15 -25
- package/dist/api/payment-requests-api.d.ts +17 -17
- package/dist/api/payment-requests-api.js +27 -38
- package/dist/api/payment-setup-api.d.ts +2 -2
- package/dist/api/payment-setup-api.js +8 -14
- package/dist/api/payments-api.d.ts +4 -4
- package/dist/api/payments-api.js +18 -28
- package/dist/api/payout-methods-api.d.ts +6 -6
- package/dist/api/payout-methods-api.js +22 -36
- package/dist/api/policy-payment-methods-api.d.ts +3 -3
- package/dist/api/policy-payment-methods-api.js +11 -18
- package/dist/api/refunds-api.d.ts +3 -3
- package/dist/api/refunds-api.js +10 -15
- package/dist/api/tenant-bank-account-api.d.ts +5 -5
- package/dist/api/tenant-bank-account-api.js +18 -29
- package/dist/api/webhooks-api.d.ts +2 -2
- package/dist/base.d.ts +0 -24
- package/dist/base.js +59 -178
- package/dist/common.d.ts +1 -1
- package/dist/common.js +0 -1
- package/dist/configuration.d.ts +0 -17
- package/dist/configuration.js +0 -2
- package/dist/models/bank-transaction-class.d.ts +0 -7
- package/dist/models/bank-transaction-entity.d.ts +0 -7
- package/dist/models/bank-transaction-invoice-entity.d.ts +0 -24
- package/dist/models/create-payment-order-dto.d.ts +1 -1
- package/dist/models/create-payment-receipt-request-dto.d.ts +1 -1
- package/dist/models/create-payment-request-dto.d.ts +1 -1
- package/dist/models/create-payment-request-request-dto.d.ts +0 -6
- package/dist/models/credit-allocation-class.d.ts +0 -6
- package/dist/models/credit-allocation-entity.d.ts +0 -6
- package/dist/models/exceeding-credit-entity.d.ts +0 -6
- package/dist/models/index.d.ts +0 -6
- package/dist/models/index.js +0 -6
- package/dist/models/list-billing-addresses-response-class.d.ts +9 -9
- package/dist/models/list-exceeding-credits-response-class.d.ts +18 -6
- package/dist/models/list-payment-receipts-response-class.d.ts +9 -9
- package/dist/models/list-payment-requests-response-class.d.ts +18 -6
- package/dist/models/list-payout-methods-response-class.d.ts +9 -9
- package/dist/models/list-refunds-response-class.d.ts +18 -6
- package/dist/models/payment-class-without-expand-properties.d.ts +2 -2
- package/dist/models/payment-class.d.ts +2 -2
- package/dist/models/payment-entity.d.ts +1 -1
- package/dist/models/payment-receipt-class.d.ts +1 -13
- package/dist/models/payment-request-class.d.ts +6 -13
- package/dist/models/payment-request-class.js +0 -1
- package/dist/models/shared-transaction-class.d.ts +0 -6
- package/dist/models/transaction-entity.d.ts +0 -6
- package/models/bank-transaction-class.ts +0 -7
- package/models/bank-transaction-entity.ts +0 -7
- package/models/bank-transaction-invoice-entity.ts +0 -24
- package/models/create-payment-order-dto.ts +1 -1
- package/models/create-payment-receipt-request-dto.ts +1 -1
- package/models/create-payment-request-dto.ts +1 -1
- package/models/create-payment-request-request-dto.ts +0 -6
- package/models/credit-allocation-class.ts +0 -6
- package/models/credit-allocation-entity.ts +0 -6
- package/models/exceeding-credit-entity.ts +0 -6
- package/models/index.ts +0 -6
- package/models/list-billing-addresses-response-class.ts +9 -9
- package/models/list-exceeding-credits-response-class.ts +18 -6
- package/models/list-payment-receipts-response-class.ts +9 -9
- package/models/list-payment-requests-response-class.ts +18 -6
- package/models/list-payout-methods-response-class.ts +9 -9
- package/models/list-refunds-response-class.ts +18 -6
- package/models/payment-class-without-expand-properties.ts +2 -2
- package/models/payment-class.ts +2 -2
- package/models/payment-entity.ts +1 -1
- package/models/payment-receipt-class.ts +1 -13
- package/models/payment-request-class.ts +6 -13
- package/models/shared-transaction-class.ts +0 -6
- package/models/transaction-entity.ts +0 -6
- package/package.json +2 -2
- package/dist/models/create-exceeding-credit-request-dto.d.ts +0 -48
- package/dist/models/create-exceeding-credit-request-dto.js +0 -15
- package/dist/models/create-exceeding-credit-response-class.d.ts +0 -25
- package/dist/models/create-exceeding-credit-response-class.js +0 -15
- package/dist/models/link-bank-transaction-payment-requests-request-dto-rest.d.ts +0 -30
- package/dist/models/link-bank-transaction-payment-requests-request-dto-rest.js +0 -15
- package/dist/models/link-bank-transaction-payment-requests-response-class.d.ts +0 -25
- package/dist/models/link-bank-transaction-payment-requests-response-class.js +0 -15
- package/dist/models/payment-receipt-entity.d.ts +0 -139
- package/dist/models/payment-receipt-entity.js +0 -20
- package/dist/models/payment-request-entity.d.ts +0 -223
- package/dist/models/payment-request-entity.js +0 -39
- package/models/create-exceeding-credit-request-dto.ts +0 -54
- package/models/create-exceeding-credit-response-class.ts +0 -31
- package/models/link-bank-transaction-payment-requests-request-dto-rest.ts +0 -36
- package/models/link-bank-transaction-payment-requests-response-class.ts +0 -31
- package/models/payment-receipt-entity.ts +0 -148
- package/models/payment-request-entity.ts +0 -233
package/api/payments-api.ts
CHANGED
|
@@ -68,16 +68,12 @@ export const PaymentsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
68
68
|
// http bearer authentication required
|
|
69
69
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (authorizationValue) {
|
|
74
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
71
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
72
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (idempotencyKeyValue) {
|
|
80
|
-
localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKeyValue);
|
|
75
|
+
if (idempotencyKey !== undefined && idempotencyKey !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
76
|
+
localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey ? idempotencyKey : baseAccessToken);
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
|
|
@@ -126,16 +122,12 @@ export const PaymentsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
126
122
|
// http bearer authentication required
|
|
127
123
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
128
124
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (authorizationValue) {
|
|
132
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
125
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
126
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
133
127
|
}
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (idempotencyKeyValue) {
|
|
138
|
-
localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKeyValue);
|
|
129
|
+
if (idempotencyKey !== undefined && idempotencyKey !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
130
|
+
localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey ? idempotencyKey : baseAccessToken);
|
|
139
131
|
}
|
|
140
132
|
|
|
141
133
|
|
|
@@ -187,10 +179,8 @@ export const PaymentsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
187
179
|
localVarQueryParameter['expand'] = expand;
|
|
188
180
|
}
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (authorizationValue) {
|
|
193
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
182
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
183
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
194
184
|
}
|
|
195
185
|
|
|
196
186
|
|
|
@@ -265,10 +255,8 @@ export const PaymentsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
265
255
|
localVarQueryParameter['filters'] = filters;
|
|
266
256
|
}
|
|
267
257
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (authorizationValue) {
|
|
271
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
258
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
259
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
272
260
|
}
|
|
273
261
|
|
|
274
262
|
|
|
@@ -66,10 +66,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
66
66
|
// http bearer authentication required
|
|
67
67
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (authorizationValue) {
|
|
72
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
69
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
70
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
|
|
@@ -112,10 +110,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
112
110
|
// http bearer authentication required
|
|
113
111
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (authorizationValue) {
|
|
118
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
113
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
114
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
|
|
@@ -165,10 +161,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
165
161
|
// http bearer authentication required
|
|
166
162
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
167
163
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (authorizationValue) {
|
|
171
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
164
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
165
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
172
166
|
}
|
|
173
167
|
|
|
174
168
|
|
|
@@ -215,10 +209,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
215
209
|
// http bearer authentication required
|
|
216
210
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
217
211
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (authorizationValue) {
|
|
221
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
212
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
213
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
222
214
|
}
|
|
223
215
|
|
|
224
216
|
|
|
@@ -267,10 +259,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
267
259
|
localVarQueryParameter['expand'] = expand;
|
|
268
260
|
}
|
|
269
261
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (authorizationValue) {
|
|
273
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
262
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
263
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
274
264
|
}
|
|
275
265
|
|
|
276
266
|
|
|
@@ -345,10 +335,8 @@ export const PayoutMethodsApiAxiosParamCreator = function (configuration?: Confi
|
|
|
345
335
|
localVarQueryParameter['filters'] = filters;
|
|
346
336
|
}
|
|
347
337
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (authorizationValue) {
|
|
351
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
338
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
339
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
352
340
|
}
|
|
353
341
|
|
|
354
342
|
|
|
@@ -67,10 +67,8 @@ export const PolicyPaymentMethodsApiAxiosParamCreator = function (configuration?
|
|
|
67
67
|
// http bearer authentication required
|
|
68
68
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (authorizationValue) {
|
|
73
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
70
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
71
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
|
|
@@ -116,10 +114,8 @@ export const PolicyPaymentMethodsApiAxiosParamCreator = function (configuration?
|
|
|
116
114
|
// http bearer authentication required
|
|
117
115
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
118
116
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (authorizationValue) {
|
|
122
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
117
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
118
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
|
|
@@ -197,10 +193,8 @@ export const PolicyPaymentMethodsApiAxiosParamCreator = function (configuration?
|
|
|
197
193
|
localVarQueryParameter['filters'] = filters;
|
|
198
194
|
}
|
|
199
195
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (authorizationValue) {
|
|
203
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
196
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
197
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
204
198
|
}
|
|
205
199
|
|
|
206
200
|
|
package/api/refunds-api.ts
CHANGED
|
@@ -63,10 +63,8 @@ export const RefundsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
63
63
|
// http bearer authentication required
|
|
64
64
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (authorizationValue) {
|
|
69
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
66
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
67
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
|
|
@@ -118,10 +116,8 @@ export const RefundsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
118
116
|
localVarQueryParameter['expand'] = expand;
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (authorizationValue) {
|
|
124
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
119
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
120
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
|
|
@@ -196,10 +192,8 @@ export const RefundsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
196
192
|
localVarQueryParameter['filters'] = filters;
|
|
197
193
|
}
|
|
198
194
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (authorizationValue) {
|
|
202
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
195
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
196
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
203
197
|
}
|
|
204
198
|
|
|
205
199
|
|
|
@@ -67,10 +67,8 @@ export const TenantBankAccountApiAxiosParamCreator = function (configuration?: C
|
|
|
67
67
|
// http bearer authentication required
|
|
68
68
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (authorizationValue) {
|
|
73
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
70
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
71
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
|
|
@@ -117,10 +115,8 @@ export const TenantBankAccountApiAxiosParamCreator = function (configuration?: C
|
|
|
117
115
|
// http bearer authentication required
|
|
118
116
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
119
117
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (authorizationValue) {
|
|
123
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
118
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
119
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
124
120
|
}
|
|
125
121
|
|
|
126
122
|
|
|
@@ -169,10 +165,8 @@ export const TenantBankAccountApiAxiosParamCreator = function (configuration?: C
|
|
|
169
165
|
localVarQueryParameter['expand'] = expand;
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (authorizationValue) {
|
|
175
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
168
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
169
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
176
170
|
}
|
|
177
171
|
|
|
178
172
|
|
|
@@ -247,10 +241,8 @@ export const TenantBankAccountApiAxiosParamCreator = function (configuration?: C
|
|
|
247
241
|
localVarQueryParameter['filters'] = filters;
|
|
248
242
|
}
|
|
249
243
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (authorizationValue) {
|
|
253
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
244
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
245
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
254
246
|
}
|
|
255
247
|
|
|
256
248
|
|
|
@@ -297,10 +289,8 @@ export const TenantBankAccountApiAxiosParamCreator = function (configuration?: C
|
|
|
297
289
|
// http bearer authentication required
|
|
298
290
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
299
291
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (authorizationValue) {
|
|
303
|
-
localVarHeaderParameter['Authorization'] = String(authorizationValue);
|
|
292
|
+
if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
|
|
293
|
+
localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
|
|
304
294
|
}
|
|
305
295
|
|
|
306
296
|
|
package/base.ts
CHANGED
|
@@ -32,20 +32,9 @@ export const COLLECTION_FORMATS = {
|
|
|
32
32
|
pipes: "|",
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export interface SessionClass {
|
|
36
|
-
sub: string;
|
|
37
|
-
username?: string;
|
|
38
|
-
email?: string;
|
|
39
|
-
tenantSlug?: string;
|
|
40
|
-
permissions?: string;
|
|
41
|
-
expiresAt?: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
35
|
export interface LoginClass {
|
|
45
36
|
accessToken: string;
|
|
46
37
|
permissions: string;
|
|
47
|
-
authMode?: string;
|
|
48
|
-
session?: SessionClass;
|
|
49
38
|
}
|
|
50
39
|
|
|
51
40
|
export interface SwitchWorkspaceRequest {
|
|
@@ -56,8 +45,6 @@ export interface SwitchWorkspaceRequest {
|
|
|
56
45
|
export interface SwitchWorkspaceResponseClass {
|
|
57
46
|
accessToken: string;
|
|
58
47
|
permissions: string;
|
|
59
|
-
authMode?: string;
|
|
60
|
-
session?: SessionClass;
|
|
61
48
|
}
|
|
62
49
|
|
|
63
50
|
export enum Environment {
|
|
@@ -90,19 +77,10 @@ interface TokenData {
|
|
|
90
77
|
accessToken?: string;
|
|
91
78
|
username?: string;
|
|
92
79
|
permissions?: string;
|
|
93
|
-
// 'both' or 'session' when authservice keeps the tokens in a server session.
|
|
94
|
-
authMode?: string;
|
|
95
|
-
sub?: string;
|
|
96
80
|
}
|
|
97
81
|
|
|
98
82
|
const NETWORK_ERROR_MESSAGE = "Network Error";
|
|
99
83
|
const TOKEN_DATA = 'APP_TOKEN';
|
|
100
|
-
// Sent only to authservice, to ask for a server session.
|
|
101
|
-
const AUTH_MODE_HEADER = 'X-Emil-Auth-Mode';
|
|
102
|
-
// Names the account on every call; one browser session can hold several.
|
|
103
|
-
const ACCOUNT_HEADER = 'X-Emil-Account';
|
|
104
|
-
const SESSION_MODES = ['both', 'session'];
|
|
105
|
-
const RESEND_SAFE_METHODS = ['get', 'head', 'options'];
|
|
106
84
|
|
|
107
85
|
/**
|
|
108
86
|
*
|
|
@@ -124,18 +102,10 @@ export class BaseAPI {
|
|
|
124
102
|
this.configuration = configuration;
|
|
125
103
|
this.basePath = configuration.basePath || this.basePath;
|
|
126
104
|
|
|
127
|
-
if
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.usesSession()) {
|
|
132
|
-
this.useSessionAuth();
|
|
133
|
-
} else {
|
|
134
|
-
// Use config token if provided, otherwise use tokenData token
|
|
135
|
-
const configToken = this.configuration.accessToken;
|
|
136
|
-
const storedToken = accessToken ? `Bearer ${accessToken}` : '';
|
|
137
|
-
this.configuration.accessToken = configToken || storedToken;
|
|
138
|
-
}
|
|
105
|
+
// Use config token if provided, otherwise use tokenData token
|
|
106
|
+
const configToken = this.configuration.accessToken;
|
|
107
|
+
const storedToken = accessToken ? `Bearer ${accessToken}` : '';
|
|
108
|
+
this.configuration.accessToken = configToken || storedToken;
|
|
139
109
|
} else {
|
|
140
110
|
const { accessToken, username } = this.tokenData;
|
|
141
111
|
|
|
@@ -149,107 +119,6 @@ export class BaseAPI {
|
|
|
149
119
|
this.attachInterceptor(axios);
|
|
150
120
|
}
|
|
151
121
|
|
|
152
|
-
// The app's own account wins over APP_TOKEN, which holds whichever tab wrote last.
|
|
153
|
-
private sessionAccount(): string | undefined {
|
|
154
|
-
return this.configuration.account || this.tokenData.sub;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Apps may pass the address as the second argument only; authservice is on the same host.
|
|
158
|
-
private authBasePath(): string {
|
|
159
|
-
return this.configuration.basePath || this.basePath;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private usesSession(): boolean {
|
|
163
|
-
return !!this.configuration.cookieAuth && SESSION_MODES.indexOf(this.tokenData.authMode) !== -1 && !!this.sessionAccount();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
private useSessionAuth() {
|
|
167
|
-
const { headers, ...baseOptions } = this.configuration.baseOptions || {};
|
|
168
|
-
this.configuration.accessToken = '';
|
|
169
|
-
this.configuration.baseOptions = {
|
|
170
|
-
...baseOptions,
|
|
171
|
-
withCredentials: true,
|
|
172
|
-
headers: { ...headers, [ACCOUNT_HEADER]: this.sessionAccount() },
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
private useHeaderAuth(accessToken: string) {
|
|
177
|
-
this.configuration.accessToken = accessToken ? `Bearer ${accessToken}` : '';
|
|
178
|
-
this.tokenData.accessToken = accessToken;
|
|
179
|
-
delete this.tokenData.authMode;
|
|
180
|
-
delete this.tokenData.sub;
|
|
181
|
-
if (this.configuration.cookieAuth) {
|
|
182
|
-
const { withCredentials, headers, ...baseOptions } = this.configuration.baseOptions || {};
|
|
183
|
-
const { [ACCOUNT_HEADER]: account, ...otherHeaders } = headers || {};
|
|
184
|
-
this.configuration.baseOptions = { ...baseOptions, headers: otherHeaders };
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private applyTokenReply({ accessToken, authMode, session }: LoginClass) {
|
|
189
|
-
if (this.configuration.cookieAuth && SESSION_MODES.indexOf(authMode) !== -1 && session?.sub) {
|
|
190
|
-
this.tokenData.authMode = authMode;
|
|
191
|
-
this.tokenData.sub = session.sub;
|
|
192
|
-
if (this.configuration.account) {
|
|
193
|
-
// A workspace switch moves the app to another account.
|
|
194
|
-
this.configuration.account = session.sub;
|
|
195
|
-
}
|
|
196
|
-
// Both keeps the token for apps not moved yet; session mode keeps no token at all.
|
|
197
|
-
if (authMode === 'both' && accessToken) {
|
|
198
|
-
this.tokenData.accessToken = accessToken;
|
|
199
|
-
} else {
|
|
200
|
-
delete this.tokenData.accessToken;
|
|
201
|
-
}
|
|
202
|
-
this.useSessionAuth();
|
|
203
|
-
} else {
|
|
204
|
-
this.useHeaderAuth(accessToken);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
private sessionHeaders(): Record<string, string> {
|
|
209
|
-
if (!this.configuration.cookieAuth) {
|
|
210
|
-
return {};
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
[AUTH_MODE_HEADER]: 'session',
|
|
214
|
-
...(this.usesSession() && { [ACCOUNT_HEADER]: this.sessionAccount() }),
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
private withCurrentAuth(config: AxiosRequestConfig): AxiosRequestConfig {
|
|
219
|
-
delete config.headers['Authorization'];
|
|
220
|
-
delete config.headers[ACCOUNT_HEADER];
|
|
221
|
-
if (this.usesSession()) {
|
|
222
|
-
config.headers[ACCOUNT_HEADER] = this.sessionAccount();
|
|
223
|
-
config.withCredentials = true;
|
|
224
|
-
} else if (this.configuration.accessToken) {
|
|
225
|
-
config.headers['Authorization'] = this.configuration.accessToken;
|
|
226
|
-
}
|
|
227
|
-
return config;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Both keeps the token, so a session call the browser could not complete can be sent again with it.
|
|
231
|
-
private canRetryWithToken(config: AxiosRequestConfig): boolean {
|
|
232
|
-
return !!config.withCredentials && !!config.headers?.[ACCOUNT_HEADER]
|
|
233
|
-
&& !!this.tokenData.accessToken && this.tokenData.authMode !== 'session';
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// A network error can come after the server ran the call, so only a call that is safe to repeat is sent again.
|
|
237
|
-
private canResend(config: AxiosRequestConfig): boolean {
|
|
238
|
-
return RESEND_SAFE_METHODS.indexOf((config.method || 'get').toLowerCase()) !== -1
|
|
239
|
-
|| Object.keys(config.headers || {}).some((name) => name.toLowerCase() === 'idempotency-key');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
private switchToToken() {
|
|
243
|
-
this.useHeaderAuth(this.tokenData.accessToken);
|
|
244
|
-
this.storeTokenData(this.tokenData);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
private retryWithToken(axios: AxiosInstance, config: AxiosRequestConfig) {
|
|
248
|
-
this.switchToToken();
|
|
249
|
-
config.withCredentials = false;
|
|
250
|
-
return axios(this.withCurrentAuth(config));
|
|
251
|
-
}
|
|
252
|
-
|
|
253
122
|
selectEnvironment(env: Environment) {
|
|
254
123
|
this.selectBasePath(env);
|
|
255
124
|
}
|
|
@@ -269,8 +138,8 @@ export class BaseAPI {
|
|
|
269
138
|
async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
|
|
270
139
|
const options: AxiosRequestConfig = {
|
|
271
140
|
method: 'POST',
|
|
272
|
-
url: `${this.
|
|
273
|
-
headers: { 'Content-Type': 'application/json'
|
|
141
|
+
url: `${this.configuration.basePath}/authservice/v1/login`,
|
|
142
|
+
headers: { 'Content-Type': 'application/json' },
|
|
274
143
|
data: {
|
|
275
144
|
username,
|
|
276
145
|
password,
|
|
@@ -280,10 +149,13 @@ export class BaseAPI {
|
|
|
280
149
|
|
|
281
150
|
const response = await globalAxios.request<LoginClass>(options);
|
|
282
151
|
|
|
152
|
+
const { data: { accessToken, permissions } } = response;
|
|
153
|
+
|
|
283
154
|
this.configuration.username = username;
|
|
155
|
+
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
284
156
|
this.tokenData.username = username;
|
|
285
|
-
this.tokenData.
|
|
286
|
-
this.
|
|
157
|
+
this.tokenData.accessToken = accessToken;
|
|
158
|
+
this.tokenData.permissions = permissions;
|
|
287
159
|
|
|
288
160
|
// Switch workspace if provided
|
|
289
161
|
if (targetWorkspace) {
|
|
@@ -303,11 +175,10 @@ export class BaseAPI {
|
|
|
303
175
|
async switchWorkspace(targetWorkspace: string): Promise<void> {
|
|
304
176
|
const options: AxiosRequestConfig = {
|
|
305
177
|
method: 'POST',
|
|
306
|
-
url: `${this.
|
|
178
|
+
url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
|
|
307
179
|
headers: {
|
|
308
180
|
'Content-Type': 'application/json',
|
|
309
|
-
|
|
310
|
-
...(!this.usesSession() && !!this.configuration.accessToken && { 'Authorization': this.configuration.accessToken as string }),
|
|
181
|
+
'Authorization': `Bearer ${this.configuration.accessToken}`,
|
|
311
182
|
},
|
|
312
183
|
data: {
|
|
313
184
|
username: this.configuration.username,
|
|
@@ -318,8 +189,11 @@ export class BaseAPI {
|
|
|
318
189
|
|
|
319
190
|
const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
|
|
320
191
|
|
|
321
|
-
|
|
322
|
-
|
|
192
|
+
const { data: { accessToken, permissions } } = response;
|
|
193
|
+
|
|
194
|
+
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
195
|
+
this.tokenData.accessToken = accessToken;
|
|
196
|
+
this.tokenData.permissions = permissions;
|
|
323
197
|
|
|
324
198
|
this.storeTokenData({
|
|
325
199
|
...this.tokenData
|
|
@@ -345,10 +219,9 @@ export class BaseAPI {
|
|
|
345
219
|
|
|
346
220
|
const options: AxiosRequestConfig = {
|
|
347
221
|
method: 'POST',
|
|
348
|
-
url: `${this.
|
|
222
|
+
url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
|
|
349
223
|
headers: {
|
|
350
224
|
'Content-Type': 'application/json',
|
|
351
|
-
...this.sessionHeaders(),
|
|
352
225
|
},
|
|
353
226
|
data: { username: username },
|
|
354
227
|
withCredentials: true,
|
|
@@ -389,22 +262,20 @@ export class BaseAPI {
|
|
|
389
262
|
&& !originalConfig._retry) {
|
|
390
263
|
originalConfig._retry = true;
|
|
391
264
|
try {
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
this.
|
|
395
|
-
this.storeTokenData(this.tokenData);
|
|
265
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
266
|
+
const accessToken = `Bearer ${tokenString}`;
|
|
267
|
+
this.tokenData.permissions = permissions;
|
|
396
268
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
269
|
+
delete originalConfig.headers['Authorization']
|
|
270
|
+
|
|
271
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
400
272
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
});
|
|
273
|
+
this.configuration.accessToken = accessToken;
|
|
274
|
+
this.tokenData.accessToken = tokenString;
|
|
275
|
+
|
|
276
|
+
this.storeTokenData(this.tokenData);
|
|
277
|
+
|
|
278
|
+
return axios(originalConfig);
|
|
408
279
|
} catch (_error) {
|
|
409
280
|
if (_error.response && _error.response.data) {
|
|
410
281
|
return Promise.reject(_error.response.data);
|
|
@@ -412,30 +283,26 @@ export class BaseAPI {
|
|
|
412
283
|
return Promise.reject(_error);
|
|
413
284
|
}
|
|
414
285
|
}
|
|
415
|
-
} else if (err.message === NETWORK_ERROR_MESSAGE && this.canRetryWithToken(originalConfig)) {
|
|
416
|
-
// Both mode: the browser blocked the session call or hid its reply; later calls use the token.
|
|
417
|
-
if (!this.canResend(originalConfig)) {
|
|
418
|
-
this.switchToToken();
|
|
419
|
-
return Promise.reject(err);
|
|
420
|
-
}
|
|
421
|
-
return this.retryWithToken(axios, originalConfig);
|
|
422
286
|
} else if (err.message === NETWORK_ERROR_MESSAGE
|
|
423
|
-
&&
|
|
424
|
-
|| (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
|
|
287
|
+
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
425
288
|
&& _retry_count < 4
|
|
426
289
|
) {
|
|
427
290
|
_retry_count++;
|
|
428
291
|
try {
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
this.tokenData.permissions =
|
|
292
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
293
|
+
const accessToken = `Bearer ${tokenString}`;
|
|
294
|
+
this.tokenData.permissions = permissions;
|
|
432
295
|
|
|
433
296
|
_retry = true;
|
|
434
|
-
|
|
297
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
298
|
+
|
|
299
|
+
this.configuration.accessToken = accessToken;
|
|
300
|
+
this.tokenData.accessToken = tokenString;
|
|
301
|
+
|
|
435
302
|
this.storeTokenData(this.tokenData);
|
|
436
303
|
|
|
437
304
|
return axios.request({
|
|
438
|
-
...
|
|
305
|
+
...originalConfig,
|
|
439
306
|
});
|
|
440
307
|
} catch (_error) {
|
|
441
308
|
if (_error.response && _error.response.data) {
|
package/common.ts
CHANGED
|
@@ -130,10 +130,9 @@ export const toPathString = function (url: URL) {
|
|
|
130
130
|
* @export
|
|
131
131
|
*/
|
|
132
132
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
133
|
-
|
|
134
|
-
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH): Promise<R> => {
|
|
133
|
+
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
135
134
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
|
136
|
-
return axios.request<T, R>(axiosRequestArgs)
|
|
135
|
+
return axios.request<T, R>(axiosRequestArgs);
|
|
137
136
|
};
|
|
138
137
|
}
|
|
139
138
|
|