public ApiDocument getDocInfoByEvent(Event e) { GetDocInfoRequest req = null; GetDocInfoResponse resp = null; GetContentResponse content = null; try { req = new GetDocInfoRequest(authToken, e.document_id); resp = (GetDocInfoResponse)Http2.post <GetDocInfoResponse>("https://api-service.edi.su/Api/Dixy/TimeLine/GetDocData", req); if (resp.intCode == 200) { content = getDocumentContent(e); resp.document.file_body = content.body; resp.document.sign_body = content.sign; return(resp.document); } return(null); } catch (Exception ex) { Logger.log("error while processing [" + e.document_id + "]"); Logger.log(resp.varMessage); Logger.log(ex.Message); return(null); } }
/* pdf print form */ public string GetPdf(string id) { string mode = "SENT"; GetPdfRequest req = new GetPdfRequest(authToken, id, mode); GetPdfResponse resp; try { resp = (GetPdfResponse)Http2.post <GetPdfResponse>("https://api-service.edi.su/Api/Dixy/PrintForm/Generate", req); if (resp.intCode != 200) { throw new Exception(resp.varMessage); } } catch (Exception e) { mode = "RECIEVED"; req = new GetPdfRequest(authToken, id, mode); resp = (GetPdfResponse)Http2.post <GetPdfResponse>("https://api-service.edi.su/Api/Dixy/PrintForm/Generate", req); } if (resp.intCode != 200) { throw new Exception(resp.varMessage); } return(resp.form); }
public Ticket TicketTorg(string thumbprint, string fileName) { CreateAnswerResponse response = null; try { string uuid = fileName.Split('_')[5].Replace(".xml", ""); ExCert cert = GetExCertificate(thumbprint); ExSigner signer = new ExSigner(cert); CreateAnswerRequest req = new CreateAnswerRequest(authToken, uuid, new AnswerData(signer)); response = (CreateAnswerResponse)Http2.post <CreateAnswerResponse>("https://api-service.edi.su/Api/Dixy/Ticket/Generate", req); if (response.intCode != 200) { Logger.log("for file [" + fileName + "] :" + response.varMessage); return(null); } string name = GetIDFileFromTicket(response.content); byte[] body = Utils.Base64DecodeToBytes(response.content, "windows-1251"); return(new Ticket(name, body)); } catch (Exception ex) { Logger.log("for file [" + fileName + "] :" + response.varMessage); Logger.log(ex.Message); return(null); } }
public Event[] getAllBindedEventsInChain(string varDocGuid) { GetTimeLineRequest req = new GetTimeLineRequest(authToken, varDocGuid, true); GetTimeLineResponse resp = (GetTimeLineResponse)Http2.post <GetTimeLineResponse>("https://api-service.edi.su/Api/Dixy/TimeLine/GetTimeLine", req); if (resp.intCode != 200) { throw new Exception(resp.varMessage); } return(resp.timeline); }
public GetContentResponse getDocumentContent(Event e) { GetContentResponse response = null; try { response = (GetContentResponse)Http2.post <GetContentResponse>("https://api-service.edi.su/Api/Dixy/Content/GetBoth", new GetContentRequest(authToken, e.document_id)); } catch (Exception ex) { Logger.log("error while processing [" + e.document_id + "]"); Logger.log(response.varMessage); Logger.log(ex.Message); } return(response); }
public bool sendDocApi(string content, string sign, string docType) { APICon.rest.Request req = null; if (docType.StartsWith("ON_SCHF") || docType.StartsWith("ON_KORSCHF")) { req = new DocumentUPDSendRequest(authToken, content, sign, docType); } else { req = new DocumentSendRequest(authToken, content, sign, docType); } DocumentSendResponse response = (DocumentSendResponse)Http2.post <DocumentSendResponse>("https://api-service.edi.su/Api/Dixy/Document/Send", req); if (response.intCode == 200) { return(true); } throw new Exception(response.varMessage); }
public GetContentResponse getUPDDocumentContent(string docGUID) { GetUPDContentResponse response = null; GetContentResponse contResp = null; try { response = (GetUPDContentResponse)Http2.post <GetUPDContentResponse>("https://api-service.edi.su/Api/Dixy/Content/GetDocWithSignContent", new GetContentRequest(authToken, docGUID)); contResp = new GetContentResponse(); contResp.intCode = response.intCode; contResp.varMessage = response.varMessage; contResp.body = response.body; contResp.sign = response.sign[0].body; } catch (Exception ex) { Logger.log("error while processing [" + docGUID + "]"); Logger.log(response.varMessage); Logger.log(ex.Message); } return(contResp); }
public bool confirmEvent(Event e, string body, string sign) { EnqueueTicketResponse enqueueResponse = null; try { EnqueueTicketRequest req = new EnqueueTicketRequest(authToken, e.document_id, body, sign); enqueueResponse = (EnqueueTicketResponse)Http2.post <EnqueueTicketResponse>("https://api-service.edi.su/Api/Dixy/Ticket/Enqueue", req); if (enqueueResponse.intCode == 200) { return(true); } return(false); } catch (Exception ex) { Logger.log("error while processing [" + e.document_id + "]"); Logger.log(enqueueResponse.varMessage); Logger.log(ex.Message); return(false); } }
public bool sendTicket(string content, string sign, string docId) { EnqueueTicketRequest req = null; EnqueueTicketResponse enqueueResponse = null; try { req = new EnqueueTicketRequest(authToken, docId, content, sign); enqueueResponse = (EnqueueTicketResponse)Http2.post <EnqueueTicketResponse>("https://api-service.edi.su/Api/Dixy/Ticket/Enqueue", req); if (enqueueResponse.intCode == 200) { return(true); } return(false); } catch (Exception ex) { Logger.log("error while processing [" + docId + "]"); Logger.log(enqueueResponse.varMessage); Logger.log(ex.Message); return(false); } }
public Program(String[] args) { Program.conf = DFSHelper.GetAppConfiguration("configuration.xml"); Logger.loadConfig(); controller = new Controller(); switch (args[0]) { case "-allcerts": // testing crypto etc. testCrypto(); break; case "-infocert": ExCert cert = null; try { cert = controller.GetExCertificate(args[1]); Console.WriteLine("certificate info:"); Console.WriteLine(cert.ToString()); } catch (Exception e) { Console.WriteLine(e.Message); } break; case "-testcert": String sign = null; String base64data = Utils.Base64DecodeToString(Encoding.GetEncoding("UTF-8").GetBytes("somedata"), "UTF-8"); try { sign = controller.Sign(args[1], base64data); if (sign != null) { Console.WriteLine("signing O.K."); } } catch (Exception e) { Console.WriteLine(e.Message); } break; case "-testrestFULLDEBUG": AuthorizeRequest debugReq = new AuthorizeRequest(conf.Login, conf.Api_pass); Console.WriteLine("request body:"); Console.WriteLine(Utils.ToJson(debugReq)); AuthorizeResponse debugResp = (AuthorizeResponse)Http2.post <AuthorizeResponse>("https://api-service.edi.su/Api/Dixy/Index/Authorize", debugReq); Console.WriteLine("response body:"); Console.WriteLine(Utils.ToJson(debugResp)); if (debugResp != null) { Console.WriteLine("rest O.K."); } break; case "-testrest": AuthorizeResponse response = (AuthorizeResponse)Http2.post <AuthorizeResponse>("https://api-service.edi.su/Api/Dixy/Index/Authorize", new AuthorizeRequest(conf.Login, conf.Api_pass)); if (response != null) { Console.WriteLine("rest O.K."); } break; case "-testsoap": GetListRequest req = new GetListRequest(); req.user = new User(); req.user.login = conf.Login; req.user.pass = Utils.GetMD5String(conf.Soap_pass); GetListResponse resp = (GetListResponse)Soap.GetList <GetListResponse>(req); if (resp != null) { Console.WriteLine("soap O.K."); } break; } }