public HttpResponseMessage Post([FromBody] VendHookPost value) { var customer = value.payload.FromJson <Customer>(); System.Diagnostics.Debug.WriteLine(customer.ContactFirstName + " " + customer.ContactLastName + " has changed"); return(this.Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage Post([FromBody] VendHookPost value) { var product = value.payload.FromJson <Product>(); System.Diagnostics.Debug.WriteLine(product.Handle + " has been updated"); return(this.Request.CreateResponse(HttpStatusCode.OK)); }
// {"TEST":"WARNING: THIS IS A TEST PAYLOAD ONLY. THESE IDs ARE NOT VALID FOR THIS RETAILER","id":"d36b12d7-2d43-11e2-8057-080027706aa2","product_id":"a0c0df02-2d20-11e2-8057-080027706aa2","outlet_id":"9ae97219-2d20-11e2-8057-080027706aa2","attributed_cost":"1","count":"-3","product":{"id":"a0c0df02-2d20-11e2-8057-080027706aa2","sku":"SODA","handle":"SODA_BLUE","source":"USER","active":"1","name":"Soda (Blue)","description":""},"outlet":{"id":"9ae97219-2d20-11e2-8057-080027706aa2","name":"Our retail store","time_zone":"Pacific\/Auckland"}} // /// <summary> /// </summary> /// <param name="value"></param> /// <returns></returns> public HttpResponseMessage Post([FromBody] VendHookPost value) { var inventory = value.payload.FromJson <Inventory>(); System.Diagnostics.Debug.WriteLine(inventory.Product + " change " + inventory.Count); return(this.Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage Post([FromBody] VendHookPost value) { lock (this) { var registerSale = value.payload.FromJson <RegisterSale>(); if (registerSale.RegisterSalePayments != null) { var lastPayment = registerSale.RegisterSalePayments.Last(); if (lastPayment != null && lastPayment.PaymentTypeId == "1") { System.Diagnostics.Debug.WriteLine("Cash sale found. Opening Cash Drawer"); } } var api = new VendAPI.VendApi( ConfigurationManager.AppSettings["Url"], ConfigurationManager.AppSettings["Username"], ConfigurationManager.AppSettings["Password"]); var printList = new List <Product>(); var products = api.GetProducts(Product.OrderBy.id, false, true); foreach (var registerSaleProduct in registerSale.RegisterSaleProducts) { var product = products.FirstOrDefault(p => p.Id == registerSaleProduct.ProductId); if (product != null && product.Type == "Food" && !this.PrintedRegisterSales.ContainsKey(registerSaleProduct.Id)) { printList.Add(product); PrintedRegisterSales.Add(registerSaleProduct.Id, registerSaleProduct.Id); } } if (printList.Count > 0) { var tableName = "Counter Sale"; if (!string.IsNullOrEmpty(registerSale.CustomerName)) { tableName = registerSale.CustomerName; } else if (!string.IsNullOrEmpty(registerSale.CustomerId) && registerSale.CustomerId != Guid.Empty.ToString()) { var customer = api.GetCustomer(registerSale.CustomerId); if (customer != null && customer.ContactFirstName != null && customer.ContactLastName != null) { tableName = customer.ContactFirstName + " " + customer.ContactLastName; } else { tableName = "WALKIN"; } } this.PrintToKitchen(registerSale, tableName, printList); } } return(this.Request.CreateResponse(HttpStatusCode.OK)); }