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] Experiment: Scan QR to Pay #15384

Draft
wants to merge 12 commits into
base: trunk
Choose a base branch
from

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Mar 19, 2025

Context: p91TBi-d5g-p2#comment-14097

Description

Experimenting with the idea of showing Scan QR to Pay to selective merchants when card reader payment is not available.

Solution

  1. Created PointOfSaleScanToPayView, reusing logic from existing ScanToPayView of showing QR code
  2. Created collectScanPayment in PointOfSaleOrderController which sets the order to pending and observes for processing status every 5 seconds.
  3. Aggregate model sets the POS in success state if collectScanPayment completes, or cancels the task if the screen is closed
  4. Added remoteFeatureFlag. If it's enabled for specific merchants, then POS option is shown in the menu but only .scan payment option is available.

The most questionable part of the solution is calling retrieveOrder every 5 seconds while the QR code is presented. However, it may be acceptable for an experimental feature that may be used only by a couple of merchants. We could rethink it if we decided to expland.

Further Improvements to consider

auto_draft

To make the solution more reliable, we need to reset the order state to auto_draft when going back to edit an order. This makes the payment page unavailable until we open the payment view again and stops customers from paying while the order is still being edited.

Customer address

Context: pdfdoF-6K9-p2

Steps to reproduce

Before testing: Set defaultValue: treu for isRemoteFeatureFlagEnabled(.pointOfSale in POSEligibilityChecker (line 104)

  1. Open the Woo app (feel free to use a site that is a non-supported country)
  2. Open POS
  3. Add products
  4. Check out
  5. Confirm QR code appears
  6. Come back, notice "Scan to pay canceled" in the console
  7. Check out again
  8. Scan the code and pay
  9. Confirm success view appears

Testing information

Screenshots

Scan.to.Pay.Flow.mov

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

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 all devices (phone/tablet) and no regressions are added.

@staskus staskus added type: task An internally driven task. feature: POS labels Mar 19, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@staskus staskus changed the title [Woo POS] Experiment: Scan QR to Pay for specific merchants [Woo POS] Experiment: Scan QR to Pay Mar 19, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Mar 19, 2025

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

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr15384-b8c8c1f
Version21.9
Bundle IDcom.automattic.alpha.woocommerce
Commitb8c8c1f
App Center BuildWooCommerce - Prototype Builds #13356
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@staskus staskus force-pushed the task/pos-experiment-with-scan-qr branch from c4bb087 to b8c8c1f Compare March 19, 2025 17:15
@staskus
Copy link
Contributor Author

staskus commented Mar 20, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants