Skip to content

Conversation

@RafaelKayumov
Copy link
Contributor

@RafaelKayumov RafaelKayumov commented Nov 27, 2025

WOOMOB-1813

Description

The PR addresses the issue where a user couldn't see TPP and card reader options in non-CIAB site. We suspect that the culprit is a site reading from local store. Since we couldn't reproduce the issue - we're adding this as a safety measure. Additionally we're adding error logging to see if the suspected issue indeed happens.

  • Adds a fallback to currentSite as a safety measure for a case where a site can't be fetched by id from storage.
  • Adds .error logging for the above case
  • Adds .error logging for the case where even a currentSite couldn't be obtained.

Test Steps

  • Use a CIAB site with unpaid orders
  • Navigate to an order that's not yet paid and eligible for a card payment.
  • Tap on "Collect Payment" CTA
  • Make sure the "Card Reader" option is not visible
  • Switch to non-CIAB site
  • Make sure the "Card Reader" option is displayed for eligible orders in non-CIAB sites.

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

@RafaelKayumov RafaelKayumov added this to the 23.7 ❄️ milestone Nov 27, 2025
@RafaelKayumov RafaelKayumov added type: bug A confirmed bug. Bug labels Nov 27, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 27, 2025

1 Error
🚫 This PR is tagged with status: do not merge label(s).
1 Warning
⚠️ This PR is assigned to the milestone 23.7 ❄️. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.
1 Message
📖 This PR contains changes to RELEASE-NOTES.txt.
Note that these changes won't affect the final version of the release notes as this version is in code freeze.
Please, get in touch with a release manager if you want to update the final release notes.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 27, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr16411-4c4771a
Version23.7
Bundle IDcom.automattic.alpha.woocommerce
Commit4c4771a
Installation URL5v11p9j2me55g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@RafaelKayumov RafaelKayumov marked this pull request as ready for review November 27, 2025 11:24
@itsmeichigo itsmeichigo self-assigned this Nov 27, 2025
Comment on lines 64 to 76

let site: Site?
if let storageSite {
site = storageSite
} else {
/// Non - fatal fallback to `currentSite` when a storage site is missing
site = currentSite()

logFailedStorageSiteRead(
siteID: siteID,
currentSiteFallbackValue: site
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about checking currentSite() first and ensure that the current site has the same ID as siteID? I expect that it does, and we would not need to check storage unless otherwise.

Suggested change
let site: Site?
if let storageSite {
site = storageSite
} else {
/// Non - fatal fallback to `currentSite` when a storage site is missing
site = currentSite()
logFailedStorageSiteRead(
siteID: siteID,
currentSiteFallbackValue: site
)
}
let site: Site? = {
if let site = currentSite(), site.siteID == siteID {
return site
}
if let storageSite = storage.loadSite(siteID: siteID)?.toReadOnly() {
return storageSite
} else {
return nil
}
}()

@RafaelKayumov RafaelKayumov added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 27, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

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

Works as expected, a few suggestions inline.

Thanks for the quick turnaround

Comment on lines +87 to +90
return onCompletion(
.failure(
OrderIsEligibleForCardPresentPaymentError.failedToObtainSite
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can continue with the eligibility check in this case, making the assumption that it's not a CIAB site and skipping those checks. It can be done later if you prefer.

enum OrderIsEligibleForCardPresentPaymentError: Error {
case orderNotFoundInStorage
case siteNotFoundInStorage
case failedToObtainSite
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps be slightly more descriptive here?

Not essential but may help future debugging/support

Suggested change
case failedToObtainSite
case failedToObtainSiteForCIABFeatureCheck

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joshheald Addressed in 8ebbd2e. The flow now proceeds to orders check in case if a site wasn't obtained.

@RafaelKayumov
Copy link
Contributor Author

Closing in favour of merged hotfix PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug status: do not merge Dependent on another PR, ready for review but not ready for merge. type: bug A confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants