diff --git a/backend/benefit/applications/api/v1/serializers/ahjo_status.py b/backend/benefit/applications/api/v1/serializers/ahjo_status.py index d813262d61..82d48771df 100644 --- a/backend/benefit/applications/api/v1/serializers/ahjo_status.py +++ b/backend/benefit/applications/api/v1/serializers/ahjo_status.py @@ -6,4 +6,4 @@ class AhjoStatusSerializer(serializers.ModelSerializer): class Meta: model = AhjoStatus - fields = ["modified_at", "error_from_ahjo"] + fields = ["modified_at", "error_from_ahjo", "validation_error_from_ahjo"] diff --git a/backend/benefit/applications/api/v1/serializers/application.py b/backend/benefit/applications/api/v1/serializers/application.py index b0dfbf9da8..f41dd9a122 100755 --- a/backend/benefit/applications/api/v1/serializers/application.py +++ b/backend/benefit/applications/api/v1/serializers/application.py @@ -1957,9 +1957,10 @@ def get_latest_ahjo_error(self, obj) -> Union[Dict, None]: return None data = AhjoStatusSerializer(status).data if data["error_from_ahjo"] is None: - data = None - else: - data.update({"status": status.status}) + if data["validation_error_from_ahjo"] is None: + data = None + else: + data["error_from_ahjo"] = data["validation_error_from_ahjo"] return data handled_by_ahjo_automation = serializers.BooleanField(