public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var envelopeId = args.Context.CurrentDocument.GetFieldValue(Configuration.RequestParams.EnvelopeIdFielId)?.ToString();
                var response   = new SkribbleHelper(log, Configuration.ApiConfig).CheckDocumentStatus(envelopeId);

                if (response.status_overall.Equals(Models.Statuses.Signed))
                {
                    args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFielId, response.document_id);
                }

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.StatusFieldId, response.status_overall);
            }
            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());
            }
        }
Exemplo n.º 2
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);
                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());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.InputParams.StatusFieldId)?.ToString();
                if (!string.IsNullOrEmpty(status) && status.Equals(Models.Statuses.Signed, StringComparison.InvariantCultureIgnoreCase))
                {
                    var docId   = args.Context.CurrentDocument.GetFieldValue(Configuration.InputParams.OperationFieldId)?.ToString();
                    var api     = new AdobeSignHelper(log);
                    var content = api.GetDocument(docId, Configuration.ApiConfig.TokenValue);
                    SaveAtt(args.Context.CurrentDocument, content);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "Document cannot be a saved if it is not signed";
                }
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
Exemplo n.º 5
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.ApiConfig.StatusFildId)?.ToString();
                if (!string.IsNullOrEmpty(status) && !status.Equals(Models.Statuses.Signed, StringComparison.InvariantCultureIgnoreCase))
                {
                    var docId       = args.Context.CurrentDocument.GetFieldValue(Configuration.ApiConfig.OperationFildId)?.ToString();
                    var api         = new AdobeSignHelper(log);
                    var membersInfo = api.GetMembersIds(docId, Configuration.ApiConfig.TokenValue);
                    var users       = GetUsers(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId), membersInfo.ToList());
                    api.SendRemind(docId, Configuration.ApiConfig.TokenValue, users);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "The document has already been signed";
                }
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
Exemplo n.º 6
0
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                logger.Log("Extracting rows from xml");
                XmlNodeList rows = GetRowsFromXml(args.Context.CurrentDocument);

                logger.Log($"Getting item list '{Configuration.TargetConfiguration.TargetItemListId}'");
                var list = args.Context.CurrentDocument.ItemsLists.GetByID(int.Parse(Configuration.TargetConfiguration.TargetItemListId));

                logger.Log($"Populating item list");
                PopulateItemList(args.Context.CurrentDocument, rows, list);
            }
            catch (System.Exception ex)
            {
                logger.Indent();
                logger.Log($"Error executing {nameof(CC_XmlToItemList)}", ex);
                // HasErrors property is responsible for detection whether action has been executed properly or not. When set to "true"
                // whole path transition will be marked as faulted and all the actions on it will be rollbacked. User will be notified
                // about failure by display of error window.
                args.HasErrors = true;
                // Message property is responsible for error message content.
                args.Message = ex.Message;
            }
            finally
            {
                args.LogMessage = logger.ToString();
                logger.Dispose();
            }
        }
        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());
            }
        }
Exemplo n.º 8
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)
        {
            var log = new StringBuilder();

            try
            {
                var envelopeId = args.Context.CurrentDocument.GetFieldValue(Configuration.EnvelopeFielId).ToString();
                var skribble   = new SkribbleHelper(log, Configuration.ApiConfig);
                if (Configuration.DeleteOperationType)
                {
                    skribble.DeleteRequest(envelopeId);
                }
                else
                {
                    skribble.DeclineSigRequest(envelopeId, Configuration.Message);
                }
            }
            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());
            }
        }
Exemplo n.º 10
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.StatusFielId)?.ToString();
                if (!string.IsNullOrEmpty(status) && status.Equals(Models.Statuses.Signed))
                {
                    var docGuid  = args.Context.CurrentDocument.GetFieldValue(Configuration.GuidIdFielId).ToString();
                    var response = new SkribbleHelper(log, Configuration.ApiConfig).GetDocumentContent(docGuid);
                    SaveAtt(args.Context.CurrentDocument, response);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "Document cannot be a saved if it is not signed";
                }
            }
            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());
            }
        }
