@@ -3,6 +3,7 @@ import { sha256 } from '../lib/hashing.js';
3
3
import type { DbCalculation } from '../models/directbilling/service/db.calculation.js' ;
4
4
import type { DbService } from '../models/directbilling/service/db.service.js' ;
5
5
import type { PartialDbService } from '../models/directbilling/service/partial.db.service.js' ;
6
+ import type { DirectBillingServicePaginatedResponse } from '../models/directbilling/service/service-paginated.response.js' ;
6
7
import type { DbGenerationResponse } from '../models/directbilling/transaction/db.generation.response.js' ;
7
8
import type { DbNotificationRequest } from '../models/directbilling/transaction/db.notifications.request.js' ;
8
9
import type { DbTransaction } from '../models/directbilling/transaction/db.transaction.js' ;
@@ -25,7 +26,7 @@ export class DirectBilling {
25
26
headers : {
26
27
'X-SIM-KEY' : this . key ,
27
28
'X-SIM-PASSWORD' : this . password ,
28
- 'X-SIM-VERSION' : '3.0.3 ' ,
29
+ 'X-SIM-VERSION' : '3.1.0 ' ,
29
30
'X-SIM-PLATFORM' : 'TYPESCRIPT' ,
30
31
} ,
31
32
} ) ;
@@ -60,17 +61,17 @@ export class DirectBilling {
60
61
page ?: number ,
61
62
pageSize ?: number ,
62
63
) : Promise < PaginatedResponse < PartialDbService > > {
63
- const query : any = { } ;
64
+ const query : Record < string , string > = { } ;
64
65
65
66
if ( page ) query . page = `${ page } ` ;
66
67
if ( pageSize ) query . limit = `${ pageSize } ` ;
67
68
68
69
const url = `/?${ new URLSearchParams ( query ) . toString ( ) } ` ;
69
70
70
- const response = ( await this . client . get ( url ) ) . data ;
71
+ const response = ( await this . client . get < DirectBillingServicePaginatedResponse > ( url ) ) . data ;
71
72
72
- response . data = response . data . map ( ( e : any ) => {
73
- e . created_at = new Date ( e . created_at . replace ( ' ' , 'T' ) ) ;
73
+ response . data = response . data . map ( ( e ) => {
74
+ e . created_at = new Date ( e . created_at . toString ( ) . replace ( ' ' , 'T' ) ) ;
74
75
75
76
return e ;
76
77
} ) ;
@@ -134,7 +135,7 @@ export class DirectBilling {
134
135
page ?: number ,
135
136
pageSize ?: number ,
136
137
) : Promise < PaginatedResponse < PartialDbTransaction > > {
137
- const query : any = { } ;
138
+ const query : Record < string , string > = { } ;
138
139
139
140
if ( page ) query . page = `${ page } ` ;
140
141
if ( pageSize ) query . limit = `${ pageSize } ` ;
@@ -185,12 +186,12 @@ export class DirectBilling {
185
186
/*
186
187
https://docs.simpay.pl/shell/?shell#directbilling-generowanie-transakcji
187
188
*/
188
- checkNotification ( key : string , body : any ) {
189
+ checkNotification ( key : string , body : DbNotificationRequest ) {
189
190
const signature = this . generateSignatureNotification ( key , body ) ;
190
191
191
192
if ( body . signature !== signature ) return undefined ;
192
193
193
- return < DbNotificationRequest > body ;
194
+ return body as DbNotificationRequest ;
194
195
}
195
196
196
197
/*
0 commit comments