@emilgroup/payment-sdk 1.22.1-beta.74 → 1.22.1-beta.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.openapi-generator/FILES +4 -0
  2. package/README.md +2 -2
  3. package/api/bank-accounts-api.ts +24 -12
  4. package/api/bank-orders-api.ts +20 -10
  5. package/api/bank-transaction-api.ts +154 -20
  6. package/api/billing-addresses-api.ts +20 -10
  7. package/api/credit-allocation-api.ts +12 -6
  8. package/api/exceeding-credits-api.ts +12 -6
  9. package/api/ibanvalidator-api.ts +4 -2
  10. package/api/payment-methods-api.ts +12 -6
  11. package/api/payment-receipts-api.ts +20 -10
  12. package/api/payment-reminders-api.ts +16 -8
  13. package/api/payment-requests-api.ts +20 -10
  14. package/api/payment-setup-api.ts +8 -4
  15. package/api/payments-api.ts +24 -12
  16. package/api/payout-methods-api.ts +24 -12
  17. package/api/policy-payment-methods-api.ts +12 -6
  18. package/api/refunds-api.ts +12 -6
  19. package/api/tenant-bank-account-api.ts +20 -10
  20. package/base.ts +174 -41
  21. package/common.ts +3 -2
  22. package/configuration.ts +20 -0
  23. package/dist/api/bank-accounts-api.d.ts +6 -6
  24. package/dist/api/bank-accounts-api.js +36 -22
  25. package/dist/api/bank-orders-api.d.ts +5 -5
  26. package/dist/api/bank-orders-api.js +29 -18
  27. package/dist/api/bank-transaction-api.d.ts +80 -14
  28. package/dist/api/bank-transaction-api.js +144 -28
  29. package/dist/api/billing-addresses-api.d.ts +5 -5
  30. package/dist/api/billing-addresses-api.js +32 -19
  31. package/dist/api/credit-allocation-api.d.ts +3 -3
  32. package/dist/api/credit-allocation-api.js +18 -11
  33. package/dist/api/exceeding-credits-api.d.ts +3 -3
  34. package/dist/api/exceeding-credits-api.js +18 -11
  35. package/dist/api/health-check-api.d.ts +1 -1
  36. package/dist/api/ibanvalidator-api.d.ts +1 -1
  37. package/dist/api/ibanvalidator-api.js +7 -4
  38. package/dist/api/payment-methods-api.d.ts +3 -3
  39. package/dist/api/payment-methods-api.js +18 -11
  40. package/dist/api/payment-receipts-api.d.ts +5 -5
  41. package/dist/api/payment-receipts-api.js +29 -18
  42. package/dist/api/payment-reminders-api.d.ts +4 -4
  43. package/dist/api/payment-reminders-api.js +25 -15
  44. package/dist/api/payment-requests-api.d.ts +5 -5
  45. package/dist/api/payment-requests-api.js +29 -18
  46. package/dist/api/payment-setup-api.d.ts +2 -2
  47. package/dist/api/payment-setup-api.js +14 -8
  48. package/dist/api/payments-api.d.ts +4 -4
  49. package/dist/api/payments-api.js +28 -18
  50. package/dist/api/payout-methods-api.d.ts +6 -6
  51. package/dist/api/payout-methods-api.js +36 -22
  52. package/dist/api/policy-payment-methods-api.d.ts +3 -3
  53. package/dist/api/policy-payment-methods-api.js +18 -11
  54. package/dist/api/refunds-api.d.ts +3 -3
  55. package/dist/api/refunds-api.js +15 -10
  56. package/dist/api/tenant-bank-account-api.d.ts +5 -5
  57. package/dist/api/tenant-bank-account-api.js +29 -18
  58. package/dist/api/webhooks-api.d.ts +2 -2
  59. package/dist/base.d.ts +24 -0
  60. package/dist/base.js +178 -59
  61. package/dist/common.d.ts +1 -1
  62. package/dist/common.js +1 -0
  63. package/dist/configuration.d.ts +17 -0
  64. package/dist/configuration.js +2 -0
  65. package/dist/models/bank-transaction-class.d.ts +7 -0
  66. package/dist/models/bank-transaction-entity.d.ts +7 -0
  67. package/dist/models/index.d.ts +4 -0
  68. package/dist/models/index.js +4 -0
  69. package/dist/models/link-bank-transaction-payment-requests-request-dto-rest.d.ts +30 -0
  70. package/dist/models/link-bank-transaction-payment-requests-request-dto-rest.js +15 -0
  71. package/dist/models/link-bank-transaction-payment-requests-response-class.d.ts +25 -0
  72. package/dist/models/link-bank-transaction-payment-requests-response-class.js +15 -0
  73. package/dist/models/payment-receipt-class.d.ts +12 -0
  74. package/dist/models/payment-receipt-entity.d.ts +139 -0
  75. package/dist/models/payment-receipt-entity.js +20 -0
  76. package/dist/models/payment-request-class.d.ts +1 -0
  77. package/dist/models/payment-request-class.js +1 -0
  78. package/dist/models/payment-request-entity.d.ts +223 -0
  79. package/dist/models/payment-request-entity.js +39 -0
  80. package/models/bank-transaction-class.ts +7 -0
  81. package/models/bank-transaction-entity.ts +7 -0
  82. package/models/index.ts +4 -0
  83. package/models/link-bank-transaction-payment-requests-request-dto-rest.ts +36 -0
  84. package/models/link-bank-transaction-payment-requests-response-class.ts +31 -0
  85. package/models/payment-receipt-class.ts +12 -0
  86. package/models/payment-receipt-entity.ts +148 -0
  87. package/models/payment-request-class.ts +1 -0
  88. package/models/payment-request-entity.ts +233 -0
  89. package/package.json +2 -2
package/dist/base.js CHANGED
@@ -74,6 +74,17 @@ 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
+ };
77
88
  var __importDefault = (this && this.__importDefault) || function (mod) {
78
89
  return (mod && mod.__esModule) ? mod : { "default": mod };
79
90
  };
@@ -112,6 +123,12 @@ function resetRetry() {
112
123
  exports.resetRetry = resetRetry;
113
124
  var NETWORK_ERROR_MESSAGE = "Network Error";
114
125
  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'];
115
132
  /**
116
133
  *
117
134
  * @export
@@ -128,10 +145,18 @@ var BaseAPI = /** @class */ (function () {
128
145
  var accessToken = this.tokenData.accessToken;
129
146
  this.configuration = configuration;
130
147
  this.basePath = configuration.basePath || this.basePath;
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;
148
+ if (configuration.cookieAuth) {
149
+ this.configuration.username = this.configuration.username || this.tokenData.username;
150
+ }
151
+ if (this.usesSession()) {
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
+ }
135
160
  }
136
161
  else {
137
162
  var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
@@ -143,6 +168,95 @@ var BaseAPI = /** @class */ (function () {
143
168
  }
144
169
  this.attachInterceptor(axios);
145
170
  }
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
+ };
146
260
  BaseAPI.prototype.selectEnvironment = function (env) {
147
261
  this.selectBasePath(env);
148
262
  };
@@ -158,14 +272,15 @@ var BaseAPI = /** @class */ (function () {
158
272
  };
159
273
  BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
160
274
  return __awaiter(this, void 0, void 0, function () {
161
- var options, response, _a, accessToken, permissions;
275
+ var options, response;
276
+ var _a;
162
277
  return __generator(this, function (_b) {
163
278
  switch (_b.label) {
164
279
  case 0:
165
280
  options = {
166
281
  method: 'POST',
167
- url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
168
- headers: { 'Content-Type': 'application/json' },
282
+ url: "".concat(this.authBasePath(), "/authservice/v1/login"),
283
+ headers: __assign({ 'Content-Type': 'application/json' }, (this.configuration.cookieAuth && (_a = {}, _a[AUTH_MODE_HEADER] = 'session', _a))),
169
284
  data: {
170
285
  username: username,
171
286
  password: password,
@@ -175,12 +290,10 @@ var BaseAPI = /** @class */ (function () {
175
290
  return [4 /*yield*/, axios_1.default.request(options)];
176
291
  case 1:
177
292
  response = _b.sent();
178
- _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
179
293
  this.configuration.username = username;
180
- this.configuration.accessToken = "Bearer ".concat(accessToken);
181
294
  this.tokenData.username = username;
182
- this.tokenData.accessToken = accessToken;
183
- this.tokenData.permissions = permissions;
295
+ this.tokenData.permissions = response.data.permissions;
296
+ this.applyTokenReply(response.data);
184
297
  if (!targetWorkspace) return [3 /*break*/, 3];
185
298
  return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
186
299
  case 2:
@@ -199,17 +312,14 @@ var BaseAPI = /** @class */ (function () {
199
312
  };
200
313
  BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
201
314
  return __awaiter(this, void 0, void 0, function () {
202
- var options, response, _a, accessToken, permissions;
203
- return __generator(this, function (_b) {
204
- switch (_b.label) {
315
+ var options, response;
316
+ return __generator(this, function (_a) {
317
+ switch (_a.label) {
205
318
  case 0:
206
319
  options = {
207
320
  method: 'POST',
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
- },
321
+ url: "".concat(this.authBasePath(), "/authservice/v1/workspaces/switch"),
322
+ headers: __assign(__assign({ 'Content-Type': 'application/json' }, this.sessionHeaders()), (!this.usesSession() && !!this.configuration.accessToken && { 'Authorization': this.configuration.accessToken })),
213
323
  data: {
214
324
  username: this.configuration.username,
215
325
  targetWorkspace: targetWorkspace,
@@ -218,11 +328,9 @@ var BaseAPI = /** @class */ (function () {
218
328
  };
219
329
  return [4 /*yield*/, axios_1.default.request(options)];
220
330
  case 1:
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;
331
+ response = _a.sent();
332
+ this.tokenData.permissions = response.data.permissions;
333
+ this.applyTokenReply(response.data);
226
334
  this.storeTokenData(__assign({}, this.tokenData));
227
335
  return [2 /*return*/];
228
336
  }
@@ -249,10 +357,8 @@ var BaseAPI = /** @class */ (function () {
249
357
  });
250
358
  options = {
251
359
  method: 'POST',
252
- url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
253
- headers: {
254
- 'Content-Type': 'application/json',
255
- },
360
+ url: "".concat(this.authBasePath(), "/authservice/v1/refresh-token"),
361
+ headers: __assign({ 'Content-Type': 'application/json' }, this.sessionHeaders()),
256
362
  data: { username: username },
257
363
  withCredentials: true,
258
364
  };
@@ -285,62 +391,75 @@ var BaseAPI = /** @class */ (function () {
285
391
  axios.interceptors.response.use(function (res) {
286
392
  return res;
287
393
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
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) {
394
+ var originalConfig, reply, _error_1, reply, _error_2;
395
+ var _this = this;
396
+ return __generator(this, function (_a) {
397
+ switch (_a.label) {
291
398
  case 0:
292
399
  originalConfig = err.config;
293
400
  if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
294
401
  if (!((err.response.status === 401 || err.response.status === 403)
295
402
  && !originalConfig._retry)) return [3 /*break*/, 4];
296
403
  originalConfig._retry = true;
297
- _c.label = 1;
404
+ _a.label = 1;
298
405
  case 1:
299
- _c.trys.push([1, 3, , 4]);
406
+ _a.trys.push([1, 3, , 4]);
300
407
  return [4 /*yield*/, this.refreshTokenInternal()];
301
408
  case 2:
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;
409
+ reply = _a.sent();
410
+ this.tokenData.permissions = reply.permissions;
411
+ this.applyTokenReply(reply);
309
412
  this.storeTokenData(this.tokenData);
310
- return [2 /*return*/, axios(originalConfig)];
413
+ if (!this.usesSession()) {
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
+ })];
311
424
  case 3:
312
- _error_1 = _c.sent();
425
+ _error_1 = _a.sent();
313
426
  if (_error_1.response && _error_1.response.data) {
314
427
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
315
428
  }
316
429
  return [2 /*return*/, Promise.reject(_error_1)];
317
- case 4: return [3 /*break*/, 9];
430
+ case 4: return [3 /*break*/, 10];
318
431
  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:
319
440
  if (!(err.message === NETWORK_ERROR_MESSAGE
320
- && originalConfig.headers.hasOwnProperty('Authorization')
321
- && _retry_count < 4)) return [3 /*break*/, 9];
441
+ && (originalConfig.headers.hasOwnProperty('Authorization')
442
+ || (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
443
+ && _retry_count < 4)) return [3 /*break*/, 10];
322
444
  _retry_count++;
323
- _c.label = 6;
324
- case 6:
325
- _c.trys.push([6, 8, , 9]);
326
- return [4 /*yield*/, this.refreshTokenInternal()];
445
+ _a.label = 7;
327
446
  case 7:
328
- _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
329
- accessToken = "Bearer ".concat(tokenString);
330
- this.tokenData.permissions = permissions;
447
+ _a.trys.push([7, 9, , 10]);
448
+ return [4 /*yield*/, this.refreshTokenInternal()];
449
+ case 8:
450
+ reply = _a.sent();
451
+ this.tokenData.permissions = reply.permissions;
331
452
  _retry = true;
332
- originalConfig.headers['Authorization'] = accessToken;
333
- this.configuration.accessToken = accessToken;
334
- this.tokenData.accessToken = tokenString;
453
+ this.applyTokenReply(reply);
335
454
  this.storeTokenData(this.tokenData);
336
- return [2 /*return*/, axios.request(__assign({}, originalConfig))];
337
- case 8:
338
- _error_2 = _c.sent();
455
+ return [2 /*return*/, axios.request(__assign({}, this.withCurrentAuth(originalConfig)))];
456
+ case 9:
457
+ _error_2 = _a.sent();
339
458
  if (_error_2.response && _error_2.response.data) {
340
459
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
341
460
  }
342
461
  return [2 /*return*/, Promise.reject(_error_2)];
343
- case 9: return [2 /*return*/, Promise.reject(err)];
462
+ case 10: return [2 /*return*/, Promise.reject(err)];
344
463
  }
345
464
  });
346
465
  }); });
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, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
65
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}, 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,6 +233,7 @@ 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.
236
237
  return function (axios, basePath) {
237
238
  if (axios === void 0) { axios = globalAxios; }
238
239
  if (basePath === void 0) { basePath = BASE_PATH; }
@@ -17,6 +17,8 @@ export interface ConfigurationParameters {
17
17
  basePath?: string;
18
18
  baseOptions?: any;
19
19
  formDataCtor?: new () => any;
20
+ cookieAuth?: boolean;
21
+ account?: string;
20
22
  }
21
23
  export declare class Configuration {
22
24
  /**
@@ -68,6 +70,21 @@ export declare class Configuration {
68
70
  * @type {new () => FormData}
69
71
  */
70
72
  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;
71
88
  constructor(param?: ConfigurationParameters);
72
89
  /**
73
90
  * Check if the given MIME is a JSON MIME.
@@ -24,6 +24,8 @@ 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;
27
29
  }
28
30
  /**
29
31
  * Check if the given MIME is a JSON MIME.
@@ -12,6 +12,7 @@
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';
15
16
  import { SuggestionGenerationProgressClass } from './suggestion-generation-progress-class';
16
17
  import { TenantBankAccountClassWithoutExpandProperties } from './tenant-bank-account-class-without-expand-properties';
17
18
  /**
@@ -152,6 +153,12 @@ export interface BankTransactionClass {
152
153
  * @memberof BankTransactionClass
153
154
  */
154
155
  '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>;
155
162
  }
156
163
  export declare const BankTransactionClassLabelEnum: {
157
164
  readonly Automated: "automated";
@@ -13,6 +13,7 @@ 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';
16
17
  import { SuggestionGenerationProgressEntity } from './suggestion-generation-progress-entity';
17
18
  import { TenantBankAccountEntity } from './tenant-bank-account-entity';
18
19
  /**
@@ -137,6 +138,12 @@ export interface BankTransactionEntity {
137
138
  * @memberof BankTransactionEntity
138
139
  */
139
140
  'exceedingCredits': Array<ExceedingCreditEntity>;
141
+ /**
142
+ *
143
+ * @type {Array<PaymentReceiptEntity>}
144
+ * @memberof BankTransactionEntity
145
+ */
146
+ 'paymentReceipts': Array<PaymentReceiptEntity>;
140
147
  /**
141
148
  *
142
149
  * @type {string}
@@ -92,6 +92,8 @@ export * from './inline-response503';
92
92
  export * from './invoice-allocation-dto';
93
93
  export * from './invoice-match-suggestion-class';
94
94
  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';
95
97
  export * from './link-bank-transaction-request-dto-rest';
96
98
  export * from './link-bank-transactions-response-class';
97
99
  export * from './list-bank-accounts-response-class';
@@ -117,8 +119,10 @@ export * from './payment-class-without-expand-properties';
117
119
  export * from './payment-entity';
118
120
  export * from './payment-method-class';
119
121
  export * from './payment-receipt-class';
122
+ export * from './payment-receipt-entity';
120
123
  export * from './payment-reminder-class';
121
124
  export * from './payment-request-class';
125
+ export * from './payment-request-entity';
122
126
  export * from './payout-method-class';
123
127
  export * from './policy-payment-method-class';
124
128
  export * from './primary-bank-account-response-class';
@@ -108,6 +108,8 @@ __exportStar(require("./inline-response503"), exports);
108
108
  __exportStar(require("./invoice-allocation-dto"), exports);
109
109
  __exportStar(require("./invoice-match-suggestion-class"), exports);
110
110
  __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);
111
113
  __exportStar(require("./link-bank-transaction-request-dto-rest"), exports);
112
114
  __exportStar(require("./link-bank-transactions-response-class"), exports);
113
115
  __exportStar(require("./list-bank-accounts-response-class"), exports);
@@ -133,8 +135,10 @@ __exportStar(require("./payment-class-without-expand-properties"), exports);
133
135
  __exportStar(require("./payment-entity"), exports);
134
136
  __exportStar(require("./payment-method-class"), exports);
135
137
  __exportStar(require("./payment-receipt-class"), exports);
138
+ __exportStar(require("./payment-receipt-entity"), exports);
136
139
  __exportStar(require("./payment-reminder-class"), exports);
137
140
  __exportStar(require("./payment-request-class"), exports);
141
+ __exportStar(require("./payment-request-entity"), exports);
138
142
  __exportStar(require("./payout-method-class"), exports);
139
143
  __exportStar(require("./policy-payment-method-class"), exports);
140
144
  __exportStar(require("./primary-bank-account-response-class"), exports);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Emil Payment Service
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ * Contact: kontakt@emil.de
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface LinkBankTransactionPaymentRequestsRequestDtoRest
16
+ */
17
+ export interface LinkBankTransactionPaymentRequestsRequestDtoRest {
18
+ /**
19
+ * Codes of the open payout payment requests the outgoing bank transaction paid; up to 1000, no duplicates, empty when only bank orders are linked. Together with the payment requests of the bank orders their amounts must add up to the transaction amount.
20
+ * @type {Array<string>}
21
+ * @memberof LinkBankTransactionPaymentRequestsRequestDtoRest
22
+ */
23
+ 'paymentRequestCodes': Array<string>;
24
+ /**
25
+ * Codes of payout bank orders the transaction paid whole: the link pays every open payment request each order holds in the transaction currency. Up to 1000, no duplicates; a payment request may not also be listed in paymentRequestCodes.
26
+ * @type {Array<string>}
27
+ * @memberof LinkBankTransactionPaymentRequestsRequestDtoRest
28
+ */
29
+ 'bankOrderCodes'?: Array<string>;
30
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Emil Payment Service
6
+ * 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.
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ * Contact: kontakt@emil.de
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Emil Payment Service
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ * Contact: kontakt@emil.de
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { BankTransactionClass } from './bank-transaction-class';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface LinkBankTransactionPaymentRequestsResponseClass
17
+ */
18
+ export interface LinkBankTransactionPaymentRequestsResponseClass {
19
+ /**
20
+ * The linked bank transaction, with the payment receipts the link created
21
+ * @type {BankTransactionClass}
22
+ * @memberof LinkBankTransactionPaymentRequestsResponseClass
23
+ */
24
+ 'bankTransaction': BankTransactionClass;
25
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Emil Payment Service
6
+ * 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.
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ * Contact: kontakt@emil.de
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -57,6 +57,12 @@ export interface PaymentReceiptClass {
57
57
  * @memberof PaymentReceiptClass
58
58
  */
59
59
  'paymentRequestCode'?: string;
60
+ /**
61
+ * The number of the payment request the payment receipt pays; read from the payment request, not stored on the receipt.
62
+ * @type {string}
63
+ * @memberof PaymentReceiptClass
64
+ */
65
+ 'paymentRequestNumber'?: string;
60
66
  /**
61
67
  * The payment service provider that produced the payment receipt.
62
68
  * @type {string}
@@ -69,6 +75,12 @@ export interface PaymentReceiptClass {
69
75
  * @memberof PaymentReceiptClass
70
76
  */
71
77
  'comment'?: string;
78
+ /**
79
+ * The code of the bank transaction whose link created the payment receipt; unset for a receipt created by hand.
80
+ * @type {string}
81
+ * @memberof PaymentReceiptClass
82
+ */
83
+ 'bankTransactionCode'?: string;
72
84
  /**
73
85
  * Time at which the object was created.
74
86
  * @type {string}