Skip to content

Commit

Permalink
MOSIP-30831 Removed transactionId for generate and revoke vid new API. (
Browse files Browse the repository at this point in the history
mosip#1185)

* MOSIP-30831 Removed transactionId for generate and revoke vid new API.

Signed-off-by: kameshsr <[email protected]>

* Fixed test case Failure

Signed-off-by: kameshsr <[email protected]>

---------

Signed-off-by: kameshsr <[email protected]>
  • Loading branch information
kameshsr committed Mar 15, 2024
1 parent f7d2698 commit fed7c28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public void validateVidCreateV2Request(IVidRequestDto<? extends BaseVidRequestDt
}
}

if (StringUtils.isEmpty(requestDto.getRequest().getTransactionID())) {
if (otpValidationRequired && StringUtils.isEmpty(requestDto.getRequest().getTransactionID())) {
audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, "transactionId",
"Request to generate VID"));

Expand Down Expand Up @@ -739,7 +739,7 @@ public void validateVidRevokeV2Request(RequestWrapper<? extends BaseVidRevokeReq
}
}

if (StringUtils.isEmpty(requestDto.getRequest().getTransactionID())) {
if (isOtpValidationRequired && StringUtils.isEmpty(requestDto.getRequest().getTransactionID())) {
audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, "transactionId", "Request to revoke VID"));
throw new InvalidInputException("transactionId");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2018,21 +2018,6 @@ public void testValidateVidCreateV2RequestInvalidIndividualId() {
false, null);
}

@Test(expected = InvalidInputException.class)
public void testValidateVidCreateV2RequestInvalidTransactionId() {
ReflectionTestUtils.setField(requestValidator, "generateId", "generate");
ReflectionTestUtils.setField(requestValidator, "newVersion", "newVersion");
ResidentVidRequestDtoV2 requestDto = new ResidentVidRequestDtoV2();
requestDto.setId("generate");
requestDto.setVersion("newVersion");
VidRequestDtoV2 vidRequestDtoV2 = new VidRequestDtoV2();
vidRequestDtoV2.setVidType("PERPETUAL");
requestDto.setRequest(vidRequestDtoV2);
requestDto.setRequesttime(String.valueOf(LocalDateTime.now()));
requestValidator.validateVidCreateV2Request(requestDto,
false, "123");
}

@Test(expected = InvalidInputException.class)
public void testValidateVidCreateV2RequestInvalidRequestDto() {
ReflectionTestUtils.setField(requestValidator, "generateId", "generate");
Expand Down Expand Up @@ -2330,20 +2315,6 @@ public void testValidateVidRevokeV2RequestEmptyRequestIdEmptyVidStatus() throws
requestValidator.validateVidRevokeV2Request(requestDto, false, "3956038419");
}

@Test(expected = InvalidInputException.class)
public void testValidateVidRevokeV2RequestEmptyRequestIdEmptyVidStatusRevoked() throws Exception {
ReflectionTestUtils.setField(requestValidator, "revokeVidIdNew", "1.0");
ReflectionTestUtils.setField(requestValidator, "revokeVidVersion", "1.0");
RequestWrapper<VidRevokeRequestDTOV2> requestDto = new RequestWrapper<>();
requestDto.setId("1.0");
requestDto.setVersion("1.0");
VidRevokeRequestDTOV2 vidRevokeRequestDTO = new VidRevokeRequestDTOV2();
vidRevokeRequestDTO.setVidStatus("REVOKED");
requestDto.setRequest(vidRevokeRequestDTO);
requestDto.setRequesttime(LocalDateTime.now().toString());
requestValidator.validateVidRevokeV2Request(requestDto, false, "3956038419");
}

@Test
public void testValidateVidRevokeV2RequestEmptyRequestIdEmptyVidStatusSuccess() throws Exception {
ReflectionTestUtils.setField(requestValidator, "revokeVidIdNew", "1.0");
Expand Down

0 comments on commit fed7c28

Please sign in to comment.