From b720db1dc1bcf5fc021ae55a4f29beaefda61eb4 Mon Sep 17 00:00:00 2001 From: KjellBerlin Date: Sat, 31 Aug 2024 09:16:02 +0200 Subject: [PATCH] Update order statuses --- src/main/kotlin/com/carbonara/core/order/OrderService.kt | 2 +- src/main/kotlin/com/carbonara/core/order/OrderStatus.kt | 2 +- src/main/kotlin/com/carbonara/core/slack/SlackService.kt | 2 +- src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt | 2 +- src/test/kotlin/com/carbonara/core/slack/SlackServiceTests.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/carbonara/core/order/OrderService.kt b/src/main/kotlin/com/carbonara/core/order/OrderService.kt index 0110fdb..21dee95 100644 --- a/src/main/kotlin/com/carbonara/core/order/OrderService.kt +++ b/src/main/kotlin/com/carbonara/core/order/OrderService.kt @@ -139,7 +139,7 @@ class OrderService( val updatedOrder = order.copy( paymentDetails = order.paymentDetails.copy(internalPaymentStatus = InternalPaymentStatus.PAID), updatedAt = OffsetDateTime.now().toString(), - orderStatus = OrderStatus.PROCESSING_ORDER + orderStatus = OrderStatus.FINDING_AVAILABLE_RIDER ) orderRepository.save(updatedOrder).awaitSingleOrNull() ?: run { log.error("Failed to update payment status to paid for orderId={}", order.orderId) diff --git a/src/main/kotlin/com/carbonara/core/order/OrderStatus.kt b/src/main/kotlin/com/carbonara/core/order/OrderStatus.kt index 9070b41..40d2be8 100644 --- a/src/main/kotlin/com/carbonara/core/order/OrderStatus.kt +++ b/src/main/kotlin/com/carbonara/core/order/OrderStatus.kt @@ -2,8 +2,8 @@ package com.carbonara.core.order enum class OrderStatus { NONE, - PROCESSING_ORDER, FINDING_AVAILABLE_RIDER, + RIDER_ASSIGNED, DELIVERY_IN_PROGRESS, DELIVERED, PAYMENT_FAILED, diff --git a/src/main/kotlin/com/carbonara/core/slack/SlackService.kt b/src/main/kotlin/com/carbonara/core/slack/SlackService.kt index 5662b9b..c3a906b 100644 --- a/src/main/kotlin/com/carbonara/core/slack/SlackService.kt +++ b/src/main/kotlin/com/carbonara/core/slack/SlackService.kt @@ -23,7 +23,7 @@ class SlackService( slackOrderStatus: String ): OrderStatus { return when(slackOrderStatus) { - "accept" -> OrderStatus.PROCESSING_ORDER + "accept" -> OrderStatus.RIDER_ASSIGNED "delivery_in_progress" -> OrderStatus.DELIVERY_IN_PROGRESS "delivered" -> OrderStatus.DELIVERED "cancelled" -> OrderStatus.CANCELLED diff --git a/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt b/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt index 86b5f35..4b2ffde 100644 --- a/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt +++ b/src/test/kotlin/com/carbonara/core/order/OrderServiceTest.kt @@ -273,7 +273,7 @@ class OrderServiceTest { products = listOf(TEST_PRODUCT), additionalDetails = CREATE_ORDER_INPUT.additionalDetails, paymentDetails = PAYMENT_DETAILS, - orderStatus = OrderStatus.PROCESSING_ORDER, + orderStatus = OrderStatus.FINDING_AVAILABLE_RIDER, createdAt = TIME.toString(), updatedAt = TIME.toString() ) diff --git a/src/test/kotlin/com/carbonara/core/slack/SlackServiceTests.kt b/src/test/kotlin/com/carbonara/core/slack/SlackServiceTests.kt index 8eb441f..05653de 100644 --- a/src/test/kotlin/com/carbonara/core/slack/SlackServiceTests.kt +++ b/src/test/kotlin/com/carbonara/core/slack/SlackServiceTests.kt @@ -23,7 +23,7 @@ class SlackServiceTests { @TestFactory fun orderStatusUpdateTests() = listOf( - OrderStatusUpdateScenario("accept", OrderStatus.PROCESSING_ORDER), + OrderStatusUpdateScenario("accept", OrderStatus.RIDER_ASSIGNED), OrderStatusUpdateScenario("delivery_in_progress", OrderStatus.DELIVERY_IN_PROGRESS), OrderStatusUpdateScenario("delivered", OrderStatus.DELIVERED), OrderStatusUpdateScenario("cancelled", OrderStatus.CANCELLED)