Skip to content
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

[Woo POS][Non-Simple Products] Redirect to Items screen after cash payment #13256

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

AnirudhBhat
Copy link
Contributor

@AnirudhBhat AnirudhBhat commented Jan 8, 2025

Closes: #13255

Description

This PR updates the navigation logic to ensure that, after a successful payment (via card or cash), users are redirected internally to the Items List screen. This guarantees that when users click on the "New Order" button on the success screen, they are returned directly to the Items List screen, bypassing any intermediate screens like the Variations screen visited during the previous checkout flow.

Steps to reproduce

Card payment

  1. Navigate to POS (More menu -> POS)
  2. Click any Variable product
  3. Select any variation and proceed for checkout
  4. Complete the payment using card and click on "New Order" button on payment success screen
  5. Ensure you are taken back to items list screen

Cash payment

  1. Navigate to POS (More menu -> POS)
  2. Click any Variable product
  3. Select any variation and proceed for checkout
  4. Complete the payment using cash and click on "New Order" button on payment success screen
  5. Ensure you are taken back to items list screen

The tests that have been performed

Tested above scenarios both on Light and Dark modes

Images/gif

redirect_after_successful_payment.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.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@AnirudhBhat AnirudhBhat added type: bug A confirmed bug. feature: point of sale POS project labels Jan 8, 2025
@AnirudhBhat AnirudhBhat added this to the 21.5 milestone Jan 8, 2025
@wpmobilebot
Copy link
Collaborator

📲 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
Commitec0ca3c
Direct Downloadwoocommerce-wear-prototype-build-pr13256-ec0ca3c.apk

@wpmobilebot
Copy link
Collaborator

📲 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
Commitec0ca3c
Direct Downloadwoocommerce-prototype-build-pr13256-ec0ca3c.apk

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.67%. Comparing base (0137ab7) to head (ec0ca3c).
Report is 23 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #13256   +/-   ##
=========================================
  Coverage     40.67%   40.67%           
  Complexity     6396     6396           
=========================================
  Files          1351     1351           
  Lines         77664    77666    +2     
  Branches      10682    10682           
=========================================
+ Hits          31587    31591    +4     
+ Misses        43291    43289    -2     
  Partials       2786     2786           

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

@malinajirka malinajirka self-assigned this Jan 8, 2025
Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Thank, LGTM!

@@ -200,6 +202,11 @@ class WooPosHomeViewModel @Inject constructor(
}

private fun onOrderSuccessfullyPaid(paymentMethod: PaymentMethod) {
viewModelScope.launch {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea to move this logic here, instead of duplicating it for card and cash payments on the calling site!

@malinajirka malinajirka merged commit 2016f5a into trunk Jan 8, 2025
18 of 21 checks passed
@malinajirka malinajirka deleted the issue/13255-redirect-after-cash-payment branch January 8, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: point of sale POS project type: bug A confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Woo POS][Non-Simple Products] Redirect to Items screen after cash payment
4 participants