From fb9d62e548935ea273ec10cc7b5b7870e30212be Mon Sep 17 00:00:00 2001 From: Ashwin Thanaraj <37061471+ashwin1111@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:44:05 +0530 Subject: [PATCH] Handle onboarding phase token expiry and add report_id to expense_groups/ response (#528) * Handle onboarding phase token expiry * add report_id to expense group response --- apps/fyle/serializers.py | 2 +- apps/workspaces/views.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/fyle/serializers.py b/apps/fyle/serializers.py index a0450f32..c515b30e 100644 --- a/apps/fyle/serializers.py +++ b/apps/fyle/serializers.py @@ -21,7 +21,7 @@ class ExpenseSerializer(serializers.ModelSerializer): class Meta: model = Expense - fields = ['updated_at', 'claim_number', 'employee_email', 'employee_name', 'fund_source', 'expense_number', 'payment_number', 'vendor', 'category', 'amount'] + fields = ['updated_at', 'claim_number', 'employee_email', 'employee_name', 'fund_source', 'expense_number', 'payment_number', 'vendor', 'category', 'amount', 'report_id'] class ExpenseGroupSerializer(serializers.ModelSerializer): diff --git a/apps/workspaces/views.py b/apps/workspaces/views.py index a56f9e1b..9d18e5ed 100644 --- a/apps/workspaces/views.py +++ b/apps/workspaces/views.py @@ -125,9 +125,9 @@ def get(self, request, **kwargs): """ Get QBO Credentials in Workspace """ - qbo_credentials = QBOCredential.objects.get(workspace=kwargs['workspace_id'], is_expired=False) + qbo_credentials = QBOCredential.objects.get(workspace=kwargs['workspace_id']) - return Response(data=QBOCredentialSerializer(qbo_credentials).data, status=status.HTTP_200_OK if qbo_credentials.refresh_token else status.HTTP_400_BAD_REQUEST) + return Response(data=QBOCredentialSerializer(qbo_credentials).data, status=status.HTTP_200_OK if qbo_credentials.refresh_token and not qbo_credentials.is_expired else status.HTTP_400_BAD_REQUEST) class GeneralSettingsView(generics.RetrieveAPIView):