Example #1
0
        private bool TryParseMarketPlaceError(string jsonResponse, out MarketPlaceError error)
        {
            // Check expected error keywords presence :
            if (!jsonResponse.Contains("error") ||
                !jsonResponse.Contains("message") ||
                !jsonResponse.Contains("code"))
            {
                error = null;
                return(false);
            }

            ICollection <ValidationError> errors = _schema.Validate(jsonResponse);

            if (errors.Count > 0)
            {
                error = null;
                return(false);
            }

            // Try to deserialize :
            try
            {
                error = JsonConvert.DeserializeObject <MarketPlaceError>(jsonResponse);
                return(true);
            }
            catch
            {
                error = null;
                return(false);
            }
        }
Example #2
0
        private bool TryParseMarketPlaceError(string jsonResponse, out MarketPlaceError error)
        {
            // Check expected error keywords presence :
            if (!jsonResponse.Contains("error") ||
                !jsonResponse.Contains("message") ||
                !jsonResponse.Contains("code"))
            {
                error = null;
                return(false);
            }

            JObject jsonObject = JObject.Parse(jsonResponse);

            if (!jsonObject.IsValid(_schema))
            {
                error = null;
                return(false);
            }

            // Try to deserialize :
            try
            {
                error = JsonConvert.DeserializeObject <MarketPlaceError>(jsonResponse);
                return(true);
            }
            catch
            {
                error = null;
                return(false);
            }
        }
 public async Task <Order> ChangeOrder(string orderId, MarketPlaceError marketPlaceError)
 {
     return(await _apiClient.ChangeOrder(orderId, marketPlaceError).ConfigureAwait(false));
 }
 public MarketPlaceException(MarketPlaceError marketPlaceError)
 {
     MarketPlaceError = marketPlaceError;
 }