Merge remote-tracking branch 'entropy-xu/payment-billing-plans'

# Conflicts:
#	crates/aether-data/src/lifecycle/bootstrap/postgres.rs
#	crates/aether-data/src/lifecycle/migrate/tests.rs
#	frontend/src/views/admin/Users.vue
This commit is contained in:
fawney19
2026-05-15 16:37:17 +08:00
97 changed files with 14795 additions and 402 deletions
@@ -485,6 +485,66 @@ pub(super) fn classify_admin_basic_family_route(
"admin:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/billing/plans" | "/api/admin/billing/plans/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"list_plans",
"admin:billing",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/billing/plans" | "/api/admin/billing/plans/"
)
{
Some(classified(
"admin_proxy",
"billing_manage",
"create_plan",
"admin:billing",
false,
))
} else if method == http::Method::PUT
&& normalized_path_no_trailing.starts_with("/api/admin/billing/plans/")
&& normalized_path_no_trailing.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"update_plan",
"admin:billing",
false,
))
} else if method == http::Method::DELETE
&& normalized_path_no_trailing.starts_with("/api/admin/billing/plans/")
&& normalized_path_no_trailing.matches('/').count() == 5
{
Some(classified(
"admin_proxy",
"billing_manage",
"delete_plan",
"admin:billing",
false,
))
} else if method == http::Method::PATCH
&& normalized_path_no_trailing.starts_with("/api/admin/billing/plans/")
&& normalized_path_no_trailing.ends_with("/status")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"billing_manage",
"set_plan_status",
"admin:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
@@ -498,6 +558,45 @@ pub(super) fn classify_admin_basic_family_route(
"admin:payments",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/payments/gateways/epay" | "/api/admin/payments/gateways/epay/"
)
{
Some(classified(
"admin_proxy",
"payments_manage",
"get_epay_gateway",
"admin:payments",
false,
))
} else if method == http::Method::PUT
&& matches!(
normalized_path,
"/api/admin/payments/gateways/epay" | "/api/admin/payments/gateways/epay/"
)
{
Some(classified(
"admin_proxy",
"payments_manage",
"update_epay_gateway",
"admin:payments",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/admin/payments/gateways/epay/test" | "/api/admin/payments/gateways/epay/test/"
)
{
Some(classified(
"admin_proxy",
"payments_manage",
"test_epay_gateway",
"admin:payments",
false,
))
} else if method == http::Method::GET
&& normalized_path_no_trailing.starts_with("/api/admin/payments/orders/")
&& normalized_path_no_trailing.matches('/').count() == 5
@@ -723,6 +723,30 @@ pub(super) fn classify_admin_operations_family_route(
"admin:users",
false,
))
} else if method == http::Method::GET
&& normalized_path_no_trailing.starts_with("/api/admin/users/")
&& normalized_path_no_trailing.ends_with("/billing/entitlements")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"users_manage",
"list_user_billing_entitlements",
"admin:users",
false,
))
} else if method == http::Method::POST
&& normalized_path_no_trailing.starts_with("/api/admin/users/")
&& normalized_path_no_trailing.ends_with("/billing/grant-plan")
&& normalized_path_no_trailing.matches('/').count() == 6
{
Some(classified(
"admin_proxy",
"users_manage",
"grant_user_billing_plan",
"admin:users",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/users/")
&& normalized_path.ends_with("/sessions")
@@ -316,6 +316,7 @@ pub(super) fn classify_public_support_route(
| "/api/wallet/flow"
| "/api/wallet/today-cost"
| "/api/wallet/recharge"
| "/api/wallet/recharge/options"
| "/api/wallet/refunds"
)
{
@@ -325,6 +326,7 @@ pub(super) fn classify_public_support_route(
"/api/wallet/flow" => "flow",
"/api/wallet/today-cost" => "today_cost",
"/api/wallet/recharge" => "list_recharge_orders",
"/api/wallet/recharge/options" => "recharge_options",
"/api/wallet/refunds" => "list_refunds",
_ => "balance",
};
@@ -374,6 +376,42 @@ pub(super) fn classify_public_support_route(
"user:wallet",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/billing/plans" | "/api/billing/plans/"
)
{
Some(classified(
"public_support",
"billing",
"plans",
"public:billing",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/billing/entitlements" | "/api/billing/entitlements/"
)
{
Some(classified(
"public_support",
"billing",
"entitlements",
"user:billing",
false,
))
} else if method == http::Method::POST
&& has_single_nested_suffix_after_prefix(normalized_path, "/api/billing/plans/", "checkout")
{
Some(classified(
"public_support",
"billing",
"plan_checkout",
"user:billing",
false,
))
} else if method == http::Method::POST
&& has_single_segment_after_prefix(normalized_path, "/api/payment/callback/")
{
@@ -384,6 +422,32 @@ pub(super) fn classify_public_support_route(
"public:payment",
false,
))
} else if matches!(method, &http::Method::GET | &http::Method::POST)
&& matches!(
normalized_path,
"/api/payment/epay/notify" | "/api/payment/epay/notify/"
)
{
Some(classified(
"public_support",
"payment_callback",
"epay_notify",
"public:payment",
false,
))
} else if matches!(method, &http::Method::GET | &http::Method::POST)
&& matches!(
normalized_path,
"/api/payment/epay/return" | "/api/payment/epay/return/"
)
{
Some(classified(
"public_support",
"payment_callback",
"epay_return",
"public:payment",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,