From df79cbc45cc84889ca2a151e5e3c472eb5c473c6 Mon Sep 17 00:00:00 2001 From: Hrishabh Tiwari <74908943+Hrishabh17@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:27:50 +0530 Subject: [PATCH] check for report in expenses (#86) * check for report in expenses * fix report check --- .../fyle_integrations_platform_connector/apis/expenses.py | 8 ++++---- connector/setup.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/connector/fyle_integrations_platform_connector/apis/expenses.py b/connector/fyle_integrations_platform_connector/apis/expenses.py index c7db06a..47c422a 100644 --- a/connector/fyle_integrations_platform_connector/apis/expenses.py +++ b/connector/fyle_integrations_platform_connector/apis/expenses.py @@ -161,7 +161,7 @@ def __construct_expenses_objects(self, expenses: List[dict]) -> List[dict]: 'project_id': expense['project']['id'] if expense['project'] else None, 'expense_number': expense['seq_num'], 'org_id': expense['org_id'], - 'claim_number': expense['report']['seq_num'] if expense['report'] else None, + 'claim_number': expense['report']['seq_num'] if 'report' in expense and expense['report'] else None, 'amount': expense['amount'], 'tax_amount': expense['tax_amount'], 'tax_group_id': expense['tax_group_id'], @@ -179,17 +179,17 @@ def __construct_expenses_objects(self, expenses: List[dict]) -> List[dict]: 'bank_transaction_id': matched_transaction['id'] if matched_transaction else None, 'purpose': expense['purpose'], 'report_id': expense['report_id'], - 'report_title': expense['report']['title'], + 'report_title': expense['report']['title'] if 'report' in expense and expense['report'] and 'title' in expense['report'] else None, 'file_ids': expense['file_ids'], 'spent_at': self.__format_date(expense['spent_at']), - 'approved_at': self.__format_date(expense['report']['last_approved_at']) if expense['report'] else None, + 'approved_at': self.__format_date(expense['report']['last_approved_at']) if 'report' in expense and expense['report'] else None, 'posted_at': self.__format_date(posted_at) if posted_at else None, 'expense_created_at': expense['created_at'], 'expense_updated_at': expense['updated_at'], 'source_account_type': expense['source_account']['type'], 'verified_at': self.__format_date(expense['last_verified_at']), 'custom_properties': custom_properties, - 'payment_number': expense['report']['reimbursement_seq_num'] if 'reimbursement_seq_num' in expense['report'] and \ + 'payment_number': expense['report']['reimbursement_seq_num'] if 'report' in expense and expense['report'] and 'reimbursement_seq_num' in expense['report'] and \ expense['report']['reimbursement_seq_num'] else None }) diff --git a/connector/setup.py b/connector/setup.py index f301de0..f0a5628 100644 --- a/connector/setup.py +++ b/connector/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='fyle-integrations-platform-connector', - version='1.38.3', + version='1.38.4', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='A common platform connector for all the Fyle Integrations to interact with Fyle Platform APIs',