public ValidateResponse DoValidate(ValidateData validatePayment) { ValidateResponse response = null; Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("apikey", this.validateApiKey); headers.Add("X-Consumer-Username", this.merchant); headers.Add("Cache-Control", "no-cache"); this.restClientValidate = new RestClient(this.request_host + "/web/", headers, CONTENT_TYPE_APP_JSON); RestResponse result = this.restClientValidate.Post("validate", ValidateData.toJson(validatePayment)); if (!String.IsNullOrEmpty(result.Response)) { response = JsonConvert.DeserializeObject <ValidateResponse>(result.Response); } response.statusCode = result.StatusCode; if (result.StatusCode != STATUS_CREATED) { if (isErrorResponse(result.StatusCode)) { throw new ValidateResponseException(result.StatusCode.ToString(), JsonConvert.DeserializeObject <ErrorResponse>(result.Response)); } else { throw new ValidateResponseException(result.StatusCode + " - " + result.Response, response); } } return(response); }