Пример #1
0
        public AmortizationScheduleResponseDto Calculate(AmortizationScheduleRequestDto request)
        {
            var response = new AmortizationScheduleResponseDto();

            var validator = new GermanyValidator();

            var validationResult = validator.Validate(request);

            if (!validationResult.IsValid)
            {
                response = validationResult.ToErrorEntiti <ValidationResult, AmortizationScheduleResponseDto>();

                return(response);
            }
            response.Status = 200;

            InitPeriods(ref response, request.AmortizationSchedule.NumberPayments);

            var previousPeriod = new PeriodEntiti();

            response.AmortizationSchedule.PeriodsList.ToList().ForEach(period =>
            {
                CalculatePeriod(ref period, request, previousPeriod);

                previousPeriod = period;
            });

            return(response);
        }
 public GermanyValidatorTests()
 {
     _germanyValidator = new GermanyValidator();
 }