Repository navigation
fix(web): show Epay subscription payment amount in CNY (HQ-Task T261105-12) - #7
Merged
Merged
Conversation
…05-12)
The subscription purchase dialog rendered the Epay amount with
formatLocalCurrencyAmount(), whose symbol follows the admin quota display
type. With display type USD a 203.93 yuan Epay charge read "$203.93".
The Epay amount is plan USD price x operation_setting.Price (price per
USD, in yuan), i.e. always RMB, independent of the display type.
- web/src/lib/currency.ts: add formatPaymentCurrencyAmount(), fixed
CNY/¥ for gateway (Epay) charges, reusing formatCurrencyValue and
mergeOptions, default max two fraction digits, no abbreviation.
Document how it differs from formatLocalCurrencyAmount() in the header
and the quick reference table.
- subscription-purchase-dialog.tsx: the "Online payment amount" row and
the "Pay {{amount}}" Epay button use the new formatter.
- tests: unit tests for the formatter under USD/CNY/CUSTOM/TOKENS,
fraction digits and '-' for null/undefined/NaN; the purchase dialog
test now asserts ¥73 / ¥10 and adds a USD-display case (¥203.96).
The wallet PaymentConfirmDialog "Topup Amount" is left unchanged: it is
topupAmount (credit in USD units) x the effective display exchange rate,
i.e. credit shown in the display currency, not the gateway charge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 9, 2026
AdoreJc
added a commit
that referenced
this pull request
Nov 12, 2026
…61112-13) (#33) The site now settles fully in US dollars with 1:1 top-ups (production options: Price=1, USDExchangeRate=1, quota_display_type=USD; Alipay and WeChat Pay go through Stripe). Two earlier fork changes still hardcoded RMB in the UI: - T261109-14 (#17): the model marketplace "Recharge" price mode always showed CNY/¥ (USD price x group ratio x Price). - T261105-12 (#7): formatPaymentCurrencyAmount always rendered the online payment amount in the subscription purchase dialog and its "Pay {{amount}}" button as ¥. Both are now fixed USD/$: - lib/currency.ts: formatPaymentCurrencyAmount uses USD/$ (still independent of the quota display type, no exchange rate applied); docs updated. - pricing/lib/recharge-price.ts: RECHARGE_PRICE_CURRENCY_LABEL is USD; recharge prices stay USD price x group ratio x Price and are not divided by usd_exchange_rate. Card view, table view, group prices, per-request, tiered and task prices all go through this helper. - pricing/components/dynamic-pricing-breakdown.tsx: tier prices in recharge mode use $ x Price. - Comments in price.ts, dynamic-price.ts and the purchase dialog. Fixed USD rather than following the quota display type: the amount is USD x Price, i.e. the US dollars the site charges, so following a CNY display type would show a USD amount with a ¥ symbol. Standard mode (switch off) is unchanged. Display only; no backend billing or order amount logic changes. No locale text referred to RMB, so locale files are unchanged. Tests: recharge-price, payment-currency-amount and purchase-dialog tests now assert $ (Price=1.5 for the price != 1 case, a Price=1 production case, and a CNY display site that must still show $ without x7); existing recharge assertions in dynamic-price, model-cards, task-price-display and viewer-groups updated from ¥ to $. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
HQ-Task: T261105-12
Agent
Links
User request
Out of scope — refuse
Open gate — do not open unless all are satisfied
Kind
Issue facts
USD, the subscription purchase dialog shows "Online payment amount $203.93" and "Pay $203.93"; the Epay order is charged 203.93 yuan.subscription-purchase-dialog.tsxformatsprice_amount × priceRatiowithformatLocalCurrencyAmount(), whose symbol comes fromgetBillingDisplayMeta(USD →plan.PriceAmount × operation_setting.Price(price per USD, in yuan) — RMB regardless of display type.web/src/features/subscriptions,web/src/lib/currency.ts); no billing, relay or deployment change.Change
web/src/lib/currency.ts: newformatPaymentCurrencyAmount(amount, options?)— fixed CNY (IntlnarrowSymbol→¥), no exchange rate, reusesformatCurrencyValue/mergeOptions, defaults to at most 2 fraction digits (also below 1) and no abbreviation,'-'for null/undefined/NaN. Header doc and quick-reference table explain the difference fromformatLocalCurrencyAmount()(that one follows the display type; a gateway amount's currency is decided by the gateway, Epay = RMB).subscription-purchase-dialog.tsx: Epay "Online payment amount" and thePay {{amount}}button use the new formatter.Research
controller/subscription_payment_epay.go(subscriptionEpayMoney=payMoneyFromUSD= USD ×operation_setting.Price);controller/topup.gogetPayMoney(top-upamountis credit in USD units).formatLocalCurrencyAmountwith a forced meta flag — a separate named function keeps the semantics explicit.wallet/.../payment-confirm-dialog.tsx"Topup Amount" istopupAmount × effectiveUsdExchangeRate, i.e. the purchased credit shown in the display currency (USD display → rate 1 →$10for $10 credit), not the gateway charge; forcing ¥ there would be wrong. Its "You Pay" line (gateway amount) usesformatCurrencywithout a symbol and is shared with Stripe/Creem/Waffo, so it is also left as is.Files
web/src/lib/currency.tsweb/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsxweb/src/lib/__tests__/payment-currency-amount.test.tsweb/src/features/subscriptions/__tests__/purchase-dialog-epay-amount.test.tsx¥, add USD-display caseBehavior
$27.94) unchanged.203,93 ¥in fr).Verification
Run in
web/with Bun 1.4.0 on Windows:bun install --frozen-lockfile→ 1213 packages installed.bun x --package @typescript/native-preview tsgo -b→ exit 0 (a deliberately injected type error was reported, so the check is real).bun x vitest run src/lib/__tests__/payment-currency-amount.test.ts src/features/subscriptions/__tests__/purchase-dialog-epay-amount.test.tsx→ 2 files, 16 tests passed.bun run test→ Test Files 210 passed (210), Tests 2516 passed (2516).bun run build→ exit 0.oxlint -c .oxlintrc.jsonon the 4 touched files → no diagnostics;oxfmt --checkon them → "All matched files use the correct format". (Fullbun run lint/format:checkreport pre-existing errors only in untouched files, e.g.scripts/sync-i18n.mjs,src/assets/**.)Risks
formatPaymentCurrencyAmount.Scope check
🤖 Generated with Claude Code