Example #1
0
        private static void RemindAdobeEnvelope(ESignAccount account, ESignEnvelopeInfo actualEnvelope)
        {
            var adobeSignClient = AdobeSignClientBuilder.Build(account);
            var reminderModel   = GetReminderCreationInfoModel(actualEnvelope);

            ESignApiExecutor.TryExecute(() => adobeSignClient.DocumentsService.SendReminder(reminderModel), adobeSignClient);
        }
Example #2
0
 private static void VerifyAccount(ESignAccount account)
 {
     if (account == null || account.IsActive != true)
     {
         throw new PXException(Messages.ESignAccountNotExists);
     }
 }
Example #3
0
 private static string GetAuthHeader(ESignAccount account)
 {
     return($"<DocuSignCredentials>" +
            $"<Username>{account.Email}</Username>" +
            $"<Password>{account.Password}</Password>" +
            $"<IntegratorKey>{IntegratorKey}</IntegratorKey>" +
            $"</DocuSignCredentials>");
 }
Example #4
0
        /// <summary>
        /// Used for creating uuthentication request for docusign.
        /// <param name="account">Docusign account<see cref="ESignAccount"></see> </param>
        /// </summary>
        public static LoginAccount AuthenticateUser(ESignAccount account)
        {
            var model = new BaseRequestModel {
                ESignAccount = account
            };

            return(TryExecute(AuthenticateUserFunc(), model));
        }
Example #5
0
        private static void RedirectToAdobeSign(ESignAccount account, ESignEnvelopeInfo envelope)
        {
            var adobeSignClient = AdobeSignClientBuilder.Build(account);
            var url             = ESignApiExecutor.TryExecute(() => adobeSignClient.DocumentsService
                                                              .GetAgreementAssets(envelope.EnvelopeID), adobeSignClient).viewURL;

            throw new PXRedirectToUrlException(url, string.Empty);
        }
Example #6
0
        public static void CancelAdobeSignEnvelope(ESignAccount account, ESignEnvelopeInfo actualEnvelope,
                                                   string voidReason)
        {
            var adobeSignClient = AdobeSignClientBuilder.Build(account);

            ESignApiExecutor.TryExecute(
                () => adobeSignClient.DocumentsService.CancelAgreement(actualEnvelope.EnvelopeID, voidReason),
                adobeSignClient);
        }
Example #7
0
 public static void VoidAdobeSignEnvelope(ESignEnvelopeInfo envelope, ESignAccount account)
 {
     if (envelope.EnvelopeInfoID.HasValue)
     {
         var adobeSignClient = AdobeSignClientBuilder.Build(account);
         ESignApiExecutor.TryExecute(() => adobeSignClient.DocumentsService.DeleteAgreement(envelope.EnvelopeID),
                                     adobeSignClient);
     }
 }
Example #8
0
        private static void RemindDocuSignEnvelope(ESignAccount account, ESignEnvelopeInfo actualEnvelope)
        {
            var dsService = new DocuSignService();
            var request   = new BaseRequestModel
            {
                ESignAccount = account,
                EnvelopeId   = actualEnvelope.EnvelopeID
            };

            dsService.RemindEnvelope(request);
        }
Example #9
0
        public static void VoidDraftDocuSignEnvelope(ESignAccount account, ESignEnvelopeInfo envelope)
        {
            var dsService = new DocuSignService();
            var request   = new VoidEnvelopeRequestModel
            {
                ESignAccount = account,
                EnvelopeId   = envelope.EnvelopeID,
            };

            dsService.VoidDraftEnvelope(request);
        }
Example #10
0
        public static void VoidDocuSignEnvelope(ESignAccount account, ESignEnvelopeInfo envelope, string voidReason)
        {
            var dsService = new DocuSignService();
            var request   = new VoidEnvelopeRequestModel
            {
                ESignAccount = account,
                EnvelopeId   = envelope.EnvelopeID,
                VoidReason   = string.IsNullOrEmpty(voidReason) ? Messages.DefaultEnvelopeVoidReason : voidReason
            };

            dsService.VoidEnvelope(request);
        }
Example #11
0
 private static void VoidDocuSignEnvelope(ESignEnvelopeInfo envelope, ESignAccount account)
 {
     if (envelope.IsActionsAvailable != null &&
         envelope.IsActionsAvailable.Value &&
         envelope.EnvelopeInfoID.HasValue)
     {
         VoidDocuSignEnvelope(account, envelope, Messages.DefaultEnvelopeVoidReason);
     }
     else if (envelope.LastStatus == EnvelopeStatus.DocuSign.Created)
     {
         VoidDraftDocuSignEnvelope(account, envelope);
     }
 }
