feat: 新增一键确认收款接口

问题: 原recordPayment只创建Pending支付记录,不更新账单状态
用户点击确认收款后需要再次审核才能生效

解决方案:
- 新增POST /api/admin/v1/billings/{id}/payments/confirm接口
- 内部原子化执行: 创建支付+自动审核+更新账单状态
- 保留原recordPayment接口用于需要审核的场景

新增文件:
- ConfirmPaymentCommand.cs
- ConfirmPaymentCommandHandler.cs
- ConfirmPaymentCommandValidator.cs
This commit is contained in:
2025-12-18 15:29:30 +08:00
parent 15a35d8e40
commit 40e914dc92
4 changed files with 214 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
using MediatR;
using TakeoutSaaS.Application.App.Billings.Dto;
using TakeoutSaaS.Domain.Tenants.Enums;
namespace TakeoutSaaS.Application.App.Billings.Commands;
/// <summary>
/// 一键确认收款命令(记录支付 + 立即审核通过)。
/// </summary>
public sealed record ConfirmPaymentCommand : IRequest<PaymentRecordDto>
{
/// <summary>
/// 账单 ID雪花算法
/// </summary>
public long BillingId { get; init; }
/// <summary>
/// 支付金额。
/// </summary>
public decimal Amount { get; init; }
/// <summary>
/// 支付方式。
/// </summary>
public TenantPaymentMethod Method { get; init; }
/// <summary>
/// 交易号。
/// </summary>
public string? TransactionNo { get; init; }
/// <summary>
/// 支付凭证 URL。
/// </summary>
public string? ProofUrl { get; init; }
/// <summary>
/// 备注信息。
/// </summary>
public string? Notes { get; init; }
}