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

[Mobile Payments] Log Stripe error codes within the CardReaderService #13976

Merged
merged 5 commits into from
Sep 16, 2024

Conversation

joshheald
Copy link
Contributor

@joshheald joshheald commented Sep 16, 2024

Description

This PR adds logging for the error codes we get from Stripe, within the StripeCardReaderService, for a lower-level way to identify errors that are causing issues.

Steps to reproduce

  1. Launch the app
  2. Turn off bluetooth on your device
  3. Navigate to Menu > Payments > Manage card reader
  4. Tap Connect card reader if needed
  5. Observe the error is shown
  6. Check the logs (Xcode console, or Menu > Settings > Help & Support > View Application Log > Current)
  7. Observe that you see a log for 💳 Stripe Error Code: SCPError(rawValue: 2320)

Testing information

Some errors don't originate from Stripe. If they don't, they'll default to being tracked with code 1. I've written some pattern matching logic to try to avoid this, but it's not feasible to test every situation here.

No unit testing because the StripeCardReaderService is not structured for unit tests, due to the impracticality of mocking the Stripe Terminal.


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

@joshheald joshheald added type: task An internally driven task. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. labels Sep 16, 2024
@joshheald joshheald added this to the 20.5 milestone Sep 16, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 16, 2024

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 Numberpr13976-ade241b
Version20.4
Bundle IDcom.automattic.alpha.woocommerce
Commitade241b
App Center BuildWooCommerce - Prototype Builds #10892
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Collaborator

@staskus staskus left a comment

Choose a reason for hiding this comment

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

👍 Thanks for the work!

Tested, I confirm that stripe payment errors are now logged .

case is CardReaderConfigError:
DDLogError("💳 Card Reader Config Error: \(error)")
default:
let nsError = error as NSError
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused

Suggested change
let nsError = error as NSError

@joshheald joshheald merged commit e2146ea into trunk Sep 16, 2024
14 checks passed
@joshheald joshheald deleted the task/log-all-stripe-errors branch September 16, 2024 17:22
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. type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants