Skip to content

Add missing response fields to CustomerInfo. Including transaction Prices#2128

Merged
vegaro merged 16 commits into
mainfrom
cc-328-add-prices-to-customerinfo-transactions
Apr 4, 2025
Merged

Add missing response fields to CustomerInfo. Including transaction Prices#2128
vegaro merged 16 commits into
mainfrom
cc-328-add-prices-to-customerinfo-transactions

Conversation

@vegaro

@vegaro vegaro commented Feb 7, 2025

Copy link
Copy Markdown
Member

This pull request introduces several enhancements and new features to the SubscriptionInfo and related classes in the purchases module. The most important changes include adding new properties to the SubscriptionInfo class, creating a new PriceResponse class, and updating the SubscriptionInfoResponse class to include additional fields.

Enhancements to SubscriptionInfo and related classes:

  • purchases/src/main/kotlin/com/revenuecat/purchases/SubscriptionInfo.kt:

    • Added new properties autoResumeDate, displayName, price, and productPlanIdentifier to the SubscriptionInfo class. [1] [2]
    • Added a locale parameter to the constructor of SubscriptionInfo, for building the price
  • purchases/src/main/kotlin/com/revenuecat/purchases/common/responses/PriceResponse.kt:

    • Created a new PriceResponse class to handle price-related information.
  • purchases/src/main/kotlin/com/revenuecat/purchases/common/responses/SubscriptionInfoResponse.kt:

    • Updated the SubscriptionInfoResponse class to include autoResumeDate, displayName, price, and productPlanIdentifier fields. [1] [2]
  • purchases/src/main/kotlin/com/revenuecat/purchases/models/Transaction.kt:

    • Added new properties displayName, isSandbox, originalPurchaseDate, and price to the Transaction class. [1] [2]

Additional updates:

  • purchases/src/main/kotlin/com/revenuecat/purchases/utils/PriceExtensions.kt:
    • Changed the visibility of MICRO_MULTIPLIER to internal.

@vegaro vegaro force-pushed the cc-328-add-prices-to-customerinfo-transactions branch from 120a014 to c9eec4e Compare February 11, 2025 13:21
@vegaro vegaro added the pr:fix A bug fix label Feb 11, 2025
@vegaro vegaro marked this pull request as ready for review February 11, 2025 15:33
@codecov

codecov Bot commented Feb 11, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 37.50000% with 50 lines in your changes missing coverage. Please review.

Project coverage is 80.12%. Comparing base (3f11b50) to head (8857a25).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...otlin/com/revenuecat/purchases/SubscriptionInfo.kt 22.22% 27 Missing and 1 partial ⚠️
...lin/com/revenuecat/purchases/models/Transaction.kt 45.83% 12 Missing and 1 partial ⚠️
...hases/common/responses/SubscriptionInfoResponse.kt 47.05% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2128      +/-   ##
==========================================
- Coverage   80.34%   80.12%   -0.23%     
==========================================
  Files         281      282       +1     
  Lines        9964    10026      +62     
  Branches     1417     1421       +4     
==========================================
+ Hits         8006     8033      +27     
- Misses       1346     1378      +32     
- Partials      612      615       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread purchases/src/main/kotlin/com/revenuecat/purchases/SubscriptionInfo.kt Outdated
@vegaro vegaro requested a review from a team March 3, 2025 11:15
@vegaro vegaro force-pushed the cc-328-add-prices-to-customerinfo-transactions branch from 68c0085 to 88a7c06 Compare March 3, 2025 11:17

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mostly just some comments to avoid the breaking changes but looking good!

Comment thread purchases/src/main/kotlin/com/revenuecat/purchases/SubscriptionInfo.kt Outdated
Comment thread purchases/src/main/kotlin/com/revenuecat/purchases/SubscriptionInfo.kt Outdated
@vegaro vegaro force-pushed the cc-328-add-prices-to-customerinfo-transactions branch from 88a7c06 to 8f498c2 Compare April 4, 2025 11:31
@vegaro vegaro requested review from facumenzella and tonidero April 4, 2025 11:49
@vegaro

vegaro commented Apr 4, 2025

Copy link
Copy Markdown
Member Author

checking the tests now

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some comments but nothing really blocking. Thanks for adding this!


