Esempio n. 1
0
        public List <byte> RetrieveDocument(long caseId, string documentId)
        {
            try
            {
                ConfigureCommunication();
                var responseContent = _communication.Get(
                    string.Format(ServiceRoute + "/retrieve/{0}/{1}", caseId, documentId));
                var contentType   = responseContent.GetContentType();
                var responseBytes = responseContent.GetByteData();
                if (!"image/tiff".Equals(contentType))
                {
                    var responseString = ChargebackUtils.BytesToString(responseBytes);
                    var docErrorResponse
                        = ChargebackUtils.DeserializeResponse <chargebackDocumentUploadResponse>(responseString);
                    throw new ChargebackDocumentException(docErrorResponse.responseMessage, docErrorResponse.responseCode, responseString);
                }

                return(responseBytes);
            }
            catch (WebException we)
            {
                throw ChargebackDocumentWebException(we, "Retrieve");
            }
        }
 private string SendRetrievalRequest(string urlRoute)
 {
     try
     {
         ConfigureCommunication();
         var responseContent = _communication.Get(urlRoute);
         var receivedBytes   = responseContent.GetByteData();
         var xmlResponse     = ChargebackUtils.BytesToString(receivedBytes);
         ChargebackUtils.PrintXml(xmlResponse, Config.Get("printXml"), Config.Get("neuterXml"));
         return(xmlResponse);
     }
     catch (WebException we)
     {
         throw ChargebackRetrievalWebException(we);
     }
 }