mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 02:28:18 +00:00
feat: ( payment ) add waafi webhook log
This commit is contained in:
@@ -45,6 +45,12 @@ export class WaafiWebhookService {
|
|||||||
|
|
||||||
const mapped = this.provider.mapWebhookStatus(payment.status);
|
const mapped = this.provider.mapWebhookStatus(payment.status);
|
||||||
|
|
||||||
|
this.logger.log(
|
||||||
|
`Waafi authorization: ref=${payment.reference_id} txn=${payment.transaction_id} ` +
|
||||||
|
`rawStatus=${payment.status} mapped=${mapped} ` +
|
||||||
|
`signatureValid=${signatureValid} (fresh=${this.isFresh(timestamp)}) eventId=${eventId ?? "n/a"}`,
|
||||||
|
);
|
||||||
|
|
||||||
await this.processor.process({
|
await this.processor.process({
|
||||||
provider: this.provider.method,
|
provider: this.provider.method,
|
||||||
// X-Webhook-Event-Id is unique per event; fall back to a derived id if absent.
|
// X-Webhook-Event-Id is unique per event; fall back to a derived id if absent.
|
||||||
|
|||||||
@@ -127,10 +127,14 @@ export class WebhooksController {
|
|||||||
@Req() req: { rawBody?: Buffer },
|
@Req() req: { rawBody?: Buffer },
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.logger.log("\n\n\n\nWaafi payment notification callback (Djibouti)\n\n\n\n");
|
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`Waafi webhook hit: event=${payload?.event ?? "unknown"} eventId=${headers["x-webhook-event-id"] ?? "n/a"}`,
|
`Waafi webhook hit: event=${payload?.event ?? "unknown"} eventId=${headers["x-webhook-event-id"] ?? "n/a"}`,
|
||||||
);
|
);
|
||||||
|
this.logger.log(`Waafi webhook headers: ${JSON.stringify(headers)}`);
|
||||||
|
this.logger.log(`Waafi webhook payload: ${JSON.stringify(payload)}`);
|
||||||
|
this.logger.log(
|
||||||
|
`Waafi webhook raw body: ${req.rawBody?.toString("utf8") ?? "(none)"}`,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
// HMAC verification must sign over the exact raw bytes Waafi sent, not re-serialized JSON.
|
// HMAC verification must sign over the exact raw bytes Waafi sent, not re-serialized JSON.
|
||||||
const rawBody = req.rawBody?.toString("utf8") ?? "";
|
const rawBody = req.rawBody?.toString("utf8") ?? "";
|
||||||
|
|||||||
Reference in New Issue
Block a user