hassanraza89 | Posts: 16

How to set challenge question after all signatures are complete

0 votes

Hi,

Is there anyway to set the challenge question after all signatures are complete. The scenario i have is one the package is generated and signed we send an email out to the user with a link to download the signed copies those signed copies need to be protected with a challenge question.

 

Thanks.


Approved Answer
Duo_Liang | Posts: 3776

Reply to: How to set challenge question after all signatures are complete

0 votes

Hi Hassan,

 

Two things I noticed from your code:
(1)The direct cause of error is that your signer has a title, whereas it's not in the SignerBuilder:

        private Signer AddSignerAuthentication(Signer signer, Authentication authentication) {
            SignerBuilder signerWithChallengeBuilder = SignerBuilder.NewSignerWithEmail(signer.Email)
                        .WithFirstName(signer.FirstName)
                        .WithLastName(signer.LastName)
                        .WithCompany(signer.Company)
                        .WithTitle(signer.Title)
                        .WithLanguage(signer.Language)
                        .WithEmailMessage(signer.Message)
                        .WithCustomId(signer.Id)
                        .WithAuthentication(authentication);

            if (signer.Attachments.Count > 0) {
                foreach (var attachmentRequirement in signer.Attachments) {
                    signerWithChallengeBuilder.WithAttachmentRequirement(attachmentRequirement);
                }
            }

            return signerWithChallengeBuilder.Build();
        }

 

 

(2) If there are multiple signers required to be updated, you don't have to repeatedly Edit then SendPackage - it can be moved outside the loop

 

            foreach (var signer in package.Signers)
            {
                ......
                    if (signStatus == SigningStatus.SIGNING_COMPLETE)
                    {
                        ......

                        eslClient.PackageService.Edit(packageId);    //REVIEW_FOR_COMPLETION -> DRAFT

                        await Task.Run(() => eslClient.PackageService.UpdateSigner(packageId, signerWithChallenge));

                        eslClient.PackageService.SendPackage(packageId);   //DRAFT -> REVIEW_FOR_COMPLETION
                    }

            ......
            }

 

Duo


Duo_Liang | Posts: 3776

Reply to: How to set challenge question after all signatures are complete

0 votes

Hi Hassan,

 

Thanks for the clarification! If you happen to have a callback listener set up, you can utilize that and follow this approach:
(1)When creating the transaction, set "autoComplete" to false. Take .NET SDK code for example:
            DocumentPackage documentPackage = PackageBuilder.NewPackageNamed("Test Transaction")
                                                                                        .WithoutAutomaticCompletion()

                                                                                        ......

(2)Instead of monitoring "PACKAGE_COMPLETE" event, your listener would monitor "PACKAGE_READY_FOR_COMPLETE" event in this case. This will keep the completion email on hold until you add challenge questions to your signer and programmatically complete the transaction. In .NET SDK code:

            OssClient ossClient = new OssClient(apiKey, apiUrl);

            PackageId packageId = new PackageId("kZ2HfmfK9mooKO4Xt_bcw0s9HDs=");
            DocumentPackage reviewForCompletion = ossClient.GetPackage(packageId);
            Signer signer = reviewForCompletion.GetSigner("[email protected]");

            Signer signerWithChallenge = SignerBuilder.NewSignerWithEmail(signer.Email)
                .WithFirstName(signer.FirstName)
                .WithLastName(signer.LastName)
                .WithCustomId(signer.Id)

                 ......
                .WithAuthentication(ChallengeBuilder.FirstQuestion("question").Answer("answer").Build())
                .Build();

            ossClient.PackageService.Edit(packageId);    //REVIEW_FOR_COMPLETION -> DRAFT
            ossClient.PackageService.UpdateSigner(packageId, signerWithChallenge);
            ossClient.PackageService.SendPackage(packageId);   //DRAFT -> REVIEW_FOR_COMPLETION
            ossClient.PackageService.MarkComplete(packageId);  //REVIEW_FOR_COMPLETION -> COMPLETED

 

Note, the code I skipped should cover all the signer level features you are leveraging, e.g. signer message, signer language, signer attachment, etc.

 

Duo


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Thanks  i will try this out.


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Hey i added the code above and now i am getting the following error:

 

Unable to edit package. Exception: The remote server returned an error: (400) Bad Request. HTTP PUT on URI https://sandbox.e-signlive.ca/api/packages/r3RfwzHQ_rhysQYBGLOcR1T5f78=. Optional details: {"messageKey":"error.validation.cannotChangePackageStatus","message":"Cannot change package status.","code":400,"name":"Validation Error"}

I read some documentation and it seems like package can only be edited in DRAFT status but we need to add challange question after all documents are signed.

Thanks.


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Hey i added the code above and now i am getting the following error:

 

