From 4028928522673fda98f9c05fbc056fd2d2e4ddb2 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 01:03:12 +0530 Subject: [PATCH 01/13] define the ds for processType->templateType mapping --- .../io/mosip/print/constant/ProcessType.java | 7 +++ .../io/mosip/print/constant/TemplateType.java | 17 +++++++ .../io/mosip/print/util/TemplateMapper.java | 46 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 src/main/java/io/mosip/print/constant/ProcessType.java create mode 100644 src/main/java/io/mosip/print/constant/TemplateType.java create mode 100644 src/main/java/io/mosip/print/util/TemplateMapper.java diff --git a/src/main/java/io/mosip/print/constant/ProcessType.java b/src/main/java/io/mosip/print/constant/ProcessType.java new file mode 100644 index 00000000..8cf91241 --- /dev/null +++ b/src/main/java/io/mosip/print/constant/ProcessType.java @@ -0,0 +1,7 @@ +package io.mosip.print.constant; + +public enum ProcessType { + NEW, + CRVS_NEW, + UPDATE, +} \ No newline at end of file diff --git a/src/main/java/io/mosip/print/constant/TemplateType.java b/src/main/java/io/mosip/print/constant/TemplateType.java new file mode 100644 index 00000000..ae7888dd --- /dev/null +++ b/src/main/java/io/mosip/print/constant/TemplateType.java @@ -0,0 +1,17 @@ +package io.mosip.print.constant; + +public enum TemplateType { + UIN_CARD_TEMPLATE("RPR_UIN_CARD_TEMPLATE"), + UIN_CARD_EMAIL_SUB("RPR_UIN_CARD_EMAIL_SUB"), + UIN_CARD_EMAIL("RPR_UIN_CARD_EMAIL"); + + private final String value; + + TemplateType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/io/mosip/print/util/TemplateMapper.java b/src/main/java/io/mosip/print/util/TemplateMapper.java new file mode 100644 index 00000000..3ac6456a --- /dev/null +++ b/src/main/java/io/mosip/print/util/TemplateMapper.java @@ -0,0 +1,46 @@ +package io.mosip.print.util; + +import io.mosip.print.constant.ProcessType; +import io.mosip.print.constant.TemplateType; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.Map; +import java.util.Optional; + +public final class TemplateMapper { + private static final Map PROCESS_TO_TEMPLATE_TYPE; + + static { + Map map = new EnumMap<>(ProcessType.class); + map.put(ProcessType.NEW, TemplateType.UIN_CARD_TEMPLATE); + map.put(ProcessType.UPDATE, TemplateType.UIN_CARD_TEMPLATE); + map.put(ProcessType.CRVS_NEW, TemplateType.UIN_CARD_EMAIL_SUB); + + PROCESS_TO_TEMPLATE_TYPE = Collections.unmodifiableMap(map); + } + + private TemplateMapper() { + // Prevent instantiation + } + + /** + * Determines the appropriate template type based on the process attributes + * + * @param attributes Map of process attributes + * @return Optional containing the corresponding TemplateType, or empty if no matching process type is found + */ + public static Optional determineTemplateType(Map attributes) { + if (attributes == null || !attributes.containsKey("processType")) { + return Optional.empty(); + } + + try { + String processTypeStr = String.valueOf(attributes.get("processType")).toUpperCase(); + ProcessType processType = ProcessType.valueOf(processTypeStr); + return Optional.ofNullable(PROCESS_TO_TEMPLATE_TYPE.get(processType)); + } catch (IllegalArgumentException e) { + return Optional.empty(); + } + } +} \ No newline at end of file From db437dbd92da54345235c93004dff24aece2aea5 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 01:22:22 +0530 Subject: [PATCH 02/13] PlatformErrorMessages: introduce new error message when template mapping fails. Introducing here to separate it from the other kind of template errors --- .../java/io/mosip/print/exception/PlatformErrorMessages.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java b/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java index 3868cfb5..b25bfb6e 100644 --- a/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java +++ b/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java @@ -50,6 +50,8 @@ public enum PlatformErrorMessages { PRT_BDD_ABIS_ABORT(PlatformConstants.PRT_PRINT_PREFIX + "002", "ABIS for the Reference ID and Request ID was Abort"), /** The PRT tem processing failure. */ + PRT_TEM_MAPPER_NOT_FOUND(PlatformConstants.PRT_PRINT_PREFIX + "030", "Template mapper could not be mapped"), + PRT_TEM_PROCESSING_FAILURE(PlatformConstants.PRT_PRINT_PREFIX + "002", "The Processing of Template Failed "), PRT_SYS_JSON_PARSING_EXCEPTION(PlatformConstants.PRT_PRINT_PREFIX + "009", "Error while parsing Json"), PRT_AUT_INVALID_TOKEN(PlatformConstants.PRT_PRINT_PREFIX + "01", "Invalid Token Present"), From 48217276bccd11539b27c2e23b3854e1ddf58282 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 01:22:46 +0530 Subject: [PATCH 03/13] TemplateType: make toString() return the value. --- src/main/java/io/mosip/print/constant/TemplateType.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/mosip/print/constant/TemplateType.java b/src/main/java/io/mosip/print/constant/TemplateType.java index ae7888dd..e3f3e7a6 100644 --- a/src/main/java/io/mosip/print/constant/TemplateType.java +++ b/src/main/java/io/mosip/print/constant/TemplateType.java @@ -14,4 +14,7 @@ public enum TemplateType { public String getValue() { return value; } + + @Override + public String toString() { return value; } } \ No newline at end of file From 39d97cf85c4a9366f198cc94771d147303eb183c Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 01:24:16 +0530 Subject: [PATCH 04/13] PrintServiceImpl: get the values from the mapped types --- .../print/service/impl/PrintServiceImpl.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java index aa7720b2..7048197a 100644 --- a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java +++ b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java @@ -22,6 +22,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import io.mosip.print.constant.*; import io.mosip.print.dto.*; import io.mosip.print.exception.*; import io.mosip.print.util.*; @@ -42,15 +43,6 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; -import io.mosip.print.constant.EventId; -import io.mosip.print.constant.EventName; -import io.mosip.print.constant.EventType; -import io.mosip.print.constant.IdType; -import io.mosip.print.constant.ModuleName; -import io.mosip.print.constant.PDFGeneratorExceptionCodeConstant; -import io.mosip.print.constant.PlatformSuccessMessages; -import io.mosip.print.constant.QrVersion; -import io.mosip.print.constant.UinCardType; import io.mosip.print.logger.LogDescription; import io.mosip.print.logger.PrintLogger; import io.mosip.print.model.CredentialStatusEvent; @@ -248,10 +240,8 @@ private Map getDocuments(String credential, String credentialTyp String individualBio = null; Map attributes = new LinkedHashMap<>(); boolean isTransactionSuccessful = false; - String template = UIN_CARD_TEMPLATE; byte[] pdfbytes = null; try { - credentialSubject = getCrdentialSubject(credential); org.json.JSONObject credentialSubjectJson = new org.json.JSONObject(credentialSubject); org.json.JSONObject decryptedJson = decryptAttribute(credentialSubjectJson, encryptionPin, credential); @@ -272,6 +262,14 @@ private Map getDocuments(String credential, String credentialTyp if (isPasswordProtected) { password = getPassword(uin); } + + + Optional templateOpt = TemplateMapper.determineTemplateType(attributes); + if (templateOpt.isEmpty()) { + throw new TemplateProcessingFailureException(PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getMessage()); + } + String template = templateOpt.get().getValue(); + if (credentialType.equalsIgnoreCase("qrcode")) { boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); @@ -388,6 +386,8 @@ private Map getDocuments(String credential, String credentialTyp private void sendUINInEmail(String residentEmailId, String fileName, Map attributes, byte[] pdfbytes, String templateLang) { + + if (pdfbytes != null) { try { List emailIds = Arrays.asList(residentEmailId, defaultEmailIds); From 4c473d241a8473fed343f4ae954c17dcd1bd7310 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 06:03:26 +0530 Subject: [PATCH 05/13] TemplateMapper: processType document generation now maps to three templates {email, emailSubject, document} --- .../io/mosip/print/util/TemplateMapper.java | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/mosip/print/util/TemplateMapper.java b/src/main/java/io/mosip/print/util/TemplateMapper.java index 3ac6456a..0b03ba69 100644 --- a/src/main/java/io/mosip/print/util/TemplateMapper.java +++ b/src/main/java/io/mosip/print/util/TemplateMapper.java @@ -2,6 +2,7 @@ import io.mosip.print.constant.ProcessType; import io.mosip.print.constant.TemplateType; +import lombok.Getter; import java.util.Collections; import java.util.EnumMap; @@ -9,13 +10,15 @@ import java.util.Optional; public final class TemplateMapper { - private static final Map PROCESS_TO_TEMPLATE_TYPE; + private static final Map PROCESS_TO_TEMPLATE_TYPE; static { - Map map = new EnumMap<>(ProcessType.class); - map.put(ProcessType.NEW, TemplateType.UIN_CARD_TEMPLATE); - map.put(ProcessType.UPDATE, TemplateType.UIN_CARD_TEMPLATE); - map.put(ProcessType.CRVS_NEW, TemplateType.UIN_CARD_EMAIL_SUB); + Map map = new EnumMap<>(ProcessType.class); + map.put(ProcessType.NEW, new TemplateMappedConfig( + TemplateType.UIN_CARD_TEMPLATE, + TemplateType.UIN_CARD_EMAIL_SUB, + TemplateType.UIN_CARD_EMAIL + )); PROCESS_TO_TEMPLATE_TYPE = Collections.unmodifiableMap(map); } @@ -25,12 +28,17 @@ private TemplateMapper() { } /** - * Determines the appropriate template type based on the process attributes + * Retrieves the template configuration mapped to the specified process type + * from the provided attributes map. If the map does not contain a valid + * process type or is invalid, an empty {@code Optional} is returned. * - * @param attributes Map of process attributes - * @return Optional containing the corresponding TemplateType, or empty if no matching process type is found + * @param attributes a map of attributes where the key "processType" is + * expected to represent the process type as a string. + * @return an {@code Optional} containing the {@code TemplateMappedConfig} + * corresponding to the process type if available; otherwise, an + * empty {@code Optional}. */ - public static Optional determineTemplateType(Map attributes) { + public static Optional getTemplatesConfig(Map attributes) { if (attributes == null || !attributes.containsKey("processType")) { return Optional.empty(); } @@ -43,4 +51,18 @@ public static Optional determineTemplateType(Map a return Optional.empty(); } } + + @Getter + public static class TemplateMappedConfig { + private final TemplateType documentTemplateName; + private final TemplateType emailSubjectTemplate; + private final TemplateType emailTemplate; + + public TemplateMappedConfig(TemplateType documentTemplateName, TemplateType emailSubjectTemplate, TemplateType emailTemplate) { + this.documentTemplateName = documentTemplateName; + this.emailSubjectTemplate = emailSubjectTemplate; + this.emailTemplate = emailTemplate; + } + + } } \ No newline at end of file From c36d7ca03d93154c857f7ab309e7b474659c4465 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 06:47:27 +0530 Subject: [PATCH 06/13] TemplateMappedConfig: assure that both the email and email subject are present --- src/main/java/io/mosip/print/util/TemplateMapper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/io/mosip/print/util/TemplateMapper.java b/src/main/java/io/mosip/print/util/TemplateMapper.java index 0b03ba69..055705b2 100644 --- a/src/main/java/io/mosip/print/util/TemplateMapper.java +++ b/src/main/java/io/mosip/print/util/TemplateMapper.java @@ -59,6 +59,13 @@ public static class TemplateMappedConfig { private final TemplateType emailTemplate; public TemplateMappedConfig(TemplateType documentTemplateName, TemplateType emailSubjectTemplate, TemplateType emailTemplate) { + boolean hasEmailTemplate = emailTemplate != null; + boolean hasEmailSubject = emailSubjectTemplate != null; + + if (hasEmailTemplate ^ hasEmailSubject) { + throw new IllegalArgumentException("Email template and subject must both be present or both be null"); + } + this.documentTemplateName = documentTemplateName; this.emailSubjectTemplate = emailSubjectTemplate; this.emailTemplate = emailTemplate; From 167e3c29156ee36498fdfa1d0138dccb4bfb0f14 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 06:49:32 +0530 Subject: [PATCH 07/13] PrintServiceImpl: sendEmail helper function, refactor sendUinEmail to use this --- .../print/service/impl/PrintServiceImpl.java | 99 +++++++++++++++---- 1 file changed, 80 insertions(+), 19 deletions(-) diff --git a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java index 7048197a..c4d3a1d7 100644 --- a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java +++ b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java @@ -31,6 +31,7 @@ import io.mosip.vercred.exception.ProofTypeNotFoundException; import io.mosip.vercred.exception.PubicKeyNotFoundException; import io.mosip.vercred.exception.UnknownException; +import lombok.Getter; import org.apache.commons.codec.binary.Base64; import org.joda.time.DateTime; import org.json.simple.JSONArray; @@ -79,11 +80,6 @@ public class PrintServiceImpl implements PrintService{ /** The Constant VALUE. */ private static final String VALUE = "value"; - /** The Constant UIN_CARD_TEMPLATE. */ - private static final String UIN_CARD_TEMPLATE = "RPR_UIN_CARD_TEMPLATE"; - private static final String UIN_CARD_EMAIL_SUB = "RPR_UIN_CARD_EMAIL_SUB"; - private static final String UIN_CARD_EMAIL = "RPR_UIN_CARD_EMAIL"; - /** The Constant FACE. */ private static final String FACE = "Face"; @@ -385,22 +381,87 @@ private Map getDocuments(String credential, String credentialTyp } - private void sendUINInEmail(String residentEmailId, String fileName, Map attributes, byte[] pdfbytes, String templateLang) { + @Getter + static class Attachment { + private final String fileName; + private final byte[] data; + public Attachment(String fileName, byte[] data) { + this.fileName = fileName; + this.data = data; + } + } - if (pdfbytes != null) { - try { - List emailIds = Arrays.asList(residentEmailId, defaultEmailIds); - List responseDTOs = notificationUtil.emailNotification(emailIds, fileName, - UIN_CARD_EMAIL, UIN_CARD_EMAIL_SUB, attributes, pdfbytes, templateLang); - responseDTOs.forEach(responseDTO -> - printLogger.info("UIN sent successfully via Email, server response..{}", responseDTO) - ); - } catch (Exception e) { - printLogger.error("Failed to send pdf UIN via email.{}", residentEmailId, e); - } - } - } + private Optional> sendEmail( + String residentEmailId, + TemplateType emailSubject, + TemplateType emailBody, + Attachment attachment, + Map attributes, + String templateLang + ) { + + Optional> noResult = Optional.empty(); + if (residentEmailId == null) { + printLogger.error("Resident email ID parameter is null"); + return noResult; + } + if (emailSubject == null) { + printLogger.error("Email subject parameter is null"); + return noResult; + } + if (emailBody == null) { + printLogger.error("Email body parameter is null"); + return noResult; + } + + if (attachment != null && (attachment.getFileName() == null || attachment.getData() == null)) { + printLogger.error("Both filename and data must be provided for email attachment"); + return noResult; + } + + List emailIds = new ArrayList<>(); + emailIds.add(residentEmailId); + if (defaultEmailIds != null) { + emailIds.add(defaultEmailIds); + } + + try { + List responseDTOs = notificationUtil.emailNotification( + emailIds, + attachment != null ? attachment.getFileName() : null, + emailBody.getValue(), + emailSubject.getValue(), + attributes, + attachment != null ? attachment.getData() : null, + templateLang + ); + return Optional.of(responseDTOs); + } catch (Exception e) { + printLogger.error("Failed to send email to {}: {}", residentEmailId, e.getMessage(), e); + return noResult; + } + } + + private void sendUINInEmail(String residentEmailId, String fileName, Map attributes, byte[] pdfbytes, String templateLang) { + if (pdfbytes == null) { + return; + } + + var responsesDtos = sendEmail( + residentEmailId, + TemplateType.UIN_CARD_EMAIL_SUB, + TemplateType.UIN_CARD_EMAIL, + new Attachment(fileName, pdfbytes), + attributes, + templateLang + ); + responsesDtos.ifPresent(responseDTOs -> { + responseDTOs.forEach(responseDTO -> + printLogger.info("Email sent successfully, server response: {}", responseDTO) + ); + }); + } /** * Creates the text file. * From 2918ba9be83221da2bcf364efc973b8f48052710 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 07:08:29 +0530 Subject: [PATCH 08/13] PrintServiceImpl: support for email only documents. That don't generate any document or attachments. Please Review, whether we need to trigger two emails. --- .../print/service/impl/PrintServiceImpl.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java index c4d3a1d7..3ca94148 100644 --- a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java +++ b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java @@ -225,7 +225,7 @@ public boolean generateCard(EventModel eventModel) { private Map getDocuments(String credential, String credentialType, String encryptionPin, String requestId, String cardType, - boolean isPasswordProtected, String refId, String registrationId) { + boolean isPasswordProtected, String refId, String registrationId) { printLogger.debug("PrintServiceImpl::getDocuments()::entry"); String credentialSubject; Map byteMap = new HashMap<>(); @@ -260,31 +260,26 @@ private Map getDocuments(String credential, String credentialTyp } - Optional templateOpt = TemplateMapper.determineTemplateType(attributes); - if (templateOpt.isEmpty()) { + Optional templateConfigOpt = TemplateMapper.getTemplatesConfig(attributes); + if (templateConfigOpt.isEmpty()) { throw new TemplateProcessingFailureException(PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getMessage()); } - String template = templateOpt.get().getValue(); + TemplateMapper.TemplateMappedConfig templateMappedConfig = templateConfigOpt.get(); + String template = templateMappedConfig.getDocumentTemplateName().getValue(); + + boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); + if (!isQRcodeSet) { + printLogger.debug(PlatformErrorMessages.PRT_PRT_QRCODE_NOT_SET.name()); + } if (credentialType.equalsIgnoreCase("qrcode")) { - boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); pdfbytes = uinCardGenerator.generateUinCard(uinArtifact, UinCardType.PDF, password); - } else { - if (!isPhotoSet) { printLogger.debug(PlatformErrorMessages.PRT_PRT_APPLICANT_PHOTO_NOT_SET.name()); } - -// byte[] textFileByte = createTextFile(decryptedJson.toString()); -// byteMap.put(UIN_TEXT_FILE, textFileByte); - - boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); - if (!isQRcodeSet) { - printLogger.debug(PlatformErrorMessages.PRT_PRT_QRCODE_NOT_SET.name()); - } printLogger.info("Attributes:{}", JSONObject.toJSONString(attributes)); // getting template and placing original valuespng InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); @@ -294,9 +289,14 @@ private Map getDocuments(String credential, String credentialTyp PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getCode()); } pdfbytes = uinCardGenerator.generateUinCard(uinArtifact, UinCardType.PDF, password); + if (templateMappedConfig.getEmailSubjectTemplate() != null && templateMappedConfig.getEmailTemplate() != null) { + TemplateType emailSubject = templateMappedConfig.getEmailSubjectTemplate(); + TemplateType emailBody = templateMappedConfig.getEmailTemplate(); + Attachment attachment = pdfbytes != null ? new Attachment(cardType + ".pdf", pdfbytes) : null; + sendEmail(residentEmailId, emailSubject, emailBody, attachment, attributes, templateLang); + } } - // Send UIN Card Pdf to Email if (emailUINEnabled) { sendUINInEmail(residentEmailId, registrationId, attributes, pdfbytes, templateLang); } From c16ed671e7c5b4204655feadc7e037b585a64853 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 09:40:36 +0530 Subject: [PATCH 09/13] PrintServiceImpl: has a single generatePdfFromTemplate method. --- .../exception/PlatformErrorMessages.java | 2 +- .../print/service/impl/PrintServiceImpl.java | 75 +++++++++++++------ .../io/mosip/print/util/TemplateMapper.java | 5 +- 3 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java b/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java index b25bfb6e..cd3ba686 100644 --- a/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java +++ b/src/main/java/io/mosip/print/exception/PlatformErrorMessages.java @@ -50,7 +50,7 @@ public enum PlatformErrorMessages { PRT_BDD_ABIS_ABORT(PlatformConstants.PRT_PRINT_PREFIX + "002", "ABIS for the Reference ID and Request ID was Abort"), /** The PRT tem processing failure. */ - PRT_TEM_MAPPER_NOT_FOUND(PlatformConstants.PRT_PRINT_PREFIX + "030", "Template mapper could not be mapped"), + PRT_TEM_MAPPER_NOT_FOUND(PlatformConstants.PRT_PRINT_PREFIX + "030", "Template mapper could not be mapped for processType = %s"), PRT_TEM_PROCESSING_FAILURE(PlatformConstants.PRT_PRINT_PREFIX + "002", "The Processing of Template Failed "), PRT_SYS_JSON_PARSING_EXCEPTION(PlatformConstants.PRT_PRINT_PREFIX + "009", "Error while parsing Json"), diff --git a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java index 3ca94148..3e444fc2 100644 --- a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java +++ b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java @@ -262,41 +262,40 @@ private Map getDocuments(String credential, String credentialTyp Optional templateConfigOpt = TemplateMapper.getTemplatesConfig(attributes); if (templateConfigOpt.isEmpty()) { - throw new TemplateProcessingFailureException(PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getMessage()); + throw new TemplateProcessingFailureException( + String.format( + PlatformErrorMessages.PRT_TEM_MAPPER_NOT_FOUND.getMessage(), + attributes.get(TemplateMapper.PROCESS_TYPE_KEY) + ) + ); } + TemplateMapper.TemplateMappedConfig templateMappedConfig = templateConfigOpt.get(); String template = templateMappedConfig.getDocumentTemplateName().getValue(); + + boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); if (!isQRcodeSet) { printLogger.debug(PlatformErrorMessages.PRT_PRT_QRCODE_NOT_SET.name()); } - if (credentialType.equalsIgnoreCase("qrcode")) { - InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); - pdfbytes = uinCardGenerator.generateUinCard(uinArtifact, UinCardType.PDF, - password); - } else { - if (!isPhotoSet) { - printLogger.debug(PlatformErrorMessages.PRT_PRT_APPLICANT_PHOTO_NOT_SET.name()); - } - printLogger.info("Attributes:{}", JSONObject.toJSONString(attributes)); - // getting template and placing original valuespng - InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); - if (uinArtifact == null) { - printLogger.error(PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.name()); - throw new TemplateProcessingFailureException( - PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getCode()); - } - pdfbytes = uinCardGenerator.generateUinCard(uinArtifact, UinCardType.PDF, password); - if (templateMappedConfig.getEmailSubjectTemplate() != null && templateMappedConfig.getEmailTemplate() != null) { - TemplateType emailSubject = templateMappedConfig.getEmailSubjectTemplate(); - TemplateType emailBody = templateMappedConfig.getEmailTemplate(); - Attachment attachment = pdfbytes != null ? new Attachment(cardType + ".pdf", pdfbytes) : null; - sendEmail(residentEmailId, emailSubject, emailBody, attachment, attributes, templateLang); - } + if (!isPhotoSet) { + printLogger.debug(PlatformErrorMessages.PRT_PRT_APPLICANT_PHOTO_NOT_SET.name()); + } + + printLogger.info("Attributes:{}", JSONObject.toJSONString(attributes)); + + pdfbytes = generatePdfFromTemplate(template, attributes, templateLang, password); + + if (templateMappedConfig.getEmailSubjectTemplate() != null && templateMappedConfig.getEmailTemplate() != null) { + TemplateType emailSubject = templateMappedConfig.getEmailSubjectTemplate(); + TemplateType emailBody = templateMappedConfig.getEmailTemplate(); + Attachment attachment = pdfbytes != null ? new Attachment(cardType + ".pdf", pdfbytes) : null; + sendEmail(residentEmailId, emailSubject, emailBody, attachment, attributes, templateLang); } + // leaving it as it is to keep backward compatibility if (emailUINEnabled) { sendUINInEmail(residentEmailId, registrationId, attributes, pdfbytes, templateLang); } @@ -781,6 +780,34 @@ private void printStatusUpdate(String requestId, byte[] data, String credentialT webSubSubscriptionHelper.printStatusUpdateEvent(topic, creEvent); } + /** + * Processes a template and generates a PDF document. + * + * @param template the template name + * @param attributes the template attributes + * @param templateLang the template language + * @param password the password for PDF protection (can be null) + * @return the generated PDF as byte array + * @throws TemplateProcessingFailureException if template processing fails + */ + private byte[] generatePdfFromTemplate(String template, Map attributes, String templateLang, String password) { + try { + InputStream uinArtifact = templateGenerator.getTemplate(template, attributes, templateLang); + + if (uinArtifact == null) { + printLogger.error(PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.name()); + throw new TemplateProcessingFailureException( + PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getCode()); + } + + return uinCardGenerator.generateUinCard(uinArtifact, UinCardType.PDF, password); + } catch (Exception e) { + printLogger.error("Error in template processing or PDF generation", e); + throw new TemplateProcessingFailureException( + PlatformErrorMessages.PRT_TEM_PROCESSING_FAILURE.getCode()); + } + } + public org.json.JSONObject decryptAttribute(org.json.JSONObject data, String encryptionPin, String credential) throws ParseException { diff --git a/src/main/java/io/mosip/print/util/TemplateMapper.java b/src/main/java/io/mosip/print/util/TemplateMapper.java index 055705b2..95ec8ed6 100644 --- a/src/main/java/io/mosip/print/util/TemplateMapper.java +++ b/src/main/java/io/mosip/print/util/TemplateMapper.java @@ -11,6 +11,7 @@ public final class TemplateMapper { private static final Map PROCESS_TO_TEMPLATE_TYPE; + public static final String PROCESS_TYPE_KEY = "processType"; static { Map map = new EnumMap<>(ProcessType.class); @@ -39,12 +40,12 @@ private TemplateMapper() { * empty {@code Optional}. */ public static Optional getTemplatesConfig(Map attributes) { - if (attributes == null || !attributes.containsKey("processType")) { + if (attributes == null || !attributes.containsKey(PROCESS_TYPE_KEY)) { return Optional.empty(); } try { - String processTypeStr = String.valueOf(attributes.get("processType")).toUpperCase(); + String processTypeStr = String.valueOf(attributes.get(PROCESS_TYPE_KEY)).toUpperCase(); ProcessType processType = ProcessType.valueOf(processTypeStr); return Optional.ofNullable(PROCESS_TO_TEMPLATE_TYPE.get(processType)); } catch (IllegalArgumentException e) { From a799c413a46257c310628b77ad8f99a570a0d2d0 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 09:49:32 +0530 Subject: [PATCH 10/13] TemplateMappedConfig: assure that atleast one field is present --- src/main/java/io/mosip/print/util/TemplateMapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/mosip/print/util/TemplateMapper.java b/src/main/java/io/mosip/print/util/TemplateMapper.java index 95ec8ed6..aca59c8a 100644 --- a/src/main/java/io/mosip/print/util/TemplateMapper.java +++ b/src/main/java/io/mosip/print/util/TemplateMapper.java @@ -62,15 +62,19 @@ public static class TemplateMappedConfig { public TemplateMappedConfig(TemplateType documentTemplateName, TemplateType emailSubjectTemplate, TemplateType emailTemplate) { boolean hasEmailTemplate = emailTemplate != null; boolean hasEmailSubject = emailSubjectTemplate != null; + boolean hasDocumentTemplate = documentTemplateName != null; if (hasEmailTemplate ^ hasEmailSubject) { throw new IllegalArgumentException("Email template and subject must both be present or both be null"); } + if (!hasDocumentTemplate && !hasEmailTemplate & !hasEmailSubject) { + throw new IllegalArgumentException("At least one of document template, email template or email subject must be present"); + } + this.documentTemplateName = documentTemplateName; this.emailSubjectTemplate = emailSubjectTemplate; this.emailTemplate = emailTemplate; } - } } \ No newline at end of file From 5c6d98a195d273e63aee8c573e90db8773cc21d7 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Sat, 3 May 2025 09:51:02 +0530 Subject: [PATCH 11/13] PrintServiceImpl: Support for just sending the email even when document template is null. --- .../print/service/impl/PrintServiceImpl.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java index 3e444fc2..5b97cb53 100644 --- a/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java +++ b/src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java @@ -269,24 +269,19 @@ private Map getDocuments(String credential, String credentialTyp ) ); } - TemplateMapper.TemplateMappedConfig templateMappedConfig = templateConfigOpt.get(); String template = templateMappedConfig.getDocumentTemplateName().getValue(); - - - - boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); - if (!isQRcodeSet) { - printLogger.debug(PlatformErrorMessages.PRT_PRT_QRCODE_NOT_SET.name()); - } - - if (!isPhotoSet) { - printLogger.debug(PlatformErrorMessages.PRT_PRT_APPLICANT_PHOTO_NOT_SET.name()); + if (template != null) { + boolean isQRcodeSet = setQrCode(decryptedJson.toString(), attributes, isPhotoSet); + if (!isQRcodeSet) { + printLogger.debug(PlatformErrorMessages.PRT_PRT_QRCODE_NOT_SET.name()); + } + if (!isPhotoSet) { + printLogger.debug(PlatformErrorMessages.PRT_PRT_APPLICANT_PHOTO_NOT_SET.name()); + } + printLogger.info("Attributes:{}", JSONObject.toJSONString(attributes)); + pdfbytes = generatePdfFromTemplate(template, attributes, templateLang, password); } - - printLogger.info("Attributes:{}", JSONObject.toJSONString(attributes)); - - pdfbytes = generatePdfFromTemplate(template, attributes, templateLang, password); if (templateMappedConfig.getEmailSubjectTemplate() != null && templateMappedConfig.getEmailTemplate() != null) { TemplateType emailSubject = templateMappedConfig.getEmailSubjectTemplate(); From 0b8c349f67b6104bc7d2f6b4525535cd178fd68a Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Tue, 6 May 2025 11:50:43 +0530 Subject: [PATCH 12/13] PrintServiceImpl: Support for just sending the email even when document template is null. --- pom.xml | 324 ++++++++---------- .../io/mosip/print/PrintPDFApplication.java | 42 +-- .../io/mosip/print/config/PrintConfig.java | 6 + .../io/mosip/print/util/RestApiClient.java | 2 +- src/main/resources/bootstrap.properties | 2 +- .../test/util/TemplateMappedConfigTest.java | 83 +++++ 6 files changed, 258 insertions(+), 201 deletions(-) create mode 100644 src/test/java/io/mosip/print/test/util/TemplateMappedConfigTest.java diff --git a/pom.xml b/pom.xml index a857235f..403f9d66 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot @@ -10,7 +10,7 @@ io.mosip.print print - 1.2.0.1 + 1.2.0.2-test4 print @@ -26,34 +26,33 @@ https://github.com/mosip/print - 11 2.9.2 - UTF-8 - 11 + UTF-8 + 11 11 3.8.0 2.22.0 3.0.2 - 3.1.0 + 3.1.0 0.8.5 3.7.0.1746 3.0.1 - 2.0.2.RELEASE - 2.0.7.RELEASE - 5.0.5.RELEASE - 2.0.0.RELEASE - 1.4.197 - 2.9.8 - 2.9.2 - 2.0.7 + 2.0.2.RELEASE + 2.0.7.RELEASE + 5.0.5.RELEASE + 2.0.0.RELEASE + 1.4.197 + 2.9.8 + 2.9.2 + 2.0.7 2.28.2 - **/constant/**,**/config/**,**/cache/**,**/dto/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*Application.java,**/*Handler.java - **/dto/**,**/config/**,**/api/** - 1.4.2 - 2.8.4 - 1.2.0.1 + **/constant/**,**/config/**,**/cache/**,**/dto/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*Application.java,**/*Handler.java + **/dto/**,**/config/**,**/api/** + 1.4.2 + 2.8.4 + 1.2.0.1 7.1.0 2.0.0 5.5.13 @@ -65,7 +64,6 @@ 3.8.1 3.3.3 - org.springframework.boot @@ -79,9 +77,9 @@ - org.springframework.cloud - spring-cloud-starter-config - 2.0.2.RELEASE + org.springframework.cloud + spring-cloud-starter-config + 2.0.2.RELEASE org.springframework.boot @@ -106,28 +104,28 @@ - com.googlecode.json-simple - json-simple - 1.1.1 + com.googlecode.json-simple + json-simple + 1.1.1 com.google.code.gson gson - org.json - json - 20190722 + org.json + json + 20190722 - + org.slf4j slf4j-api 1.7.25 - joda-time - joda-time - 2.8.1 + joda-time + joda-time + 2.8.1 org.apache.velocity @@ -207,22 +205,21 @@ ${google.zxing.version} - org.apache.httpcomponents - httpclient - 4.5.8 + org.apache.httpcomponents + httpclient + 4.5.8 - org.mockito - mockito-core - 2.22.0 - test + org.mockito + mockito-core + 2.22.0 + test io.mosip.kernel kernel-websubclient-api ${kernel.websub.version} - com.fasterxml.jackson.core jackson-core @@ -249,38 +246,40 @@ 1.0.0 - - - - ossrh - CentralRepository - https://oss.sonatype.org/content/repositories/snapshots - default - - true - - - - central - MavenCentral - default - https://repo1.maven.org/maven2 - - false - - - - + + + ossrh + CentralRepository + https://oss.sonatype.org/content/repositories/snapshots + default + + true + + + + danubetech-maven-public + https://repo.danubetech.com/repository/maven-public/ + + + central + MavenCentral + default + https://repo1.maven.org/maven2 + + false + + + - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + @@ -289,7 +288,7 @@ ${maven.surefire.plugin.version} ${skipTests} - false + true ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --illegal-access=permit @@ -352,33 +351,15 @@ - - org.apache.maven.plugins - maven-compiler-plugin - ${maven.compiler.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - true - none - - + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + org.apache.maven.plugins maven-jar-plugin @@ -413,87 +394,78 @@ + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + false + + org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.version} + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + true + + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + pl.project13.maven + git-commit-id-plugin + 3.0.1 + + + get-the-git-infos + + revision + + validate + + - true - none + true + ${project.build.outputDirectory}/git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - false - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - pl.project13.maven - git-commit-id-plugin - 3.0.1 - - - get-the-git-infos - - revision - - validate - - - - true - ${project.build.outputDirectory}/git.properties - - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - - full - ${project.basedir}/.git - - - @@ -527,4 +499,4 @@ - + \ No newline at end of file diff --git a/src/main/java/io/mosip/print/PrintPDFApplication.java b/src/main/java/io/mosip/print/PrintPDFApplication.java index 0465f1c9..edbd1c13 100644 --- a/src/main/java/io/mosip/print/PrintPDFApplication.java +++ b/src/main/java/io/mosip/print/PrintPDFApplication.java @@ -15,36 +15,32 @@ import io.mosip.print.service.impl.CbeffImpl; import io.mosip.print.spi.CbeffUtil; - -@SpringBootApplication(scanBasePackages = { "io.mosip.print.*", "${mosip.auth.adapter.impl.basepackage}" }, exclude = { DataSourceAutoConfiguration.class, - HibernateJpaAutoConfiguration.class, - CacheAutoConfiguration.class }) +@SpringBootApplication(scanBasePackages = { "io.mosip.print.*", "${mosip.auth.adapter.impl.basepackage}" }, + exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, CacheAutoConfiguration.class }) @EnableScheduling @EnableAsync public class PrintPDFApplication { - - @Bean - @Primary - public CbeffUtil getCbeffUtil() { - return new CbeffImpl(); - } + @Bean + @Primary + public CbeffUtil getCbeffUtil() { + return new CbeffImpl(); + } @Bean public CredentialsVerifier credentialsVerifier() { return new CredentialsVerifier(); } - @Bean - public ThreadPoolTaskScheduler taskScheduler() { - ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); - threadPoolTaskScheduler.setPoolSize(5); - threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler"); - return threadPoolTaskScheduler; - } - - public static void main(String[] args) { - SpringApplication.run(PrintPDFApplication.class, args); - } - -} + @Bean + public ThreadPoolTaskScheduler taskScheduler() { + ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); + threadPoolTaskScheduler.setPoolSize(5); + threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler"); + return threadPoolTaskScheduler; + } + + public static void main(String[] args) { + SpringApplication.run(PrintPDFApplication.class, args); + } +} \ No newline at end of file diff --git a/src/main/java/io/mosip/print/config/PrintConfig.java b/src/main/java/io/mosip/print/config/PrintConfig.java index c4fb5d7a..1f328d02 100644 --- a/src/main/java/io/mosip/print/config/PrintConfig.java +++ b/src/main/java/io/mosip/print/config/PrintConfig.java @@ -4,6 +4,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.web.client.RestTemplate; @Configuration @@ -18,4 +19,9 @@ public TaskScheduler taskScheduler() { } + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + } diff --git a/src/main/java/io/mosip/print/util/RestApiClient.java b/src/main/java/io/mosip/print/util/RestApiClient.java index 636020d7..5471643c 100644 --- a/src/main/java/io/mosip/print/util/RestApiClient.java +++ b/src/main/java/io/mosip/print/util/RestApiClient.java @@ -40,7 +40,7 @@ public class RestApiClient { /** The builder. */ @Autowired - @Qualifier("selfTokenRestTemplate") + // @Qualifier("selfTokenRestTemplate") private RestTemplate restTemplate; @Autowired diff --git a/src/main/resources/bootstrap.properties b/src/main/resources/bootstrap.properties index 2c439ba6..d4722dd6 100644 --- a/src/main/resources/bootstrap.properties +++ b/src/main/resources/bootstrap.properties @@ -6,6 +6,6 @@ spring.application.name=print management.endpoint.health.show-details=always management.endpoints.web.exposure.include=info,health,refresh -server.port=8088 +server.port=80881 server.servlet.context-path=/v1/print health.config.enabled=false \ No newline at end of file diff --git a/src/test/java/io/mosip/print/test/util/TemplateMappedConfigTest.java b/src/test/java/io/mosip/print/test/util/TemplateMappedConfigTest.java new file mode 100644 index 00000000..56240683 --- /dev/null +++ b/src/test/java/io/mosip/print/test/util/TemplateMappedConfigTest.java @@ -0,0 +1,83 @@ +package io.mosip.print.test.util; + +import io.mosip.print.constant.TemplateType; +import io.mosip.print.util.TemplateMapper; +import org.junit.Test; +import static org.junit.Assert.*; + +public class TemplateMappedConfigTest { + + @Test + public void testValidConfigWithAllTemplates() { + TemplateMapper.TemplateMappedConfig config = new TemplateMapper.TemplateMappedConfig( + TemplateType.UIN_CARD_TEMPLATE, + TemplateType.UIN_CARD_EMAIL_SUB, + TemplateType.UIN_CARD_EMAIL + ); + + assertNotNull(config); + assertEquals(TemplateType.UIN_CARD_TEMPLATE, config.getDocumentTemplateName()); + assertEquals(TemplateType.UIN_CARD_EMAIL_SUB, config.getEmailSubjectTemplate()); + assertEquals(TemplateType.UIN_CARD_EMAIL, config.getEmailTemplate()); + } + + @Test + public void testValidConfigWithOnlyDocumentTemplate() { + TemplateMapper.TemplateMappedConfig config = new TemplateMapper.TemplateMappedConfig( + TemplateType.UIN_CARD_TEMPLATE, + null, + null + ); + + assertNotNull(config); + assertEquals(TemplateType.UIN_CARD_TEMPLATE, config.getDocumentTemplateName()); + assertNull(config.getEmailSubjectTemplate()); + assertNull(config.getEmailTemplate()); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidConfigWithEmailTemplateButNoSubject() { + new TemplateMapper.TemplateMappedConfig( + TemplateType.UIN_CARD_TEMPLATE, + null, + TemplateType.UIN_CARD_EMAIL + ); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidConfigWithEmailSubjectButNoTemplate() { + new TemplateMapper.TemplateMappedConfig( + TemplateType.UIN_CARD_TEMPLATE, + TemplateType.UIN_CARD_EMAIL_SUB, + null + ); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidConfigWithNoTemplates() { + new TemplateMapper.TemplateMappedConfig(null, null, null); + } + + @Test + public void testValidConfigWithOnlyEmailTemplates() { + TemplateMapper.TemplateMappedConfig config = new TemplateMapper.TemplateMappedConfig( + null, + TemplateType.UIN_CARD_EMAIL_SUB, + TemplateType.UIN_CARD_EMAIL + ); + + assertNotNull(config); + assertNull(config.getDocumentTemplateName()); + assertEquals(TemplateType.UIN_CARD_EMAIL_SUB, config.getEmailSubjectTemplate()); + assertEquals(TemplateType.UIN_CARD_EMAIL, config.getEmailTemplate()); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidConfigWithNullDocumentAndOneEmailComponent() { + new TemplateMapper.TemplateMappedConfig( + null, + TemplateType.UIN_CARD_EMAIL_SUB, + null + ); + } +} \ No newline at end of file From 5790d699a600f7bae0dc79c5bdc787dc8b5f5df6 Mon Sep 17 00:00:00 2001 From: abdulbathish Date: Tue, 6 May 2025 12:26:04 +0530 Subject: [PATCH 13/13] add url and desc --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 403f9d66..5a68ed2c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,8 @@ print 1.2.0.2-test4 print + https://github.com/mosip/print + MOSIP Print service MPL 2.0