Tai.Wallet.Withdrawal.EntityFrameworkCore 1.0.0

dotnet add package Tai.Wallet.Withdrawal.EntityFrameworkCore --version 1.0.0
                    
NuGet\Install-Package Tai.Wallet.Withdrawal.EntityFrameworkCore -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tai.Wallet.Withdrawal.EntityFrameworkCore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tai.Wallet.Withdrawal.EntityFrameworkCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Tai.Wallet.Withdrawal.EntityFrameworkCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tai.Wallet.Withdrawal.EntityFrameworkCore --version 1.0.0
                    
#r "nuget: Tai.Wallet.Withdrawal.EntityFrameworkCore, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tai.Wallet.Withdrawal.EntityFrameworkCore@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tai.Wallet.Withdrawal.EntityFrameworkCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Tai.Wallet.Withdrawal.EntityFrameworkCore&version=1.0.0
                    
Install as a Cake Tool

Tai.Wallet.Withdrawal

业务储值钱包提现 1.0.0,.NET 10 / ABP 10.7.0。七个独立生产层包,NuGet 依赖 Tai.Wallet 1.0.0;不内置第三方出款渠道。

状态流转:Requested → Processing → Succeeded / Failed,Requested 可 Cancel。申请仅冻结 Cash,成功才 Capture,确认失败或未出款前取消则 Release。Processing 表示渠道结果可能未知,不允许用户取消;超时、网络异常、后台任务重试均不能自行解冻。出款服务必须先记录 Processing,再调用外部渠道;外部调用与数据库提交分开,使用订单 ID 作为渠道幂等键,查询确认结果后在新事务调用 SucceedAsync / FailAsync。回调、查单、补偿和渠道可靠投递由消费宿主实现。

CalculateUserFeeAsync 可由宿主继承 WalletWithdrawalManager 覆盖,默认 0;手续费随申请快照,从 Cash 额外冻结,客户端无法指定。Wallet.Withdrawal.ForfeitBonusOnWithdrawal 设置默认 false;启用时按本次占用现金占可用现金的比例向下取整计算赠金作废额,同时冻结 Bonus,仅出款成功后扣除,失败或取消一起释放。StoredValue 不参与提现或赠金计算;改变设置不重算已有订单。

业务请求 ID 与订单 ID、冻结 ID、钱包交易 ID 分开。相同请求重复创建返回原订单,金额、渠道或说明变化会拒绝。确认成功必须提供稳定的外部引用,重复确认引用必须一致。账户、流水、冻结与提现单必须在共享宿主 DbContext 的同一事务提交,外部渠道操作不放在该事务内。并发错误需丢弃事务后重试,禁止失败后继续提交。

接入

按需安装 Tai.Wallet.Withdrawal.Domain.Shared、Domain、Application.Contracts、Application、EntityFrameworkCore、HttpApi、HttpApi.Client。宿主依赖对应 TaiWalletWithdrawal*Module,组合钱包层。数据库实现 IWalletDbContext / IWalletWithdrawalDbContext,调用 ConfigureWallet() / ConfigureWalletWithdrawal(),并 ReplaceDbContext 到共享上下文;连接字符串 TaiWallet。完整代码见 samples/Tai.Wallet.Withdrawal.Sample。钱包表前缀/Schema 跟随 WalletDbProperties,提现表 TaiWalletWithdrawalOrders。

HTTP 提供 POST /api/wallet/withdrawals、GET /api/wallet/withdrawals/{id}、POST /api/wallet/withdrawals/{id}/cancel。申请字段 AccountId、RequestId、Amount、Channel、Description;金额输出 JSON 字符串。读取权限 Wallet.Withdrawals,申请 .Create、取消 .Cancel,同时验证用户归属与租户。HTTP 不提供标记成功或失败接口,后台可信服务使用领域 Manager。RemoteServices 客户端键 WalletWithdrawal。

示例与验证

sample 使用 SQLite 和 JWT 验证,Authentication:Authority / Audience 配置真实身份服务;示例的 permission claim 提供器仅演示授权,不是核心强制依赖。

# 从仓库根目录,先构建本地钱包依赖包,再验证整个系列:
bash scripts/verify-wallet-series.sh
# 从本模块目录,显式迁移后运行:
dotnet run --project samples/Tai.Wallet.Withdrawal.Sample -- --migrate
dotnet run --project samples/Tai.Wallet.Withdrawal.Sample

单模块 scripts/verify.sh 依赖已发布钱包包或 TAI_WALLET_FEED,执行构建、测试、迁移一致性、新数据库迁移和打包。Initial 是新数据库基线,生产迁移由实际宿主负责。当前测试覆盖权限、归属、租户隔离、幂等、冻结、未知结果、重复确认、失败释放、可选赠金作废和 HTTP 入口;不代表已验证任何真实出款渠道。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 151 10/17/2026