Unable to edit package. Exception: The remote server returned an error: (400) Bad Request. HTTP PUT on URI https://sandbox.e-signlive.ca/api/packages/r3RfwzHQ_rhysQYBGLOcR1T5f78=. Optional details: {"messageKey":"error.validation.cannotChangePackageStatus","message":"Cannot change package status.","code":400,"name":"Validation Error"}

I read some documentation and it seems like package can only be edited in DRAFT status but we need to add challange question after all documents are signed.

Thanks.


Duo_Liang | Posts: 3776

Reply to: How to set challenge question after all signatures are complete

0 votes

Hi Hassan,

 

Thanks for the information! Like I mentioned above, you need an additional step to set "autoComplete" to false in package creation step:
            DocumentPackage documentPackage = PackageBuilder.NewPackageNamed("Test Transaction")
                                                                                        .WithoutAutomaticCompletion()

                                                                                        ......

This prevents the transaction from automatically get completed and provides the integration point where your callback integration can edit the transaction and signer.

 

Duo


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Ya i did add that 

 

 var packageBuilder = PackageBuilder.NewPackageNamed(signingPackage.Name)
                .WithoutAutomaticCompletion()
                .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                    .WithHandOverLinkHref(signingPackage.HandOverLinkHref)
                    .WithHandOverLinkText(signingPackage.HandOverLinkText)
                    .WithoutOptOut()
                    .WithoutDocumentToolbarDownloadButton()
                    .HideOwnerInPersonDropDown()
                    .WithDecline()
                    .WithDeclineOther()
                    .WithMaxAuthAttempts(3)
                    .WithoutDialogOnComplete()
                    .WithoutCaptureText()
                    .WithoutLanguageDropDown()
                    .WithCeremonyLayoutSettings(CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                        .WithGlobalDownloadButton()
                        .WithLogoImageSource(signingPackage.LogoUrl)
                        //.WithoutTitle()
                        .WithoutSessionBar()
                        .WithoutGlobalNavigation()
                        .WithoutBreadCrumbs()))
                .WithLanguage(Thread.CurrentThread.CurrentUICulture)
                .WithAutomaticCompletion();


Duo_Liang | Posts: 3776

Reply to: How to set challenge question after all signatures are complete

0 votes

At the last line - .WithAutomaticCompletion() - this has conflict with WithoutAutomaticCompletion()

 

Duo


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Could this be done outside of the Call back action.


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Hi 

I am using the following code after all signers sign all documents 

 

 var eslClient = new EslClient(_apiKey, _apiUrl);
            var packageId = new PackageId(signingPackage.VendorId);

            var package = eslClient.GetPackage(packageId);
            DocumentPackage reviewForCompletion = eslClient.GetPackage(packageId);

            foreach (var signer in package.Signers)
            {
                try
                {
                    var signertest = reviewForCompletion.GetSigner(signer.Email);
                    var signStatus = eslClient.GetSigningStatus(packageId, signer.Id, null);
                    if (signStatus == SigningStatus.SIGNING_COMPLETE)
                    {
                        var signer11 = reviewForCompletion.GetSigner(signer.Email);

                        var signerWithChallenge = SignerBuilder.NewSignerWithEmail(signer.Email)
                            .WithFirstName(signer.FirstName)
                            .WithLastName(signer.LastName)
                            .WithCustomId(signer.Id)
                             .WithAuthentication(ChallengeBuilder.FirstQuestion("What's your favorite sport?").Answer("soccer").Build())
                             .Build();

                        eslClient.PackageService.Edit(packageId);    //REVIEW_FOR_COMPLETION -> DRAFT
                        //eslClient.PackageService.UpdateSigner(packageId, signerWithChallenge);

                        await Task.Run(() => eslClient.PackageService.UpdateSigner(packageId, signerWithChallenge));

                        eslClient.PackageService.SendPackage(packageId);   //DRAFT -> REVIEW_FOR_COMPLETION
                    }

                }
                catch (Exception ex)
                {

                    throw;
                }


            }

 

when this code is executed  await Task.Run(() => eslClient.PackageService.UpdateSigner(packageId, signerWithChallenge)); i am getting the following error in return 

"Silanis.ESL.SDK.EslServerException: 'Could not update signer. Exception: The remote server returned an error: (400) Bad Request. HTTP PUT on URI https://sandbox.e-signlive.ca/api/packages/MDoRT_Dnn_Na0hXuwsOhKRAO5HA=/roles/bfc69e69-a0f2-4304-a7bb-1035b1fa2a21. Optional details: {"messageKey":"error.validation.cannotEditSignerAfterSigning","message":"Recipient information cannot be updated because the recipient has already begun signing.","code":400}'"

I also noticed the application on OneSpan went from InProgress to Draft status.

 

Thanks.


hassanraza89 | Posts: 16

Reply to: How to set challenge question after all signatures are complete

0 votes

Thanks so much it worked.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off