@@ -20,6 +20,7 @@ class AccountService {
20
20
protected _basePath = 'https://checkout.postfinance.ch:443/api' ;
21
21
protected defaultHeaders : any = { } ;
22
22
protected _useQuerystring : boolean = false ;
23
+ protected _timeout : number = 25 ;
23
24
24
25
protected authentications = {
25
26
'default' : < Authentication > new VoidAuth ( { } )
@@ -28,6 +29,28 @@ class AccountService {
28
29
constructor ( configuration : any ) {
29
30
this . setDefaultAuthentication ( new VoidAuth ( configuration ) ) ;
30
31
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
+ }
31
54
}
32
55
33
56
set useQuerystring ( value : boolean ) {
@@ -61,7 +84,7 @@ class AccountService {
61
84
* @param {* } [options] Override http request options.
62
85
*/
63
86
public _delete ( id : number , options : any = { } ) : Promise < { response : http . IncomingMessage ; body ?: any ; } > {
64
- const localVarPath = this . basePath + '/account/delete' ;
87
+ const localVarPath = '/account/delete' ;
65
88
let localVarQueryParameters : any = { } ;
66
89
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
67
90
let localVarFormParams : any = { } ;
@@ -74,7 +97,7 @@ class AccountService {
74
97
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
75
98
76
99
let defaultHeaderParams = {
77
- "x-meta-sdk-version" : "3.1.2 " ,
100
+ "x-meta-sdk-version" : "3.2.0 " ,
78
101
"x-meta-sdk-language" : "typescript" ,
79
102
"x-meta-sdk-provider" : "PostFinance Checkout" ,
80
103
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -85,13 +108,15 @@ class AccountService {
85
108
let localVarUseFormData = false ;
86
109
87
110
let localVarRequestOptions : localVarRequest . Options = {
111
+ baseUrl : this . _basePath ,
88
112
method : 'POST' ,
89
113
qs : localVarQueryParameters ,
90
114
headers : localVarHeaderParams ,
91
115
uri : localVarPath ,
92
116
useQuerystring : this . _useQuerystring ,
93
117
json : true ,
94
118
body : ObjectSerializer . serialize ( id , "number" ) ,
119
+ timeout : this . _timeout * 1000
95
120
} ;
96
121
97
122
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
@@ -151,15 +176,15 @@ class AccountService {
151
176
* @param {* } [options] Override http request options.
152
177
*/
153
178
public count ( filter ?: EntityQueryFilter , options : any = { } ) : Promise < { response : http . IncomingMessage ; body : number ; } > {
154
- const localVarPath = this . basePath + '/account/count' ;
179
+ const localVarPath = '/account/count' ;
155
180
let localVarQueryParameters : any = { } ;
156
181
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
157
182
let localVarFormParams : any = { } ;
158
183
159
184
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
160
185
161
186
let defaultHeaderParams = {
162
- "x-meta-sdk-version" : "3.1.2 " ,
187
+ "x-meta-sdk-version" : "3.2.0 " ,
163
188
"x-meta-sdk-language" : "typescript" ,
164
189
"x-meta-sdk-provider" : "PostFinance Checkout" ,
165
190
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -170,13 +195,15 @@ class AccountService {
170
195
let localVarUseFormData = false ;
171
196
172
197
let localVarRequestOptions : localVarRequest . Options = {
198
+ baseUrl : this . _basePath ,
173
199
method : 'POST' ,
174
200
qs : localVarQueryParameters ,
175
201
headers : localVarHeaderParams ,
176
202
uri : localVarPath ,
177
203
useQuerystring : this . _useQuerystring ,
178
204
json : true ,
179
205
body : ObjectSerializer . serialize ( filter , "EntityQueryFilter" ) ,
206
+ timeout : this . _timeout * 1000
180
207
} ;
181
208
182
209
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
@@ -236,7 +263,7 @@ class AccountService {
236
263
* @param {* } [options] Override http request options.
237
264
*/
238
265
public create ( entity : AccountCreate , options : any = { } ) : Promise < { response : http . IncomingMessage ; body : Account ; } > {
239
- const localVarPath = this . basePath + '/account/create' ;
266
+ const localVarPath = '/account/create' ;
240
267
let localVarQueryParameters : any = { } ;
241
268
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
242
269
let localVarFormParams : any = { } ;
@@ -249,7 +276,7 @@ class AccountService {
249
276
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
250
277
251
278
let defaultHeaderParams = {
252
- "x-meta-sdk-version" : "3.1.2 " ,
279
+ "x-meta-sdk-version" : "3.2.0 " ,
253
280
"x-meta-sdk-language" : "typescript" ,
254
281
"x-meta-sdk-provider" : "PostFinance Checkout" ,
255
282
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -260,13 +287,15 @@ class AccountService {
260
287
let localVarUseFormData = false ;
261
288
262
289
let localVarRequestOptions : localVarRequest . Options = {
290
+ baseUrl : this . _basePath ,
263
291
method : 'POST' ,
264
292
qs : localVarQueryParameters ,
265
293
headers : localVarHeaderParams ,
266
294
uri : localVarPath ,
267
295
useQuerystring : this . _useQuerystring ,
268
296
json : true ,
269
297
body : ObjectSerializer . serialize ( entity , "AccountCreate" ) ,
298
+ timeout : this . _timeout * 1000
270
299
} ;
271
300
272
301
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
@@ -326,7 +355,7 @@ class AccountService {
326
355
* @param {* } [options] Override http request options.
327
356
*/
328
357
public read ( id : number , options : any = { } ) : Promise < { response : http . IncomingMessage ; body : Account ; } > {
329
- const localVarPath = this . basePath + '/account/read' ;
358
+ const localVarPath = '/account/read' ;
330
359
let localVarQueryParameters : any = { } ;
331
360
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
332
361
let localVarFormParams : any = { } ;
@@ -343,7 +372,7 @@ class AccountService {
343
372
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
344
373
345
374
let defaultHeaderParams = {
346
- "x-meta-sdk-version" : "3.1.2 " ,
375
+ "x-meta-sdk-version" : "3.2.0 " ,
347
376
"x-meta-sdk-language" : "typescript" ,
348
377
"x-meta-sdk-provider" : "PostFinance Checkout" ,
349
378
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -354,12 +383,14 @@ class AccountService {
354
383
let localVarUseFormData = false ;
355
384
356
385
let localVarRequestOptions : localVarRequest . Options = {
386
+ baseUrl : this . _basePath ,
357
387
method : 'GET' ,
358
388
qs : localVarQueryParameters ,
359
389
headers : localVarHeaderParams ,
360
390
uri : localVarPath ,
361
391
useQuerystring : this . _useQuerystring ,
362
392
json : true ,
393
+ timeout : this . _timeout * 1000
363
394
} ;
364
395
365
396
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
@@ -419,7 +450,7 @@ class AccountService {
419
450
* @param {* } [options] Override http request options.
420
451
*/
421
452
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' ;
423
454
let localVarQueryParameters : any = { } ;
424
455
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
425
456
let localVarFormParams : any = { } ;
@@ -432,7 +463,7 @@ class AccountService {
432
463
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
433
464
434
465
let defaultHeaderParams = {
435
- "x-meta-sdk-version" : "3.1.2 " ,
466
+ "x-meta-sdk-version" : "3.2.0 " ,
436
467
"x-meta-sdk-language" : "typescript" ,
437
468
"x-meta-sdk-provider" : "PostFinance Checkout" ,
438
469
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -443,13 +474,15 @@ class AccountService {
443
474
let localVarUseFormData = false ;
444
475
445
476
let localVarRequestOptions : localVarRequest . Options = {
477
+ baseUrl : this . _basePath ,
446
478
method : 'POST' ,
447
479
qs : localVarQueryParameters ,
448
480
headers : localVarHeaderParams ,
449
481
uri : localVarPath ,
450
482
useQuerystring : this . _useQuerystring ,
451
483
json : true ,
452
484
body : ObjectSerializer . serialize ( query , "EntityQuery" ) ,
485
+ timeout : this . _timeout * 1000
453
486
} ;
454
487
455
488
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
@@ -509,7 +542,7 @@ class AccountService {
509
542
* @param {* } [options] Override http request options.
510
543
*/
511
544
public update ( entity : AccountUpdate , options : any = { } ) : Promise < { response : http . IncomingMessage ; body : Account ; } > {
512
- const localVarPath = this . basePath + '/account/update' ;
545
+ const localVarPath = '/account/update' ;
513
546
let localVarQueryParameters : any = { } ;
514
547
let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
515
548
let localVarFormParams : any = { } ;
@@ -522,7 +555,7 @@ class AccountService {
522
555
( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
523
556
524
557
let defaultHeaderParams = {
525
- "x-meta-sdk-version" : "3.1.2 " ,
558
+ "x-meta-sdk-version" : "3.2.0 " ,
526
559
"x-meta-sdk-language" : "typescript" ,
527
560
"x-meta-sdk-provider" : "PostFinance Checkout" ,
528
561
"x-meta-sdk-language-version" : this . getVersion ( ) ,
@@ -533,13 +566,15 @@ class AccountService {
533
566
let localVarUseFormData = false ;
534
567
535
568
let localVarRequestOptions : localVarRequest . Options = {
569
+ baseUrl : this . _basePath ,
536
570
method : 'POST' ,
537
571
qs : localVarQueryParameters ,
538
572
headers : localVarHeaderParams ,
539
573
uri : localVarPath ,
540
574
useQuerystring : this . _useQuerystring ,
541
575
json : true ,
542
576
body : ObjectSerializer . serialize ( entity , "AccountUpdate" ) ,
577
+ timeout : this . _timeout * 1000
543
578
} ;
544
579
545
580
this . authentications . default . applyToRequest ( localVarRequestOptions ) ;
0 commit comments