问题: 原recordPayment只创建Pending支付记录,不更新账单状态
用户点击确认收款后需要再次审核才能生效
解决方案:
- 新增POST /api/admin/v1/billings/{id}/payments/confirm接口
- 内部原子化执行: 创建支付+自动审核+更新账单状态
- 保留原recordPayment接口用于需要审核的场景
新增文件:
- ConfirmPaymentCommand.cs
- ConfirmPaymentCommandHandler.cs
- ConfirmPaymentCommandValidator.cs
43 lines
992 B
C#
43 lines
992 B
C#
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; }
|
||
}
|
||
|