Skip to content

Conversation

AdamGrzybkowski
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski commented Sep 30, 2025

Closes WOOMOB-1346

Description

This PR adds the payment section to the BookingDetailsScreen with a working View order button and not fully implemented mark as paid/mark as refunded buttons.

There are two extra commits that move the view model callback to the view state to limit the growing number of parameters - fc1ae2f and a4e6bd3.

Steps to reproduce

  1. Use a CIAB site.
  2. Manually install the bookings plugin from this ZIP file: p1758531103469849/1758101141.913349-slack-C03L1NF1EA3
  3. You'll need to enable bookings v2 on your CIAB testing site. You can do that by installing the Code Snippets plugin to your site and adding the following PHP snippet: define( 'WC_BOOKINGS_NEXT_ENABLED', true );
  4. Create some bookings.
  5. Open the bookings tab
  6. Tap on any booking
  7. Scroll down and notice the payment section (data is hardcoded for now)
  8. Tap on View order
  9. Confirm the order details screen was opened (the ID is hardcoded, so don't expect real data yet)

Testing information

You can verify with different font/view scaling and light/dark theme.
Tapping on the Mark as paid/Mark as refunded should also update the temp in-memory state.

The tests that have been performed

The above.

Images/gif

Screenshot 2025-09-29 at 15 52 53
Screen_recording_20250930_115742.mp4
  • 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

This PR adds a payment section to the booking details screen with payment information display and action buttons for marking payments as paid/refunded and viewing the associated order.

Key changes:

  • Added payment section UI component with payment breakdown (service, tax, discount, total)
  • Implemented "View order" navigation functionality
  • Added "Mark as paid" and "Mark as refunded" buttons with state management

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
BookingPaymentSection.kt New composable component for displaying payment details and action buttons
BookingDetailsViewState.kt Added payment model and callback functions for payment actions
BookingDetailsViewModel.kt Implemented payment status update logic and callback handling
BookingDetailsScreen.kt Integrated payment section into booking details UI
BookingDetailsFragment.kt Added navigation to order details screen
nav_graph_bookings.xml Added navigation action to order details
strings.xml Added payment section related string resources
BookingDetailsViewModelTest.kt Updated test to use new state structure

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

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 30, 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitd82dc68
Direct Downloadwoocommerce-wear-prototype-build-pr14666-d82dc68.apk

thickness = 0.5.dp,
modifier = Modifier.padding(start = 16.dp)
)
if (paymentStatus == BookingPaymentStatus.PAID) {
Copy link
Contributor Author

@AdamGrzybkowski AdamGrzybkowski Sep 30, 2025

Choose a reason for hiding this comment

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

Not 100% this is the correct logic. Should we also show the Mark as refunded if the booking status is completed?

Copy link
Contributor

Choose a reason for hiding this comment

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

I asked about it in Slack (p1759326540162229-slack-C09FHQNQERG). If we don’t get a reply, we can add a TODO comment to update this logic later and merge the PR now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have renamed the button to Issue refund, and for now, both Mark as paid and Issue refund will open the order screen. We can update to a refund screen when we have the order object to properly enable that.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 30, 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 Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitd82dc68
Direct Downloadwoocommerce-prototype-build-pr14666-d82dc68.apk

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 14.04959% with 104 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.39%. Comparing base (d666a23) to head (d82dc68).
⚠️ Report is 12 commits behind head on trunk.

Files with missing lines Patch % Lines
...droid/ui/bookings/compose/BookingPaymentSection.kt 4.58% 104 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14666      +/-   ##
============================================
- Coverage     38.41%   38.39%   -0.03%     
  Complexity     9823     9823              
============================================
  Files          2090     2091       +1     
  Lines        116568   116688     +120     
  Branches      15592    15611      +19     
============================================
+ Hits          44785    44801      +16     
- Misses        67625    67729     +104     
  Partials       4158     4158              

☔ 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-1346_payment_section branch from a4e6bd3 to bdcebd8 Compare October 1, 2025 10:42
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 23.4. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@AdamGrzybkowski AdamGrzybkowski force-pushed the issue/WOOMOB-1346_payment_section branch from bdcebd8 to 874459f Compare October 1, 2025 10:43
@irfano irfano self-assigned this Oct 1, 2025
Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

LGTM! I don't have any blocking feedback, so I'm approving, but please review my comments before merging. 🚀

thickness = 0.5.dp,
modifier = Modifier.padding(start = 16.dp)
)
if (paymentStatus == BookingPaymentStatus.PAID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I asked about it in Slack (p1759326540162229-slack-C09FHQNQERG). If we don’t get a reply, we can add a TODO comment to update this logic later and merge the PR now.

@AdamGrzybkowski
Copy link
Contributor Author

@irfano Do you want to re-review the latest commits?

Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for handling the changes. ✅

@irfano irfano merged commit c581192 into trunk Oct 2, 2025
15 checks passed
@irfano irfano deleted the issue/WOOMOB-1346_payment_section branch October 2, 2025 11:24
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.

5 participants