mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 18:59:50 +08:00
feat(payments): 增加兑换码与支付适配框架 (#299)
* feat(payments): 增加兑换码与支付适配框架 * fix(ci): 对齐 Rust 1.95 lint 与格式要求 * fix(payments): harden redeem code wallet credits --------- Co-authored-by: fawney19 <[email protected]>
This commit is contained in:
@@ -510,6 +510,93 @@ pub(super) fn classify_admin_basic_family_route(
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& matches!(
|
||||
normalized_path,
|
||||
"/api/admin/payments/redeem-codes/batches"
|
||||
| "/api/admin/payments/redeem-codes/batches/"
|
||||
)
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"list_redeem_code_batches",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::POST
|
||||
&& matches!(
|
||||
normalized_path,
|
||||
"/api/admin/payments/redeem-codes/batches"
|
||||
| "/api/admin/payments/redeem-codes/batches/"
|
||||
)
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"create_redeem_code_batch",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path_no_trailing.starts_with("/api/admin/payments/redeem-codes/batches/")
|
||||
&& normalized_path_no_trailing.matches('/').count() == 6
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"get_redeem_code_batch",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::GET
|
||||
&& normalized_path_no_trailing.starts_with("/api/admin/payments/redeem-codes/batches/")
|
||||
&& normalized_path_no_trailing.ends_with("/codes")
|
||||
&& normalized_path_no_trailing.matches('/').count() == 7
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"list_redeem_codes",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::POST
|
||||
&& normalized_path_no_trailing.starts_with("/api/admin/payments/redeem-codes/batches/")
|
||||
&& normalized_path_no_trailing.ends_with("/disable")
|
||||
&& normalized_path_no_trailing.matches('/').count() == 7
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"disable_redeem_code_batch",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::POST
|
||||
&& normalized_path_no_trailing.starts_with("/api/admin/payments/redeem-codes/batches/")
|
||||
&& normalized_path_no_trailing.ends_with("/delete")
|
||||
&& normalized_path_no_trailing.matches('/').count() == 7
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"delete_redeem_code_batch",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else if method == http::Method::POST
|
||||
&& normalized_path_no_trailing.starts_with("/api/admin/payments/redeem-codes/codes/")
|
||||
&& normalized_path_no_trailing.ends_with("/disable")
|
||||
&& normalized_path_no_trailing.matches('/').count() == 7
|
||||
{
|
||||
Some(classified(
|
||||
"admin_proxy",
|
||||
"payments_manage",
|
||||
"disable_redeem_code",
|
||||
"admin:payments",
|
||||
false,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -358,12 +358,13 @@ pub(super) fn classify_public_support_route(
|
||||
} else if method == http::Method::POST
|
||||
&& matches!(
|
||||
normalized_path,
|
||||
"/api/wallet/recharge" | "/api/wallet/refunds"
|
||||
"/api/wallet/recharge" | "/api/wallet/refunds" | "/api/wallet/redeem"
|
||||
)
|
||||
{
|
||||
let route_kind = match normalized_path {
|
||||
"/api/wallet/recharge" => "create_recharge_order",
|
||||
"/api/wallet/refunds" => "create_refund",
|
||||
"/api/wallet/redeem" => "redeem",
|
||||
_ => "create_recharge_order",
|
||||
};
|
||||
Some(classified(
|
||||
|
||||
Reference in New Issue
Block a user