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:
Entropy.Xu
2026-04-17 10:07:52 +08:00
committed by GitHub
co-authored by fawney19
parent 54d77598ae
commit 6964729cb7
36 changed files with 5129 additions and 274 deletions
@@ -277,6 +277,100 @@ impl<'a> AdminAppState<'a> {
self.app.admin_fail_payment_order(order_id).await
}
pub(crate) async fn list_admin_redeem_code_batches(
&self,
status: Option<&str>,
limit: usize,
offset: usize,
) -> Result<
(
Vec<aether_data::repository::wallet::StoredAdminRedeemCodeBatch>,
u64,
),
GatewayError,
> {
self.app
.list_admin_redeem_code_batches(status, limit, offset)
.await
}
pub(crate) async fn read_admin_redeem_code_batch(
&self,
batch_id: &str,
) -> Result<
crate::AdminWalletMutationOutcome<
aether_data::repository::wallet::StoredAdminRedeemCodeBatch,
>,
GatewayError,
> {
self.app.read_admin_redeem_code_batch(batch_id).await
}
pub(crate) async fn list_admin_redeem_codes(
&self,
batch_id: &str,
status: Option<&str>,
limit: usize,
offset: usize,
) -> Result<aether_data::repository::wallet::StoredAdminRedeemCodePage, GatewayError> {
self.app
.list_admin_redeem_codes(batch_id, status, limit, offset)
.await
}
pub(crate) async fn admin_create_redeem_code_batch(
&self,
input: aether_data::repository::wallet::CreateAdminRedeemCodeBatchInput,
) -> Result<
Option<aether_data::repository::wallet::CreateAdminRedeemCodeBatchResult>,
GatewayError,
> {
self.app.admin_create_redeem_code_batch(input).await
}
pub(crate) async fn admin_disable_redeem_code_batch(
&self,
batch_id: &str,
operator_id: Option<&str>,
) -> Result<
crate::AdminWalletMutationOutcome<
aether_data::repository::wallet::StoredAdminRedeemCodeBatch,
>,
GatewayError,
> {
self.app
.admin_disable_redeem_code_batch(batch_id, operator_id)
.await
}
pub(crate) async fn admin_delete_redeem_code_batch(
&self,
batch_id: &str,
operator_id: Option<&str>,
) -> Result<
crate::AdminWalletMutationOutcome<
aether_data::repository::wallet::StoredAdminRedeemCodeBatch,
>,
GatewayError,
> {
self.app
.admin_delete_redeem_code_batch(batch_id, operator_id)
.await
}
pub(crate) async fn admin_disable_redeem_code(
&self,
code_id: &str,
operator_id: Option<&str>,
) -> Result<
crate::AdminWalletMutationOutcome<aether_data::repository::wallet::StoredAdminRedeemCode>,
GatewayError,
> {
self.app
.admin_disable_redeem_code(code_id, operator_id)
.await
}
pub(crate) async fn admin_adjust_wallet_balance(
&self,
wallet_id: &str,