Example #1
0
        public async Task <ErpQuoteDto> GetQuote(ErpQuoteDto erpQuoteDto)
        {
            var body = JsonConvert.SerializeObject(erpQuoteDto);

            using var responseMessage =
                      await _requestProvider.SendAsync(Constants.ErpPricesUrl, HttpMethod.Post, null, body);

            if (!_requestProvider.IsSuccess(responseMessage))
            {
                throw new InvalidHttpResponseException("Error trying to quote price from the ERP service.",
                                                       responseMessage.StatusCode);
            }
            var stream = await responseMessage.Content.ReadAsStreamAsync();

            return(await _requestProvider.ReadJsonStream <ErpQuoteDto>(stream));
        }