修复币商充值币种列表

This commit is contained in:
ZuoZuo 2026-07-15 22:10:30 +08:00
parent 56b50cc87e
commit a93370d434
2 changed files with 40 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, expect, test, vi } from "vitest";
import { COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES } from "../constants.js";
import { FinanceCoinSellerRechargeOrderList } from "./FinanceCoinSellerRechargeOrderList.jsx";
afterEach(() => {
@ -86,6 +87,15 @@ test("coin seller recharge order create dialog verifies receipt before create",
);
}, 10000);
test("MiFaPay and V5Pay expose the complete runtime currency list", () => {
const runtimeCurrencies = Intl.supportedValuesOf("currency");
expect(COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES.mifapay).toEqual(expect.arrayContaining(runtimeCurrencies));
expect(COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES.v5pay).toEqual(expect.arrayContaining(runtimeCurrencies));
expect(COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES.mifapay).toContain("BRL");
expect(COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES.v5pay).toContain("BRL");
});
test("makeup order keeps zero coins while creating a normal recharge record", async () => {
const nowMS = new Date(2026, 6, 13, 9, 0, 0, 0).getTime();
vi.spyOn(Date, "now").mockReturnValue(nowMS);

View File

@ -29,9 +29,37 @@ export const COIN_SELLER_RECHARGE_CHAINS = [
["BSC", "BSC"],
];
// 三方回单使用 ISO 4217 字母代码,前端不再维护渠道币种白名单;白名单会随渠道扩区而过期,
// 造成后端能够校验的订单在录单入口不可选。Intl 数据来自浏览器运行时,并保留旧浏览器所需的现有币种兜底。
const FALLBACK_PROVIDER_CURRENCIES = [
"AED",
"BDT",
"BHD",
"BRL",
"EGP",
"IDR",
"INR",
"KWD",
"MXN",
"OMR",
"PHP",
"PKR",
"QAR",
"SAR",
"TRY",
"VND",
];
export const COIN_SELLER_RECHARGE_CURRENCIES = [
...new Set(
typeof Intl.supportedValuesOf === "function"
? [...Intl.supportedValuesOf("currency"), ...FALLBACK_PROVIDER_CURRENCIES]
: FALLBACK_PROVIDER_CURRENCIES,
),
].sort();
export const COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES = {
mifapay: ["PHP", "INR", "IDR", "VND", "SAR", "AED", "BHD", "QAR", "OMR", "KWD", "BDT", "PKR", "EGP"],
v5pay: ["PHP", "SAR", "EGP", "AED", "IDR", "INR", "PKR", "TRY", "MXN"],
mifapay: COIN_SELLER_RECHARGE_CURRENCIES,
v5pay: COIN_SELLER_RECHARGE_CURRENCIES,
};
export const COIN_SELLER_RECHARGE_STATUS = [