From 51418018ba4fe38a1db9c359d0592463d0bcacdb Mon Sep 17 00:00:00 2001 From: Sahil-tarento <140611066+Sahil-tarento@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:10:13 +0530 Subject: [PATCH 1/2] Adding the condition for DigiLocker (#515) --- .../digilocker/service/DigiLockerIntegrationServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java b/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java index 43971ef7d..726e44d6a 100644 --- a/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java +++ b/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java @@ -72,6 +72,7 @@ public PullURIResponse generateURIResponse(String digiLockerHmac, String request } catch (IOException e) { logger.error("Not able to process the request requestBody: " + requestBody, e); responseStatus.setStatus("0"); + response.getDocDetails().setDocContent("Document is not available."); return response; } CertificateAddInfoDTO certificateAddInfoDTO = new CertificateAddInfoDTO(); @@ -105,6 +106,7 @@ public PullURIResponse generateURIResponse(String digiLockerHmac, String request if ((CollectionUtils.isEmpty(userEnrollmentInfo)) || (CollectionUtils.isNotEmpty(userEnrollmentInfo) && userEnrollmentInfo.size() > 1)) { logger.error("Issue with getting the userEnrollment List" + userEnrollmentInfo); response.setResponseStatus(new ResponseStatus("0", dateFormat.format(new Date()), request.getTxn())); + response.getDocDetails().setDocContent("Document is not available."); return response; } else { URIResponseDocDetails docDetails = response.getDocDetails(); @@ -209,6 +211,7 @@ public PullDocResponse generateDocResponse(String digiLockerHmac, String request } catch (IOException e) { logger.error("Not able to process the request requestBody: " + requestBody, e); responseStatus.setStatus("0"); + response.getDocDetails().setDocContent("Document is not available."); return response; } CertificateAddInfoDTO certificateAddInfoDTO = new CertificateAddInfoDTO(); From 0406353e9fde517bfb8e984f8350ee517efaf4b3 Mon Sep 17 00:00:00 2001 From: Sahil-tarento <140611066+Sahil-tarento@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:59:58 +0530 Subject: [PATCH 2/2] Fix for insertion breaking use case (#516) --- .../digilocker/service/DigiLockerIntegrationServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java b/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java index 726e44d6a..0294295ff 100644 --- a/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java +++ b/src/main/java/org/sunbird/digilocker/service/DigiLockerIntegrationServiceImpl.java @@ -136,7 +136,7 @@ public PullURIResponse generateURIResponse(String digiLockerHmac, String request userEnrollment = userEnrollment.stream().filter(enroll -> ((String) enroll.get("token")).equalsIgnoreCase(certificateAccessCode)).collect(Collectors.toList()); dockerLookUpInfo.put(Constants.CERTIFICATE_ID, userEnrollment.get(0).get(Constants.IDENTIFIER)); try { - dockerLookUpInfo.put(Constants.LAST_ISSUED_ON, simpleDateFormat.format(dateFormat.parse((String) userEnrollment.get(0).get(Constants.LAST_ISSUED_ON)))); + dockerLookUpInfo.put(Constants.LAST_ISSUED_ON, dateFormat.parse((String) userEnrollment.get(0).get(Constants.LAST_ISSUED_ON))); } catch (ParseException e) { responseStatus.setStatus("0"); logger.error("Not able to parse date"); @@ -153,7 +153,7 @@ public PullURIResponse generateURIResponse(String digiLockerHmac, String request certificateAddInfoDTO.setDocumentInfo(request.getDocDetails().getDocType()); certificateAddInfoDTO.setCertificateName((String)dockerLookUpInfo.get(Constants.CERTIFICATE_NAME)); certificateAddInfoDTO.setDocumentName(DocumentType.getValueForKey(request.getDocDetails().getDocType())); - certificateAddInfoDTO.setCertificateIssueOn((String)dockerLookUpInfo.get(Constants.LAST_ISSUED_ON)); + certificateAddInfoDTO.setCertificateIssueOn(simpleDateFormat.format((Date)dockerLookUpInfo.get(Constants.LAST_ISSUED_ON))); certificateAddInfoDTO.setUserName((String)getUserInfo.get(Constants.FIRSTNAME)); certificateAddInfoDTO.setSwd((String)getUserInfo.get(Constants.CHANNEL)); certificateAddInfoDTO.setSwdIndicator(String.valueOf(((String)getUserInfo.get(Constants.CHANNEL)).charAt(0)));