diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/TransactionDataProvider.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/TransactionDataProvider.kt index 6105639..f97466e 100644 --- a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/TransactionDataProvider.kt +++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/TransactionDataProvider.kt @@ -13,8 +13,8 @@ import reactor.core.publisher.Mono */ interface TransactionDataProvider { - /** Retrieve total record count for the given search criteria */ - fun totalRecordCount(searchCriteria: HelpDeskSearchTransactionRequestDto): Mono + /** Retrieve total record count for the given search parameters */ + fun totalRecordCount(searchParams: HelpDeskSearchTransactionRequestDto): Mono /** * Perform paginated query for retrieve transaction information for the given search criteria diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProvider.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProvider.kt index fc5eafe..02517e5 100644 --- a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProvider.kt +++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProvider.kt @@ -25,36 +25,35 @@ class PMTransactionDataProvider(@Autowired private val connectionFactory: Connec private val logger = LoggerFactory.getLogger(javaClass) - override fun totalRecordCount(searchCriteria: HelpDeskSearchTransactionRequestDto): Mono = - when (searchCriteria) { + override fun totalRecordCount(searchParams: HelpDeskSearchTransactionRequestDto): Mono = + when (searchParams) { is SearchTransactionRequestPaymentTokenDto -> Mono.just(0) is SearchTransactionRequestRptIdDto -> Mono.just(0) is SearchTransactionRequestTransactionIdDto -> Mono.just(0) is SearchTransactionRequestEmailDto -> - getTotalResultCount(buildTransactionByUserEmailCountQuery(searchCriteria.userEmail)) + getTotalResultCount(buildTransactionByUserEmailCountQuery(searchParams.userEmail)) is SearchTransactionRequestFiscalCodeDto -> Mono.error(RuntimeException("Not implemented yet")) - else -> Mono.error(InvalidSearchCriteriaException(searchCriteria.type, ProductDto.PM)) + else -> Mono.error(InvalidSearchCriteriaException(searchParams.type, ProductDto.PM)) } override fun findResult( - searchCriteria: HelpDeskSearchTransactionRequestDto, + searchParams: HelpDeskSearchTransactionRequestDto, pageSize: Int, pageNumber: Int ): Mono> { - val searchCriteriaType = searchCriteria.type + val searchCriteriaType = searchParams.type val invalidSearchCriteriaError = Mono.error>( InvalidSearchCriteriaException(searchCriteriaType, ProductDto.PM) ) - return when (searchCriteria) { + return when (searchParams) { is SearchTransactionRequestPaymentTokenDto -> invalidSearchCriteriaError is SearchTransactionRequestRptIdDto -> invalidSearchCriteriaError is SearchTransactionRequestTransactionIdDto -> invalidSearchCriteriaError is SearchTransactionRequestEmailDto -> getResultSetFromPaginatedQuery( - resultQuery = - buildTransactionByUserEmailPaginatedQuery(searchCriteria.userEmail), + resultQuery = buildTransactionByUserEmailPaginatedQuery(searchParams.userEmail), pageNumber = pageNumber, pageSize = pageSize, searchType = searchCriteriaType diff --git a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt index 3386628..b1f19d2 100644 --- a/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt +++ b/src/main/kotlin/it/pagopa/ecommerce/helpdesk/services/PmService.kt @@ -29,7 +29,7 @@ class PmService(@Autowired val pmTransactionDataProvider: PMTransactionDataProvi if (totalCount > 0) { pmTransactionDataProvider .findResult( - searchCriteria = pmSearchTransactionRequestDto, + searchParams = pmSearchTransactionRequestDto, pageSize = pageSize, pageNumber = pageNumber ) diff --git a/src/test/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProviderTest.kt b/src/test/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProviderTest.kt index 9f9b6b7..bbbe4db 100644 --- a/src/test/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProviderTest.kt +++ b/src/test/kotlin/it/pagopa/ecommerce/helpdesk/dataproviders/oracle/PMTransactionDataProviderTest.kt @@ -82,7 +82,7 @@ class PMTransactionDataProviderTest { ) StepVerifier.create( pmTransactionDataProvider.findResult( - searchCriteria = HelpdeskTestUtils.buildSearchRequestByUserMail(), + searchParams = HelpdeskTestUtils.buildSearchRequestByUserMail(), pageNumber = 0, pageSize = 10 ) @@ -96,7 +96,7 @@ class PMTransactionDataProviderTest { StepVerifier.create( pmTransactionDataProvider.totalRecordCount( - searchCriteria = HelpdeskTestUtils.buildSearchRequestByRptId() + searchParams = HelpdeskTestUtils.buildSearchRequestByRptId() ) ) .expectNext(0) @@ -108,7 +108,7 @@ class PMTransactionDataProviderTest { StepVerifier.create( pmTransactionDataProvider.findResult( - searchCriteria = HelpdeskTestUtils.buildSearchRequestByRptId(), + searchParams = HelpdeskTestUtils.buildSearchRequestByRptId(), pageNumber = 0, pageSize = 10 ) diff --git a/src/test/kotlin/it/pagopa/ecommerce/helpdesk/services/PmServiceTest.kt b/src/test/kotlin/it/pagopa/ecommerce/helpdesk/services/PmServiceTest.kt index cbd1a1d..30f2a9f 100644 --- a/src/test/kotlin/it/pagopa/ecommerce/helpdesk/services/PmServiceTest.kt +++ b/src/test/kotlin/it/pagopa/ecommerce/helpdesk/services/PmServiceTest.kt @@ -29,7 +29,7 @@ class PmServiceTest { .willReturn(Mono.just(totalCount)) given( pmTransactionDataProvider.findResult( - searchCriteria = searchCriteria, + searchParams = searchCriteria, pageSize = pageSize, pageNumber = pageNumber )