Skip to content

Fix FX conversion for platform-credit top-ups - #754

Closed
LIghtJUNction wants to merge 1 commit into
mainfrom
codex/fix-fx-conversion-for-platform-credit-top-ups
Closed

LIghtJUNction wants to merge 1 commit into
mainfrom
codex/fix-fx-conversion-for-platform-credit-top-ups

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

Motivation

  • A quote/settlement path derived platform_units_per_usd from the display FX (CNY/custom) which caused non-USD purchases to be undercharged while persisting the full USD-denominated credited quota.
  • This allowed ordinary authenticated users to purchase inflated platform credits by choosing payment methods that omitted an explicit platform rate.

Description

  • Keep platform-credit units independent of the display/settlement FX by returning decimal.NewFromInt(1) from configuredPlatformUnitsPerUSD() so platform credits remain USD-denominated accounting units.
  • Change implemented in apps/api-go/controller/topup.go with clarifying comments that display/settlement FX affect only the fiat charge, not the platform-unit purchase rate.

Testing

  • Ran the targeted controller test cd apps/api-go && go test ./controller -run TestQuoteTopUpSupportsExplicitFXAndLegacyDirectPricing -count=1, which completed without failures.
  • Ran gofmt -w on the modified file and validated the local test invocation returned clean results.

Codex Task

Copy link
Copy Markdown
Member Author

代码审查阻断(2026-10-11,基于 main@da5d163):此 PR 将 configuredPlatformUnitsPerUSD() 一律返回 1,与当前主分支注释所定义的兼容批次比例 K/QPU、pkg/paymentpricing.Rates.PlatformUnitsPerUSD() 以及现有 topup_shared_settlement_test.go(预期示例比例 6.8)冲突。

请不要在未统一对账单位之前直接合并。本修复需要保留冻结平台计量单位与资金结算汇率的独立性,覆盖 CNY/USD、自定义网关、平台积分到钱包 quota、冻结订单金额、回调幂等,以及已有测试中的非 1 比例。请使用隔离测试数据给出支付金额/到账额度对账矩阵。当前 PR 仅将输出常数化不足以证明不存在低价套利,还可能导致多收或少收。

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-11T12:33:32.058049Z 1b38475 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member Author

按维护者要求关闭过时修复分支;相关问题将基于最新 main 重新核验和修复。本次关闭不代表问题已修复。

@LIghtJUNction
LIghtJUNction deleted the codex/fix-fx-conversion-for-platform-credit-top-ups branch November 5, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants