refactor: ( payment ) use rabbitmq for webhooks event

This commit is contained in:
Abubeker Yasin
2026-06-13 20:19:23 +03:00
parent eb94d58a4e
commit c35b5089ce
17 changed files with 396 additions and 10 deletions

View File

@@ -4,7 +4,14 @@ import { map } from 'rxjs/operators';
@Injectable()
export class ResponseTransformInterceptor<T> implements NestInterceptor<T, any> {
intercept(_ctx: ExecutionContext, next: CallHandler<T>): Observable<any> {
intercept(ctx: ExecutionContext, next: CallHandler<T>): Observable<any> {
// Only wrap HTTP responses. This interceptor is global, so it also runs for RabbitMQ
// message handlers (golevelup uses Nest's context system) — there, wrapping the return
// value would corrupt the handler's contract (e.g. a returned Nack would be swallowed,
// dropping a message instead of dead-lettering it). Let non-HTTP returns pass through.
if (ctx.getType() !== 'http') {
return next.handle();
}
return next.handle().pipe(
map((data) => ({ success: true, data, timestamp: new Date().toISOString() })),
);