This topic contains 3 replies, has 2 voices, and was last updated by  Duo_Liang 3 weeks, 1 day ago.

  • Author
    Posts
  • Participant
    mailtodanish
    Newbie
    Member since: 20.11.2017
    Number of posts: 16

    Hi,

    I want to create a package and have to add Signers and Documents later on same package.

    Thanks,

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 608
    Approved answer

    Score

    0

    Hi there,

    Please refer to this code snippet:

    		//step 1: create a package and create it with status of "DRAFT"
    		DocumentPackage newPackage = newPackageNamed("Create package + Add Signers and Docs")
    				.describedAs("xxxxxxx")
    				.build();
    		
    		PackageId createPackage = eslClient.createPackage(newPackage);
    		System.out.println(createPackage);
    		
    		
    		//step 2: add signers
    		Signer signer1 = SignerBuilder.newSignerWithEmail("signer1@example.com")
    				.withFirstName("John")
    				.withLastName("Smith")
    				.withCustomId("Signer1")
    				.build();
    		
    		Signer signer2 = SignerBuilder.newSignerWithEmail("signer2@example.com")
    				.withFirstName("Mary")
    				.withLastName("Doe")
    				.withCustomId("Signer2")
    				.build();
    		
    		eslClient.getPackageService().addSigner(createPackage, signer1);
    		eslClient.getPackageService().addSigner(createPackage, signer2);
    		
    		
    		//step 3: add documents and use .withSignature() function or extraction methods to place signatures/fields
    		Document document1 = DocumentBuilder.newDocumentWithName("document1")
    				.fromFile(FILE_PATH)
    				.withId("document1")
    				.withDescription("Sample Document Description")
    				.build();
    		
    		Document document2 = DocumentBuilder.newDocumentWithName("document2")
    				.fromFile(FILE_PATH2)
    				.withId("document2")
    				.withDescription("Sample Document Description")
    				.build();
    		
    		
    		eslClient.getPackageService().uploadDocuments(createPackage.getId(), Arrays.asList(document1,document2));
    		
    		//step4: send package when it's ready
    		//eslClient.sendPackage(createPackage);

    Which contains four steps:
    step 1: create a package and create it with status of “DRAFT”
    step 2: add signers
    step 3: add documents and use .withSignature() function or extraction methods to place signatures/fields
    step4: send package when it’s ready

    Hope this could help!
    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist
    Participant
    mailtodanish
    Newbie
    Member since: 20.11.2017
    Number of posts: 16

    Score

    0

    Hi,

    Is it possible if we can set Sender detail as well.

    we have to send document to clients but need to capture Agent (Sender) detail.

    ThankS

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 608

    Score

    0

    Hi,

    You can use below code to set sender info, aka, “send on behalf of your sender”:

    	
    DocumentPackage superDuperPackage = PackageBuilder.newPackageNamed("package_name")
    				.withSigner(
                                                          ...
    						)
    				.withDocument(
                                                        ...
                                                    )
    				.withSenderInfo(SenderInfoBuilder.newSenderInfo("your_sender_email")
    						.withName("sender_firstname", "sender_lastname")
    						.withCompany("sender_company")
    						.withTitle("sender_title")
    						.withTimezoneId("sender_timezoneid")
    						)
                                      ...
    				.build();

    Because you are sending on behalf of your sender,
    1. the sender has to be already invited to your account owner
    2. and the sender email in the code needs to match with your sender’s

    Hope this could help!
    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist

You must be logged in to reply to this topic.