Example #1
0
        public OrderFetcher GetFecther(List<Order> orders)
        {
            OrderFetcher fetcher = new OrderFetcher(service, merchantId, new string[] { marketplaceId });
            fetcher.ProcessOrder += delegate(Order order)
            {
                orders.Add(order);
                NLog.LogManager.GetCurrentClassLogger().Info(order.ToString());
            };

            return fetcher;
        }
Example #2
0
        public void GetOrderItems(SalesOrder salesOrder)
        {
            salesOrder.DeliveryMode = "Standard";
            salesOrder.ShippingMethodDescription = "Standard";
            salesOrder.ShippingChargeCode = "FREIGHT";

            OrderFetcher fetcher = new OrderFetcher(service, merchantId, new string[] { marketplaceId });
            var orderService = new OrderService();
            fetcher.FetchOrderItems(salesOrder.NativeId, delegate(OrderItem item)
            {
                NLog.LogManager.GetCurrentClassLogger().Info(item.ToString());
                if(item.IsSetShippingPrice())
                    salesOrder.ShippingChargeAmount += Decimal.Parse(item.ShippingPrice.Amount);
                var quantityOrdered = item.IsSetQuantityOrdered() ? item.QuantityOrdered : 0;
                if(!item.IsSetItemPrice() && quantityOrdered == 0)
                    NLog.LogManager.GetCurrentClassLogger().Error("Amazon, Assuming Line is Cancelled.  Item Price and Quantity not set for Order {0} Item SKU {1} Quantity Ordered {2}",salesOrder.OrderId,item.SellerSKU, quantityOrdered);
                else
                    salesOrder.AddLineItem(item.SellerSKU,item.Title,item.QuantityOrdered,decimal.Parse(item.ItemPrice.Amount) /  item.QuantityOrdered,
                                          decimal.Parse(item.ItemPrice.Amount),
                                           orderService.GetItemSalesUoM(item.SellerSKU),
                                           orderService.GetItemPrice(item.SellerSKU));
            });
        }