Tai.Wallet.Recharge.EntityFrameworkCore 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tai.Wallet.Recharge.EntityFrameworkCore --version 1.1.0
                    
NuGet\Install-Package Tai.Wallet.Recharge.EntityFrameworkCore -Version 1.1.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.Recharge.EntityFrameworkCore" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tai.Wallet.Recharge.EntityFrameworkCore" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Tai.Wallet.Recharge.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.Recharge.EntityFrameworkCore --version 1.1.0
                    
#r "nuget: Tai.Wallet.Recharge.EntityFrameworkCore, 1.1.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.Recharge.EntityFrameworkCore@1.1.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.Recharge.EntityFrameworkCore&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Tai.Wallet.Recharge.EntityFrameworkCore&version=1.1.0
                    
Install as a Cake Tool

Tai.Wallet.Recharge

业务储值钱包充值 1.1.0,.NET 10 / ABP 10.7.0。可选集成包,以 NuGet 引用 Tai.Wallet 1.0.0 和 Tai.Payment 0.1.1;不反向增加钱包核心的支付依赖。

充值单快照 AccountId、Currency、PrincipalFund、实付金额、活动与券赠金。WalletRechargeOptions.PrincipalFund 默认 Cash,可配置 StoredValue,禁止 Bonus;后续配置改变不会重算已创建订单。Currency 默认 CNY;当前支付适配按两位小数换算,核心钱包本身不做汇率换算。金额 HTTP 输出字符串,输入允许字符串和 JSON 数字。

支付单创建和充值单记录采用独立提交,支付结果必须核验关联 ID、金额、币种和状态。成功支付后,充值状态、可选券确认、钱包本金及赠金入账在组合宿主的同一事务内提交。一笔充值只生成一笔 Credit、多条 Entry,LedgerTransactionId 保存实际流水 ID;业务请求 ID 不充当交易 ID。后台补账重复执行通过幂等键返回同一交易。

活动占用计数由数据库乐观并发保护,分布式锁用于协调;并发失败后必须在新事务重试。充值券扩展点 WalletRechargeCouponProvider 由 Tai.Wallet.Voucher.Recharge 替换,预占携带币种;付款状态未知时不自动释放券。

接入

按需安装 Domain.Shared、Domain、Application.Contracts、Application、EntityFrameworkCore、HttpApi,各层宿主添加对应 TaiWalletRecharge*Module 的 DependsOn。参考 samples/Tai.Wallet.Recharge.Sample:组合钱包、支付和充值上下文,实现 IWalletDbContext / IWalletRechargeDbContext / IPaymentDbContext,模型调用 ConfigureWallet / ConfigureWalletRecharge / ConfigurePayment,ReplaceDbContext 指向同一个宿主上下文。连接字符串 TaiWallet。配置 WalletRechargeOptions 与支付 Provider,可靠事件交付由宿主配置 ABP Outbox / Inbox。

IWalletRechargeAppService 提供报价、创建、读取、结账、刷新;HTTP 位于 /api/wallet/recharges;管理活动位于 /api/wallet/recharge-offers。RemoteService 名称 WalletRecharge。权限、用户归属及租户过滤同时生效;活动管理使用独立管理权限。创建需要稳定 RequestId,重复请求必须保留原金额和券内容。

验证与迁移

新示例 Initial 是新数据库基线,旧 Balance 模型不兼容,不可直接应用到旧数据库。源码跨模块依赖通过本地包验证:在仓库根目录运行 bash scripts/verify-wallet-series.sh;单独运行 bash wallet-recharge/scripts/verify.sh 时,依赖需已发布,或通过 TAI_WALLET_FEED 指向完整的本地包源。脚本执行还原、Release 构建、测试和各生产包打包,数据库测试从当前模型建库。

示例运行前先在示例宿主中为当前模型生成迁移,再执行 dotnet run --project samples/Tai.Wallet.Recharge.Sample -- --migrate,然后正常启动宿主;示例 JWT 和支付配置请使用自己的验证配置及支付 Provider。生产数据库驱动和迁移属于实际消费宿主。

宿主管理查询(1.1.0)

宿主可在进程内注入 Tai.Wallet.Recharge.Administration.IWalletRechargeAdministrationAppService。契约和服务均禁用远程暴露,不新增 Controller。所有方法要求独立权限 Wallet.Recharges.Administration.Read,位于现有 Wallet.Recharge group 下;客户充值权限不授予此能力。

GetListAsync 返回当前租户的充值单及总数,支持用户、币种、创建时间 [CreatedFrom, CreatedBefore) 和状态筛选,以创建时间倒序、ID 倒序稳定分页。Sorting 仅支持 CreationTime、CreationTime ASC、CreationTime DESC;Keyword 仅接受完整 GUID,精确匹配充值 ID、支付请求 ID 或用户 ID。GetAsync 允许读取当前租户任意用户的充值单。DTO 显式映射,省略请求键、券哈希、券预占引用及内部属性。

状态在 SQL 中左联表支付请求后投影:已有到账时间为 Credited,否则支付完成为 Paid、支付失败为 PaymentFailed,其余为 WaitingForPayment;列表和状态筛选不逐行调用领域服务。充值与支付仓储必须通过 ReplaceDbContext 接到同一个宿主上下文,按上述接入方式组合。

GetStatisticsAsync 按到账时间 [CreditedFrom, CreditedBefore) 汇总当前币种的已到账本金、赠金及笔数;已支付未到账数为该币种当前全部 Paid 充值单数量,不受到账时间范围限制。本次 ConfigureWalletRecharge() 增加 (TenantId, CreationTime)、(TenantId, UserId, CreationTime)、(TenantId, CreditedTime) 索引。模块不生成迁移,Vetus 等消费宿主统一生成并验证;示例快照不作为本次发布的迁移依据。

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.2.0 122 11/19/2026
1.1.0 189 11/1/2026
1.0.0 137 10/17/2026
0.2.2 112 10/17/2026
0.2.1 118 10/11/2026
0.2.0 110 10/11/2026
0.1.0 114 10/10/2026