修正(会员支付):微信虚拟支付只接受在售且可购买的档位

- build_wechat_virtual_pay_params 的档位校验补齐 enabled 与 is_purchasable
- 与 resolve_enabled_profile_recharge_order_product 的可售判定对齐,拒绝 Normal 占位与下架档位
This commit is contained in:
2026-10-04 10:35:01 +08:00
parent 44feb7b0f5
commit 4a2594a90c
@@ -1821,14 +1821,18 @@ fn build_wechat_virtual_pay_params(
.with_message("当前充值商品不存在,请刷新后再试")
})?,
RuntimeProfileRechargeProductKind::Membership => {
// 会员商品不在商品配置表里:确认档位仍在目录中即可,购买数量固定为 1。
// 会员商品不在商品配置表里:确认档位仍可售(在售且非 Normal 占位)即可,购买数量固定为 1。
let (plan, _) =
module_runtime::parse_runtime_profile_membership_product_id(&order.product_id)
.ok_or_else(|| {
AppError::from_status(StatusCode::BAD_REQUEST)
.with_message("当前会员套餐不存在,请刷新后再试")
})?;
if !center.membership_plans.iter().any(|item| item.plan == plan) {
if !center
.membership_plans
.iter()
.any(|item| item.plan == plan && item.enabled && item.plan.is_purchasable())
{
return Err(AppError::from_status(StatusCode::BAD_REQUEST)
.with_message("当前会员套餐不存在,请刷新后再试"));
}