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

[POS][Custom payment UI] – Switch to Payment Controller in POS Totals | Base PR #12977

Merged
merged 150 commits into from
Dec 13, 2024

Conversation

samiuelson
Copy link
Collaborator

@samiuelson samiuelson commented Nov 21, 2024

Switch to Payment Controller in WooPosTotalsViewModel for payment collection

💡 This is a base PR that includes the following partial PRs:

  1. [POS][Custom payment UI] – Payment cancelation #13037
  2. [POS][Custom payment UI] – Remove "collect payment" button #13038
  3. [POS][Custom payment UI] – Reader not connected error handling #13053
  4. [POS][Custom payment UI] – Failed payment error handling  #13057
  5. [POS][Custom payment UI] – UI animation for Loading data and CollectingPayment states #13090
  6. [POS][Custom payment UI] – Payment processing animation with Lottie #13100

⚠️ Don't merge until all the partial PRs above are marked merged.

Closes: #12822

Description

This PR is first step toward integrating CardReaderPaymentController into WooPosTotals screen.

In addition to using CardReaderPaymentController into WooPosTotalsViewModel, an old code specific to old IPP flow reuse in POS was removed.

In the next PRs:

  1. Handling cancelations (e.g. on back press)
  2. Removing "Collect Payment" button
  3. Showing "Connect to a reader" error in Totals screen
  4. Introducing new Totals screen UI states with animations for payment states (loading, collecting, capturing, processing)
  5. Showing payment errors

💡 The PR targets a feature branch feature/custom-payment-ui. "Do not merge" label added to prevent merging at the moment so that we are able to release the full feature.

Steps to reproduce

Test that it's possible to collect payment (happy path) and that "Payment success" screen is shown after payment is completed.

Testing information

The tests that have been performed

  1. Reader connect/disconnect using floating menu
  2. (POS) payment collection happy path

Images/gif

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

This allows observing all the states in POS, without the dialog-based UI. Previously custom `if` statement was used to avoid showing (duplicate) success dialog.
POS-specific payment failure handling is not applicable, because we're now observing payments states using `CardReaderPaymentController.paymentState`. In the dialog-based Payment flow, the result payment result is passed here — to the SelectPaymentMethod screen (start of the payment flow nav graph).
The new result is designed both for reader "connection" and "prepare for payment" actions.
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 21, 2024

2 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class TTPPaymentProgressDelegate is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 21, 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
Commit1c90560
Direct Downloadwoocommerce-wear-prototype-build-pr12977-1c90560.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 21, 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
Commit1c90560
Direct Downloadwoocommerce-prototype-build-pr12977-1c90560.apk

* There is no need to open `SelectPaymentMethod` we can start directly in `CardReaderStatusChecker` both for reader connection and preparation for payment.
The only requirement for reader is to be connected. There's no need to pass any other intent to the IPP flow. Once reader connects we can engage Payment Controller to collect payment.
The only requirement for reader is to be connected. There's no need to pass any other intent to the IPP flow. Once reader connects we can engage Payment Controller to collect payment.
@samiuelson samiuelson changed the title [POS][Custom payment UI] Part 6 — Switch to Payment Controller in POS Totals [POS][Custom payment UI] – Switch to Payment Controller in POS Totals | Base PR Dec 12, 2024
samiuelson and others added 3 commits December 12, 2024 17:05
… custom-payment-ui-payment-processing-animation
…processing-animation

[POS][Custom payment UI] – Payment processing animation with Lottie
@wpmobilebot
Copy link
Collaborator

Project dependencies changes

The following changes in project dependencies were detected (configuration vanillaReleaseRuntimeClasspath):

list
New Dependencies
com.airbnb.android:lottie:5.2.0
com.airbnb.android:lottie-compose:5.2.0
tree
+\--- com.airbnb.android:lottie-compose:5.2.0
+     +--- com.airbnb.android:lottie:5.2.0
+     |    +--- androidx.appcompat:appcompat:1.3.1 -> 1.6.1 (*)
+     |    \--- com.squareup.okio:okio:1.17.4 -> 3.7.0 (*)
+     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.9.10 (*)
+     +--- androidx.compose.foundation:foundation:1.1.1 -> 1.7.1 (*)
+     \--- androidx.compose.ui:ui:1.1.1 -> 1.7.1 (*)

@samiuelson samiuelson removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Dec 12, 2024
@samiuelson samiuelson added this to the 21.3 milestone Dec 12, 2024
@samiuelson samiuelson added the feature: mobile payments Related to mobile payments / card present payments / Woo Payments. label Dec 12, 2024
@samiuelson samiuelson merged commit af499bf into trunk Dec 13, 2024
16 checks passed
@samiuelson samiuelson deleted the custom-payment-ui-6-use-payment-controller-in-pos branch December 13, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: mobile payments Related to mobile payments / card present payments / Woo Payments. feature: point of sale POS project unit-tests-exemption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass "Ready to collect" payment result to POS card reader facade
6 participants