Madeva

Unable to modify Expiry date of package

0 votes
Hi team, I am trying to modify the package expiry date using Java SDK (11.21), even though I am getting 200 success response but it is not reflecting or updating. Please find a piece of code which I have used. myPackage.setExpiryDate(new Date()); eslClient.changePackageStatusToDraft(myPackage.getId()); eslClient.updatePackage(myPackage.getId(),myPackage); Please Help me to update the package expiry date

Reply to: Unable to modify Expiry date of package

1 votes
Hi Madeva, The reason why the expiry date doesn't get changed is: you can't send a package and set expiry date at same API/SDK call. Let's clarify it a little bit: With incomplete code snippet, I assume that the "myPackage" object was retrieved when the package was sent, so the status attribute is still "SENT", even if you called "changePackageStatusToDraft" function, it won't update local object. Based on this, you can adjust your code like below: (PS: expiry date can't be a past date when the call hitting OneSpan Sign server, so I added one minute to current date)
	    final Calendar cal2 = Calendar.getInstance();
	    cal2.add(Calendar.MINUTE, 1);
	    Date time2 = cal2.getTime();
		pkg.setStatus(PackageStatus.DRAFT);
		pkg.setExpiryDate(time2);
		eslClient.changePackageStatusToDraft(pkg.getId());
		eslClient.updatePackage(pkg.getId(),pkg);
		eslClient.sendPackage(createPackage);
Hope this could help! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Unable to modify Expiry date of package

0 votes
Thank you Duo_Liang, It works for me..

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