Skip to content

Conversation

@rickvdl
Copy link
Contributor

@rickvdl rickvdl commented Nov 12, 2025

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Some internal context here. Basically the localizedPriceString (the pre-formatted product price) was formatted using the price.currency from the actual product here . Whereas all the other prices were formatted using the TestStoreProduct's priceFormatter, which was configured to use the TestStoreProduct's locale.rc_currencyCode, which was AFAIK always Locale.current, which means that the formatted prices would be formatted according to the device's locale. Which will often be different from the product's currency.

TL;DR. localizePriceString used the product's currency, all other formatted strings used the device's locale's currency, causing discrepancies.

Description

This was fixed by passing the currencyCode to the TestStoreProduct, ensuring it can format prices using the correct currencyCode. A fallback using the old behavior is still in place in order to maintain backwards compatibility (the public API of the TestStoreProduct initializer).

@emerge-tools
Copy link

emerge-tools bot commented Nov 12, 2025

📸 Snapshot Test

240 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 0 0 240 0 N/A

🛸 Powered by Emerge Tools

@rickvdl rickvdl force-pushed the rickvdl/test-store-formatted-price-string-currency-code branch 2 times, most recently from 88cf0f5 to b8e39d5 Compare November 14, 2025 15:55
@rickvdl
Copy link
Contributor Author

rickvdl commented Nov 14, 2025

@RCGitBot please test

expect(storeProduct.isFamilyShareable) == isFamilyShareable
}

// Legacy behavior: if no currencyCode is passed it will take the currencyCode from the locale
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how I feel about this implicit behavior when using the backwards compatible initializer. However this is how it worked before, so I'm not sure...

@rickvdl rickvdl force-pushed the rickvdl/test-store-formatted-price-string-currency-code branch from d6b4932 to 5950228 Compare December 2, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants