Skip to content

Commit

Permalink
MOSIP-25536 Added online verification partner id in jpa repo view his…
Browse files Browse the repository at this point in the history
…tory. (mosip#790)

* Fixed service history issue.

* MOSIP-24939 Improved code coverage.

* MOSIP-24939 Improved code coverage.

* MOSIP-24939 Improved code coverage.

* MOSIP-24939 Improved code coverage.

* MOSIP-24939 Improved code coverage.

* MOSIP-24939 Improved code coverage.

* MOSIP-25854 Fixed vid card issue.

* MOSIP-25854 Fixed vid card issue.

* MOSIP-25854 Fixed vid card issue.

* MOSIP-25536 Added online verification partner id in jpa repo view history.

* MOSIP-25536 Fixed test case failure.
  • Loading branch information
kameshsr authored Mar 9, 2023
1 parent b2c969e commit 474304f
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,5 @@ private ResidentConstants() {
public static final String IMAGE = "mosip.resident.photo.token.claim-photo";
public static final String VID = "vid";
public static final String NAME = "name";
public static final String ONLINE_VERIFICATION_PARTNER_ID = "ida.online-verification-partner-id";
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,58 +100,58 @@ List<ResidentTransactionEntity> findByTokenWithoutServiceTypeAndDate(@Param("tok
@Query("update ResidentTransactionEntity set read_status='true' where event_id=:eventId")
int updateReadStatus(@Param("eventId") String eventId);

Page<ResidentTransactionEntity> findByTokenId(String tokenId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndOlvPartnerIdIsNullOrOlvPartnerId(String tokenId, String olvPartnerId,Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndEventIdLike(
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId,
LocalDateTime startDate,
LocalDateTime endDate,
List<String> requestTypeCodes,
List<String> statusCodes,
String eventId,
Pageable pageable
String onlineVerificationPartnerId, Pageable pageable
);

Page<ResidentTransactionEntity> findByEventIdLike(String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeIn(
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> requestTypeCodes,
List<String> statusCodes, Pageable pageable);
List<String> statusCodes, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndEventIdLike(
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate,
LocalDateTime endDate,
List<String> requestTypeCodes, String eventId, Pageable pageable);
List<String> requestTypeCodes, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndEventIdLike(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> statusCodes, String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> statusCodes, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndEventIdLike(
String tokenId, List<String> requestTypeCodes, List<String> statusCodes, String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, List<String> requestTypeCodes, List<String> statusCodes, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndStatusCodeIn(
String tokenId, List<String> requestTypeCodes, List<String> statusCodes, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, List<String> requestTypeCodes, List<String> statusCodes, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndEventIdLike(
String tokenId, List<String> requestTypeCodes, String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, List<String> requestTypeCodes, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndStatusCodeInAndEventIdLike(
String tokenId, List<String> statusCodes, String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, List<String> statusCodes, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndEventIdLike(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, String eventId, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, String eventId, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndStatusCodeIn(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> statusCodes, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> statusCodes, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeIn(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> requestTypeCodes, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, List<String> requestTypeCodes, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetween(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndCrDtimesBetweenAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, LocalDateTime startDate, LocalDateTime endDate, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeIn(
String tokenId, List<String> requestTypeCodes, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndRequestTypeCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
String tokenId, List<String> requestTypeCodes, String onlineVerificationPartnerId, Pageable pageable);

Page<ResidentTransactionEntity> findByTokenIdAndStatusCodeIn(String tokenId, List<String> statusCodes, Pageable pageable);
Page<ResidentTransactionEntity> findByTokenIdAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(String tokenId, List<String> statusCodes, String onlineVerificationPartnerId, Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,7 @@ public PageDto<ServiceHistoryResponseDto> getServiceHistoryResponse(String sortT
LocalDate toDateTime, String serviceType, String langCode,
int timeZoneOffset)
throws ResidentServiceCheckedException {
String onlineVerificationPartnerId = this.env.getProperty(ResidentConstants.ONLINE_VERIFICATION_PARTNER_ID);
if (sortType == null) {
sortType = SortType.DESC.toString();
}
Expand All @@ -1706,70 +1707,88 @@ public PageDto<ServiceHistoryResponseDto> getServiceHistoryResponse(String sortT
if (fromDateTime != null && toDateTime != null && serviceType != null && !serviceType.equalsIgnoreCase(ALL)
&& statusFilter != null && searchText != null) {
residentTransactionEntityPage= residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndEventIdLike(
findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType),
getStatusFilterQuery(statusFilter), searchText ,pageable);
getStatusFilterQuery(statusFilter), searchText ,onlineVerificationPartnerId,pageable);
} else if (fromDateTime != null && toDateTime != null && serviceType != null
&& !serviceType.equalsIgnoreCase(ALL) && statusFilter != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeIn(
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType),
getStatusFilterQuery(statusFilter) ,pageable);
getStatusFilterQuery(statusFilter) ,onlineVerificationPartnerId, pageable);
} else if (fromDateTime != null && toDateTime != null && serviceType != null
&& !serviceType.equalsIgnoreCase(ALL) && searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndEventIdLike(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType),
searchText, onlineVerificationPartnerId, pageable
);
} else if (fromDateTime != null && toDateTime != null && statusFilter != null && searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndEventIdLike(
tokenId, date.getT1(), date.getT2(), getStatusFilterQuery(statusFilter), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), getStatusFilterQuery(statusFilter), searchText,
onlineVerificationPartnerId, pageable
);
} else if (serviceType != null && !serviceType.equalsIgnoreCase(ALL) && statusFilter != null
&& searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndEventIdLike(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), getStatusFilterQuery(statusFilter), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), getStatusFilterQuery(statusFilter),
searchText, onlineVerificationPartnerId, pageable
);
} else if (serviceType != null && !serviceType.equalsIgnoreCase(ALL) && statusFilter != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndRequestTypeCodeInAndStatusCodeIn(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), getStatusFilterQuery(statusFilter), pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndRequestTypeCodeInAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), getStatusFilterQuery(statusFilter),
onlineVerificationPartnerId, pageable
);
} else if (serviceType != null && !serviceType.equalsIgnoreCase(ALL) && searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndRequestTypeCodeInAndEventIdLike(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndRequestTypeCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), searchText, onlineVerificationPartnerId, pageable
);
} else if (statusFilter != null && searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndStatusCodeInAndEventIdLike(
tokenId, getStatusFilterQuery(statusFilter), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndStatusCodeInAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, getStatusFilterQuery(statusFilter), searchText, onlineVerificationPartnerId, pageable
);
} else if (fromDateTime != null && toDateTime != null && searchText != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndEventIdLike(
tokenId, date.getT1(), date.getT2(), searchText, pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), searchText, onlineVerificationPartnerId, pageable
);
} else if (fromDateTime != null && toDateTime != null && statusFilter != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndStatusCodeIn(
tokenId, date.getT1(), date.getT2(), getStatusFilterQuery(statusFilter), pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), getStatusFilterQuery(statusFilter), onlineVerificationPartnerId, pageable
);
} else if (fromDateTime != null && toDateTime != null && serviceType != null
&& !serviceType.equalsIgnoreCase(ALL)) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeIn(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType), pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndCrDtimesBetweenAndRequestTypeCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), convertServiceTypeToResidentTransactionType(serviceType),
onlineVerificationPartnerId, pageable
);
} else if (fromDateTime != null && toDateTime != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetween(
tokenId, date.getT1(), date.getT2(), pageable
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndCrDtimesBetweenAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, date.getT1(), date.getT2(), onlineVerificationPartnerId, pageable
);
} else if (serviceType != null && !serviceType.equalsIgnoreCase(ALL)) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndRequestTypeCodeIn(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), pageable
residentTransactionEntityPage = residentTransactionRepository.
findByTokenIdAndRequestTypeCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, convertServiceTypeToResidentTransactionType(serviceType), onlineVerificationPartnerId, pageable
);
} else if (statusFilter != null) {
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndStatusCodeIn(
tokenId, getStatusFilterQuery(statusFilter), pageable
residentTransactionEntityPage = residentTransactionRepository.findByTokenIdAndStatusCodeInAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, getStatusFilterQuery(statusFilter), onlineVerificationPartnerId, pageable
);
} else if(searchText != null){
residentTransactionEntityPage = residentTransactionRepository.findByEventIdLike(searchText, pageable);
residentTransactionEntityPage = residentTransactionRepository.findByEventIdLikeAndOlvPartnerIdIsNullOrOlvPartnerId(
searchText, onlineVerificationPartnerId, pageable);
} else {
residentTransactionEntityPage =
residentTransactionRepository.findByTokenId(tokenId, pageable);
residentTransactionRepository.findByTokenIdAndOlvPartnerIdIsNullOrOlvPartnerId(
tokenId, onlineVerificationPartnerId, pageable);
}
if(residentTransactionEntityPage == null ){
throw new ResidentServiceException(ResidentErrorCode.UNABLE_TO_FETCH_SERVICE_HISTORY_FROM_DB.getErrorCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public void setup() throws Exception {
eventId = "123";
idType = "RID";
resultResponse = "[B@3a7e365";

residentTransactionEntity = Optional.of(new ResidentTransactionEntity());
residentTransactionEntity.get().setEventId(eventId);
residentTransactionEntity.get().setRequestTypeCode(RequestType.UPDATE_MY_UIN.toString());
Expand Down Expand Up @@ -284,8 +283,8 @@ public void testGetUnreadNotifyList() throws ResidentServiceCheckedException, Ap
residentTransactionEntity1.setEventId("123");
Page<ResidentTransactionEntity> residentTransactionEntityPage =
new PageImpl<>(List.of(residentTransactionEntity1));
Mockito.when(residentTransactionRepository.findByTokenIdAndRequestTypeCodeIn
(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(residentTransactionEntityPage);
Mockito.when(residentTransactionRepository.findByTokenIdAndRequestTypeCodeInAndOlvPartnerIdIsNullOrOlvPartnerId
(Mockito.any(), Mockito.any(), Mockito.anyString(), Mockito.any())).thenReturn(residentTransactionEntityPage);
ResponseWrapper<PageDto<ServiceHistoryResponseDto>> responseWrapper = new ResponseWrapper<>();
ServiceHistoryResponseDto serviceHistoryResponseDto = new ServiceHistoryResponseDto();
serviceHistoryResponseDto.setEventId("123");
Expand Down
Loading

0 comments on commit 474304f

Please sign in to comment.