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][Cash & Receipts] Order completion call. Navigation to the payment success #13086

Open
wants to merge 18 commits into
base: trunk
Choose a base branch
from

Conversation

kidinov
Copy link
Contributor

@kidinov kidinov commented Dec 6, 2024

Closes: #13084

Description

Testing information

  • More -> POS -> New order
  • Choose pay with cash
  • Complete the order
  • Notice that success screen is shown
  • Go to the order list in the main app. Notice new, complete order. Check it detals

Try back navigation from the cash payment screen, too

The tests that have been performed

Above

Images/gif

12-09--11-06.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.

@kidinov kidinov marked this pull request as draft December 6, 2024 13:39
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 6, 2024

📲 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
Commitc4d2887
Direct Downloadwoocommerce-wear-prototype-build-pr13086-c4d2887.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 6, 2024

📲 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
Commitc4d2887
Direct Downloadwoocommerce-prototype-build-pr13086-c4d2887.apk

…all-from-the-mocked-cash-payment-screen' into 13084-woo-poscash-receipts-implement-order-completion-call-during-cash-payment-flow-with-navigation-to-the-payment-success

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/WooPosHomeViewModel.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/totals/WooPosTotalsViewModel.kt
…all-from-the-mocked-cash-payment-screen' into 13084-woo-poscash-receipts-implement-order-completion-call-during-cash-payment-flow-with-navigation-to-the-payment-success
@kidinov kidinov requested a review from samiuelson December 9, 2024 11:34
@kidinov kidinov added the feature: point of sale POS project label Dec 9, 2024
@kidinov kidinov added this to the 21.3 milestone Dec 9, 2024
@kidinov kidinov marked this pull request as ready for review December 9, 2024 12:16
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 41.59292% with 66 lines in your changes missing coverage. Please review.

Project coverage is 40.45%. Comparing base (a2b4711) to head (c4d2887).
Report is 54 commits behind head on trunk.

Files with missing lines Patch % Lines
...i/woopos/cashpayment/WooPosCashPaymentViewModel.kt 0.00% 20 Missing ⚠️
...id/ui/woopos/cashpayment/WooPosCashPaymentState.kt 0.00% 14 Missing ⚠️
...rce/android/ui/woopos/home/WooPosHomeNavigation.kt 0.00% 9 Missing ⚠️
...erce/android/ui/woopos/home/WooPosHomeViewModel.kt 68.96% 8 Missing and 1 partial ⚠️
...oid/ui/woopos/home/totals/WooPosTotalsViewModel.kt 64.28% 2 Missing and 3 partials ⚠️
.../woopos/cashpayment/WooPosCashPaymentNavigation.kt 0.00% 3 Missing ⚠️
...os/root/navigation/WooPosNavigationEventHandler.kt 0.00% 3 Missing ⚠️
.../woopos/cashpayment/WooPosCashPaymentRepository.kt 94.73% 0 Missing and 1 partial ⚠️
...mmerce/android/ui/woopos/home/WooPosHomeUIEvent.kt 0.00% 1 Missing ⚠️
...ui/woopos/root/navigation/WooPosNavigationEvent.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #13086   +/-   ##
=========================================
  Coverage     40.44%   40.45%           
- Complexity     6187     6192    +5     
=========================================
  Files          1292     1292           
  Lines         74270    74326   +56     
  Branches      10159    10170   +11     
=========================================
+ Hits          30039    30069   +30     
- Misses        41623    41646   +23     
- Partials       2608     2611    +3     

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

Base automatically changed from 13063-woo-poscash-receipts-implement-order-complition-call-from-the-mocked-cash-payment-screen to trunk December 11, 2024 09:23
@samiuelson samiuelson self-assigned this Dec 11, 2024
site = selectedSite.get(),
newStatus = statusModel,
newPaymentMethodId = CASH_ON_DELIVERY_PAYMENT_TYPE,
codGateway?.title ?: "Pay in Person",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
codGateway?.title ?: "Pay in Person",
newPaymentMethodTitle = codGateway?.title ?: "Pay in Person",

💡 np

Copy link
Collaborator

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

Looks good, @kidinov. I left some non-blocking comments.

I also noticed that the Totals screen is visible for a while before Payment successful is shown. Can we avoid that? See video:

Screen_recording_20241211_190849.mp4

@@ -196,11 +199,15 @@ fun WooPosTotalsPaymentCashScreenScreen() {
enteredAmount = "5$",
changeDue = "5$",
total = "10$",
canBeOrderBeCompleted = true,
button = WooPosCashPaymentState.Collecting.Button(
text = "Complete order",
Copy link
Collaborator

Choose a reason for hiding this comment

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

💡 To Res


private fun handleOrderCompletion() {
viewModelScope.launch {
val stateBeforeCompleting = _state.value as? WooPosCashPaymentState.Collecting ?: return@launch
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Do we expect other states – shouldn't we crash? What will happen if we return here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants