Skip to content

Commit 415b3df

Browse files
Release 3.2.0
1 parent c7b3512 commit 415b3df

File tree

88 files changed

+3112
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3112
-642
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2022 wallee AG
189+
Copyright 2023 wallee AG
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,32 @@ transactionService.create(spaceId, transaction).then((response) => {
9494

9595
```
9696

97+
### Configure connection timeout
98+
Connection timeout determines how long the request can take, before cutting off the connection. Same value applies both to inner 'Read timeout' and 'Connection timeout' of a [NPM request module](https://www.npmjs.com/package/request).
99+
100+
Default connection timeout is 25s.
101+
102+
103+
Connection timeout can be set 2 ways:
104+
105+
1. Via configuration property 'timeout' providing value in seconds.
106+
```
107+
let config = {
108+
... other properties ...
109+
timeout: 15
110+
}
111+
let transactionService: PostFinanceCheckout.api.TransactionService = new PostFinanceCheckout.api.TransactionService(config);
112+
```
113+
114+
2. Via service property 'timeout' providing value in seconds
115+
```
116+
let config = {
117+
... properties ...
118+
}
119+
let transactionService: PostFinanceCheckout.api.TransactionService = new PostFinanceCheckout.api.TransactionService(config);
120+
transactionService.timeout = 15;
121+
```
122+
97123
## License
98124

99125
Please see the [license file](https://github.com/pfpayments/typescript-sdk/blob/master/LICENSE) for more information.

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ import { User as UserModelImport } from "./src/models/User";
243243
import { UserAccountRole as UserAccountRoleModelImport } from "./src/models/UserAccountRole";
244244
import { UserSpaceRole as UserSpaceRoleModelImport } from "./src/models/UserSpaceRole";
245245
import { UserType as UserTypeModelImport } from "./src/models/UserType";
246+
import { WalletType as WalletTypeModelImport } from "./src/models/WalletType";
246247
import { WebhookIdentity as WebhookIdentityModelImport } from "./src/models/WebhookIdentity";
247248
import { WebhookListener as WebhookListenerModelImport } from "./src/models/WebhookListener";
248249
import { WebhookListenerEntity as WebhookListenerEntityModelImport } from "./src/models/WebhookListenerEntity";
@@ -869,6 +870,8 @@ export namespace PostFinanceCheckout {
869870
export const UserSpaceRole = UserSpaceRoleModelImport;
870871
export type UserType = UserTypeModelImport;
871872
export const UserType = UserTypeModelImport;
873+
export type WalletType = WalletTypeModelImport;
874+
export const WalletType = WalletTypeModelImport;
872875
export type WebhookIdentity = WebhookIdentityModelImport;
873876
export const WebhookIdentity = WebhookIdentityModelImport;
874877
export type WebhookListener = WebhookListenerModelImport;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "postfinancecheckout",
33
"title": "PostFinance Checkout",
4-
"version": "3.1.2",
4+
"version": "3.2.0",
55
"description": "TypeScript/JavaScript client for PostFinance Checkout",
66
"homepage": "http://github.com/pfpayments/typescript-sdk",
77
"repository": {

src/api/AccountService.ts

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AccountService {
2020
protected _basePath = 'https://checkout.postfinance.ch:443/api';
2121
protected defaultHeaders : any = {};
2222
protected _useQuerystring : boolean = false;
23+
protected _timeout : number = 25;
2324

2425
protected authentications = {
2526
'default': <Authentication>new VoidAuth({})
@@ -28,6 +29,28 @@ class AccountService {
2829
constructor(configuration: any) {
2930
this.setDefaultAuthentication(new VoidAuth(configuration));
3031
this.defaultHeaders = configuration.default_headers;
32+
this.setTimeout(configuration.timeout);
33+
}
34+
35+
/**
36+
* Set timeout in seconds. Default timeout: 25 seconds
37+
* @param {number} timeout
38+
*/
39+
set timeout(timeout: number) {
40+
this.setTimeout(timeout)
41+
}
42+
43+
private setTimeout(timeout: number) {
44+
if (timeout !== undefined) {
45+
if (!Number.isInteger(timeout)) {
46+
throw new Error('Timeout value has to be integer');
47+
}
48+
if (timeout) {
49+
this._timeout = timeout;
50+
} else {
51+
throw new Error('Timeout value has to be greater than 0');
52+
}
53+
}
3154
}
3255

3356
set useQuerystring(value: boolean) {
@@ -61,7 +84,7 @@ class AccountService {
6184
* @param {*} [options] Override http request options.
6285
*/
6386
public _delete (id: number, options: any = {}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
64-
const localVarPath = this.basePath + '/account/delete';
87+
const localVarPath = '/account/delete';
6588
let localVarQueryParameters: any = {};
6689
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
6790
let localVarFormParams: any = {};
@@ -74,7 +97,7 @@ class AccountService {
7497
(<any>Object).assign(localVarHeaderParams, options.headers);
7598

7699
let defaultHeaderParams = {
77-
"x-meta-sdk-version": "3.1.2",
100+
"x-meta-sdk-version": "3.2.0",
78101
"x-meta-sdk-language": "typescript",
79102
"x-meta-sdk-provider": "PostFinance Checkout",
80103
"x-meta-sdk-language-version": this.getVersion(),
@@ -85,13 +108,15 @@ class AccountService {
85108
let localVarUseFormData = false;
86109

87110
let localVarRequestOptions: localVarRequest.Options = {
111+
baseUrl: this._basePath,
88112
method: 'POST',
89113
qs: localVarQueryParameters,
90114
headers: localVarHeaderParams,
91115
uri: localVarPath,
92116
useQuerystring: this._useQuerystring,
93117
json: true,
94118
body: ObjectSerializer.serialize(id, "number"),
119+
timeout: this._timeout * 1000
95120
};
96121

97122
this.authentications.default.applyToRequest(localVarRequestOptions);
@@ -151,15 +176,15 @@ class AccountService {
151176
* @param {*} [options] Override http request options.
152177
*/
153178
public count (filter?: EntityQueryFilter, options: any = {}) : Promise<{ response: http.IncomingMessage; body: number; }> {
154-
const localVarPath = this.basePath + '/account/count';
179+
const localVarPath = '/account/count';
155180
let localVarQueryParameters: any = {};
156181
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
157182
let localVarFormParams: any = {};
158183

159184
(<any>Object).assign(localVarHeaderParams, options.headers);
160185

161186
let defaultHeaderParams = {
162-
"x-meta-sdk-version": "3.1.2",
187+
"x-meta-sdk-version": "3.2.0",
163188
"x-meta-sdk-language": "typescript",
164189
"x-meta-sdk-provider": "PostFinance Checkout",
165190
"x-meta-sdk-language-version": this.getVersion(),
@@ -170,13 +195,15 @@ class AccountService {
170195
let localVarUseFormData = false;
171196

172197
let localVarRequestOptions: localVarRequest.Options = {
198+
baseUrl: this._basePath,
173199
method: 'POST',
174200
qs: localVarQueryParameters,
175201
headers: localVarHeaderParams,
176202
uri: localVarPath,
177203
useQuerystring: this._useQuerystring,
178204
json: true,
179205
body: ObjectSerializer.serialize(filter, "EntityQueryFilter"),
206+
timeout: this._timeout * 1000
180207
};
181208

182209
this.authentications.default.applyToRequest(localVarRequestOptions);
@@ -236,7 +263,7 @@ class AccountService {
236263
* @param {*} [options] Override http request options.
237264
*/
238265
public create (entity: AccountCreate, options: any = {}) : Promise<{ response: http.IncomingMessage; body: Account; }> {
239-
const localVarPath = this.basePath + '/account/create';
266+
const localVarPath = '/account/create';
240267
let localVarQueryParameters: any = {};
241268
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
242269
let localVarFormParams: any = {};
@@ -249,7 +276,7 @@ class AccountService {
249276
(<any>Object).assign(localVarHeaderParams, options.headers);
250277

251278
let defaultHeaderParams = {
252-
"x-meta-sdk-version": "3.1.2",
279+
"x-meta-sdk-version": "3.2.0",
253280
"x-meta-sdk-language": "typescript",
254281
"x-meta-sdk-provider": "PostFinance Checkout",
255282
"x-meta-sdk-language-version": this.getVersion(),
@@ -260,13 +287,15 @@ class AccountService {
260287
let localVarUseFormData = false;
261288

262289
let localVarRequestOptions: localVarRequest.Options = {
290+
baseUrl: this._basePath,
263291
method: 'POST',
264292
qs: localVarQueryParameters,
265293
headers: localVarHeaderParams,
266294
uri: localVarPath,
267295
useQuerystring: this._useQuerystring,
268296
json: true,
269297
body: ObjectSerializer.serialize(entity, "AccountCreate"),
298+
timeout: this._timeout * 1000
270299
};
271300

272301
this.authentications.default.applyToRequest(localVarRequestOptions);
@@ -326,7 +355,7 @@ class AccountService {
326355
* @param {*} [options] Override http request options.
327356
*/
328357
public read (id: number, options: any = {}) : Promise<{ response: http.IncomingMessage; body: Account; }> {
329-
const localVarPath = this.basePath + '/account/read';
358+
const localVarPath = '/account/read';
330359
let localVarQueryParameters: any = {};
331360
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
332361
let localVarFormParams: any = {};
@@ -343,7 +372,7 @@ class AccountService {
343372
(<any>Object).assign(localVarHeaderParams, options.headers);
344373

345374
let defaultHeaderParams = {
346-
"x-meta-sdk-version": "3.1.2",
375+
"x-meta-sdk-version": "3.2.0",
347376
"x-meta-sdk-language": "typescript",
348377
"x-meta-sdk-provider": "PostFinance Checkout",
349378
"x-meta-sdk-language-version": this.getVersion(),
@@ -354,12 +383,14 @@ class AccountService {
354383
let localVarUseFormData = false;
355384

356385
let localVarRequestOptions: localVarRequest.Options = {
386+
baseUrl: this._basePath,
357387
method: 'GET',
358388
qs: localVarQueryParameters,
359389
headers: localVarHeaderParams,
360390
uri: localVarPath,
361391
useQuerystring: this._useQuerystring,
362392
json: true,
393+
timeout: this._timeout * 1000
363394
};
364395

365396
this.authentications.default.applyToRequest(localVarRequestOptions);
@@ -419,7 +450,7 @@ class AccountService {
419450
* @param {*} [options] Override http request options.
420451
*/
421452
public search (query: EntityQuery, options: any = {}) : Promise<{ response: http.IncomingMessage; body: Array<Account>; }> {
422-
const localVarPath = this.basePath + '/account/search';
453+
const localVarPath = '/account/search';
423454
let localVarQueryParameters: any = {};
424455
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
425456
let localVarFormParams: any = {};
@@ -432,7 +463,7 @@ class AccountService {
432463
(<any>Object).assign(localVarHeaderParams, options.headers);
433464

434465
let defaultHeaderParams = {
435-
"x-meta-sdk-version": "3.1.2",
466+
"x-meta-sdk-version": "3.2.0",
436467
"x-meta-sdk-language": "typescript",
437468
"x-meta-sdk-provider": "PostFinance Checkout",
438469
"x-meta-sdk-language-version": this.getVersion(),
@@ -443,13 +474,15 @@ class AccountService {
443474
let localVarUseFormData = false;
444475

445476
let localVarRequestOptions: localVarRequest.Options = {
477+
baseUrl: this._basePath,
446478
method: 'POST',
447479
qs: localVarQueryParameters,
448480
headers: localVarHeaderParams,
449481
uri: localVarPath,
450482
useQuerystring: this._useQuerystring,
451483
json: true,
452484
body: ObjectSerializer.serialize(query, "EntityQuery"),
485+
timeout: this._timeout * 1000
453486
};
454487

455488
this.authentications.default.applyToRequest(localVarRequestOptions);
@@ -509,7 +542,7 @@ class AccountService {
509542
* @param {*} [options] Override http request options.
510543
*/
511544
public update (entity: AccountUpdate, options: any = {}) : Promise<{ response: http.IncomingMessage; body: Account; }> {
512-
const localVarPath = this.basePath + '/account/update';
545+
const localVarPath = '/account/update';
513546
let localVarQueryParameters: any = {};
514547
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
515548
let localVarFormParams: any = {};
@@ -522,7 +555,7 @@ class AccountService {
522555
(<any>Object).assign(localVarHeaderParams, options.headers);
523556

524557
let defaultHeaderParams = {
525-
"x-meta-sdk-version": "3.1.2",
558+
"x-meta-sdk-version": "3.2.0",
526559
"x-meta-sdk-language": "typescript",
527560
"x-meta-sdk-provider": "PostFinance Checkout",
528561
"x-meta-sdk-language-version": this.getVersion(),
@@ -533,13 +566,15 @@ class AccountService {
533566
let localVarUseFormData = false;
534567

535568
let localVarRequestOptions: localVarRequest.Options = {
569+
baseUrl: this._basePath,
536570
method: 'POST',
537571
qs: localVarQueryParameters,
538572
headers: localVarHeaderParams,
539573
uri: localVarPath,
540574
useQuerystring: this._useQuerystring,
541575
json: true,
542576
body: ObjectSerializer.serialize(entity, "AccountUpdate"),
577+
timeout: this._timeout * 1000
543578
};
544579

545580
this.authentications.default.applyToRequest(localVarRequestOptions);

0 commit comments

Comments
 (0)