peterzog

Get URL after designer send

0 votes

We are embedding the designer in an iframe.  After the user clicks "Send to Sign" the package moves to in-progress status. We prevent OneSpan from sending the message; rather we send the URL via Salesforce.  What is the best practice to request a new URL to send via Salesforce? When I try to request it I get this error:

OneSpanRESTAPIHelper.OneSpanRestAPIHelperException: Error obtaining OneSpan signing Url: 403 - Forbidden - {"technical":"Cannot access a package that can be edited YIH....Vxd7l-JBAqc=","messageKey":"error.forbidden.cannotAccessEditablePkg","message":"Cannot access an editable package.","code":403,"name":"Access Denied"}


Reply to: Get URL after designer send

0 votes

Disregard. I was able to solve it.  


Reply to: Get URL after designer send

0 votes

Hi Peter,

 

You are receiving this error is most likely because the transaction is still in DRAFT status. Adding a send transaction call before it should make it work:

    pkg.status = OneSpanAPIObjects.PackageStatus.SENT;
         
    sdk.updatePackage(pkg, packageId); 

 

On top of that, when you said "when user clicks Send to Sign in designer, you prevent OneSpan from sending the message", did you block the traffic from the designer page and did you mean to prevent the invitation email from sending? Just let you know that you can hide the "Send to Sign" button in designer, it's part of the designer customization options. And you can disable the "email.activate" template completely or just for in-person signing scenarios.

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Get URL after designer send

0 votes

Good call out.  If we block the "Send to Sign" button, does that button become "Done"? Or how does the user let the designer know it's done?

Also, having one issue where the "Document ID" does not appear to match the document name.  We are seeing a value like this: 


"id": "e2bafaed06cee52d571a7f2e1aaa7d659962dd9839399ff2"

when we are expecting "testdoc1".

In the portal, we see the document name we expect.  Our other transactions are working as normal, and this issue only appears with documents generated with the OneSpan Designer.  

 


Reply to: Get URL after designer send

0 votes

Hi Peter,

 

No, if you block the button, it will be hidden from the designer. The label says "Done" when it's a template (vs transaction). 

We typically suggest to use a button outside the iframe, or the exit button of the pop-up dialog to continue the process. If your current approach works well, please disregard this suggestion.

Do you mean the end user uploaded the document via designer? If that's the case, the document ID could be randomly generated by OneSpan system to make sure it's unique within the transaction (Uploading a document with the same document ID could replace the existing one). You may have to consider filtering the documents by their names if you allowed users to upload via designer.

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Get URL after designer send

0 votes

Ok, one more question on the button option, if we hide the button, and the user drags the desired signer blocks, are those settings immediately saved in real-time? Meaning, if we give the user a way to navigate away from the designer (in an iframe) they're changes will be maintained?

Regarding the document name question.  We are creating the package and uploading the document prior to the designer.  This is where we are setting the name. We then pass in the Package ID and the Apex SDK generates the designer URL for us. Then we load the package as an iframe.  

Peter


Reply to: Get URL after designer send

0 votes

Hi Peter,

 

Yes, all the changes made in designer take effect in real time.

Thanks for the clarification for the document name/id issue, I see what you meant now. When you upload the document, did you also explicitly set the document.Id like other creation flows do?

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Get URL after designer send

0 votes

Here is a snippet of what we are doing:

 

List<FlowOutputs> outputs = new List<FlowOutputs>();

 

// Check if there are any requests

if (requests.isEmpty()) {

return outputs;

}

// Get the first request

Request req = requests[0];

// Query ContentVersion for the latest version of the file

ContentVersion cv = [

SELECT Id, Title, VersionData

FROM ContentVersion

WHERE ContentDocumentId = :req.contentDocumentId AND IsLatest = true

LIMIT 1

];

// Create esl client

OneSpanSDK sdk = new OneSpanSDK();

// Create package

OneSpanAPIObjects.Package_x pkg = new OneSpanAPIObjects.Package_x();

pkg.name = cv.Title + ' - ' + Datetime.now().format();

// Prepare Documents Blob

String document1Name = cv.Title;

Map<String,Blob> documentBlobMap = new Map<String,Blob>();

documentBlobMap.put(document1Name, cv.VersionData);

 

List<OneSpanAPIObjects.Role> roles = new List<OneSpanAPIObjects.Role>();

 

for(OneSpanSigner esSigner: req.oneSpanSigners) {

// Create Signer

OneSpanAPIObjects.Signer signer = new OneSpanAPIObjects.Signer();

signer.firstName = esSigner.firstName;

signer.lastName = esSigner.lastName;

signer.email = esSigner.email;

signer.name = esSigner.firstName + ' ' + esSigner.lastName;

 

OneSpanAPIObjects.Role role = new OneSpanAPIObjects.Role();

role.signers = new List<OneSpanAPIObjects.Signer>{ signer };

role.name = esSigner.firstName + ' ' + esSigner.lastName;

role.id = esSigner.signerLookupId;

role.type = 'SIGNER';

role.index = esSigner.index;

 

roles.add(role);

}

 

pkg.roles = roles;

 

String packageId = sdk.createPackage(pkg, documentBlobMap);


Reply to: Get URL after designer send

0 votes

I should clarify. Our process is:

  1. We upload the document to Salesforce
  2. We create the package via Apex (see above)
  3. We get the designer URL by via endpointWithoutAPI + '/auth?senderAuthenticationToken='+ senderAuthenticationToken + '&target=' + endpointWithoutAPI + '/a/transaction/'+packageId+'/designer';
  4. Display the designer in an iframe

Reply to: Get URL after designer send

0 votes

I see, try to add below snippets around this area, this will specify the document metadata:

                    ......

                    documentBlobMap.put(document1Name, cv.VersionData);

 

                    OneSpanAPIObjects.Document document1 = new OneSpanAPIObjects.Document();
                    document1.name = document1Name ;
                    document1.id = document1Name ;
                    pkg.documents = new List<OneSpanAPIObjects.Document>{document1};    

                    ......

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Get URL after designer send

1 votes

My bad.  I should have seen this. Thank you, it's working now.


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