public LoanProposalDto ProposeLoan(ProposeLoanDto dto) { if (dto.Principal <= 0 || dto.Principal > _loanInputRequirements.CustomerMaximumPrincipal) { throw new LoanException("principal amount is incorrect"); } if (dto.Months <= 0 || dto.Months > _loanInputRequirements.MaximumLoanPeriodInMonths) { throw new LoanException("loan period is incorrect"); } var loanSpecification = new LoanSpecification { OriginalPrincipal = dto.Principal, DurationInMonths = dto.Months, CompoundFrequency = CompoundFrequency.Monthly, AnnualInterestRate = _bankInterestProvider.AnnualInterestRate }; var loan = _loanFactory.CreateLoan(loanSpecification); return(_loanMapper.Map(loan)); }
public ActionResult <LoanProposalDto> ProposeLoan([FromQuery] ProposeLoanDto proposeLoanDto) => OkOrNotFound(_loanService.ProposeLoan(proposeLoanDto));