From fb75beb0f4fc90d18a9a132c9e2d84f83fc9fee3 Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Wed, 18 Dec 2024 17:18:57 +0530 Subject: [PATCH] [INJICERT-657] add validFrom if missing from plugin Signed-off-by: Harsh Vardhan --- .../certify/vcformatters/VelocityTemplatingEngineImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java b/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java index 3b7d8e0..a235c6f 100644 --- a/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java +++ b/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java @@ -137,6 +137,9 @@ public String format(JSONObject valueMap, Map templateSettings) String expiryTime = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(duration.getSeconds()).format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN)); finalTemplate.put(VCDM2Constants.VALID_UNITL, expiryTime); } + if (!valueMap.has(VCDM2Constants.VALID_FROM)) { + finalTemplate.put(VCDM2Constants.VALID_FROM, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN))); + } VelocityContext context = new VelocityContext(finalTemplate); engine.evaluate(context, writer, /*logTag */ templateName,template.toString()); if (StringUtils.isNotEmpty(idPrefix)) {