diff --git a/mock-certify-plugin/src/main/java/io.mosip.certify.mock.integration/service/MockVCIssuancePlugin.java b/mock-certify-plugin/src/main/java/io.mosip.certify.mock.integration/service/MockVCIssuancePlugin.java index 67314c5..b09653e 100644 --- a/mock-certify-plugin/src/main/java/io.mosip.certify.mock.integration/service/MockVCIssuancePlugin.java +++ b/mock-certify-plugin/src/main/java/io.mosip.certify.mock.integration/service/MockVCIssuancePlugin.java @@ -250,25 +250,11 @@ public VCResult getVerifiableCredential(VCRequestDto vcRequestDto, Strin throw new VCIExchangeException(ErrorConstants.VCI_EXCHANGE_FAILED); } - log.info("Setting up the data for mDoc"); - data.put("issue_date", "2024-01-12"); - data.put("expiry_date", "2025-01-12"); - data.put("family_name","Agatha"); - data.put("given_name","Joseph"); - data.put("birth_date", "1994-11-06"); - data.put("issuing_country", "Island"); - data.put("document_number",documentNumber); - data.put("driving_privileges",new HashMap<>(){{ - put("vehicle_category_code","A"); - put("issue_date","2023-01-01"); - put("expiry_date","2043-01-01"); - }}); - if(vcRequestDto.getFormat().equals("mso_mdoc")){ VCResult vcResult = new VCResult<>(); String mdocVc = null; try { - mdocVc = new io.mosip.certify.mock.integration.mocks.MdocGenerator().generate(data,holderId, caKeyAndCertificate,issuerKeyAndCertificate); + mdocVc = new io.mosip.certify.mock.integration.mocks.MdocGenerator().generate(mockDataForMsoMdoc(documentNumber),holderId, caKeyAndCertificate,issuerKeyAndCertificate); } catch (Exception e) { log.error("Exception on mdoc creation", e); throw new VCIExchangeException(ErrorConstants.VCI_EXCHANGE_FAILED); @@ -281,6 +267,25 @@ public VCResult getVerifiableCredential(VCRequestDto vcRequestDto, Strin throw new VCIExchangeException(ErrorConstants.NOT_IMPLEMENTED); } + private Map mockDataForMsoMdoc(String documentNumber) { + Map data = new HashMap<>(); + log.info("Setting up the data for mDoc"); + //TODO: Populate datetime in real time + data.put("issue_date", "2024-01-12"); + data.put("expiry_date", "2025-01-12"); + data.put("family_name","Agatha"); + data.put("given_name","Joseph"); + data.put("birth_date", "1994-11-06"); + data.put("issuing_country", "Island"); + data.put("document_number", documentNumber); + data.put("driving_privileges",new HashMap<>(){{ + put("vehicle_category_code","A"); + put("issue_date","2023-01-01"); + put("expiry_date","2043-01-01"); + }}); + return data; + } + public OIDCTransaction getUserInfoTransaction(String accessTokenHash) { return cacheManager.getCache(USERINFO_CACHE).get(accessTokenHash, OIDCTransaction.class); }