Tai.Wallet.Voucher.Domain.Shared 1.1.0

dotnet add package Tai.Wallet.Voucher.Domain.Shared --version 1.1.0
                    
NuGet\Install-Package Tai.Wallet.Voucher.Domain.Shared -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.Voucher.Domain.Shared" 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.Voucher.Domain.Shared" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Tai.Wallet.Voucher.Domain.Shared" />
                    
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.Voucher.Domain.Shared --version 1.1.0
                    
#r "nuget: Tai.Wallet.Voucher.Domain.Shared, 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.Voucher.Domain.Shared@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.Voucher.Domain.Shared&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Tai.Wallet.Voucher.Domain.Shared&version=1.1.0
                    
Install as a Cake Tool

Tai.Wallet.Voucher

业务储值钱包兑换码与充值券 1.1.0,.NET 10 / ABP 10.7.0。核心包通过 NuGet 依赖 Tai.Wallet 1.3.0;可选 Tai.Wallet.Voucher.Recharge 组合 Tai.Wallet.Recharge 1.2.0,替换充值券扩展点。

批次快照币种与资金类型,直接兑换本金默认 StoredValue,可显式配置 Cash 或 Bonus。受限本金和 Cash 均不能通过缩短已生效活动期限改变已承诺权益。直接兑换显式开户并原子入账,返回 AccountId 与真实 TransactionId;业务记录和钱包多分录交易共同提交。

批次有两个互不影响的日期:StartTime / EndTime 是码的兑换窗口,BonusExpiryMode 决定兑入的赠送金能用多久。BonusExpiryMode 为 Permanent 表示永久有效;FixedTime 用 BonusExpiryTime 给整批一个共同到期时刻,不论何时兑换;DaysAfterCredit 用 BonusExpiryDays(1 到 3650)表示自赠送金首次到账起算的完整 24 小时天数。只有发放 Bonus 的批次能设置期限,本金批次带期限会被拒绝。已到固定到期时刻的券在兑换或充值建单时即被拒绝,且不消耗用券次数。

直接兑换记录 VoucherRedemption 与充值券预占 VoucherCouponReservation 分表。券预占保存充值 ID、币种、实付与赠金快照,充值成功事务中确认;重复预占必须匹配原内容。预占没有钱包交易,成功确认也不会再单独生成一次赠金入账,由充值的一笔 Credit 包含本金和所有赠金。支付状态未知时保留占用。

直接兑换在兑换时刻解析期限并记入 VoucherRedemption.BonusExpireTime,钱包据此生成一条赠送金发放记录;相对的期限从实际到账时起算,重试取回原记录时沿用首次结果。充值券的期限在预占时锁入 VoucherCouponReservation,并随充值单快照到支付成功,因此活动赠金和券赠金可以有不同期限。

兑换码只存哈希;批量生成的明码仅返回一次,接口禁用审计。登录用户、权限、租户、失败计数、分布式锁和数据库并发共同保护兑换。每次实际兑换或预占推进批次并发版本,避免两个不同码同时绕过同批次的用户额度。发生并发冲突在全新事务重试;分布式锁不是唯一正确性保障。

接入与 HTTP

宿主按层声明 TaiWalletVoucher*Module 依赖,组合 IWalletDbContext 与 IWalletVoucherDbContext(包括 CouponReservations),调用 ConfigureWallet / ConfigureWalletVoucher,并 ReplaceDbContext 为共享宿主上下文。使用充值券时再组合充值、支付上下文与 TaiWalletVoucherRechargeModule。示例完整展示接入;连接字符串 TaiWallet。

用户入口 POST /api/wallet/vouchers/redeem 和 GET /api/wallet/vouchers/redemptions。管理员入口 /api/wallet/voucher-batches,提供批次、码及权限受控的使用记录查询;/{id}/redemptions 查询直接兑换,/{id}/coupon-reservations 查询充值券预占及确认状态。两类记录不再混用 State 字段。RemoteService 名称 WalletVoucher。金额输入允许字符串,输出为字符串。

验证与迁移

Initial 是重构后的新数据库基线,不兼容旧开发数据库。生产部署由实际消费宿主管理迁移,不应直接在已有数据上运行新初始迁移。1.1.0 的 BonusExpiry 迁移新增钱包的赠送金发放记录表,并为兑换批次、兑换记录与充值券预占增加期限列;已有记录保持不变,升级前已到账的赠送金由钱包按永久有效处理。

从仓库根目录运行 bash scripts/verify-wallet-series.sh,按本地 NuGet 包依赖顺序验证全系列。单独验证使用 bash wallet-voucher/scripts/verify.sh,尚未发布的依赖通过 TAI_WALLET_FEED 指定本地包源。验证包含构建、业务及 HTTP 测试、模型检查、新数据库迁移和打包。sample 的 --migrate 显式迁移,正常运行展示 JWT 认证与模块 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 (2)

Showing the top 2 NuGet packages that depend on Tai.Wallet.Voucher.Domain.Shared:

Package Downloads
Tai.Wallet.Voucher.Domain

ABP module that redeems voucher codes and prepaid cards into Tai.Wallet balances

Tai.Wallet.Voucher.Application.Contracts

ABP module that redeems voucher codes and prepaid cards into Tai.Wallet balances

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 183 11/19/2026
1.0.1 242 11/1/2026
1.0.0 196 10/17/2026
0.2.0 170 10/11/2026
0.1.0 179 10/11/2026