diff --git a/flux_sdk/pension/utils/ascensus.py b/flux_sdk/pension/utils/ascensus.py index cdaa5c38..82ab0b97 100644 --- a/flux_sdk/pension/utils/ascensus.py +++ b/flux_sdk/pension/utils/ascensus.py @@ -5,7 +5,7 @@ from decimal import ROUND_HALF_UP, Decimal from enum import Enum from io import IOBase, StringIO -from typing import Optional, Union +from typing import Any, Optional, Union from flux_sdk.flux_core.data_models import ( ContributionType, @@ -420,17 +420,17 @@ def _create_eds_for_value( percentage: bool, ssn: str, effective_date: datetime, - ): + ) -> EmployeeDeductionSetting: eds = EmployeeDeductionSetting() eds.ssn = ssn eds.effective_date = effective_date eds.deduction_type = deduction_type - eds.value = Decimal(value) #type: ignore + eds.value = Decimal(value) # type: ignore eds.is_percentage = percentage return eds @staticmethod - def _is_valid_amount(value): + def _is_valid_amount(value) -> bool: try: Decimal(value) return True @@ -452,11 +452,15 @@ def get_deduction_type(given_ded_type) -> Optional[DeductionType]: return ded_match_map.get(given_ded_type, None) @staticmethod - def _parse_deduction_rows(row, result): + def _parse_deduction_rows( + row: dict[str, Any], result: list[EmployeeDeductionSetting] + ) -> list[EmployeeDeductionSetting]: ssn = row["EmployeeSSN"] deduction_type = UpdateDeductionElectionsAscensusUtil.get_deduction_type(row["ContributionCode"]) eligibility_date = ( - datetime.strptime(row["EmployeeEligibilityDate"], "%m%d%Y").date() if row["EmployeeEligibilityDate"] else "" + datetime.strptime(row["EmployeeEligibilityDate"], "%m%d%Y") + if row["EmployeeEligibilityDate"] + else datetime.now() ) if ( @@ -479,7 +483,7 @@ def _parse_deduction_rows(row, result): return result @staticmethod - def _parse_loan_rows(row, ssn_to_loan_sum_map): + def _parse_loan_rows(row: dict[str, Any], ssn_to_loan_sum_map: dict[str, Decimal]) -> dict[str, Decimal]: ssn = row["EmployeeSSN"] if UpdateDeductionElectionsAscensusUtil._is_valid_amount(row["LoanPaymentAmount"]): loan_value = Decimal(row["LoanPaymentAmount"]) @@ -502,7 +506,7 @@ def parse_deductions_for_ascensus(uri: str, stream: IOBase) -> list[EmployeeDedu result: list[EmployeeDeductionSetting] = [] try: - reader = csv.DictReader(stream) #type: ignore + reader = csv.DictReader(stream) # type: ignore except Exception as e: logger.error(f"[UpdateDeductionElectionsImpl.parse_deductions] Parse deductions failed due to message {e}") return result diff --git a/flux_sdk/pension/utils/tests/test_ascensus/test_ascensus_360.py b/flux_sdk/pension/utils/tests/test_ascensus/test_ascensus_360.py index d54df2bb..44fde487 100644 --- a/flux_sdk/pension/utils/tests/test_ascensus/test_ascensus_360.py +++ b/flux_sdk/pension/utils/tests/test_ascensus/test_ascensus_360.py @@ -21,8 +21,8 @@ def get_file_data_for_test_update_deduction(self, date): "D,222222-00000,DOE,JOHN,,{},03312019,401K,10.00,0.00,5102022,,,,\n" "D,222222-00000,DOE,JOHN,,{},03312019,4ROTH,0,2.00,,,,,\n" "D,222222-00000,DOE,JOHN,,{},03312019,401K,5.00,0.00,,,,,,\n" - "D,222222-00000,DOE,JOHN,,{},03312019,4ROTH,0,1.00,,,,,\n" - "L,222222-00000,DOE,JOHN,,{},04122018,401L,,,,20181031922XXX,00000000101.19 ,00000005524.17,\n" + "D,222222-00000,DOE,JOHN,,{},03312019,4ROTH,0,1.00,,03312019,,,\n" + "L,222222-00000,DOE,JOHN,,{},04122018,401L,,,03312019,20181031922XXX,00000000101.19 ,00000005524.17,\n" "L,222222-00000,DOE,JOHN,,{},04192018,401L,,,,20180817923XXX,00000000061.30 ,00000007171.35,\n" "L,222222-00000,DOE,JOHN,,{},04122018,401L,,,,20181031924XXX,00000000100.00 ,00000005524.17,\n" "L,222222-00000,DOE,JOHN,,{},04192018,401L,,,,20180817925XXX,00000000100.00 ,00000007171.35,\n" diff --git a/pyproject.toml b/pyproject.toml index 90a4ba07..13a264d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "rippling-flux-sdk" -version = "0.19" +version = "0.20" description = "Defines the interfaces and data-models used by Rippling Flux Apps." authors = ["Rippling Apps "] readme = "README.md"