Skip to content

Commit

Permalink
Introduce order status payment failed
Browse files Browse the repository at this point in the history
  • Loading branch information
KjellBerlin committed Aug 28, 2024
1 parent 485d7f7 commit 8562dab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 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 @@ -123,7 +123,7 @@ class OrderService(
val updatedOrder = order.copy(
paymentDetails = order.paymentDetails.copy(internalPaymentStatus = InternalPaymentStatus.FAILED),
updatedAt = OffsetDateTime.now().toString(),
orderStatus = OrderStatus.CANCELLED
orderStatus = OrderStatus.PAYMENT_FAILED
)
orderRepository.save(updatedOrder).awaitSingleOrNull() ?: run {
log.error("Failed to update payment status to failed for orderId={}", order.orderId)
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/carbonara/core/order/OrderStatus.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ enum class OrderStatus {
FINDING_AVAILABLE_RIDER,
DELIVERY_IN_PROGRESS,
DELIVERED,
CANCELLED
PAYMENT_FAILED,
CANCELLED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class OrderServiceTest {
val ORDER_DAO_PAYMENT_FAILED = ORDER_DAO.copy(
paymentDetails = ORDER_DAO.paymentDetails.copy(
internalPaymentStatus = InternalPaymentStatus.FAILED),
orderStatus = OrderStatus.CANCELLED
orderStatus = OrderStatus.PAYMENT_FAILED
)
}
}

0 comments on commit 8562dab

Please sign in to comment.