diff --git a/src/main/java/it/pagopa/selfcare/pagopa/service/impl/ExternalServiceImpl.java b/src/main/java/it/pagopa/selfcare/pagopa/service/impl/ExternalServiceImpl.java index 993de0f..bd80007 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/service/impl/ExternalServiceImpl.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/service/impl/ExternalServiceImpl.java @@ -42,7 +42,7 @@ public ExternalServiceImpl(BrokerInstitutionsRepository brokerInstitutionsReposi @Override public BrokerInstitutionsResponse getBrokerInstitutions(String brokerCode, Integer limit, Integer page) { Optional brokerInstitutionsEntity = brokerInstitutionsRepository - .findPagedInstitutionsByBrokerCode(brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit); + .findPagedInstitutionsByBrokerCode(brokerCode, page * limit, limit); if (brokerInstitutionsEntity.isEmpty() || brokerInstitutionsEntity.get().getInstitutionEntities() == null) { throw new AppException(AppError.BROKER_INSTITUTIONS_NOT_FOUND, brokerCode); @@ -89,7 +89,7 @@ public CIIbansResponse getCIsIbans(Integer limit, Integer page) { public CIIbansResponse getBrokerIbans(String brokerCode, Integer limit, Integer page) { Pageable pageable = PageRequest.of(page, limit); Optional brokerIbanAggregate = brokerIbansRepository.getBrokerIbans( - brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit); + brokerCode, page * limit, limit); if (brokerIbanAggregate.isEmpty() || brokerIbanAggregate.get().getIbansSlice() == null) { throw new AppException(AppError.BROKER_IBANS_NOT_FOUND, brokerCode);