public Response Send(IHostedPciDataConverter converter, ApiCredentials credentials, BaseRequest request)
 {
     request.SetRequestCredentials(credentials);
     var queryString = converter.ConvertToQueryString(request);
     var responseString = Post(queryString, credentials.GetUrl(request.RequestType));
     return converter.ConvertToResponse(responseString);
 }
        public Response Send(IHostedPciDataConverter converter, ApiCredentials credentials, BaseRequest request,
             out string url, out string rawRquest, out string rawResponse)
        {
            var requestUrl = credentials.GetUrl(request.RequestType);
            
            request.SetRequestCredentials(credentials);
            var queryString = converter.ConvertToQueryString(request);
            var responseString = Post(queryString, requestUrl);
            var response = converter.ConvertToResponse(responseString);
            
            url = requestUrl;
            rawRquest = queryString;
            rawResponse = responseString;

            return response;
        }
        private ActionResult ProcessModelPostRequest(object model, BaseRequest request)
        {
            if (!ModelState.IsValid)
                return View(model);

            string url;
            string rawRequest;
            string rawResponse;

            var response = _service.Send(_converter, _configuration.GetConfigurationSettings(),
                request, out url, out rawRequest, out rawResponse);

            var responseModel = new RequestResultModel(response, url, rawRequest, rawResponse);

            return View("Response", responseModel);
        }