From c524e6a47ff8483c59a3f6e329e180e03b4bd863 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 20 Dec 2024 11:32:00 +0530 Subject: [PATCH] Generalized the parameters of `format_and_fetch_deduction_info` (#103) * Generalized the parameters of format and fetch deduction info * ruff fix * review comment fixes * review comment fixes * review comment fixes * ruff fix * Refactored Data Models * ruff fix * Review Comment Fixes * Review Comment Fixes * refactored Unique Id * renamed employees_role_data * company id addition * removed eum * metadata renamed * review comment fixes * review comment fixes * review comment fixes * review comment fixes --------- Co-authored-by: AkshayContributes --- .../process_employees_deductions/data_models.py | 8 ++++++++ .../process_employees_deductions/interface.py | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/flux_sdk/benefits_administration/capabilities/process_employees_deductions/data_models.py b/flux_sdk/benefits_administration/capabilities/process_employees_deductions/data_models.py index 516dd4e9..523c9aa7 100644 --- a/flux_sdk/benefits_administration/capabilities/process_employees_deductions/data_models.py +++ b/flux_sdk/benefits_administration/capabilities/process_employees_deductions/data_models.py @@ -23,3 +23,11 @@ class ExternalDeductionCodeToRipplingCode: rippling_code: str rippling_deduction_field: DeductionCodeField +class EmployeeRoleData: + role_id: str + employee_number: str | None + +class EmployeeDeductionMetadata: + deduction_codes: list[ExternalDeductionCodeToRipplingCode] + employees_role_data: list[EmployeeRoleData] | None + company_id: str | None diff --git a/flux_sdk/benefits_administration/capabilities/process_employees_deductions/interface.py b/flux_sdk/benefits_administration/capabilities/process_employees_deductions/interface.py index 5a8b7b44..c46e0220 100644 --- a/flux_sdk/benefits_administration/capabilities/process_employees_deductions/interface.py +++ b/flux_sdk/benefits_administration/capabilities/process_employees_deductions/interface.py @@ -3,7 +3,7 @@ from flux_sdk.benefits_administration.capabilities.process_employees_deductions.data_models import ( DeductionDetails, - ExternalDeductionCodeToRipplingCode, + EmployeeDeductionMetadata, ) @@ -18,12 +18,14 @@ class ProcessEmployeesDeductions(ABC): @staticmethod @abstractmethod def format_and_fetch_deduction_info( - stream: StringIO, deduction_code_mapping: list[ExternalDeductionCodeToRipplingCode] + stream: StringIO, + metadata: EmployeeDeductionMetadata ) -> list[DeductionDetails]: """ This method receives the file which contains the deductions relevant to the companies employees and returns the deductions details for each employee - :param StringIO: - :param list[ExternalDeductionCodeToRipplingCode]: + :param StringIO: filestream + :param EmployeeDeductionMetadata: contains metadata for the deduction like deduction code mapping + and mappings like employee_id: role_id, and the company's unique id type :return list[DeductionDetails]: """