Skip to content

Conversation

AdamGrzybkowski
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski commented Oct 15, 2025

WOOMOB-1385

Description

As per the discussion p1760521762369029/1760520041.270299-slack-C09FHQNQERG, this PR adds the Pay at location status for the booking based on the order status and the payment method.

Note

There's an extra commit b5a61e6 that fixes a bug in the Today tab filtering logic. The start_date_after is not inclusive, so Bookings that start at 12:00 AM are not included in the response.

Steps to reproduce

  1. Create a booking
  2. Make sure the order is not completed and set the payment method to Cash on delivery
  3. Open the app
  4. Go to the bookings tab and find your booking
  5. Confirm the badge shows Pay at location

Testing information

To test the bug with date filtering, create a booking that starts today at 12:00 AM - I used the room rental template for that. Open the Today tab and verify the booking is there.

The tests that have been performed

The above.

Images/gif

Screenshot_20251015_130950
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new “Pay at location” booking status when an order is completed with Cash on Delivery, and fixes the Today tab date filtering so bookings starting at 12:00 AM are included.

  • Map completed + COD orders to a new BookingStatus.PayAtLocation and style it in UI.
  • Adjust date range filter lower bound to the previous day’s end-of-day to accommodate exclusive API behavior; update tests accordingly.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingMapper.kt Maps completed COD orders to PayAtLocation; updates toUiModel signature.
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/bookings/BookingMapperTest.kt Adds unit test for PayAtLocation mapping.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/list/BookingListFiltersBuilder.kt Changes “today at midnight” lower bound to previous day end-of-day.
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/bookings/list/BookingListFilterBuilderTest.kt Updates expected Instant for lower bound to reflect exclusive API behavior.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/compose/BookingStatusTag.kt Adds PayAtLocation status, color mapping, and previews.
WooCommerce/src/main/res/values/strings.xml Adds string for “Pay at location”.
Comments suppressed due to low confidence (1)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/list/BookingListFiltersBuilder.kt:1

  • Expand the KDoc to document why the lower bound uses the previous day’s end-of-day (the API's start_date_after is exclusive). This makes the non-obvious date arithmetic clear to future readers.
package com.woocommerce.android.ui.bookings.list

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 98 to 110
private fun BookingEntity.Status.toUiModel(
orderStatus: String?,
paymentMethod: String?,
): BookingStatus {
return if (orderStatus == "completed" && paymentMethod == "cod") {
BookingStatus.PayAtLocation
} else {
when (this) {
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid magic strings for order status and payment method. Extract 'completed' and 'cod' into well-named constants (or reference existing enums/constants) to centralize these protocol values and prevent typos.

Copilot uses AI. Check for mistakes.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitf0130fd
Direct Downloadwoocommerce-wear-prototype-build-pr14758-f0130fd.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitf0130fd
Direct Downloadwoocommerce-prototype-build-pr14758-f0130fd.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 36.36364% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.00%. Comparing base (eacf58a) to head (f0130fd).
⚠️ Report is 56 commits behind head on trunk.

Files with missing lines Patch % Lines
...ce/android/ui/bookings/compose/BookingStatusTag.kt 0.00% 9 Missing ⚠️
...m/woocommerce/android/ui/bookings/BookingMapper.kt 54.54% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14758      +/-   ##
============================================
- Coverage     38.00%   38.00%   -0.01%     
- Complexity     9960     9964       +4     
============================================
  Files          2118     2118              
  Lines        119122   119130       +8     
  Branches      16225    16230       +5     
============================================
+ Hits          45269    45270       +1     
- Misses        69287    69294       +7     
  Partials       4566     4566              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdamGrzybkowski AdamGrzybkowski force-pushed the issue/WOOMOB-1385_payment_status branch from b5a61e6 to 528e000 Compare October 17, 2025 07:39
@hichamboushaba hichamboushaba self-assigned this Oct 17, 2025
@wpmobilebot wpmobilebot modified the milestones: 23.5, 23.6 Oct 17, 2025
@wpmobilebot
Copy link
Collaborator

Version 23.5 has now entered code-freeze, so the milestone of this PR has been updated to 23.6.

Copy link
Member

@hichamboushaba hichamboushaba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, :shipit:

@hichamboushaba hichamboushaba merged commit 02fb13b into trunk Oct 17, 2025
14 of 15 checks passed
@hichamboushaba hichamboushaba deleted the issue/WOOMOB-1385_payment_status branch October 17, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants