From 3e4dcbf36bbc2b6dd01963eba19da9f32433b721 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Mon, 30 Sep 2024 18:59:52 +0530 Subject: [PATCH] fix: changes as per review --- .../gst_india/utils/gstin_info.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/india_compliance/gst_india/utils/gstin_info.py b/india_compliance/gst_india/utils/gstin_info.py index c927a058d..566457a82 100644 --- a/india_compliance/gst_india/utils/gstin_info.py +++ b/india_compliance/gst_india/utils/gstin_info.py @@ -59,9 +59,6 @@ def _get_gstin_info(gstin, *, throw_error=True): response=get_formatted_response_for_status(response, gstin), ) - if response.get("errorCode") == "FO8000": - return get_formatted_response_for_status(response, gstin) - except Exception as exc: if isinstance(exc, GSPServerError): frappe.cache.set_value("gst_server_error", True, expires_in_sec=60) @@ -79,9 +76,9 @@ def _get_gstin_info(gstin, *, throw_error=True): gstin_info = frappe._dict( gstin=response.gstin, - business_name=titlecase(business_name), + business_name=titlecase(business_name or ""), gst_category=GST_CATEGORIES.get(response.dty, ""), - status=response.sts, + status=response.sts if response.sts else "Invalid", ) if permanent_address := response.get("pradr"): @@ -232,24 +229,16 @@ def get_formatted_response_for_status(response, gstin): """ Format response from Public API """ - if response.get("errorCode") == "FO8000": - return frappe._dict( - { - "gstin": gstin, - "status": "Invalid", - } - ) - return frappe._dict( { - "gstin": response.gstin, + "gstin": response.gstin or gstin, "registration_date": parse_datetime( response.rgdt, day_first=True, throw=False ), "cancelled_date": parse_datetime( response.cxdt, day_first=True, throw=False ), - "status": response.sts, + "status": response.sts if response.sts else "Invalid", } )