Example #1
0
        public void Check_Customer_Modified_Since()
        {
            IEntity order = new Domain.Order()
            {
                Id            = 1,
                PaymentStatus = PaymentStatus.PartiallyRefunded
            };


            string json = JsonConvert.SerializeObject(order, Formatting.Indented);


            //var client = new Client(this.ApiConfig);
            //var response1 = client.Utilities.GetTime();
            //var date = response1.Data.Item.CurrentTime;

            //var filter = new FilterCustomers();
            //filter.IfModifiedSince = ((DateTime)date).AddMinutes(-10);
            //var response2 = client.Customers.Get(filter);
            //var response3 = client.Customers.Count(filter);
        }
        public void Check_Customer_Modified_Since() {

            IEntity order = new Domain.Order() {
                Id = 1,
                PaymentStatus = PaymentStatus.PartiallyRefunded
            };
            

            string json = JsonConvert.SerializeObject(order, Formatting.Indented);


            //var client = new Client(this.ApiConfig);
            //var response1 = client.Utilities.GetTime();
            //var date = response1.Data.Item.CurrentTime;

            //var filter = new FilterCustomers();
            //filter.IfModifiedSince = ((DateTime)date).AddMinutes(-10);
            //var response2 = client.Customers.Get(filter);
            //var response3 = client.Customers.Count(filter);

        }
        /// <summary>
        /// Converts the response object into MarketplaceOrder object.
        /// Also makes the call to get the items for the order.
        /// </summary>
        /// <param name="order">The given Amazon order object.</param>
        /// <returns>A MarketplaceOrder object</returns>
        private MarketplaceOrder convertOrderResponseToMarketplaceOrder(BigCommerce4Net.Domain.Order order)
        {
            var marketplaceOrder = new MarketplaceOrder()
            {
                BuyerEmail              = order.BillingAddress.Email,
                BuyerName               = string.Format("{0} {1}", order.BillingAddress.FirstName, order.BillingAddress.LastName),
                OrderTotal              = order.SubtotalIncludingTax,
                OrderId                 = order.Id.ToString(),
                Marketplace             = ChannelName,
                ShipServiceLevel        = "Standard",
                ShipmentServiceCategory = "Standard",
                NumOfItemsShipped       = order.ItemsShipped,
                NumOfItemsUnshipped     = order.ItemsTotal - order.ItemsShipped,
                PurchaseDate            = order.DateCreated.HasValue ? order.DateCreated.Value : DateTime.Now,
                LastUpdateDate          = order.DateModified.HasValue ? order.DateModified.Value : DateTime.Now,
                PaymentMethod           = order.PaymentMethod,
                OrderStatus             = MapEISOrderStatusBigCommerce(order.StatusId),
                OrderType               = order.OrderIsDigital ? "DigitalOrder" : "StandardOrder",
                //EarliestShipDate = order.EarliestShipDate,
                //LatestShipDate = order.LatestShipDate,
                //EarliestDeliveryDate = order.EarliestDeliveryDate,
                //LatestDeliveryDate = order.LatestDeliveryDate,
                //MarketplaceId = order.MarketplaceId,
                //PurchaseOrderNumber = order.PurchaseOrderNumber,
                //SalesChannel = order.SalesChannel,
                //SellerOrderId = order.SellerOrderId,
            };

            var shippingAddresses = GetShippingAddresses(order.Id);

            if (order.ShippingAddressCount > 0 && shippingAddresses.Count > 0)
            {
                marketplaceOrder.ShippingAddressLine1  = shippingAddresses.First().Street1;
                marketplaceOrder.ShippingAddressLine2  = shippingAddresses.First().Street2;
                marketplaceOrder.ShippingAddressLine3  = "";
                marketplaceOrder.ShippingCity          = shippingAddresses.First().City;
                marketplaceOrder.ShippingStateOrRegion = shippingAddresses.First().State;
                marketplaceOrder.ShippingPostalCode    = shippingAddresses.First().ZipCode;
                marketplaceOrder.ShippingAddressName   = string.Format("{0} {1}", shippingAddresses.First().FirstName, shippingAddresses.First().LastName);
                marketplaceOrder.ShippingAddressPhone  = shippingAddresses.First().Phone;
                marketplaceOrder.CompanyName           = shippingAddresses.First().Company;
            }
            else
            {
                marketplaceOrder.ShippingAddressLine1  = order.BillingAddress.Street1;
                marketplaceOrder.ShippingAddressLine2  = order.BillingAddress.Street2;
                marketplaceOrder.ShippingAddressLine3  = "";
                marketplaceOrder.ShippingCity          = order.BillingAddress.City;
                marketplaceOrder.ShippingStateOrRegion = order.BillingAddress.State;
                marketplaceOrder.ShippingPostalCode    = order.BillingAddress.ZipCode;
                marketplaceOrder.ShippingAddressName   = string.Format("{0} {1}", order.BillingAddress.FirstName, order.BillingAddress.LastName);
                marketplaceOrder.ShippingAddressPhone  = order.BillingAddress.Phone;
                marketplaceOrder.CompanyName           = order.BillingAddress.Company;
            }

            // Add Order Items
            var orderItems = new List <MarketplaceOrderItem>();

            var orderProducts = GetOrdersProduct(order.Id);

            foreach (var oproduct in orderProducts)
            {
                orderItems.Add(convertOrderItemResponseToMarketplaceOrderItem(oproduct));
            }
            marketplaceOrder.OrderItems = orderItems;

            return(marketplaceOrder);
        }