public async Task <Result <ConversionRateDto> > Handle(GetConversionRateQuery query) { var validationResult = ValdateQuery(query); if (validationResult.IsFailure) { return(Result.Failure <ConversionRateDto>(validationResult.Error)); } var fxDate = _dateTimeProvider.UtcNow.ToString("yyyy-MM-dd"); var response = await _currencyRateClient.GetConversionRate(fxDate, query.TransactionCurrency, query.BillingCurrency, query.TransactionAmount); if (response.IsFailure()) { return(Result.Failure <ConversionRateDto>(response.Data?.ErrorMessage)); } var conversionRate = new ConversionRateDto { TransactionAmount = query.TransactionAmount, TransactionCurrency = query.TransactionCurrency, ConversionRate = response.Data.ConversionRate.GetValueOrDefault(), BillingAmount = response.Data.CrdhldBillAmt.GetValueOrDefault(), BillingCurrency = response.Data.CrdhldBillCurr }; return(Result.Success(conversionRate)); }