From 01711b59273c8a9b18e0ba2172eb3647cce39aa8 Mon Sep 17 00:00:00 2001 From: komoliddin Date: Wed, 22 Apr 2026 11:28:35 +0500 Subject: [PATCH] feat: add 404 response for missing company or person in Didox API --- core/apps/evaluation/views/didox.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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