Update webhooks.controller.ts

This commit is contained in:
Abubeker Yasin
2026-07-09 10:32:19 +03:00
parent f1452ba67e
commit cd4df2f810

View File

@@ -51,8 +51,22 @@ export class WebhooksController {
@ApiOperation({
summary: "Telebirr payment notification callback (Ethiopia)",
})
async receiveTelebirr(@Body() payload: TelebirrWebhookPayload) {
this.logger.log("Telebirr webhook called");
async receiveTelebirr(
@Body() payload: TelebirrWebhookPayload,
@Headers() headers: Record<string, string>,
@Req() req: { method?: string; rawBody?: Buffer },
) {
this.logger.log(
`Telebirr webhook hit: method=${req.method ?? "n/a"} ` +
`merchOrderId=${payload?.merch_order_id ?? "n/a"} ` +
`paymentOrderId=${payload?.payment_order_id ?? "n/a"} ` +
`tradeStatus=${payload?.trade_status ?? "n/a"}`,
);
this.logger.log(`Telebirr webhook headers: ${JSON.stringify(headers)}`);
this.logger.log(`Telebirr webhook payload: ${JSON.stringify(payload)}`);
this.logger.log(
`Telebirr webhook raw body: ${req.rawBody?.toString("utf8") ?? "(none)"}`,
);
try {
await this.telebirr.handle(payload);
} catch (err) {