public static bool IsValid(this ShipStationOrder order) { if (order == null) { return(false); } var shipTo = order.ShippingAddress; if (shipTo == null) { return(false); } if (string.IsNullOrEmpty(shipTo.Name) || string.IsNullOrWhiteSpace(shipTo.Street1) || string.IsNullOrWhiteSpace(shipTo.City) || string.IsNullOrWhiteSpace(shipTo.Country)) { return(false); } var isInUs = shipTo.Country.Equals("US", StringComparison.OrdinalIgnoreCase); if (isInUs && (string.IsNullOrWhiteSpace(shipTo.PostalCode) || string.IsNullOrWhiteSpace(shipTo.State))) { return(false); } return(true); }
public bool Equals( ShipStationOrder other ) { if( ReferenceEquals( null, other ) ) return false; if( ReferenceEquals( this, other ) ) return true; return this.OrderId.Equals( other.OrderId ); }
public bool Equals(ShipStationOrder other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(this.OrderId.Equals(other.OrderId)); }
public async Task UpdateOrderAsync( ShipStationOrder order ) { if( !order.IsValid() ) return; await ActionPolicies.SubmitAsync.Do( async () => { try { await this._webRequestServices.PostDataAsync( ShipStationCommand.CreateUpdateOrder, order.SerializeToJson() ); } catch( WebException x ) { if( x.Response.GetHttpStatusCode() == HttpStatusCode.InternalServerError ) ShipStationLogger.Log.Trace( "Error updating order. Encountered 500 Internal Error. Order: {order}", order ); else throw; } } ); }