Skip to content

Commit

Permalink
MOSIP-36852 - fix scenario3 (Prereg_BookAppointmentByPRID_blank_preRe…
Browse files Browse the repository at this point in the history
…gistrationId)

Signed-off-by: ymahtat-dev <[email protected]>
  • Loading branch information
ymahtat-dev committed Nov 5, 2024
1 parent f449140 commit a24dd3d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public MainResponseDTO<BookingRegistrationDTO> getAppointmentDetails(String preR
}

private void userValidation(String applicationId) {
this.applicationIdValidation(applicationId);
String authUserId = authUserDetails().getUserId();
List<String> list = listAuth(authUserDetails().getAuthorities());
if (list.contains("ROLE_INDIVIDUAL")) {
Expand All @@ -155,7 +156,7 @@ private void userValidation(String applicationId) {
+ " and userID " + authUserId);
ApplicationEntity applicationEntity = null;
try {
applicationEntity = applicationRepostiory.findByApplicationId(applicationId);
applicationEntity = applicationRepostiory.findById(applicationId).orElseThrow();
} catch (Exception ex) {
log.error(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"Invaid applicationId/Not Record Found for the ID : " + applicationId);
Expand All @@ -169,6 +170,15 @@ private void userValidation(String applicationId) {
}
}

private void applicationIdValidation(String applicationId) {
if (applicationId == null || applicationId.trim().isEmpty()) {
throw new AppointmentExecption(
ApplicationErrorCodes.PRG_APP_013.getCode(),
"preRegistrationId cannot be empty."
);
}
}

/**
* This method is used to get the list of authorization role
*
Expand Down

0 comments on commit a24dd3d

Please sign in to comment.