diff --git a/core/apps/evaluation/views/didox.py b/core/apps/evaluation/views/didox.py index f327e6d..cd4752f 100644 --- a/core/apps/evaluation/views/didox.py +++ b/core/apps/evaluation/views/didox.py @@ -31,7 +31,6 @@ class DidoxCompanyInfoAPIView(GenericAPIView): def get(self, request, *args, **kwargs): tin = kwargs.get("tin") - # 🔥 TYPE CHECK try: tin = int(tin) except (TypeError, ValueError): @@ -48,4 +47,14 @@ class DidoxCompanyInfoAPIView(GenericAPIView): status=status.HTTP_502_BAD_GATEWAY ) + # if both name and personalNum are null/empty -> 404 + name = data.get("name") + personal_num = data.get("personalNum") + + if not name and not personal_num: + return Response( + {"detail": "Company or person not found"}, + status=status.HTTP_404_NOT_FOUND + ) + return Response(data, status=status.HTTP_200_OK) \ No newline at end of file