Skip to content

Default customer info schema version to latest known by SDK#1080

Merged
tonidero merged 1 commit into
mainfrom
default-customer-info-schema-version
Jun 22, 2023
Merged

Default customer info schema version to latest known by SDK#1080
tonidero merged 1 commit into
mainfrom
default-customer-info-schema-version

Conversation

@tonidero

@tonidero tonidero commented Jun 22, 2023

Copy link
Copy Markdown
Contributor

Description

An integration test started failing due to #1073. The error was that the schemaVersion field in the customer info didn't match between the fetched and cached customer info. It was actually luck that made it work before 😬 .

Before that change, this test tried to get customer info twice: On sdk configuration and the first part of the test. Since both of these happen pretty quickly, we only made the request once and called both callbacks with the same response. However, the first request actually modified the JSONObject, adding the schema version and some other fields in order to cache it in the device. This made it so the JSONObject actually had those fields in the second callback, causing the schemaVersion to have a value. Then, the value returned from cache already has the schemaVersion field set so the test passed.

After the change in #1073, the test still tries to get customer info twice, but the raw json sharing didn't happen, since when we call getCustomerInfo we now need to check first for unsynced purchases, causing us to not share the callback, so the schema version that was set in the first callback wasn't shared with the second one, causing the schemaVersion field to be 0, causing the test to fail.

After talking about it, we think defaulting the schema version to the latest known version by the SDK is probably expected behavior, instead of defaulting to 0 before it's been saved.

Followup to #1078

@tonidero tonidero added the pr:fix A bug fix label Jun 22, 2023
@tonidero tonidero marked this pull request as ready for review June 22, 2023 08:52
@tonidero tonidero requested a review from a team June 22, 2023 08:52
@tonidero tonidero mentioned this pull request Jun 22, 2023
@codecov

codecov Bot commented Jun 22, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1080 (4b95267) into main (f030cbb) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1080   +/-   ##
=======================================
  Coverage   85.86%   85.86%           
=======================================
  Files         179      179           
  Lines        6362     6362           
  Branches      876      876           
=======================================
  Hits         5463     5463           
  Misses        557      557           
  Partials      342      342           
Impacted Files Coverage Δ
...revenuecat/purchases/common/CustomerInfoFactory.kt 87.27% <100.00%> (ø)

@tonidero tonidero merged commit 21bf89c into main Jun 22, 2023
@tonidero tonidero deleted the default-customer-info-schema-version branch June 22, 2023 12:17
tonidero added a commit that referenced this pull request Jun 23, 2023
### Description
#1073 broke some more integration tests. I fixed one in #1080, but
didn't run the offline entitlements integration tests 🤦‍♂️ .

Most of these make sense after that functionality was added
tonidero pushed a commit that referenced this pull request Jun 23, 2023
**This is an automatic release.**

### Bugfixes
* Default customer info schema version to latest known by SDK (#1080)
via Toni Rico (@tonidero)
* Handle other diagnostics-related exceptions (#1076) via Toni Rico
(@tonidero)
* Return error in queryPurchases if error connecting to billing client
(#1072) via Toni Rico (@tonidero)
### Other Changes
* Fix offline entitlements integration tests (#1085) via Toni Rico
(@tonidero)
* Add defaultsRelease variant tests run configuration (#1074) via Toni
Rico (@tonidero)
* Compose sample app: move to gradle catalog (#1081) via Toni Rico
(@tonidero)
* Compose sample app: automate builds (#1082) via Toni Rico (@tonidero)
* Compose sample app (#1056) via Toni Rico (@tonidero)
* Migrate to Gradle version catalog (#1059) via Cesar de la Vega
(@vegaro)
* Trusted entitlements: Add logs with verification mode (#1067) via Toni
Rico (@tonidero)
* Sync pending purchases before getting customer info (#1073) via Toni
Rico (@tonidero)
* Refactor syncing pending transactions logic out of `Purchases` (#1058)
via Toni Rico (@tonidero)
* Refactor CustomerInfo listener and cache logic into
CustomerInfoUpdater (#1052) via Toni Rico (@tonidero)
* Trusted entitlements: Add integration tests (#1071) via Toni Rico
(@tonidero)
* Trusted entitlements: Add internal mechanism to force signing errors
for tests (#1070) via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
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.

2 participants