@OptIn(ExperimentalSerializationApi::class)
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
internal val json = Json {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've talked in the past that we should try to unify these into a single Json instance with a single configuration, so serializing is consistent accross models... Maybe we could extract the OfferingParser json instance and use that one? I see this one has explicitNulls set to false, but I would assume that should be fine even if the same thing happens for Offerings?

We can probably also do this in a separate PR, but feels like something we should try to move towards soon.


internal companion object {
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
internal val json = Json {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same thing about the json instance. I think ideally we only add at most one for CustomerInfo data (but preferable use the same as other parts of the SDK).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Did that in a9da840 (#2128)

Thanks for the idea!

Comment thread purchases/src/main/kotlin/com/revenuecat/purchases/utils/PriceExtensions.kt Outdated
Comment thread purchases/src/test/java/com/revenuecat/purchases/utils/Responses.kt
@vegaro vegaro force-pushed the cc-328-add-prices-to-customerinfo-transactions branch from 5345286 to 74e7af4 Compare April 4, 2025 13:40
@vegaro vegaro requested a review from tonidero April 4, 2025 15:33
@vegaro vegaro added this pull request to the merge queue Apr 4, 2025
@vegaro vegaro removed this pull request from the merge queue due to a manual request Apr 4, 2025

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing those changes! :shipit:

@vegaro vegaro added this pull request to the merge queue Apr 4, 2025
Merged via the queue into main with commit b085d62 Apr 4, 2025
@vegaro vegaro deleted the cc-328-add-prices-to-customerinfo-transactions branch April 4, 2025 16:52
github-merge-queue Bot pushed a commit that referenced this pull request Apr 15, 2025
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* Add missing response fields to `CustomerInfo`. Including transaction
Prices (#2128) via Cesar de la Vega (@vegaro)

## RevenueCatUI SDK
### Paywallv2
#### 🐞 Bugfixes
* [Paywalls v2] Fixes timeline layout when width is Fit (#2354) via
JayShortway (@JayShortway)
* [Paywalls V2] Improves fuzzy matching locale when the region doesn't
match (#2355) via JayShortway (@JayShortway)
* [Paywalls V2] Norwegian Bokmål and Norwegian Nynorsk fall back to
Norwegian. (#2329) via JayShortway (@JayShortway)
### Customer Center
#### 🐞 Bugfixes
* Clean up on restoring functionality in customer center (#2316) via
Cesar de la Vega (@vegaro)

### 🔄 Other Changes
* [Paywalls v2] Adds the unsupported Background type to the error
message (#2350) via JayShortway (@JayShortway)
* [Paywalls v2] Uses a fixed date for template previews to avoid daily
changes. (#2351) via JayShortway (@JayShortway)
* [Paywalls v2] Adds a default case to `Background` and
`ButtonComponent` (#2347) via JayShortway (@JayShortway)
* [Paywalls v2] Improves `PaywallComponentsTemplatePreviewRecorder`
stability (#2352) via JayShortway (@JayShortway)
* [Paywalls v2] Adds a default case to most enums and sealed types
(#2346) via JayShortway (@JayShortway)
* Adds `EnumDeserializerWithDefault` and `SealedDeserializerWithDefault`
(#2345) via JayShortway (@JayShortway)
* [Paywalls V2] Renders template previews in a fixed resolution using
Paparazzi (#2214) via JayShortway (@JayShortway)
* Bump fastlane from 2.227.0 to 2.227.1 (#2344) via dependabot[bot]
(@dependabot[bot])
* Migrate root gradle file to KTS (#2343) via Jaewoong Eum (@skydoves)
* Migrate tester modules to KTS format (#2340) via Jaewoong Eum
(@skydoves)
* Introduce purchases-bom package (#2339) via Jaewoong Eum (@skydoves)
* [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule
(#2338) via RevenueCat Git Bot (@RCGitBot)
* [Diagnostics] Removes Android 7 requirement (#2335) via JayShortway
(@JayShortway)
* [Paywalls v2] Fixes `update-paywall-preview-resources-submodule` CI
job (#2337) via JayShortway (@JayShortway)
* Make purchases module to transitive dependency for the ui module
(#2334) via Jaewoong Eum (@skydoves)
* Migrate settings.gradle to KTS and add the dependency resolutions
(#2328) via Jaewoong Eum (@skydoves)

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.

3 participants