Skip to content

Commit f0130fd

Browse files
Fix condition check for Pay at location status
1 parent 528e000 commit f0130fd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingMapper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class BookingMapper @Inject constructor(
104104
orderStatus: String?,
105105
paymentMethod: String?,
106106
): BookingStatus {
107-
return if (orderStatus == "completed" && paymentMethod == "cod") {
107+
return if (orderStatus != "completed" && paymentMethod == "cod") {
108108
BookingStatus.PayAtLocation
109109
} else {
110110
when (this) {

WooCommerce/src/test/kotlin/com/woocommerce/android/ui/bookings/BookingMapperTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class BookingMapperTest : BaseUnitTest() {
228228
}
229229

230230
@Test
231-
fun `given completed order with COD payment method, when mapped to summary model, then status is PayAtLocation`() {
231+
fun `given processing order with COD payment method, when mapped to summary model, then status is PayAtLocation`() {
232232
// GIVEN
233233
val booking = sampleBooking().let { original ->
234234
val paymentInfo = BookingPaymentInfo(
@@ -239,7 +239,7 @@ class BookingMapperTest : BaseUnitTest() {
239239
total = BigDecimal("55.00"),
240240
totalTax = BigDecimal("0.00")
241241
)
242-
val orderWithPayment = original.order.copy(paymentInfo = paymentInfo, status = "completed")
242+
val orderWithPayment = original.order.copy(paymentInfo = paymentInfo, status = "processing")
243243
original.copy(order = orderWithPayment)
244244
}
245245

0 commit comments

Comments
 (0)