Skip to content

Commit

Permalink
Update order statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
KjellBerlin committed Aug 31, 2024
1 parent 7bc9e1f commit b720db1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/carbonara/core/order/OrderService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/carbonara/core/order/OrderStatus.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/carbonara/core/slack/SlackService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b720db1

Please sign in to comment.