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()); } }
private string CallAdobeApi(AttachmentData att, DocumentData currentDocument) { var api = new AdobeSignHelper(_log); var documentId = api.SendDocument(att.Content, Configuration.ApiConfig.TokenValue, $"{att.FileName}.{att.FileExtension}"); var agreementsId = api.SendToSig(documentId, Configuration.ApiConfig.TokenValue, Configuration.MessageContent.MailSubject, Configuration.MessageContent.MailBody, GetMemberInfo(), true, Configuration.RedirectUrl); currentDocument.SetFieldValue(Configuration.AttConfig.AgreementsIdFild, agreementsId); currentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID); return(api.GetSigningURL(Configuration.ApiConfig.TokenValue, agreementsId)); }