Skip to content

PurchaseOrchestrator: always refresh receipt purchasing in sandbox#2280

Merged
NachoSoto merged 3 commits into
mainfrom
always-refresh-receipt-sandbox
Feb 15, 2023
Merged

PurchaseOrchestrator: always refresh receipt purchasing in sandbox#2280
NachoSoto merged 3 commits into
mainfrom
always-refresh-receipt-sandbox

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Feb 13, 2023

Copy link
Copy Markdown
Contributor

Fixes #2260 and SDKONCALL-216.
Follow up to #2245.

The change in #2245 was meant to avoid receipt refresh throttling errors (#2116).
However, that was a regression when using StoreKit config files because those don't get refreshed in the backend.

Unfortunately the workaround introduced in #1945 prevented us from noticing this, because we use DangerousSettings.InternalSettings.enableReceiptFetchRetry in our own integration tests.
I added an integration test that explicitly covers this scenario. That fails without this change if disabling that dangerous setting. I thought about making that test run without the setting, but that might lead to flaky failures in CI, which is why we introduced that workaround in the first place. But at least now we have an explicit integration test for this, as well as 2 unit tests.

@NachoSoto NachoSoto added the pr:fix A bug fix label Feb 13, 2023
@NachoSoto NachoSoto requested a review from a team February 13, 2023 14:35
@codecov

codecov Bot commented Feb 13, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2280 (7c952c8) into main (6a52a64) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 7c952c8 differs from pull request most recent head 67ec351. Consider uploading reports for the commit 67ec351 to get more accurate results

@@            Coverage Diff             @@
##             main    #2280      +/-   ##
==========================================
- Coverage   86.20%   86.18%   -0.03%     
==========================================
  Files         186      186              
  Lines       12306    12299       -7     
==========================================
- Hits        10609    10600       -9     
- Misses       1697     1699       +2     
Impacted Files Coverage Δ
...s/Purchasing/Purchases/PurchasesOrchestrator.swift 86.26% <100.00%> (+0.22%) ⬆️
...s/Purchasing/StoreKitAbstractions/Storefront.swift 57.14% <0.00%> (-5.36%) ⬇️
Sources/Networking/HTTPClient/HTTPRequest.swift 100.00% <0.00%> (ø)
Sources/Networking/HTTPClient/HTTPClient.swift 98.29% <0.00%> (+0.30%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread Sources/Purchasing/Purchases/PurchasesOrchestrator.swift Outdated
Fixes #2260 and [SDKONCALL-216].
Follow up to #2245.

The change in #2245 was meant to avoid receipt refresh throttling errors (#2116).
However, that was a regression when using StoreKit config files because those don't get refreshed in the backend.

Unfortunately the workaround introduced in #1945 prevented us from noticing this, because we use `DangerousSettings.InternalSettings.enableReceiptFetchRetry` in our own integration tests.
I added an integration test that explicitly covers this scenario. That fails without this change if disabling that dangerous setting. I thought about making that test run without the setting, but that might lead to flaky failures in CI, which is why we introduced that workaround in the first place. But at least now we have an explicit integration test for this, as well as 2 unit tests.
@NachoSoto NachoSoto force-pushed the always-refresh-receipt-sandbox branch from 7c952c8 to 67ec351 Compare February 15, 2023 17:18
@NachoSoto NachoSoto enabled auto-merge (squash) February 15, 2023 17:22
@NachoSoto NachoSoto merged commit 34284bd into main Feb 15, 2023
@NachoSoto NachoSoto deleted the always-refresh-receipt-sandbox branch February 15, 2023 17:28
NachoSoto pushed a commit that referenced this pull request Feb 15, 2023
**This is an automatic release.**

### Bugfixes
* `PurchaseOrchestrator`: always refresh receipt purchasing in sandbox
(#2280) via NachoSoto (@NachoSoto)
* `BundleSandboxEnvironmentDetector`: always return `true` when running
on simulator (#2276) via NachoSoto (@NachoSoto)
* `OfferingsManager`: ensure underlying
`OfferingsManager.Error.configurationError` is logged (#2266) via
NachoSoto (@NachoSoto)
### Other Changes
* `UserDefaultsDefaultTests`: fixed flaky failures (#2284) via NachoSoto
(@NachoSoto)
* `BaseBackendTest`: improved test failure message (#2285) via NachoSoto
(@NachoSoto)
* Updated targets and schemes for Xcode 14.2 (#2282) via NachoSoto
(@NachoSoto)
* `HTTPRequest.Path.health`: don't cache using `ETagManager` (#2278) via
NachoSoto (@NachoSoto)
* `EntitlementInfos.all`: fixed docstring (#2279) via NachoSoto
(@NachoSoto)
* `StoreKit2StorefrontListener`: added tests to fix flaky code coverage
(#2265) via NachoSoto (@NachoSoto)
* `NetworkError`: added underlying error to description (#2263) via
NachoSoto (@NachoSoto)
* Created `Signing.verify(message:hasValidSignature:with:)` (#2216) via
NachoSoto (@NachoSoto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.17.4 Break purchases

2 participants