Esempio n. 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);
        }
Esempio n. 2
0
            private async Task <HttpResponseMessage> UpdateEcommerceProduct(Module module)
            {
                var product = new EcommerceItem {
                    product = new ProductItem {
                        id    = module.EcommerceId,
                        title = module.Title
                    }
                };

                return(await Woocommerce.UpdateProduct(
                           product, _configuration
                           ));
            }
Esempio n. 3
0
            private async Task <HttpResponseMessage> UpdateEcommerceProduct(Track track, long ecommerceId)
            {
                var product = new EcommerceItem {
                    product = new ProductItem {
                        id    = ecommerceId,
                        title = track.Title
                    }
                };

                return(await Woocommerce.UpdateProduct(
                           product, _configuration
                           ));
            }
Esempio n. 4
0
            private async Task <HttpResponseMessage> CreateEcommerceProduct(Module module)
            {
                var product = new EcommerceItem {
                    product = new ProductItem {
                        visible       = false,
                        title         = module.Title,
                        type          = "simple",
                        regular_price = "0",
                        description   = module.Excerpt
                    }
                };

                return(await Woocommerce.CreateProduct(
                           product, _configuration
                           ));
            }
Esempio n. 5
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);
            }