Refactor and ignore n/a exchange callbacks

This commit is contained in:
2022-11-10 07:20:20 +00:00
parent 8b52063473
commit c3d908341a
6 changed files with 40 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
import uuid
import orjson
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseBadRequest
from django.shortcuts import render

View File

@@ -78,6 +78,9 @@ class HookAPI(APIView):
except Hook.DoesNotExist:
return HttpResponseBadRequest("Hook does not exist.")
if data["exchange"].lower() == "n/a":
log.debug("HookAPI callback: exchange is N/A, skipping")
return HttpResponse("OK")
# Create the callback object
callback = Callback.objects.create(hook=hook, **data)
callback.save()