mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Merge pull request #196 from Tria-plc/feat/payment-microservice
fix: ( telebirr ) fix webhook return types
This commit is contained in:
@@ -31,16 +31,15 @@ export class TelebirrWebhookService {
|
||||
result: {
|
||||
status: mapped,
|
||||
providerTxnId,
|
||||
paidAt: this.parseEpochSeconds(payload.trans_end_time),
|
||||
paidAt: this.parseEpoch(payload.trans_end_time),
|
||||
failureCode: payload.trade_status,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private parseEpochSeconds(raw: string | undefined): Date | undefined {
|
||||
private parseEpoch(raw: string | undefined): Date | undefined {
|
||||
if (!raw) return undefined;
|
||||
const n = parseInt(raw, 10);
|
||||
if (Number.isNaN(n)) return undefined;
|
||||
return new Date(n * 1000);
|
||||
return new Date(n < 1e12 ? n * 1000 : n);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user