diff --git a/apps/fyle/models.py b/apps/fyle/models.py index 4be0b9a9..30807e92 100644 --- a/apps/fyle/models.py +++ b/apps/fyle/models.py @@ -168,6 +168,7 @@ def create_expense_objects(expenses: List[Dict], workspace_id: int, skip_update: 'purpose': expense['purpose'], 'report_id': expense['report_id'], 'corporate_card_id': expense['corporate_card_id'], + 'masked_corporate_card_number': expense['masked_corporate_card_number'], 'bank_transaction_id': expense['bank_transaction_id'], 'file_ids': expense['file_ids'], 'spent_at': expense['spent_at'], diff --git a/tests/test_fyle/fixtures.py b/tests/test_fyle/fixtures.py index 5332cf72..0e16949e 100644 --- a/tests/test_fyle/fixtures.py +++ b/tests/test_fyle/fixtures.py @@ -8,6 +8,7 @@ }, 'posted_at': '2024-05-10T07:53:25', 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', 'activity_details': None, 'added_to_report_at': None, 'admin_amount': None, @@ -242,7 +243,8 @@ 'tax_group_id': None, 'previous_export_state': None, 'accounting_export_summary': [], - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, "expenses_spent_at":[ { @@ -286,7 +288,8 @@ 'Vehicle Type': '', 'Fyle Categories': '', }, - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '1235', @@ -329,7 +332,8 @@ 'Vehicle Type': '', 'Fyle Categories': '', }, - 'is_posted_at_null': True + 'is_posted_at_null': True, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '1236', @@ -372,7 +376,8 @@ 'Vehicle Type': '', 'Fyle Categories': '', }, - 'is_posted_at_null': True + 'is_posted_at_null': True, + 'masked_corporate_card_number': '**** 4567', }, ], @@ -503,7 +508,8 @@ "Vehicle Type": "", "Fyle Categories": "" }, - "is_posted_at_null": False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { "id": "1265", @@ -547,7 +553,8 @@ "Vehicle Type": "", "Fyle Categories": "" }, - "is_posted_at_null": False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, ], 'expense_refund_single_ccc':{ @@ -592,7 +599,8 @@ "Vehicle Type": "", "Fyle Categories": "" }, - "is_posted_at_null": False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, 'expense_refund_single':{ "id": "1265", @@ -628,7 +636,8 @@ "spent_at": "2021-12-22T17:00:00", "approved_at": "2021-12-22T07:30:26.289842+00:00", "posted_at": None, - "is_posted_at_null": True, + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', "expense_created_at": "2021-12-23T07:14:13.990650+00:00", "expense_updated_at": "2021-12-27T05:26:43.954470+00:00", "source_account_type": "PERSONAL_CASH_ACCOUNT", @@ -681,7 +690,8 @@ "Vehicle Type": "", "Fyle Categories": "" }, - "is_posted_at_null": False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { "id": "1111", @@ -725,7 +735,8 @@ "Vehicle Type": "", "Fyle Categories": "" }, - "is_posted_at_null": False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], "skipped_expenses": { @@ -955,7 +966,8 @@ 'paid_on_qbo': False, 'created_at': '2024-06-18T19:12:17.003409+00:00', 'updated_at': '2024-06-18T19:12:17.003421+00:00', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '24009', @@ -1007,7 +1019,8 @@ 'paid_on_qbo': False, 'created_at': '2024-06-18T19:12:17.020617+00:00', 'updated_at': '2024-06-18T19:12:17.020627+00:00', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'ccc_expenses_split_same_bank_transaction_id': [ @@ -1058,7 +1071,8 @@ 'created_at': '2024-06-18T19:12:17.003409+00:00', 'updated_at': '2024-06-18T19:12:17.003421+00:00', 'bank_transaction_id': 'anish', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '24009', @@ -1110,7 +1124,8 @@ 'created_at': '2024-06-18T19:12:17.020617+00:00', 'updated_at': '2024-06-18T19:12:17.020627+00:00', 'bank_transaction_id': 'anish', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'ccc_expenses_split_diff_bank_transaction_id': [ @@ -1162,7 +1177,8 @@ 'updated_at': '2024-06-18T19:12:17.003421+00:00', 'bank_transaction_id': 'Arkham', 'fund_source': 'CCC', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '24004', @@ -1215,7 +1231,8 @@ 'updated_at': '2024-06-18T19:12:17.003421+00:00', 'bank_transaction_id': 'Arkham', 'fund_source': 'CCC', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '24008', @@ -1265,7 +1282,8 @@ 'updated_at': '2024-06-18T19:12:17.003421+00:00', 'bank_transaction_id': 'Anish', 'fund_source': 'CCC', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': '24009', @@ -1318,7 +1336,8 @@ 'updated_at': '2024-06-18T19:12:17.003421+00:00', 'bank_transaction_id': 'Anish', 'fund_source': 'CCC', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'expense_groups_complete_response': { @@ -1570,7 +1589,8 @@ 'custom_properties': {}, 'paid_on_qbo': False, 'payment_number': 'P/2022/05/R/4', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'fund_source': 'PERSONAL', @@ -1664,7 +1684,8 @@ 'custom_properties': {}, 'paid_on_qbo': False, 'payment_number': 'P/2022/05/R/5', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'fund_source': 'PERSONAL', @@ -2087,7 +2108,8 @@ 'exported_at': '2022-05-23T13:03:37.501808Z', 'updated_at': '2022-05-23T13:03:37.502024Z', 'workspace': 3, - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': 10, @@ -2368,7 +2390,8 @@ 'exported_at': '2022-05-23T13:03:15.136482Z', 'updated_at': '2022-05-23T13:03:15.136864Z', 'workspace': 3, - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': 9, @@ -2759,7 +2782,8 @@ 'exported_at': '2022-05-23T13:02:52.066735Z', 'updated_at': '2022-05-23T13:02:52.067152Z', 'workspace': 3, - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': 18, @@ -10035,7 +10059,8 @@ 'Klass': '', }, 'payment_number': 'P/2022/05/R/9', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': 'txW7qE5DUF84', @@ -10091,7 +10116,8 @@ 'Klass': '', }, 'payment_number': 'P/2022/05/R/9', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', }, { 'id': 'txW7qE5DUF85', @@ -10148,6 +10174,7 @@ }, 'payment_number': 'P/2022/05/R/9', 'is_posted_at_null': True, + 'masked_corporate_card_number': '**** 4567', } ], 'expenses': [ @@ -10206,7 +10233,8 @@ 'Klass': '', }, 'payment_number': 'P/2022/05/R/9', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'reimbursements': [ diff --git a/tests/test_workspaces/fixtures.py b/tests/test_workspaces/fixtures.py index ff0ff7d8..2bef885a 100644 --- a/tests/test_workspaces/fixtures.py +++ b/tests/test_workspaces/fixtures.py @@ -130,7 +130,8 @@ 'Klass': '', }, 'payment_number': 'P/2022/05/R/14', - 'is_posted_at_null': False + 'is_posted_at_null': False, + 'masked_corporate_card_number': '**** 4567', } ], 'company_info': {