✨ Display per-currency book price overrides at point of purchase#1150
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the store/product/checkout pricing display logic to honor the API’s optional priceInDecimalByCurrency per-currency overrides, aiming to show customers the same HKD/TWD price that Stripe will charge (instead of relying solely on the USD index ladder conversion).
Changes:
- Add
priceInDecimalByCurrencytyping toBookstorePriceand propagate it throughuseBookInfopricing items. - Centralize override-vs-ladder resolution in
useCurrency, and introduceformatConvertedPricefor formatting amounts already resolved into the display currency. - Update store/product list and checkout UIs to pass/consume currency overrides and compute converted line totals once to prevent row/total divergence.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/types/bookstore.d.ts | Adds the per-currency override type and attaches it to BookstorePrice. |
| app/composables/use-currency.ts | Centralizes override resolution and adds formatting for already-converted totals. |
| app/composables/use-book-info.ts | Propagates override data and exposes minPricingItem for consistent min-tier access. |
| app/pages/store/[nftClassId]/index.vue | Uses override-aware formatting for edition prices on the product page. |
| app/components/BookstoreItem.vue | Uses min-tier override when available for catalog tile pricing/discount display. |
| app/components/BookListItem.vue | Uses tier override for list item pricing/discount display. |
| app/pages/checkout.vue | Computes per-line converted totals once and formats totals without double conversion. |
Comment on lines
+41
to
+48
| const currency = displayCurrency.value | ||
| if (currency !== 'usd') { | ||
| const override = priceInDecimalByCurrency?.[currency] | ||
| if (typeof override === 'number' && override > 0) { | ||
| return override / 100 | ||
| } | ||
| } | ||
| return convertUSDPriceToCurrency(usdPrice, currency) |
3f35dc5 to
ab183b2
Compare
Honour the API's optional priceInDecimalByCurrency so the HKD/TWD price shown on the store, product and checkout pages matches what Stripe will actually charge, instead of the index-based ladder conversion. Resolution is centralised in useCurrency (override beats ladder, USD unchanged); checkout resolves each line once so rows and the grand total cannot diverge, and the min-tier lookup now has a single source in useBookInfo.
ab183b2 to
efe70c2
Compare
nwingt
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Honour the API's optional priceInDecimalByCurrency so the HKD/TWD price shown on the store, product and checkout pages matches what Stripe will actually charge, instead of the index-based ladder conversion.
Resolution is centralised in useCurrency (override beats ladder, USD unchanged); checkout resolves each line once so rows and the grand total cannot diverge, and the min-tier lookup now has a single source in useBookInfo.
Requires: likecoin/likecoin-api-public#1265