@emilgroup/payment-sdk 1.22.1-beta.76 → 1.22.1-beta.78
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/dist/base.js
CHANGED
|
@@ -74,17 +74,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
74
74
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
78
|
-
var t = {};
|
|
79
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
80
|
-
t[p] = s[p];
|
|
81
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
82
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
83
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
84
|
-
t[p[i]] = s[p[i]];
|
|
85
|
-
}
|
|
86
|
-
return t;
|
|
87
|
-
};
|
|
88
77
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
89
78
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
90
79
|
};
|
|
@@ -123,12 +112,6 @@ function resetRetry() {
|
|
|
123
112
|
exports.resetRetry = resetRetry;
|
|
124
113
|
var NETWORK_ERROR_MESSAGE = "Network Error";
|
|
125
114
|
var TOKEN_DATA = 'APP_TOKEN';
|
|
126
|
-
// Sent only to authservice, to ask for a server session.
|
|
127
|
-
var AUTH_MODE_HEADER = 'X-Emil-Auth-Mode';
|
|
128
|
-
// Names the account on every call; one browser session can hold several.
|
|
129
|
-
var ACCOUNT_HEADER = 'X-Emil-Account';
|
|
130
|
-
var SESSION_MODES = ['both', 'session'];
|
|
131
|
-
var RESEND_SAFE_METHODS = ['get', 'head', 'options'];
|
|
132
115
|
/**
|
|
133
116
|
*
|
|
134
117
|
* @export
|
|
@@ -145,18 +128,10 @@ var BaseAPI = /** @class */ (function () {
|
|
|
145
128
|
var accessToken = this.tokenData.accessToken;
|
|
146
129
|
this.configuration = configuration;
|
|
147
130
|
this.basePath = configuration.basePath || this.basePath;
|
|
148
|
-
if
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.useSessionAuth();
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
// Use config token if provided, otherwise use tokenData token
|
|
156
|
-
var configToken = this.configuration.accessToken;
|
|
157
|
-
var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
|
|
158
|
-
this.configuration.accessToken = configToken || storedToken;
|
|
159
|
-
}
|
|
131
|
+
// Use config token if provided, otherwise use tokenData token
|
|
132
|
+
var configToken = this.configuration.accessToken;
|
|
133
|
+
var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
|
|
134
|
+
this.configuration.accessToken = configToken || storedToken;
|
|
160
135
|
}
|
|
161
136
|
else {
|
|
162
137
|
var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
|
|
@@ -168,95 +143,6 @@ var BaseAPI = /** @class */ (function () {
|
|
|
168
143
|
}
|
|
169
144
|
this.attachInterceptor(axios);
|
|
170
145
|
}
|
|
171
|
-
// The app's own account wins over APP_TOKEN, which holds whichever tab wrote last.
|
|
172
|
-
BaseAPI.prototype.sessionAccount = function () {
|
|
173
|
-
return this.configuration.account || this.tokenData.sub;
|
|
174
|
-
};
|
|
175
|
-
// Apps may pass the address as the second argument only; authservice is on the same host.
|
|
176
|
-
BaseAPI.prototype.authBasePath = function () {
|
|
177
|
-
return this.configuration.basePath || this.basePath;
|
|
178
|
-
};
|
|
179
|
-
BaseAPI.prototype.usesSession = function () {
|
|
180
|
-
return !!this.configuration.cookieAuth && SESSION_MODES.indexOf(this.tokenData.authMode) !== -1 && !!this.sessionAccount();
|
|
181
|
-
};
|
|
182
|
-
BaseAPI.prototype.useSessionAuth = function () {
|
|
183
|
-
var _a;
|
|
184
|
-
var _b = this.configuration.baseOptions || {}, headers = _b.headers, baseOptions = __rest(_b, ["headers"]);
|
|
185
|
-
this.configuration.accessToken = '';
|
|
186
|
-
this.configuration.baseOptions = __assign(__assign({}, baseOptions), { withCredentials: true, headers: __assign(__assign({}, headers), (_a = {}, _a[ACCOUNT_HEADER] = this.sessionAccount(), _a)) });
|
|
187
|
-
};
|
|
188
|
-
BaseAPI.prototype.useHeaderAuth = function (accessToken) {
|
|
189
|
-
this.configuration.accessToken = accessToken ? "Bearer ".concat(accessToken) : '';
|
|
190
|
-
this.tokenData.accessToken = accessToken;
|
|
191
|
-
delete this.tokenData.authMode;
|
|
192
|
-
delete this.tokenData.sub;
|
|
193
|
-
if (this.configuration.cookieAuth) {
|
|
194
|
-
var _a = this.configuration.baseOptions || {}, withCredentials = _a.withCredentials, headers = _a.headers, baseOptions = __rest(_a, ["withCredentials", "headers"]);
|
|
195
|
-
var _b = headers || {}, _c = ACCOUNT_HEADER, account = _b[_c], otherHeaders = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);
|
|
196
|
-
this.configuration.baseOptions = __assign(__assign({}, baseOptions), { headers: otherHeaders });
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
BaseAPI.prototype.applyTokenReply = function (_a) {
|
|
200
|
-
var accessToken = _a.accessToken, authMode = _a.authMode, session = _a.session;
|
|
201
|
-
if (this.configuration.cookieAuth && SESSION_MODES.indexOf(authMode) !== -1 && (session === null || session === void 0 ? void 0 : session.sub)) {
|
|
202
|
-
this.tokenData.authMode = authMode;
|
|
203
|
-
this.tokenData.sub = session.sub;
|
|
204
|
-
if (this.configuration.account) {
|
|
205
|
-
// A workspace switch moves the app to another account.
|
|
206
|
-
this.configuration.account = session.sub;
|
|
207
|
-
}
|
|
208
|
-
// Both keeps the token for apps not moved yet; session mode keeps no token at all.
|
|
209
|
-
if (authMode === 'both' && accessToken) {
|
|
210
|
-
this.tokenData.accessToken = accessToken;
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
delete this.tokenData.accessToken;
|
|
214
|
-
}
|
|
215
|
-
this.useSessionAuth();
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
this.useHeaderAuth(accessToken);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
BaseAPI.prototype.sessionHeaders = function () {
|
|
222
|
-
var _a, _b;
|
|
223
|
-
if (!this.configuration.cookieAuth) {
|
|
224
|
-
return {};
|
|
225
|
-
}
|
|
226
|
-
return __assign((_a = {}, _a[AUTH_MODE_HEADER] = 'session', _a), (this.usesSession() && (_b = {}, _b[ACCOUNT_HEADER] = this.sessionAccount(), _b)));
|
|
227
|
-
};
|
|
228
|
-
BaseAPI.prototype.withCurrentAuth = function (config) {
|
|
229
|
-
delete config.headers['Authorization'];
|
|
230
|
-
delete config.headers[ACCOUNT_HEADER];
|
|
231
|
-
if (this.usesSession()) {
|
|
232
|
-
config.headers[ACCOUNT_HEADER] = this.sessionAccount();
|
|
233
|
-
config.withCredentials = true;
|
|
234
|
-
}
|
|
235
|
-
else if (this.configuration.accessToken) {
|
|
236
|
-
config.headers['Authorization'] = this.configuration.accessToken;
|
|
237
|
-
}
|
|
238
|
-
return config;
|
|
239
|
-
};
|
|
240
|
-
// Both keeps the token, so a session call the browser could not complete can be sent again with it.
|
|
241
|
-
BaseAPI.prototype.canRetryWithToken = function (config) {
|
|
242
|
-
var _a;
|
|
243
|
-
return !!config.withCredentials && !!((_a = config.headers) === null || _a === void 0 ? void 0 : _a[ACCOUNT_HEADER])
|
|
244
|
-
&& !!this.tokenData.accessToken && this.tokenData.authMode !== 'session';
|
|
245
|
-
};
|
|
246
|
-
// A network error can come after the server ran the call, so only a call that is safe to repeat is sent again.
|
|
247
|
-
BaseAPI.prototype.canResend = function (config) {
|
|
248
|
-
return RESEND_SAFE_METHODS.indexOf((config.method || 'get').toLowerCase()) !== -1
|
|
249
|
-
|| Object.keys(config.headers || {}).some(function (name) { return name.toLowerCase() === 'idempotency-key'; });
|
|
250
|
-
};
|
|
251
|
-
BaseAPI.prototype.switchToToken = function () {
|
|
252
|
-
this.useHeaderAuth(this.tokenData.accessToken);
|
|
253
|
-
this.storeTokenData(this.tokenData);
|
|
254
|
-
};
|
|
255
|
-
BaseAPI.prototype.retryWithToken = function (axios, config) {
|
|
256
|
-
this.switchToToken();
|
|
257
|
-
config.withCredentials = false;
|
|
258
|
-
return axios(this.withCurrentAuth(config));
|
|
259
|
-
};
|
|
260
146
|
BaseAPI.prototype.selectEnvironment = function (env) {
|
|
261
147
|
this.selectBasePath(env);
|
|
262
148
|
};
|
|
@@ -272,15 +158,14 @@ var BaseAPI = /** @class */ (function () {
|
|
|
272
158
|
};
|
|
273
159
|
BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
|
|
274
160
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
-
var options, response;
|
|
276
|
-
var _a;
|
|
161
|
+
var options, response, _a, accessToken, permissions;
|
|
277
162
|
return __generator(this, function (_b) {
|
|
278
163
|
switch (_b.label) {
|
|
279
164
|
case 0:
|
|
280
165
|
options = {
|
|
281
166
|
method: 'POST',
|
|
282
|
-
url: "".concat(this.
|
|
283
|
-
headers:
|
|
167
|
+
url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
|
|
168
|
+
headers: { 'Content-Type': 'application/json' },
|
|
284
169
|
data: {
|
|
285
170
|
username: username,
|
|
286
171
|
password: password,
|
|
@@ -290,10 +175,12 @@ var BaseAPI = /** @class */ (function () {
|
|
|
290
175
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
291
176
|
case 1:
|
|
292
177
|
response = _b.sent();
|
|
178
|
+
_a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
|
|
293
179
|
this.configuration.username = username;
|
|
180
|
+
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
294
181
|
this.tokenData.username = username;
|
|
295
|
-
this.tokenData.
|
|
296
|
-
this.
|
|
182
|
+
this.tokenData.accessToken = accessToken;
|
|
183
|
+
this.tokenData.permissions = permissions;
|
|
297
184
|
if (!targetWorkspace) return [3 /*break*/, 3];
|
|
298
185
|
return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
|
|
299
186
|
case 2:
|
|
@@ -312,14 +199,17 @@ var BaseAPI = /** @class */ (function () {
|
|
|
312
199
|
};
|
|
313
200
|
BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
|
|
314
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
315
|
-
var options, response;
|
|
316
|
-
return __generator(this, function (
|
|
317
|
-
switch (
|
|
202
|
+
var options, response, _a, accessToken, permissions;
|
|
203
|
+
return __generator(this, function (_b) {
|
|
204
|
+
switch (_b.label) {
|
|
318
205
|
case 0:
|
|
319
206
|
options = {
|
|
320
207
|
method: 'POST',
|
|
321
|
-
url: "".concat(this.
|
|
322
|
-
headers:
|
|
208
|
+
url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
|
|
209
|
+
headers: {
|
|
210
|
+
'Content-Type': 'application/json',
|
|
211
|
+
'Authorization': "Bearer ".concat(this.configuration.accessToken),
|
|
212
|
+
},
|
|
323
213
|
data: {
|
|
324
214
|
username: this.configuration.username,
|
|
325
215
|
targetWorkspace: targetWorkspace,
|
|
@@ -328,9 +218,11 @@ var BaseAPI = /** @class */ (function () {
|
|
|
328
218
|
};
|
|
329
219
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
330
220
|
case 1:
|
|
331
|
-
response =
|
|
332
|
-
|
|
333
|
-
this.
|
|
221
|
+
response = _b.sent();
|
|
222
|
+
_a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
|
|
223
|
+
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
224
|
+
this.tokenData.accessToken = accessToken;
|
|
225
|
+
this.tokenData.permissions = permissions;
|
|
334
226
|
this.storeTokenData(__assign({}, this.tokenData));
|
|
335
227
|
return [2 /*return*/];
|
|
336
228
|
}
|
|
@@ -357,8 +249,10 @@ var BaseAPI = /** @class */ (function () {
|
|
|
357
249
|
});
|
|
358
250
|
options = {
|
|
359
251
|
method: 'POST',
|
|
360
|
-
url: "".concat(this.
|
|
361
|
-
headers:
|
|
252
|
+
url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
|
|
253
|
+
headers: {
|
|
254
|
+
'Content-Type': 'application/json',
|
|
255
|
+
},
|
|
362
256
|
data: { username: username },
|
|
363
257
|
withCredentials: true,
|
|
364
258
|
};
|
|
@@ -391,75 +285,62 @@ var BaseAPI = /** @class */ (function () {
|
|
|
391
285
|
axios.interceptors.response.use(function (res) {
|
|
392
286
|
return res;
|
|
393
287
|
}, function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
394
|
-
var originalConfig,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
switch (_a.label) {
|
|
288
|
+
var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
|
|
289
|
+
return __generator(this, function (_c) {
|
|
290
|
+
switch (_c.label) {
|
|
398
291
|
case 0:
|
|
399
292
|
originalConfig = err.config;
|
|
400
293
|
if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
|
|
401
294
|
if (!((err.response.status === 401 || err.response.status === 403)
|
|
402
295
|
&& !originalConfig._retry)) return [3 /*break*/, 4];
|
|
403
296
|
originalConfig._retry = true;
|
|
404
|
-
|
|
297
|
+
_c.label = 1;
|
|
405
298
|
case 1:
|
|
406
|
-
|
|
299
|
+
_c.trys.push([1, 3, , 4]);
|
|
407
300
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
408
301
|
case 2:
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
this.
|
|
302
|
+
_a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
|
|
303
|
+
accessToken = "Bearer ".concat(tokenString);
|
|
304
|
+
this.tokenData.permissions = permissions;
|
|
305
|
+
delete originalConfig.headers['Authorization'];
|
|
306
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
307
|
+
this.configuration.accessToken = accessToken;
|
|
308
|
+
this.tokenData.accessToken = tokenString;
|
|
412
309
|
this.storeTokenData(this.tokenData);
|
|
413
|
-
|
|
414
|
-
return [2 /*return*/, axios(this.withCurrentAuth(originalConfig))];
|
|
415
|
-
}
|
|
416
|
-
// Both mode: if the browser does not send the session cookie (another site), use the token.
|
|
417
|
-
return [2 /*return*/, axios(this.withCurrentAuth(originalConfig)).catch(function (retryError) {
|
|
418
|
-
var _a;
|
|
419
|
-
if (((_a = retryError === null || retryError === void 0 ? void 0 : retryError.response) === null || _a === void 0 ? void 0 : _a.status) !== 401 || !_this.tokenData.accessToken) {
|
|
420
|
-
return Promise.reject(retryError);
|
|
421
|
-
}
|
|
422
|
-
return _this.retryWithToken(axios, originalConfig);
|
|
423
|
-
})];
|
|
310
|
+
return [2 /*return*/, axios(originalConfig)];
|
|
424
311
|
case 3:
|
|
425
|
-
_error_1 =
|
|
312
|
+
_error_1 = _c.sent();
|
|
426
313
|
if (_error_1.response && _error_1.response.data) {
|
|
427
314
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
428
315
|
}
|
|
429
316
|
return [2 /*return*/, Promise.reject(_error_1)];
|
|
430
|
-
case 4: return [3 /*break*/,
|
|
317
|
+
case 4: return [3 /*break*/, 9];
|
|
431
318
|
case 5:
|
|
432
|
-
if (!(err.message === NETWORK_ERROR_MESSAGE && this.canRetryWithToken(originalConfig))) return [3 /*break*/, 6];
|
|
433
|
-
// Both mode: the browser blocked the session call or hid its reply; later calls use the token.
|
|
434
|
-
if (!this.canResend(originalConfig)) {
|
|
435
|
-
this.switchToToken();
|
|
436
|
-
return [2 /*return*/, Promise.reject(err)];
|
|
437
|
-
}
|
|
438
|
-
return [2 /*return*/, this.retryWithToken(axios, originalConfig)];
|
|
439
|
-
case 6:
|
|
440
319
|
if (!(err.message === NETWORK_ERROR_MESSAGE
|
|
441
|
-
&&
|
|
442
|
-
|
|
443
|
-
&& _retry_count < 4)) return [3 /*break*/, 10];
|
|
320
|
+
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
321
|
+
&& _retry_count < 4)) return [3 /*break*/, 9];
|
|
444
322
|
_retry_count++;
|
|
445
|
-
|
|
446
|
-
case
|
|
447
|
-
|
|
323
|
+
_c.label = 6;
|
|
324
|
+
case 6:
|
|
325
|
+
_c.trys.push([6, 8, , 9]);
|
|
448
326
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
449
|
-
case
|
|
450
|
-
|
|
451
|
-
|
|
327
|
+
case 7:
|
|
328
|
+
_b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
|
|
329
|
+
accessToken = "Bearer ".concat(tokenString);
|
|
330
|
+
this.tokenData.permissions = permissions;
|
|
452
331
|
_retry = true;
|
|
453
|
-
|
|
332
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
333
|
+
this.configuration.accessToken = accessToken;
|
|
334
|
+
this.tokenData.accessToken = tokenString;
|
|
454
335
|
this.storeTokenData(this.tokenData);
|
|
455
|
-
return [2 /*return*/, axios.request(__assign({},
|
|
456
|
-
case
|
|
457
|
-
_error_2 =
|
|
336
|
+
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
337
|
+
case 8:
|
|
338
|
+
_error_2 = _c.sent();
|
|
458
339
|
if (_error_2.response && _error_2.response.data) {
|
|
459
340
|
return [2 /*return*/, Promise.reject(_error_2.response.data)];
|
|
460
341
|
}
|
|
461
342
|
return [2 /*return*/, Promise.reject(_error_2)];
|
|
462
|
-
case
|
|
343
|
+
case 9: return [2 /*return*/, Promise.reject(err)];
|
|
463
344
|
}
|
|
464
345
|
});
|
|
465
346
|
}); });
|
package/dist/common.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare const toPathString: (url: URL) => string;
|
|
|
62
62
|
*
|
|
63
63
|
* @export
|
|
64
64
|
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
66
66
|
/**
|
|
67
67
|
* Emil Payment Service
|
|
68
68
|
* 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.
|
package/dist/common.js
CHANGED
|
@@ -233,7 +233,6 @@ exports.toPathString = toPathString;
|
|
|
233
233
|
* @export
|
|
234
234
|
*/
|
|
235
235
|
var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
236
|
-
// Typed by hand: since axios 1.20, request() returns an internal axios type that SDK declarations cannot name.
|
|
237
236
|
return function (axios, basePath) {
|
|
238
237
|
if (axios === void 0) { axios = globalAxios; }
|
|
239
238
|
if (basePath === void 0) { basePath = BASE_PATH; }
|
package/dist/configuration.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ export interface ConfigurationParameters {
|
|
|
17
17
|
basePath?: string;
|
|
18
18
|
baseOptions?: any;
|
|
19
19
|
formDataCtor?: new () => any;
|
|
20
|
-
cookieAuth?: boolean;
|
|
21
|
-
account?: string;
|
|
22
20
|
}
|
|
23
21
|
export declare class Configuration {
|
|
24
22
|
/**
|
|
@@ -70,21 +68,6 @@ export declare class Configuration {
|
|
|
70
68
|
* @type {new () => FormData}
|
|
71
69
|
*/
|
|
72
70
|
formDataCtor?: new () => any;
|
|
73
|
-
/**
|
|
74
|
-
* Use a server session when authservice makes one; otherwise the token, as without this option.
|
|
75
|
-
* Set `account` too, so each SDK object keeps its own account.
|
|
76
|
-
*
|
|
77
|
-
* @type {boolean}
|
|
78
|
-
* @memberof Configuration
|
|
79
|
-
*/
|
|
80
|
-
cookieAuth?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* The session account (Cognito sub) this app shows, so the SDK never takes another tab's account.
|
|
83
|
-
*
|
|
84
|
-
* @type {string}
|
|
85
|
-
* @memberof Configuration
|
|
86
|
-
*/
|
|
87
|
-
account?: string;
|
|
88
71
|
constructor(param?: ConfigurationParameters);
|
|
89
72
|
/**
|
|
90
73
|
* Check if the given MIME is a JSON MIME.
|
package/dist/configuration.js
CHANGED
|
@@ -24,8 +24,6 @@ var Configuration = /** @class */ (function () {
|
|
|
24
24
|
this.basePath = param.basePath;
|
|
25
25
|
this.baseOptions = param.baseOptions;
|
|
26
26
|
this.formDataCtor = param.formDataCtor;
|
|
27
|
-
this.cookieAuth = param.cookieAuth;
|
|
28
|
-
this.account = param.account;
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
29
|
* Check if the given MIME is a JSON MIME.
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
import { BankOrderClass } from './bank-order-class';
|
|
13
13
|
import { BankTransactionInvoiceClass } from './bank-transaction-invoice-class';
|
|
14
14
|
import { InvoiceMatchSuggestionClass } from './invoice-match-suggestion-class';
|
|
15
|
-
import { PaymentReceiptClass } from './payment-receipt-class';
|
|
16
15
|
import { SuggestionGenerationProgressClass } from './suggestion-generation-progress-class';
|
|
17
16
|
import { TenantBankAccountClassWithoutExpandProperties } from './tenant-bank-account-class-without-expand-properties';
|
|
18
17
|
/**
|
|
@@ -153,12 +152,6 @@ export interface BankTransactionClass {
|
|
|
153
152
|
* @memberof BankTransactionClass
|
|
154
153
|
*/
|
|
155
154
|
'suggestionGenerationProgress'?: SuggestionGenerationProgressClass;
|
|
156
|
-
/**
|
|
157
|
-
* Payment receipts created by linking this outgoing transaction to payment requests
|
|
158
|
-
* @type {Array<PaymentReceiptClass>}
|
|
159
|
-
* @memberof BankTransactionClass
|
|
160
|
-
*/
|
|
161
|
-
'paymentReceipts'?: Array<PaymentReceiptClass>;
|
|
162
155
|
}
|
|
163
156
|
export declare const BankTransactionClassLabelEnum: {
|
|
164
157
|
readonly Automated: "automated";
|
|
@@ -13,7 +13,6 @@ import { BankOrderEntity } from './bank-order-entity';
|
|
|
13
13
|
import { BankTransactionInvoiceEntity } from './bank-transaction-invoice-entity';
|
|
14
14
|
import { ExceedingCreditEntity } from './exceeding-credit-entity';
|
|
15
15
|
import { InvoiceMatchSuggestionEntity } from './invoice-match-suggestion-entity';
|
|
16
|
-
import { PaymentReceiptEntity } from './payment-receipt-entity';
|
|
17
16
|
import { SuggestionGenerationProgressEntity } from './suggestion-generation-progress-entity';
|
|
18
17
|
import { TenantBankAccountEntity } from './tenant-bank-account-entity';
|
|
19
18
|
/**
|
|
@@ -138,12 +137,6 @@ export interface BankTransactionEntity {
|
|
|
138
137
|
* @memberof BankTransactionEntity
|
|
139
138
|
*/
|
|
140
139
|
'exceedingCredits': Array<ExceedingCreditEntity>;
|
|
141
|
-
/**
|
|
142
|
-
*
|
|
143
|
-
* @type {Array<PaymentReceiptEntity>}
|
|
144
|
-
* @memberof BankTransactionEntity
|
|
145
|
-
*/
|
|
146
|
-
'paymentReceipts': Array<PaymentReceiptEntity>;
|
|
147
140
|
/**
|
|
148
141
|
*
|
|
149
142
|
* @type {string}
|
|
@@ -77,30 +77,6 @@ export interface BankTransactionInvoiceEntity {
|
|
|
77
77
|
* @memberof BankTransactionInvoiceEntity
|
|
78
78
|
*/
|
|
79
79
|
'bankTransaction': BankTransactionEntity;
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
* @type {string}
|
|
83
|
-
* @memberof BankTransactionInvoiceEntity
|
|
84
|
-
*/
|
|
85
|
-
'unlinkCode'?: string | null;
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
* @type {string}
|
|
89
|
-
* @memberof BankTransactionInvoiceEntity
|
|
90
|
-
*/
|
|
91
|
-
'unlinkedPaymentCode'?: string | null;
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
94
|
-
* @type {Array<string>}
|
|
95
|
-
* @memberof BankTransactionInvoiceEntity
|
|
96
|
-
*/
|
|
97
|
-
'unlinkedCreditCodes'?: Array<string> | null;
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
100
|
-
* @type {string}
|
|
101
|
-
* @memberof BankTransactionInvoiceEntity
|
|
102
|
-
*/
|
|
103
|
-
'unlinkEventPublishedAt'?: string | null;
|
|
104
80
|
/**
|
|
105
81
|
*
|
|
106
82
|
* @type {string}
|
|
@@ -28,7 +28,7 @@ export interface CreatePaymentOrderDto {
|
|
|
28
28
|
*/
|
|
29
29
|
'comment'?: string;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Optional payment date.
|
|
32
32
|
* @type {string}
|
|
33
33
|
* @memberof CreatePaymentOrderDto
|
|
34
34
|
*/
|
|
@@ -34,7 +34,7 @@ export interface CreatePaymentReceiptRequestDto {
|
|
|
34
34
|
*/
|
|
35
35
|
'direction': CreatePaymentReceiptRequestDtoDirectionEnum;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Date the payment was confirmed
|
|
38
38
|
* @type {string}
|
|
39
39
|
* @memberof CreatePaymentReceiptRequestDto
|
|
40
40
|
*/
|
|
@@ -60,7 +60,7 @@ export interface CreatePaymentRequestDto {
|
|
|
60
60
|
*/
|
|
61
61
|
'productSlug'?: string;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Optional payment date.
|
|
64
64
|
* @type {string}
|
|
65
65
|
* @memberof CreatePaymentRequestDto
|
|
66
66
|
*/
|
|
@@ -69,12 +69,6 @@ export interface CreatePaymentRequestRequestDto {
|
|
|
69
69
|
* @memberof CreatePaymentRequestRequestDto
|
|
70
70
|
*/
|
|
71
71
|
'domainEntityType': CreatePaymentRequestRequestDtoDomainEntityTypeEnum;
|
|
72
|
-
/**
|
|
73
|
-
* Code of the settlement the payment request was created for.
|
|
74
|
-
* @type {string}
|
|
75
|
-
* @memberof CreatePaymentRequestRequestDto
|
|
76
|
-
*/
|
|
77
|
-
'settlementCode'?: string;
|
|
78
72
|
/**
|
|
79
73
|
* Code of the partner the payment request was created for.
|
|
80
74
|
* @type {string}
|
|
@@ -34,12 +34,6 @@ export interface CreditAllocationClass {
|
|
|
34
34
|
* @memberof CreditAllocationClass
|
|
35
35
|
*/
|
|
36
36
|
'exceedingCreditCodes': Array<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Partner code derived from the policy related to the exceeding credits.
|
|
39
|
-
* @type {string}
|
|
40
|
-
* @memberof CreditAllocationClass
|
|
41
|
-
*/
|
|
42
|
-
'partnerCode': string;
|
|
43
37
|
/**
|
|
44
38
|
* Policy code associated with the credit.
|
|
45
39
|
* @type {string}
|
|
@@ -131,12 +131,6 @@ export interface ExceedingCreditEntity {
|
|
|
131
131
|
* @memberof ExceedingCreditEntity
|
|
132
132
|
*/
|
|
133
133
|
'tenantHierarchy': string;
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @type {boolean}
|
|
137
|
-
* @memberof ExceedingCreditEntity
|
|
138
|
-
*/
|
|
139
|
-
'createdEventPending': boolean;
|
|
140
134
|
}
|
|
141
135
|
export declare const ExceedingCreditEntityCurrencyEnum: {
|
|
142
136
|
readonly Eur: "EUR";
|
package/dist/models/index.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ export * from './create-billing-address-request-dto';
|
|
|
31
31
|
export * from './create-billing-address-response-class';
|
|
32
32
|
export * from './create-credit-allocation-request-dto';
|
|
33
33
|
export * from './create-credit-allocation-response-class';
|
|
34
|
-
export * from './create-exceeding-credit-request-dto';
|
|
35
|
-
export * from './create-exceeding-credit-response-class';
|
|
36
34
|
export * from './create-payment-method-response-class';
|
|
37
35
|
export * from './create-payment-order-dto';
|
|
38
36
|
export * from './create-payment-order-request-dto';
|
|
@@ -92,8 +90,6 @@ export * from './inline-response503';
|
|
|
92
90
|
export * from './invoice-allocation-dto';
|
|
93
91
|
export * from './invoice-match-suggestion-class';
|
|
94
92
|
export * from './invoice-match-suggestion-entity';
|
|
95
|
-
export * from './link-bank-transaction-payment-requests-request-dto-rest';
|
|
96
|
-
export * from './link-bank-transaction-payment-requests-response-class';
|
|
97
93
|
export * from './link-bank-transaction-request-dto-rest';
|
|
98
94
|
export * from './link-bank-transactions-response-class';
|
|
99
95
|
export * from './list-bank-accounts-response-class';
|
|
@@ -119,10 +115,8 @@ export * from './payment-class-without-expand-properties';
|
|
|
119
115
|
export * from './payment-entity';
|
|
120
116
|
export * from './payment-method-class';
|
|
121
117
|
export * from './payment-receipt-class';
|
|
122
|
-
export * from './payment-receipt-entity';
|
|
123
118
|
export * from './payment-reminder-class';
|
|
124
119
|
export * from './payment-request-class';
|
|
125
|
-
export * from './payment-request-entity';
|
|
126
120
|
export * from './payout-method-class';
|
|
127
121
|
export * from './policy-payment-method-class';
|
|
128
122
|
export * from './primary-bank-account-response-class';
|
package/dist/models/index.js
CHANGED
|
@@ -47,8 +47,6 @@ __exportStar(require("./create-billing-address-request-dto"), exports);
|
|
|
47
47
|
__exportStar(require("./create-billing-address-response-class"), exports);
|
|
48
48
|
__exportStar(require("./create-credit-allocation-request-dto"), exports);
|
|
49
49
|
__exportStar(require("./create-credit-allocation-response-class"), exports);
|
|
50
|
-
__exportStar(require("./create-exceeding-credit-request-dto"), exports);
|
|
51
|
-
__exportStar(require("./create-exceeding-credit-response-class"), exports);
|
|
52
50
|
__exportStar(require("./create-payment-method-response-class"), exports);
|
|
53
51
|
__exportStar(require("./create-payment-order-dto"), exports);
|
|
54
52
|
__exportStar(require("./create-payment-order-request-dto"), exports);
|
|
@@ -108,8 +106,6 @@ __exportStar(require("./inline-response503"), exports);
|
|
|
108
106
|
__exportStar(require("./invoice-allocation-dto"), exports);
|
|
109
107
|
__exportStar(require("./invoice-match-suggestion-class"), exports);
|
|
110
108
|
__exportStar(require("./invoice-match-suggestion-entity"), exports);
|
|
111
|
-
__exportStar(require("./link-bank-transaction-payment-requests-request-dto-rest"), exports);
|
|
112
|
-
__exportStar(require("./link-bank-transaction-payment-requests-response-class"), exports);
|
|
113
109
|
__exportStar(require("./link-bank-transaction-request-dto-rest"), exports);
|
|
114
110
|
__exportStar(require("./link-bank-transactions-response-class"), exports);
|
|
115
111
|
__exportStar(require("./list-bank-accounts-response-class"), exports);
|
|
@@ -135,10 +131,8 @@ __exportStar(require("./payment-class-without-expand-properties"), exports);
|
|
|
135
131
|
__exportStar(require("./payment-entity"), exports);
|
|
136
132
|
__exportStar(require("./payment-method-class"), exports);
|
|
137
133
|
__exportStar(require("./payment-receipt-class"), exports);
|
|
138
|
-
__exportStar(require("./payment-receipt-entity"), exports);
|
|
139
134
|
__exportStar(require("./payment-reminder-class"), exports);
|
|
140
135
|
__exportStar(require("./payment-request-class"), exports);
|
|
141
|
-
__exportStar(require("./payment-request-entity"), exports);
|
|
142
136
|
__exportStar(require("./payout-method-class"), exports);
|
|
143
137
|
__exportStar(require("./policy-payment-method-class"), exports);
|
|
144
138
|
__exportStar(require("./primary-bank-account-response-class"), exports);
|