diff --git a/lib/payments/directbilling.d.ts b/lib/payments/directbilling.d.ts index 1539294..4bedd86 100644 --- a/lib/payments/directbilling.d.ts +++ b/lib/payments/directbilling.d.ts @@ -20,7 +20,7 @@ export declare class DirectBilling { getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise>; getTransaction(serviceId: number, transactionId: string): Promise; createTransaction(serviceId: number, key: string, request: DbTransactionRequest): Promise; - checkNotification(key: string, body: any): DbTransaction | undefined; + checkNotification(key: string, body: any): DbNotificationRequest | undefined; generateSignature(key: string, request: DbTransactionRequest): string; generateSignatureNotification(key: string, request: DbNotificationRequest): string; } diff --git a/lib/payments/sms.js b/lib/payments/sms.js index fd0ef1b..7867ec1 100644 --- a/lib/payments/sms.js +++ b/lib/payments/sms.js @@ -185,7 +185,9 @@ class Sms { verifySmsCode(serviceId, code, number) { return __awaiter(this, void 0, void 0, function* () { const response = (yield this.client.post(`/${serviceId}`, { code, number })).data.data; - response.used_at = new Date(response.used_at.replace(' ', 'T')); + if (response.used_at) { + response.used_at = new Date(response.used_at.replace(' ', 'T')); + } return response; }); } diff --git a/package.json b/package.json index b128f7d..efe9e93 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "simpay-typescript-api", "author": "Rafał Więcek", - "version": "2.2.0", + "version": "2.2.1", "description": "SimPay.pl API", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/payments/sms.ts b/src/payments/sms.ts index 0076bd7..31f3be2 100644 --- a/src/payments/sms.ts +++ b/src/payments/sms.ts @@ -209,7 +209,9 @@ export class Sms { async verifySmsCode(serviceId: number, code: string, number?: number): Promise { const response = (await this.client.post(`/${serviceId}`, { code, number })).data.data; - response.used_at = new Date(response.used_at.replace(' ', 'T')); + if( response.used_at ) { + response.used_at = new Date(response.used_at.replace(' ', 'T')); + } return response; }