-
Notifications
You must be signed in to change notification settings - Fork 133
[WOOMOB-1561] Booking details - cancel booking action #14808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the Cancel booking action for the REST API, allowing users to cancel bookings through the mobile app. The implementation includes necessary UI updates to properly reflect the cancelled state and handle the cancellation flow.
Key Changes
- Added REST API support for canceling bookings with automatic order refresh to sync status updates
- Updated booking status badge logic to correctly handle cancelled bookings using "on-hold" instead of incomplete order status
- Modified UI visibility logic to hide cancel button and attendance section for cancelled bookings
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| BookingsStore.kt | Added refreshBooking parameter and refactored update logic to support optional order refresh |
| BookingsRestClient.kt | Extended payload mapping to include booking status field |
| BookingUpdatePayload.kt | Added status field to support cancellation requests |
| BookingDtoMapper.kt | Changed toBookingOrderInfo visibility to support order refresh logic |
| BookingsRepository.kt | Implemented cancelBooking method that updates status and refreshes order |
| BookingMapper.kt | Fixed badge logic to check for "on-hold" status and added cancel button visibility logic |
| BookingDetailsViewModel.kt | Integrated cancel booking repository call with error handling |
| BookingDetailsViewState.kt | Added computed property for attendance status modification capability |
| BookingDetailsScreen.kt | Wrapped attendance section in animated visibility based on cancel button state |
| BookingAppointmentDetails.kt | Added cancel button visibility control and conditional divider rendering |
| BookingsStoreTest.kt | Added comprehensive test coverage for booking update scenarios |
| BookingDetailsViewModelTest.kt | Added tests for cancel booking success and failure cases |
| BookingMapperTest.kt | Updated test name and assertion to reflect corrected "on-hold" status logic |
| strings.xml | Added error message string for booking cancellation failures |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/bookings/BookingMapperTest.kt
Outdated
Show resolved
Hide resolved
This follows the latest changes to the CIAB admin
af05120 to
27afcb3
Compare
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #14808 +/- ##
============================================
+ Coverage 38.17% 38.19% +0.02%
- Complexity 10060 10068 +8
============================================
Files 2132 2132
Lines 120344 120407 +63
Branches 16458 16476 +18
============================================
+ Hits 45939 45993 +54
+ Misses 69776 69771 -5
- Partials 4629 4643 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WOOMOB-1561
Description
This PR implements the Cancel booking action (REST API part). There were some extra things that had to updated to make the whole Cancel work as expected:
Pay on sitebadge. The previousorder.status != "completed"didn't work well forcancelledbookings/orders`. This also follows the latest changes to the web logic. - p1761223364429439/1761044767.213429-slack-C09FHQNQERG. d762e9aAdditionally, there's an extra commit that adds an option to refresh the underlying order when updating the booking af05120. Up untill now, updating the booking was not affecting the order, but the new cancel booking is different as it also marks the order as cancelled. The order status is used to determine the badge so we need it updated.
Test Steps
CancelPlease, try changing the attendance status, saving a new note and verify network requests to make sure we are not refreshing the order.
Images/gif
Screen_recording_20251023_151051.mp4
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.