All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.deepdreams.worker.services.deduction.RAVServicev1989Impl Maven / Gradle / Ivy

There is a newer version: 0.1.2-RELEASE
Show newest version
package tech.deepdreams.worker.services.deduction;
import java.util.Arrays;
import java.util.Map;
import tech.deepdreams.worker.api.services.DeductionService;
import tech.deepdreams.worker.api.enums.CountryCode ;
import tech.deepdreams.worker.constants.ElementCode;
import tech.deepdreams.worker.constants.LocalConstantCode;

public class RAVServicev1989Impl implements DeductionService{
	
	
	public Double calculateEmployee(Map params) {
		Double value = (Double) params.get(LocalConstantCode.CODE_GROSS_TAXABLE_SALARY) ;
		
		int rawIndex = Arrays.binarySearch(rangeArray, value) ;
		int index = Math.max(rawIndex >= 0 ? rawIndex - 1 : -1 * (rawIndex + 1) - 1, 0) ;
		
		return valueArray[index] ;
	}

	
	public Double calculateEmployer(Map params) {
		return 0.0 ;
	}
	
	
	public CountryCode country() {
		return CountryCode.CMR ;
	}
	
	public String code() {
		return ElementCode.CODE_RAV ;
	}
	
	public int version() {
		return 1989 ;
	}
	
	private Double[] rangeArray = new Double[] { 0.0, 50_000.0, 100_000.0, 200_000.0, 300_000.0, 400_000.00, 
			500_000.00, 600_000.00, 700_000.00, 800_000.00, 900_000.00, 1_000_000.00, 999_999_999.0 } ;
	
	private Double[] valueArray = new Double[] { 0.0, 700.0, 1_950.0, 3_250.0, 4_550.0, 5_850.0, 7_150.0, 8_450.0,
			9_750.0, 11_050.0, 12_350.0, 13_000.0 } ;
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy