diff --git a/src/main/kotlin/com/carbonara/core/order/OrderQuery.kt b/src/main/kotlin/com/carbonara/core/order/OrderQuery.kt index ca16209..3dfa68e 100644 --- a/src/main/kotlin/com/carbonara/core/order/OrderQuery.kt +++ b/src/main/kotlin/com/carbonara/core/order/OrderQuery.kt @@ -11,6 +11,6 @@ class OrderQuery( @GraphQLDescription("Get all paid orders of an user") suspend fun paidOrders(userId: String): List { - return orderService.getPaidOrdersByAuth0UserId(userId) + return orderService.getNonPendingOrdersByAuth0UserId(userId) } } diff --git a/src/main/kotlin/com/carbonara/core/order/OrderService.kt b/src/main/kotlin/com/carbonara/core/order/OrderService.kt index 2ab3f56..86e9071 100644 --- a/src/main/kotlin/com/carbonara/core/order/OrderService.kt +++ b/src/main/kotlin/com/carbonara/core/order/OrderService.kt @@ -62,7 +62,7 @@ class OrderService( } } - suspend fun getPaidOrdersByAuth0UserId( + suspend fun getNonPendingOrdersByAuth0UserId( auth0UserId: String ): List { return orderRepository.findAllByAuth0UserIdAndPaymentStatuses( diff --git a/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt b/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt index b72ff00..b683ee8 100644 --- a/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt +++ b/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt @@ -145,7 +145,7 @@ class OrderServiceTest { } @Nested - inner class GetPaidAndFailedOrdersByAuth0UserIdTests { + inner class GetNonPendingOrdersByAuth0UserIdTests { @Test fun `Happy case`() { @@ -154,7 +154,7 @@ class OrderServiceTest { paymentStatuses = listOf(InternalPaymentStatus.PAID.name, InternalPaymentStatus.FAILED.name) ) } returns listOf(ORDER_DAO_PAID, ORDER_DAO_PAYMENT_FAILED).toFlux() - val result = runBlocking { orderService.getPaidOrdersByAuth0UserId(AUTH0_USER_ID) } + val result = runBlocking { orderService.getNonPendingOrdersByAuth0UserId(AUTH0_USER_ID) } assertEquals(listOf(ORDER_DAO_PAID.toOrderDto(), ORDER_DAO_PAYMENT_FAILED.toOrderDto()), result) coVerify(exactly = 1) { orderRepository.findAllByAuth0UserIdAndPaymentStatuses( @@ -170,7 +170,7 @@ class OrderServiceTest { paymentStatuses = listOf(InternalPaymentStatus.PAID.name, InternalPaymentStatus.FAILED.name) ) } returns emptyList().toFlux() - val result = runBlocking { orderService.getPaidOrdersByAuth0UserId(AUTH0_USER_ID) } + val result = runBlocking { orderService.getNonPendingOrdersByAuth0UserId(AUTH0_USER_ID) } assertEquals(emptyList(), result) coVerify(exactly = 1) { orderRepository.findAllByAuth0UserIdAndPaymentStatuses(