Tai.Wallet.Recharge.HttpApi 1.2.0

dotnet add package Tai.Wallet.Recharge.HttpApi --version 1.2.0
                    
NuGet\Install-Package Tai.Wallet.Recharge.HttpApi -Version 1.2.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.HttpApi" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tai.Wallet.Recharge.HttpApi" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Tai.Wallet.Recharge.HttpApi" />
                    
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.HttpApi --version 1.2.0
                    
#r "nuget: Tai.Wallet.Recharge.HttpApi, 1.2.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.HttpApi@1.2.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.HttpApi&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Tai.Wallet.Recharge.HttpApi&version=1.2.0
                    
Install as a Cake Tool

Tai.Wallet.Recharge

业务储值钱包充值 1.2.0,.NET 10 / ABP 10.7.0。可选集成包,以 NuGet 引用 Tai.Wallet 1.3.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。后台补账重复执行通过幂等键返回同一交易。

活动赠金与券赠金各自携带期限:WalletRechargeOffer 和 IWalletRechargeCouponProvider 都返回 WalletBonusExpiryRule,充值创建时分别快照到充值单,支付成功入账时再按首次到账时刻解析。因此一笔充值可以产生两条赠送金发放记录,各自到期;报价与充值详情返回双方的 BonusExpiryMode、BonusExpiryTime 与 BonusExpiryDays。固定到期时刻已过的活动不再参与报价,已建单并付款的充值仍在到账时入账并立即记录过期。

活动占用计数由数据库乐观并发保护,分布式锁用于协调;并发失败后必须在新事务重试。充值券扩展点 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 模型不兼容,不可直接应用到旧数据库。1.2.0 的 BonusExpiry 迁移增加活动与充值单的赠金期限列、钱包的赠送金发放记录表;已有充值单的期限为空,按永久有效处理。源码跨模块依赖通过本地包验证:在仓库根目录运行 bash scripts/verify-wallet-series.sh;单独运行 bash wallet-recharge/scripts/verify.sh 时,依赖需已发布,或通过 TAI_WALLET_FEED 指向完整的本地包源。脚本执行还原、Release 构建、测试、迁移模型检查、新 SQLite 数据库迁移和各生产包打包。

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

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 111 11/19/2026
1.1.0 188 11/1/2026
1.0.0 142 10/17/2026
0.2.2 115 10/17/2026
0.2.1 109 10/11/2026
0.2.0 116 10/11/2026
0.1.0 108 10/10/2026