public void CanGetSalesOrdersMappedFromMagento()
        {
            using(var store = new MagentoStore())
            {
                var orders = store.GetNewOrders();
                foreach (var order in orders)
                {
                    Console.WriteLine(order.OrderId + " " + order.NativeId  + " " +
                                      order.DeliveryCustomerName + " " +
                                      order.DeliveryStreet + " " +
                                      order.DeliveryCity + " " +
                                      order.DeliveryState + " " +
                                      order.DeliveryZip + " " +
                                      order.DeliveryCountry + " " +
                                      order.StoreCreatedAt + " " +
                                      order.DeliveryMode

                                     );
                    foreach (var line in order.LineItems) {
                        Console.WriteLine("    -  " + line.ItemSku  + " " +
                                         line.ItemName  + " " +
                                         line.LineNumber  + " " +
                                         line.Price  + " " +
                                         line.Quantity  + " " +
                                         line.StoreTotal  + " " +
                                         line.UnitOfMeasure + " " +
                                         line.LineDiscount
                                         );
                    }
                }
            }
        }
        public void CanGetNewMagentoOrders()
        {
            using(var store = new MagentoStore())
            {
                var soe = store.GetNewMagentoOrders();

                  foreach (salesOrderEntity msoe in soe)
                  {
                      	var orderInfo = store.GetMagentoOrderDetails(msoe.increment_id);
                          Console.WriteLine(orderInfo.order_id  + "::" + orderInfo.increment_id + " :: "
                      	                  + orderInfo.billing_firstname + " " + orderInfo.subtotal + "Number of items: "
                      	                  + orderInfo.items.Length);
                      	orderInfo.items.ToList().ForEach(PrintOrderItem);
                  }
            }
        }
Exemple #3
0
        public void ProcessNewMagentoOrders()
        {
            using(var store = new MagentoStore())
            {
                //1. process updates
                ProcessUpdatedMagentoOrders(store.GetUpdatedOrders());

                //2. do the new orders
                var orders = store.GetNewOrders();
                NLog.LogManager.GetCurrentClassLogger().Info("New magento orders: {0}", orders.Count);
                //don't insert order edited in magento in AX
                //orders.Where(o => !(o.OrderId.Contains("-"))).ToList().ForEach(x => CreateAxSalesOrder(x, "Magento"));
                //still log the edited orders though
                //orders.Where(o => o.OrderId.Contains("-")).ToList().ForEach(x => CreateProcessedOrder(x, "Magento"));
            }
        }
        public void GetLastUpdatedAt()
        {
            using(var store = new MagentoStore())
            {
                var soe = store.GetUpdateMagentoOrders();
                Console.WriteLine("total {0}", soe.Count);
                  foreach (salesOrderEntity msoe in soe)
                  {
                      	var orderInfo = store.GetMagentoOrderDetails(msoe.increment_id);
                          Console.WriteLine(orderInfo.order_id  + "::" + orderInfo.increment_id + " :: "
                      	                  + orderInfo.billing_firstname + " " + orderInfo.subtotal + " Number of items: "
                      	                  + orderInfo.items.Length);
                      	Console.WriteLine("created {0} :: updated {1} :: Status {2}", orderInfo.created_at, orderInfo.updated_at, orderInfo.status);

                  }
            }
        }
 public void ProcessUpdatedMagentoOrdersTest()
 {
     var service = new OrderService();
     var store = new MagentoStore();
     service.ProcessUpdatedMagentoOrders(store.GetUpdatedOrders());
 }