Exemplo n.º 1
0
 public GeneratedFile GenerateRevocationRequestXml(string authToken, string boxId, string messageId,
                                                   string attachmentId, RevocationRequestInfo revocationRequestInfo)
 {
     if (boxId == null)
     {
         throw new ArgumentNullException("boxId");
     }
     if (messageId == null)
     {
         throw new ArgumentNullException("messageId");
     }
     if (attachmentId == null)
     {
         throw new ArgumentNullException("attachmentId");
     }
     return(diadocHttpApi.GenerateRevocationRequestXml(authToken, boxId, messageId, attachmentId, revocationRequestInfo));
 }
Exemplo n.º 2
0
        public async Task Save()
        {
            try {
                BeginAction();
                var patch = Payload.Patch();

                RevocationRequestInfo revinfo = new RevocationRequestInfo();
                revinfo.Comment = Comment.Value;
                revinfo.Signer  = GetSigner();

                GeneratedFile revocationXml = await Async((x) => Payload.Api.GenerateRevocationRequestXml(
                                                              x,
                                                              Payload.BoxId,
                                                              Payload.Message.MessageId,
                                                              Payload.Entity.EntityId,
                                                              revinfo));

                SignedContent revocSignContent = new SignedContent();
                revocSignContent.Content = revocationXml.Content;

                if (!TrySign(revocSignContent))
                {
                    throw new Exception("Ошибка подписи документа TrySign");
                }

                RevocationRequestAttachment revattch = new RevocationRequestAttachment();
                revattch.ParentEntityId = Payload.Entity.EntityId;
                revattch.SignedContent  = revocSignContent;

                patch.AddRevocationRequestAttachment(revattch);
                await Async(x => Payload.Api.PostMessagePatch(x, patch));
                await EndAction();
            }
            catch (Exception e) {
                var error = ErrorHelper.TranslateException(e)
                            ?? "Не удалось выполнить операцию, попробуйте повторить позднее.";
                Manager.Warning(error);
                Log.Error(error, e);
                await EndAction(false);
            }
        }
        public void Revocation(Message revocation)
        {
            RevocationRequestInfo revinfo = new RevocationRequestInfo();

            revinfo.Comment = "АННУЛИРОВНИЕ";
            revinfo.Signer  = signers.First();

            var document = revocation.Entities.First();

            MessagePatchToPost patch = new MessagePatchToPost()
            {
                BoxId     = box.BoxId,
                MessageId = revocation.MessageId
            };

            GeneratedFile revocationXml = api.GenerateRevocationRequestXml(
                token,
                box.BoxId,
                revocation.MessageId,
                document.EntityId,
                revinfo);

            SignedContent revocSignContent = new SignedContent();

            revocSignContent.Content = revocationXml.Content;
            revocSignContent.SignWithTestSignature = true;

            RevocationRequestAttachment revattch = new RevocationRequestAttachment();

            revattch.ParentEntityId = document.EntityId;
            revattch.SignedContent  = revocSignContent;

            patch.AddRevocationRequestAttachment(revattch);

            api.PostMessagePatch(token, patch);
        }
        public Task <GeneratedFile> GenerateRevocationRequestXmlAsync(string authToken, string boxId, string messageId, string attachmentId, RevocationRequestInfo revocationRequestInfo)
        {
            var queryString = $"/GenerateRevocationRequestXml?boxId={boxId}&messageId={messageId}&attachmentId={attachmentId}";

            return(PerformGenerateXmlHttpRequestAsync(authToken, queryString, revocationRequestInfo));
        }
Exemplo n.º 5
0
        public GeneratedFile GenerateRevocationRequestXml(string authToken, string boxId, string messageId, string attachmentId, RevocationRequestInfo revocationRequestInfo)
        {
            var queryString = string.Format("/GenerateRevocationRequestXml?boxId={0}&messageId={1}&attachmentId={2}", boxId, messageId, attachmentId);

            return(PerformGenerateXmlHttpRequest(authToken, queryString, revocationRequestInfo));
        }