Esempio n. 1
0
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att        = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log);
                var attContent = Convert.ToBase64String(att.Content);
                var userList   = args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId);

                var skribble = new SkribbleHelper(_log, Configuration.ApiConfig);
                var response = skribble.SendEnvelope(attContent, GenerateRequestModel(), PrepareUsers(userList));

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);

                SaveUrlForUsers(userList, response);
            }
            catch (Exception e)
            {
                _log.AppendLine(e.ToString());
                args.HasErrors = true;
                args.Message   = e.Message;
            }
            finally
            {
                args.LogMessage = _log.ToString();
                args.Context.PluginLogger.AppendInfo(_log.ToString());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att        = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log);
                var attContent = Convert.ToBase64String(att.Content);
                var response   = new SkribbleHelper(_log, Configuration.ApiConfig).SendEnvelope(attContent, GenerateRequestModel(), PrepareUser());

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);

                args.TransitionInfo.RedirectUrl($"{response.signing_url}?exitURL={Configuration.RedirectUrl}");
            }
            catch (Exception e)
            {
                _log.AppendLine(e.ToString());
                args.HasErrors = true;
                args.Message   = e.Message;
            }
            finally
            {
                args.LogMessage = _log.ToString();
                args.Context.PluginLogger.AppendInfo(_log.ToString());
            }
        }
Esempio n. 3
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, log);
                if (att == null)
                {
                    throw new Exception("No attachment to signature");
                }

                var api         = new AdobeSignHelper(log);
                var docId       = api.SendDocument(att.Content, Configuration.ApiConfig.TokenValue, $"{att.FileName}.{att.FileExtension}");
                var operationId = api.SendToSig(docId, Configuration.ApiConfig.TokenValue, Configuration.MessageContent.MailSubject, Configuration.MessageContent.MailBody, GetMembersInfo(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId)));

                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AgreementsIdFild, operationId);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);
            }
            catch (Exception e)
            {
                log.AppendLine(e.ToString());
                args.HasErrors = true;
                args.Message   = e.Message;
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log);
                if (att == null)
                {
                    throw new Exception("No attachment to signature");
                }

                var signUrl = CallAdobeApi(att, args.Context.CurrentDocument);
                _log.AppendLine($"Document URL: {signUrl}");
                args.TransitionInfo.RedirectUrl(signUrl);
            }
            catch (Exception e)
            {
                _log.AppendLine(e.ToString());
                args.HasErrors = true;
                args.Message   = e.Message;
            }
            finally
            {
                args.LogMessage = _log.ToString();
                args.Context.PluginLogger.AppendInfo(_log.ToString());
            }
        }
Esempio n. 5
0
        string FormatUrl()
        {
            string attachmentPath = "";

            if (!We7Helper.IsEmptyID(AttachmentID))
            {
                ThisAttachment = AttachmentHelper.GetAttachment(AttachmentID);
            }
            else if (!We7Helper.IsEmptyID(OwnerID) && FileType != "")
            {
                ThisAttachment = AttachmentHelper.GetFirstAttachment(OwnerID, FileType, FilesName);
            }
            if (ThisAttachment != null)
            {
                attachmentPath = string.Format("\\{0}\\{1}", ThisAttachment.FilePath, ThisAttachment.FileName);
            }
            return(attachmentPath);
        }