/// <summary> /// Register that a shipment has been shipped. /// </summary> /// <param name="shipDate">Date the shipment has been shipped.</param> /// <param name="updateGoogleCheckout">If the order associated with this shipment is a GoogleCheckout /// order, this flag indicates whether to send an update notification to GoogleCheckout or not.</param> public void Ship(DateTime shipDate, bool updateGoogleCheckout) { this.ShipDate = shipDate; this.Save(); //FORCE ASSOCIATED ORDER TO RELOAD FROM DATABASE this._Order = OrderDataSource.Load(this.OrderId, false); //TRIGGER THE SHIPMENT SHIPPED EVENT Stores.StoreEventEngine.ShipmentShipped(this); //RECALCULATE SHIPMENT STATUS this.Order.RecalculateShipmentStatus(); //if the order was a google checkout order, update gooogle checkout if (updateGoogleCheckout) { if (!string.IsNullOrEmpty(this.Order.GoogleOrderNumber)) { GoogleCheckout instance = GoogleCheckout.GetInstance(); TrackingNumber number = GetLastTrackingNumber(); string carrier = GetGCCarrier(number); string trNumber = (number == null || string.IsNullOrEmpty(number.TrackingNumberData)) ? null : number.TrackingNumberData; instance.AddTrackingData(this.Order.GoogleOrderNumber, carrier, trNumber); //If order has not yet shipped completely, notify that it is under processing if (this.Order.ShipmentStatus == OrderShipmentStatus.Unshipped || this.Order.ShipmentStatus == OrderShipmentStatus.Unspecified) { instance.ProcessOrder(this.Order.GoogleOrderNumber); } } } }