示例#1
0
        public Dictionary <Guid, decimal> Execute(MaternityBenefitsCase simulationCase, IEnumerable <MaternityBenefitsPerson> persons)
        {
            var rule = new Rule.MaternityBenefitsCase()
            {
                NumWeeks        = simulationCase.NumWeeks,
                MaxWeeklyAmount = simulationCase.MaxWeeklyAmount,
                Percentage      = simulationCase.Percentage
            };

            var rulePersons = persons.Select(x => new Rule.MaternityBenefitsPerson()
            {
                Id            = x.Id,
                AverageIncome = x.AverageIncome
            }).ToList();

            var rulesReq = new Rule.MaternityBenefitsBulkRequest()
            {
                Rule    = rule,
                Persons = rulePersons
            };

            var result = _rulesApi.Execute <Rule.MaternityBenefitsBulkResponse>(ENDPOINT, rulesReq);

            return(result.ResponseDict.ToDictionary(x => x.Key, y => y.Value.Amount));
        }
示例#2
0
        public decimal Execute(MaternityBenefitsCase simulationCase, MaternityBenefitsPerson person)
        {
            var rule = new Rule.MaternityBenefitsCase()
            {
                NumWeeks        = simulationCase.NumWeeks,
                MaxWeeklyAmount = simulationCase.MaxWeeklyAmount,
                Percentage      = simulationCase.Percentage
            };
            var rulePerson = new Rule.MaternityBenefitsPerson()
            {
                AverageIncome = person.AverageIncome
            };
            var rulesReq = new Rule.MaternityBenefitsRequest()
            {
                Rule   = rule,
                Person = rulePerson
            };

            var result = _rulesApi.Execute <Rule.MaternityBenefitsResponse>(ENDPOINT, rulesReq);

            return(result.Amount);
        }