public IMortgageCalculationResult GetMortgageCalculation(IMortgageCalculationRequest request) { _logger.LogDebug($"{nameof(GetMortgageCalculation)} Request received"); var provider = _mortgageCalculatorProviderFactory.GetProvider(request); return(provider.PerformCalculation()); }
public IMortgageCalculatorProvider GetProvider(IMortgageCalculationRequest request) { switch (request) { case null: throw new ArgumentNullException(nameof(request)); case MortgageCalculationRequest mcRequest: _logger.LogDebug($"{nameof(GetProvider)} is producing a {nameof(CalculateNetCalculatorProvider)} provider"); return(new CalculateNetCalculatorProvider(_loggerFactory, _validationMessageLocalizer, _errorMessageLocalizer, _httpClientProvider, mcRequest)); default: throw new NotImplementedException(_errorMessageLocalizer["MortgageCalculationRequestTypeNotSupported", request.GetType().Name]); } }