Example #12
0
        private static void RedirectToDocuSign(ESignAccount account, ESignEnvelopeInfo envelope)
        {
            var dsService = new DocuSignService();
            var request   = new BaseRequestModel
            {
                ESignAccount = account,
                EnvelopeId   = envelope.EnvelopeID
            };

            var url = dsService.Redirect(request);

            throw new PXRedirectToUrlException(url.Url, string.Empty);
        }
 private static Credentials CreateCredentials(ESignAccount setup, string companyId = null)
 {
     return(new Credentials
     {
         AccountId = setup.AccountID,
         ApiUrl = setup.ApiUrl,
         ClientId = setup.ClientID,
         ClientSecret = setup.ClientSecret,
         ApiAccessPoint = setup.ApiAccessPoint,
         AccessToken = setup.AccessToken,
         RefreshToken = setup.RefreshToken,
         CompanyId = companyId
     });
 }
        public static AdobeSignClient BuildUnauthorized(ESignAccount account, string companyId = null)
        {
            var credentials = CreateCredentials(account, companyId);

            if (HttpContext.Current != null)
            {
                var url = string.Concat(
                    HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority),
                    HttpContext.Current.Request.ApplicationPath != null && HttpContext.Current.Request.ApplicationPath.EndsWith("/")
                            ? string.Concat(HttpContext.Current.Request.ApplicationPath, "Pages/ES/ESign.aspx")
                            : string.Concat(HttpContext.Current.Request.ApplicationPath, "/", "Pages/ES/ESign.aspx"));
                credentials.RedirectUrl = url;
            }
            return(new AdobeSignClient(credentials));
        }
Example #15
0
        public virtual IEnumerable voidEnvelope(PXAdapter adapter)
        {
            if (Envelopes.Current != null)
            {
                var voidReason = VoidRequest.Current.VoidReason;

                VoidRequest.Cache.Clear();
                VoidRequest.Cache.ClearQueryCache();

                if (VoidRequest.AskExt(true) == WebDialogResult.OK)
                {
                    if (Envelopes.Current != null)
                    {
                        var envelopeInfoId = Envelopes.Current.EnvelopeInfoID;

                        PXLongOperation.StartOperation(this, () =>
                        {
                            if (string.IsNullOrEmpty(voidReason))
                            {
                                throw new PXSetPropertyException(
                                    string.Format(Messages.FieldRequired, "Void Reason"),
                                    typeof(VoidRequestFilter.voidReason).Name);
                            }
                            var maintenanceGraph         = CreateInstance <WikiFileMaintenance>();
                            var fileMaintenanceExtension = maintenanceGraph.GetExtension <WikiFileMaintenanceESExt>();
                            var uploadGraph = CreateInstance <UploadFileMaintenance>();
                            var taskGraph   = CreateInstance <CRTaskMaint>();

                            var envelope         = GetEnvelopeInfo(maintenanceGraph, envelopeInfoId);
                            ESignAccount account =
                                fileMaintenanceExtension.ESignAccount.Search <ESignAccount.accountID>(
                                    envelope.ESignAccountID);

                            var actualEnvelope = fileMaintenanceExtension.CheckStatus(maintenanceGraph, envelope, uploadGraph, taskGraph);
                            if (!actualEnvelope.IsActionsAvailable.HasValue || !actualEnvelope.IsActionsAvailable.Value)
                            {
                                throw new PXException(Messages.EnvelopeVoidIsNotAvailable);
                            }

                            VerifyAccount(account);

                            switch (account.ProviderType)
                            {
                            case DocuSignProvider:
                                VoidDocuSignEnvelope(account, envelope, voidReason);
                                break;

                            case AdobeSignProvider:
                                CancelAdobeSignEnvelope(account, actualEnvelope, voidReason);
                                break;

                            default:
                                throw new PXException(Messages.ProviderTypeIsMissing);
                            }

                            fileMaintenanceExtension.CheckStatus(maintenanceGraph, envelope, uploadGraph, taskGraph);
                        });
                    }
                }
            }
            return(adapter.Get());
        }
        public static AdobeSignClient Build(ESignAccount account, string companyId = null)
        {
            var credentials = CreateCredentials(account, companyId);

            return(new AdobeSignClient(credentials));
        }