amwebexpert

Set the package expiry date programmaticaly

0 votes
Hi, Is it possible to set the package expiry date programmaticaly with the e-SignLive Java API? Can you provide a sample? Thanks!

Approved Answer

Reply to: Set the package expiry date programmaticaly

0 votes
I apologize if it wasn't clear in the API documentation. When creating a new package, you have the option of setting the expiry date. An example is shown in "Custom Package Data" in the "Document Package Configuration" section of the API documentation.
DocumentPackage superDuperPackage1 = newPackageNamed( "Policy " + new SimpleDateFormat( "HH:mm:ss" ).format( new Date() ) )
        	     .describedAs( "This is a package created using the e-SignLive SDK" )
        	     .expiresAt( new Date() )
        	     .withEmailMessage( "This message should be delivered to all signers" )
        	     .withSigner( newSignerWithEmail( "[email protected]" )
        	          .withCustomId( "Client1" )
        	          .withFirstName( "John" )
        	          .withLastName( "Smith" )
        	          .withTitle( "Managing Director" )
        	          .withCompany( "Acme Inc." ) )
        	     .withDocument( newDocumentWithName( "First Document" )
        	          .fromStream( new java.io.FileInputStream(DOCUMENT_PATH), DocumentType.PDF )
        	          .withSignature( signatureFor( "[email protected]" )
        	               .onPage( 0 )
        	               .withField( FieldBuilder.checkBox()
        	                    .onPage( 0 )
        	                    .atPosition( 400, 200 )
        	                    .withValue( "x" ) )
        	               .atPosition( 100, 100 ) ) )
        	          .withAttributes(newDocumentPackageAttributes()
        	               .withAttribute( "First Name", "Bill" )
        	               .withAttribute("Last Name", "Johnson")
        	               .withAttribute("Signing Order", "1")
        	               .build())
        	          .build();
 
PackageId packageId = eslClient.createPackage( superDuperPackage );
eslClient.sendPackage( packageId );
In the sample code I provided earlier, I set the expiry date on an already created package. It is indeed not covered in the documentation.
Haris Haidary OneSpan Technical Consultant

Reply to: Set the package expiry date programmaticaly

0 votes
It is definitely possible to set the expiry date with the Java SDK. The sample code below sets the expiry date to two weeks from today:
public class expiryDate {

    public static final String API_KEY = "your_api_key";
    public static final String API_URL = "https://sandbox.esignlive.com/api"; 
    // USE https://apps.e-signlive.com/api FOR PRODUCTION
 
    public static void main( String[] args ) {
    	
    	Calendar cal = Calendar.getInstance();
	cal.add(Calendar.DATE, +14);
		
	Date expiryDate = cal.getTime();
		
    	//connect to e-SignLive
    	EslClient eslClient = new EslClient( API_KEY, API_URL );

    	//create a packageId using your packageId string
    	PackageId packageId = new PackageId("472b7114-9478-493d-bd3c-2367a0cdab4e");
    	
    	//get your package
    	DocumentPackage myPackage = eslClient.getPackage(packageId);
    	
    	myPackage.setExpiryDate(expiryDate);
    	
    	eslClient.getPackageService().updatePackage(packageId, myPackage);
    }
}
Haris Haidary OneSpan Technical Consultant

Reply to: Set the package expiry date programmaticaly

0 votes
Thanks! I'm going to try it! Is there a section I'm missing cause I can't find this from your Java SDK api online documentation... ?

Reply to: Set the package expiry date programmaticaly

0 votes
Ok thanks! I searched for keywords like expiry / reminder... And then found only explanation text saying this was an existing feature without code snippet... Thanks again!

Reply to: Set the package expiry date programmaticaly

0 votes
My pleasure :)
Haris Haidary OneSpan Technical Consultant

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