talk2bks | Posts: 35

Set Owner on In-Person Documents

0 votes

I have the code working that sets the "sender" when the package is not in-person. But this code doesn't seem to work with in-person. All the in-person packages shows me (account owner) as the owner even when I set a different user as the sender.

According to the package information, the sender information is not there and I'm listed as owner. Is there a way to customize the owner?

 

 


Duo_Liang | Posts: 3776

Reply to: Set Owner on In-Person Documents

0 votes

Hi Brian,

 

Thanks for your post! I just did a quick test specifying sender in an in-person signing tranasction and it actually works for me. The APEX SDK code looks like below for your reference:

 

    public static void test231204(){
    
        OneSpanSDK sdk = new OneSpanSDK();
        OneSpanAPIObjects.Package_x pkg = new OneSpanAPIObjects.Package_x();
        
       
        pkg.name = 'Application Letter';
        pkg.status = OneSpanAPIObjects.PackageStatus.SENT;
        pkg.description = 'Sample Description';

 

        //pkg settings

        OneSpanAPIObjects.Settings settings = new OneSpanAPIObjects.Settings();
        OneSpanAPIObjects.CeremonySettings ceremonySettings = new OneSpanAPIObjects.CeremonySettings();
        ceremonySettings.inPerson = true;
        settings.ceremony = ceremonySettings;
        pkg.settings = settings;

 

        //specify sender

        OneSpanAPIObjects.Sender sender = new OneSpanAPIObjects.Sender();
        sender.email = 'your_sender_email';
        pkg.sender = sender;

 

        //signers
        OneSpanAPIObjects.Signer signer = new OneSpanAPIObjects.Signer();
        signer.firstName = 'john';
        signer.lastName = 'smith';
        signer.email = '[email protected]';
        signer.name = 'Signer1';
        signer.id = 'john';

        List<OneSpanAPIObjects.Signer> signers = new List<OneSpanAPIObjects.Signer>();
        signers.add(signer);

        OneSpanAPIObjects.Role role = new OneSpanAPIObjects.Role();
        role.signers = signers;
        role.reassign = true;
        role.name = 'Signer1';
        role.id = 'Signer1';
        role.type = 'SIGNER';
        pkg.roles = new List<OneSpanAPIObjects.Role> {role};


        //documents
        ContentVersion sr = [SELECT Id, Title,VersionData  FROM ContentVersion WHERE Title = 'file_title' AND IsLatest = TRUE LIMIT 1];

        Map<String,Blob> blobMap = new Map<String,Blob>();
        blobMap.put('ApplicationLetter', sr.VersionData);
        OneSpanAPIObjects.Document doc1 = new OneSpanAPIObjects.Document();
        doc1.name = 'ApplicationLetter';
        doc1.extract = true;
        OneSpanAPIObjects.Data data_x = new OneSpanAPIObjects.Data();
        data_x.ese_document_texttag_extract_needed= 'true';
        doc1.extractionTypes = new List<string>{'TEXT_TAGS'};
        doc1.data = data_x;

        pkg.documents = new List<OneSpanAPIObjects.Document> {doc1};
 
         
        String response = sdk.createPackage(pkg,blobMap); 
        system.debug('response: '+response);
        
    }

 

Feel free to try this code and let me know if you can find anything different from your code.

 

Duo


talk2bks | Posts: 35

Reply to: Set Owner on In-Person Documents

1 votes

After a while of debugging, I found the issue. I was running the sdk.createPackage(pkg); early in the coding process, then running updates like sdk.addroles() and sdk.updatePackage() throughout the process.

The sender is established on the sdk.createPackage() and therefore has to be set with the initial creation. Updating the package with a new sender doesn't seem to work. But now that I know how this works, I can proceed. Also, I like how in your code you are adding the roles and the documents in the createPackage() which I'm going to try to rewrite my code to match.


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