Merge branch 'master' of https://git.genarrative.world/GenarrativeAI/Genarrative
This commit is contained in:
@@ -77,6 +77,13 @@ pub fn runtime_profile_recharge_point_products() -> Vec<RuntimeProfileRechargePr
|
||||
]
|
||||
}
|
||||
|
||||
/// 中文注释:保留旧展示 helper 的兼容入口;首充资格已改为按商品档位在配置表侧计算。
|
||||
pub fn resolve_runtime_profile_recharge_point_products(
|
||||
_has_points_recharged: bool,
|
||||
) -> Vec<RuntimeProfileRechargeProductSnapshot> {
|
||||
runtime_profile_recharge_point_products()
|
||||
}
|
||||
|
||||
pub fn runtime_profile_recharge_membership_products() -> Vec<RuntimeProfileRechargeProductSnapshot>
|
||||
{
|
||||
vec![
|
||||
@@ -709,16 +716,33 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_recharge_order_input_rejects_unknown_product() {
|
||||
let error = build_runtime_profile_recharge_order_create_input(
|
||||
fn recharge_point_products_do_not_hide_all_first_bonus_by_account_flag() {
|
||||
let first_recharge_products = resolve_runtime_profile_recharge_point_products(false);
|
||||
assert_eq!(first_recharge_products[0].bonus_points, 60);
|
||||
assert_eq!(first_recharge_products[0].badge_label, "首充双倍");
|
||||
assert_eq!(first_recharge_products[0].description, "首充送60泥点");
|
||||
|
||||
let repeated_recharge_products = resolve_runtime_profile_recharge_point_products(true);
|
||||
assert_eq!(repeated_recharge_products[0].bonus_points, 60);
|
||||
assert_eq!(repeated_recharge_products[0].badge_label, "首充双倍");
|
||||
assert_eq!(repeated_recharge_products[0].description, "首充送60泥点");
|
||||
assert_eq!(repeated_recharge_products[5].bonus_points, 3280);
|
||||
assert_eq!(repeated_recharge_products[5].badge_label, "首充双倍");
|
||||
assert_eq!(repeated_recharge_products[5].description, "首充送3280泥点");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_recharge_order_input_accepts_configured_product_id_later() {
|
||||
let input = build_runtime_profile_recharge_order_create_input(
|
||||
"user-1".to_string(),
|
||||
"bad-product".to_string(),
|
||||
"custom-points-600".to_string(),
|
||||
"mock".to_string(),
|
||||
1,
|
||||
)
|
||||
.expect_err("unknown product should fail");
|
||||
.expect("product existence is validated against database config later");
|
||||
|
||||
assert_eq!(error, RuntimeProfileFieldError::UnknownRechargeProduct);
|
||||
assert_eq!(input.product_id, "custom-points-600");
|
||||
assert_eq!(input.payment_channel, "mock");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user