Exemplo n.º 11
0
 public override void Run(RunCustomActionParams args)
 {
     try
     {
         var status = args.Context.CurrentDocument.GetFieldValue(Configuration.StatusFielId)?.ToString();
         if (!string.IsNullOrEmpty(status) && status.Equals(Statuses.Open))
         {
             var userList = args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId);
             var guid     = args.Context.CurrentDocument.GetFieldValue(Configuration.EnvelopeFielId)?.ToString();
             var skribble = new SkribbleHelper(_log, Configuration.ApiConfig);
             var newDocId = skribble.SendReminder(guid, Configuration.Message, PrepareUsers(userList));
             args.Context.CurrentDocument.SetFieldValue(Configuration.GuidFielId, newDocId);
         }
     }
     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)
        {
            var returnUrl = Configuration.RedirectUrl;
            var apiClient = new ApiClient();

            var embededUserInfo = new EmbededUserModel()
            {
                Name         = args.Context.CurrentDocument.Fields.GetByID(Configuration.EmbededUserNameFieldId).GetValue().ToString(),
                Mail         = args.Context.CurrentDocument.Fields.GetByID(Configuration.EmbededUserMailFieldId).GetValue().ToString(),
                RecipientId  = args.Context.CurrentDocument.Fields.GetByID(Configuration.EmbededRecipientIdFieldId).GetValue().ToString(),
                ClientUserId = args.Context.CurrentDocument.Fields.GetByID(Configuration.EmbededClientUserIdFieldId).GetValue().ToString(),
                EnvelopeId   = args.Context.CurrentDocument.Fields.GetByID(Configuration.EnvelopeGUIDFieldId).GetValue().ToString()
            };
            var view = new ApiHelper(apiClient, Configuration.ApiSettings, _logger).CreateRecipientView(embededUserInfo, returnUrl);

            args.TransitionInfo.RedirectUrl(view.Url);
        }
 public override void Run(RunCustomActionParams args)
 {
     try
     {
         var env = GetEnvelope(args.Context);
         _logger.AppendLine("Setting field");
         args.Context.CurrentDocument.Fields.GetByID(Configuration.InputParameters.StatusFieldId).SetValue(env.Status);
     }
     catch (Exception ex)
     {
         _logger.AppendLine(ex.ToString());
         args.Message   = ex.Message;
         args.HasErrors = true;
     }
     finally
     {
         args.LogMessage = _logger.ToString();
         args.Context.PluginLogger.AppendInfo(_logger.ToString());
     }
 }
 public override void Run(RunCustomActionParams args)
 {
     try
     {
         var apiClient  = new ApiClient();
         var envelopeId = args.Context.CurrentDocument.Fields.GetByID(Configuration.EnvelopeSettings.EnvelopeGUIDFieldId).GetValue().ToString();
         _logger.AppendLine($"Sending reminder to recipients of envelope: {envelopeId}");
         var summary = new ApiHelper(apiClient, Configuration.ApiSettings, _logger).ResendEnvelope(envelopeId);
     }
     catch (Exception ex)
     {
         _logger.AppendLine(ex.ToString());
         args.Message   = ex.Message;
         args.HasErrors = true;
     }
     finally
     {
         args.LogMessage = _logger.ToString();
         args.Context.PluginLogger.AppendInfo(_logger.ToString());
     }
 }
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var operationId = args.Context.CurrentDocument.GetFieldValue(Configuration.OperationFildId)?.ToString();
                var api         = new AdobeSignHelper(log);
                api.DeleteAgreement(operationId, Configuration.TokenValue);
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
 public override void Run(RunCustomActionParams args)
 {
     try
     {
         var apiClient  = new ApiClient();
         var envelopeId = args.Context.CurrentDocument.Fields.GetByID(Configuration.DocumentSettings.EnvelopeGUIDFieldId).GetValue().ToString();
         _logger.AppendLine($"Downloading documents for envelope : {envelopeId}");
         var documents = new ApiHelper(apiClient, Configuration.ApiSettings, _logger).DownloadDocuments(envelopeId);
         AddDocumentsToAttachments(documents, args.Context);
     }
     catch (Exception ex)
     {
         _logger.AppendLine(ex.ToString());
         args.Message   = ex.Message;
         args.HasErrors = true;
     }
     finally
     {
         args.LogMessage = _logger.ToString();
         args.Context.PluginLogger.AppendInfo(_logger.ToString());
     }
 }
Exemplo n.º 17
0
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var dataHelper = new DataHelper(_logger, args.Context);
                var documents  = dataHelper.GetDocuments(Configuration);
                var signers    = dataHelper.GetSigners(Configuration);

                var summary = SendEmails(documents, signers);
                SetFields(summary, args.Context);
            }
            catch (ApiException e)
            {
                var message = e.Message;
                if (!String.IsNullOrWhiteSpace(message) && message.Contains("consent_required"))
                {
                    _logger.AppendLine("CONSENT REQUIRED");
                    args.Message = "CONSENT REQUIRED";
                }
                else
                {
                    _logger.AppendLine(e.ToString());
                    args.Message = e.Message;
                }
                args.HasErrors = true;
            }
            catch (Exception ex)
            {
                _logger.AppendLine(ex.ToString());
                args.Message   = ex.Message;
                args.HasErrors = true;
            }
            finally
            {
                args.LogMessage = _logger.ToString();
                args.Context.PluginLogger.AppendInfo(_logger.ToString());
            }
        }
Exemplo n.º 18
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var docId  = args.Context.CurrentDocument.GetFieldValue(Configuration.DokFildId)?.ToString();
                var status = new AutentiHelper(log).GetDocumentStatus(Configuration.ApiConfig.TokenValue, docId);

                args.Context.CurrentDocument.SetFieldValue(Configuration.StatusFildId, status);
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att   = GetAttachment(args.Context);
                var users = PrepareUsersToSign(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId));
                var api   = new AutentiHelper(_log);
                var docId = api.SendEnvelope(Configuration, users, att);

                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.DokumentIdFild, docId);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                _log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = _log.ToString();
                args.Context.PluginLogger.AppendInfo(_log.ToString());
            }
        }