Skip to content

Commit daaab55

Browse files
committed
Fix used_at casting to date in sms code verification
1 parent 169f19a commit daaab55

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

lib/payments/directbilling.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export declare class DirectBilling {
2020
getTransactionsPaginated(serviceId: number, page?: number, pageSize?: number): Promise<PaginatedResponse<PartialDbTransaction>>;
2121
getTransaction(serviceId: number, transactionId: string): Promise<DbTransaction | undefined>;
2222
createTransaction(serviceId: number, key: string, request: DbTransactionRequest): Promise<DbGenerationResponse | undefined>;
23-
checkNotification(key: string, body: any): DbTransaction | undefined;
23+
checkNotification(key: string, body: any): DbNotificationRequest | undefined;
2424
generateSignature(key: string, request: DbTransactionRequest): string;
2525
generateSignatureNotification(key: string, request: DbNotificationRequest): string;
2626
}

lib/payments/sms.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ class Sms {
185185
verifySmsCode(serviceId, code, number) {
186186
return __awaiter(this, void 0, void 0, function* () {
187187
const response = (yield this.client.post(`/${serviceId}`, { code, number })).data.data;
188-
response.used_at = new Date(response.used_at.replace(' ', 'T'));
188+
if (response.used_at) {
189+
response.used_at = new Date(response.used_at.replace(' ', 'T'));
190+
}
189191
return response;
190192
});
191193
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "simpay-typescript-api",
33
"author": "Rafał Więcek",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"description": "SimPay.pl API",
66
"main": "lib/index.js",
77
"types": "lib/index.d.ts",

src/payments/sms.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ export class Sms {
209209
async verifySmsCode(serviceId: number, code: string, number?: number): Promise<VerificationResponse | undefined> {
210210
const response = (await this.client.post(`/${serviceId}`, { code, number })).data.data;
211211

212-
response.used_at = new Date(response.used_at.replace(' ', 'T'));
212+
if( response.used_at ) {
213+
response.used_at = new Date(response.used_at.replace(' ', 'T'));
214+
}
213215

214216
return response;
215217
}

0 commit comments

Comments
 (0)