Exemple #1
0
        public void ShouldBeAbleToCreateRegisterSale()
        {
            var register = new VendApi(this.Url, this.Username, this.Password).GetRegisters().First(r => r.Name == "Main Register");
            var products = new VendApi(this.Url, this.Username, this.Password).GetProducts(Product.OrderBy.name, false, true);
            var product1 = products.First(p => p.Handle == this.Product1);
            var product2 = products.First(p => p.Handle == this.Product2);

            var registerSale = new RegisterSale
            {
                RegisterId           = register.Id,
                CustomerId           = "null",
                SaleDate             = DateTime.UtcNow.ToString("u"),
                UserName             = "******",
                TotalPrice           = product1.Price + (product2.Price * 2),
                TotalTax             = product1.Tax + (product2.Tax * 2),
                TaxName              = "GST",
                Status               = "SAVED",
                InvoiceNumber        = "102",
                InvoiceSequence      = 102,
                Note                 = null,
                RegisterSaleProducts =
                    new[]
                {
                    new RegisterSaleProduct
                    {
                        ProductId = product1.Id,
                        Quantity  = 1,
                        Price     = product1.Price,
                        Tax       = product1.Tax,
                        TaxId     = product1.TaxId,
                        TaxTotal  = product1.Tax
                    },
                    new RegisterSaleProduct
                    {
                        ProductId = product2.Id,
                        Quantity  = 2,
                        Price     = product2.Price,
                        Tax       = product2.Tax,
                        TaxTotal  = product2.Tax * 2
                    }
                }
            };

            var savedRegisterSale = new VendApi(this.Url, this.Username, this.Password).SaveRegisterSale(registerSale);

            Assert.IsNotNull(savedRegisterSale);
            Assert.AreNotEqual(Guid.Empty, savedRegisterSale.Id);
        }
Exemple #2
0
        public void ShouldBeAbleToPostASockTransfer()
        {
            var vendApi   = new VendApi(this.Url, this.Username, this.Password);
            var registers = vendApi.GetRegisters();
            var products  = new VendApi(this.Url, this.Username, this.Password).GetProducts(Product.OrderBy.name, false, true);
            var product1  = products.First(p => p.Handle == this.Product1);
            var product2  = products.First(p => p.Handle == this.Product2);

            var mainRegister = registers.First(r => r.Name == "Main Register");

            Assert.IsNotNull(mainRegister, "This test requires that the main register exists.");
            var consignment = new StockTransfer
            {
                Name           = "New Name",
                Date           = DateTime.UtcNow.ToString("u"),
                Type           = "OUTLET",
                OutletId       = mainRegister.OutletId,
                SourceOutletId = mainRegister.OutletId,
                Status         = "OPEN",
            };

            vendApi.SaveStockTransfer(consignment);
        }