示例#1
0
        private void LineItemDelivered(ulong merchantId, string orderId,
                                       OrdersShipLineItemsRequest ship)
        {
            Console.WriteLine("=================================================================");
            Console.WriteLine("Delivered {0} of item {1}", ship.LineItems[0].Quantity,
                              ship.LineItems[0].LineItemId);
            Console.WriteLine("=================================================================");

            var req = new OrdersUpdateShipmentRequest();

            req.Carrier     = ship.Carrier;
            req.TrackingId  = ship.TrackingId;
            req.ShipmentId  = ship.ShipmentId;
            req.Status      = "delivered";
            req.OperationId = NewOperationId();

            var resp = sandboxService.Orders.Updateshipment(req, merchantId, orderId).Execute();

            Console.WriteLine("Finished with status {0}.", resp.ExecutionStatus);
            Console.WriteLine();
        }
示例#2
0
        /// <summary>
        /// Updates a shipment's status, carrier, and/or tracking ID. This method can only be called for non-multi-client accounts.
        /// Documentation https://developers.google.com/shoppingcontent/v2sandbox/reference/orders/updateshipment
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated ShoppingContent service.</param>
        /// <param name="merchantId">The ID of the managing account.</param>
        /// <param name="orderId">The ID of the order.</param>
        /// <param name="body">A valid ShoppingContent v2sandbox body.</param>
        /// <returns>OrdersUpdateShipmentResponseResponse</returns>
        public static OrdersUpdateShipmentResponse Updateshipment(ShoppingContentService service, string merchantId, string orderId, OrdersUpdateShipmentRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (merchantId == null)
                {
                    throw new ArgumentNullException(merchantId);
                }
                if (orderId == null)
                {
                    throw new ArgumentNullException(orderId);
                }

                // Make the request.
                return(service.Orders.Updateshipment(body, merchantId, orderId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Orders.Updateshipment failed.", ex);
            }
        }