Exemple #1
0
        private async Task <EcommerceResponse> GetEcommerceOrder(long orderId)
        {
            var response = await Woocommerce.GetOrderById(
                orderId, _configuration
                );

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var content = await response.Content.ReadAsStringAsync();

                //var parsed = JObject.Parse(content);
                return(JsonConvert.DeserializeObject <EcommerceResponse>(
                           content
                           ));
            }
            else
            {
                string content = await response.Content.ReadAsStringAsync();

                var exc = new Exception($"order-not-found: {content}");
                SentrySdk.CaptureException(exc);
            }

            return(null);
        }
Exemple #2
0
            private async Task <EcommerceResponse> GetEcommerceOrder(long orderId, CancellationToken token)
            {
                var response = await Woocommerce.GetOrderById(
                    orderId, _configuration
                    );

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    var parsed = JObject.Parse(content);
                    return(JsonConvert.DeserializeObject <EcommerceResponse>(
                               content
                               ));
                }
                else
                {
                    string content = await response.Content.ReadAsStringAsync();
                    await CreateErrorLog("order-not-found", content, token);
                }

                return(null);
            }