tech.deepdreams.worker.services.deduction.ITSServicev2024Impl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of worker-civ-impl Show documentation
Show all versions of worker-civ-impl Show documentation
Payroll Worker API project for Spring Boot
package tech.deepdreams.worker.services.deduction ;
import java.util.Map;
import tech.deepdreams.worker.api.services.DeductionService;
import tech.deepdreams.worker.constants.CIVElementCode;
import tech.deepdreams.worker.constants.LocalConstantCode;
import tech.deepdreams.worker.api.enums.CountryCode;
public class ITSServicev2024Impl implements DeductionService{
public Double calculateEmployee(Map params) {
Double value = (Double) params.get(LocalConstantCode.CODE_GROSS_TAXABLE_SALARY) ;
Double shares = (Double) params.get(LocalConstantCode.CODE_SHARES) ;
Double reduction = 0.0 ;
for (int index = 0 ; index < sharesArray.length ; index++) {
if(Math.abs(sharesArray[index]-shares) < 0.1) {
reduction = reduceAmounts[index] ;
break ;
}
}
return Math.max(0.0, Math.min(value, 240_000.0) - 75_000.0) * 0.016 +
Math.max(0.0, Math.min(value, 800_000.0) - 240_000.0) * 0.21 +
Math.max(0.0, Math.min(value, 2_400_000.0) - 800_000.0) * 0.24 +
Math.max(0.0, Math.min(value, 8_000_000.0) - 2_400_000.0) * 0.28 +
Math.max(0.0, Math.min(value, 999_999_999.0) - 8_000_000.0) * 0.32 - reduction ;
}
public Double calculateEmployer(Map params) {
return 0.0 ;
}
private final double[] sharesArray = new double[] { 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0 } ;
private final double[] reduceAmounts = new double[] { 0.0, 5_500.0, 11_000.0, 16_500.0, 22_000.0, 27_500.0, 33_000.0, 38_500.5, 44_000.0 } ;
public CountryCode country() {
return CountryCode.CIV ;
}
public String code() {
return CIVElementCode.CODE_ITS ;
}
public int version() {
return 2024 ;
}
}