feat: 支持充值商品配置和档位首充
This commit is contained in:
@@ -1039,7 +1039,7 @@ test('profile recharge modal buys points through mock channel outside mini progr
|
||||
expect(onRechargeSuccess).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('profile recharge modal hides first bonus display after points recharge', async () => {
|
||||
test('profile recharge modal trusts per-product first bonus display after points recharge', async () => {
|
||||
const user = userEvent.setup();
|
||||
mockGetRpgProfileRechargeCenter.mockResolvedValueOnce({
|
||||
walletBalance: 60,
|
||||
@@ -1076,8 +1076,8 @@ test('profile recharge modal hides first bonus display after points recharge', a
|
||||
const rechargeDialog = await screen.findByText('账户充值');
|
||||
expect(rechargeDialog).toBeTruthy();
|
||||
expect(screen.getByRole('button', { name: /60泥点/u })).toBeTruthy();
|
||||
expect(screen.queryByText('首充双倍')).toBeNull();
|
||||
expect(screen.queryByText('60+60泥点')).toBeNull();
|
||||
expect(screen.getByText('首充双倍')).toBeTruthy();
|
||||
expect(screen.getByText('60+60泥点')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('profile recharge modal posts requestPayment params in mini program web-view', async () => {
|
||||
|
||||
@@ -2498,20 +2498,16 @@ async function confirmWechatRechargeOrderUntilSettled(
|
||||
|
||||
function RechargeProductCard({
|
||||
product,
|
||||
hasPointsRecharged,
|
||||
submittingProductId,
|
||||
onBuy,
|
||||
}: {
|
||||
product: ProfileRechargeProduct;
|
||||
hasPointsRecharged: boolean;
|
||||
submittingProductId: string | null;
|
||||
onBuy: (product: ProfileRechargeProduct) => void;
|
||||
}) {
|
||||
const submitting = submittingProductId === product.productId;
|
||||
const effectiveBonusPoints =
|
||||
product.kind === 'points' && hasPointsRecharged ? 0 : product.bonusPoints;
|
||||
const badgeLabel =
|
||||
product.kind === 'points' && hasPointsRecharged ? '' : product.badgeLabel;
|
||||
const effectiveBonusPoints = product.bonusPoints;
|
||||
const badgeLabel = product.badgeLabel;
|
||||
const value =
|
||||
product.kind === 'points'
|
||||
? `${product.pointsAmount}${effectiveBonusPoints > 0 ? `+${effectiveBonusPoints}` : ''}泥点`
|
||||
@@ -2646,7 +2642,6 @@ function ProfileRechargeModal({
|
||||
<RechargeProductCard
|
||||
key={product.productId}
|
||||
product={product}
|
||||
hasPointsRecharged={center?.hasPointsRecharged === true}
|
||||
submittingProductId={submittingProductId}
|
||||
onBuy={onBuy}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user