public ChangedRateInfo GetNewRateCustomerData(Int64 AgreementID, EBaseRateCode newBaseRateCode)
        {
            ChangedRateInfo result = new ChangedRateInfo();

            if (AgreementID != 0)
            {
                var agreement = _agreememtRepository.GetAgreementById(AgreementID);

                if (agreement == null || agreement.Customer == null)
                {
                    throw new RCException(ErrorCode.DataNotFound, "Agreement not found");
                }

                decimal newBasicRateValue      = _baseRateValueExtractor.RetrieveBasicRateValueAsync(newBaseRateCode).Result;
                decimal originalBasicRateValue = _baseRateValueExtractor.RetrieveBasicRateValueAsync(agreement.BaseRateCode).Result;

                result.Agreement = new AgreementInfo(agreement);
                result.Person    = new PersonInfo(agreement.Customer);

                result.OriginalInterestRate = _impactEvaluator.CalculateInterestRate(originalBasicRateValue, agreement.Margin);
                result.NewInterestRate      = _impactEvaluator.CalculateInterestRate(newBasicRateValue, agreement.Margin);
            }

            return(result);
        }
Beispiel #2
0
        public HttpResponseMessage GetEvaluatedImpactInfo([FromUri] Int64 agreementId, [FromUri] EBaseRateCode newBaseRateCode)
        {
            HttpStatusCode  statusCode      = HttpStatusCode.OK;
            ChangedRateInfo changedRateInfo = new ChangedRateInfo();

            changedRateInfo = _ratesCalculationSerivce.GetNewRateCustomerData(agreementId, newBaseRateCode);

            return(this.Request.CreateResponse(statusCode, changedRateInfo));
        }