public async Task ProductOptionsQuantityUpdatedV3Async()
        {
            var service = this.BigCommerceFactory.CreateProductsService(this.ConfigV3);

            var productToUpdate = new BigCommerceProductOption {
                ProductId = 45, Id = 53, Quantity = "6"
            };
            await service.UpdateProductOptionsAsync(new List <BigCommerceProductOption> {
                productToUpdate
            }, CancellationToken.None);
        }
Exemplo n.º 2
0
        public async Task ProductOptionsQuantityUpdatedAsync()
        {
            var service = this.BigCommerceFactory.CreateProductsService(this.Config);

            var productToUpdate = new BigCommerceProductOption {
                ProductId = 75, Id = 4, Quantity = "6"
            };
            await service.UpdateProductOptionsAsync(new List <BigCommerceProductOption> {
                productToUpdate
            });
        }
        public void ProductOptionsQuantityUpdatedV3()
        {
            var service = this.BigCommerceFactory.CreateProductsService(this.ConfigV3);

            var productToUpdate = new BigCommerceProductOption {
                ProductId = 45, Id = 53, Quantity = "6"
            };

            service.UpdateProductOptions(new List <BigCommerceProductOption> {
                productToUpdate
            });
        }
        private async Task UpdateProductOptionQuantityAsync(BigCommerceProductOption productOption)
        {
            var endpoint = ParamsBuilder.CreateProductOptionUpdateEndpoint(productOption.ProductId, productOption.Id);
            var jsonContent = new { inventory_level = productOption.Quantity }.ToJson();

            await ActionPolicies.SubmitAsync.Do(async() =>
            {
                await this._webRequestServices.PutDataAsync(BigCommerceCommand.UpdateProduct, endpoint, jsonContent);

                //API requirement
                this.CreateApiDelay().Wait();
            });
        }
        public async Task ProductOptionsQuantityUpdatedV3Async()
        {
            var service           = this.BigCommerceFactory.CreateProductsService(this.ConfigV3);
            var testProduct       = this.GetProductBySkuV3(testProductWithOptionsSku);
            var testProductOption = this.GetProductOptionBySku(testProduct, testProductOptionSku);
            var newOptionQuantity = new Random().Next(1, 100);

            var productToUpdate = new BigCommerceProductOption()
            {
                ProductId = testProduct.Id,
                Id        = testProductOption.Id,
                Quantity  = newOptionQuantity.ToString()
            };

            await service.UpdateProductOptionsAsync(new List <BigCommerceProductOption> {
                productToUpdate
            }, CancellationToken.None);

            var updatedProduct       = this.GetProductBySkuV3(testProductWithOptionsSku);
            var updatedProductOption = this.GetProductOptionBySku(updatedProduct, testProductOptionSku);

            updatedProductOption.Quantity.Should().Be(newOptionQuantity.ToString());
        }