public override int GetHashCode() { unchecked { var hashCode = Billing != null?Billing.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (CartHash != null ? CartHash.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CartTax != null ? CartTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CreatedVia != null ? CreatedVia.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerId; hashCode = (hashCode * 397) ^ (CustomerIpAddress != null ? CustomerIpAddress.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CustomerNote != null ? CustomerNote.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CustomerUserAgent != null ? CustomerUserAgent.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DiscountTax != null ? DiscountTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DiscountTotal != null ? DiscountTotal.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ (Number != null ? Number.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OrderKey != null ? OrderKey.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ParentId; hashCode = (hashCode * 397) ^ (PaymentMethod != null ? PaymentMethod.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PaymentMethodTitle != null ? PaymentMethodTitle.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PricesIncludeTax.GetHashCode(); hashCode = (hashCode * 397) ^ (Shipping != null ? Shipping.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShippingTax != null ? ShippingTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShippingTotal != null ? ShippingTotal.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Total != null ? Total.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TotalTax != null ? TotalTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); return(hashCode); } }
private T Execute <T>(RestRequest request) where T : new() { var client = new RestClient(BaseUrl); client.ClearHandlers(); client.AddHandler("application/json", new JsonDeserializer()); client.AddDefaultParameter("Accept-Encoding", "gzip,deflate", ParameterType.HttpHeader); request.AddParameter("apiKey", ApiKey); request.AddParameter("cid", Cid); request.AddParameter("minorRev", MinorRev); request.AddParameter("currencyCode", CurrencyCode); request.AddParameter("locale", Locale); request.AddParameter("sig", Sig); if (CustomerUserAgent.HasValue()) { request.AddParameter("customerUserAgent", CustomerUserAgent); } if (CustomerSessionId.HasValue()) { request.AddParameter("customerSessionId", CustomerSessionId); } if (CustomerIpAddress.HasValue()) { request.AddParameter("customerIpAddress", CustomerIpAddress); } request.Parameters.ForEach(p => Debug.WriteLine(p.Name + "=" + p.Value)); // This is a fix for the RestSharp Deserialiser // Not a long term fix // Better to migrate from RestSharp Json Deserialiser to Json.NET Deserialiser // and decorate our classes with properties request.OnBeforeDeserialization = removeAttributeSymbol; var response = client.Execute <T>(request); if (response.ErrorException != null) { throw response.ErrorException; } return(response.Data); }