admin/src/Oms.Application/Dtos/Payment/WeChatPayDtos.cs
zzh b0fd3a30e1
All checks were successful
Build and Deploy / deploy (push) Successful in 1m29s
feat: 微信在线支付入账加固(CAS 防重、禁人工审未付单、下单失败清理)
回调/查单/补偿走事务内原子占单再入账;关单同步驳回充值;创建先落单失败即 Failed;列表标记在线支付态。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-12-01 12:25:45 +08:00

121 lines
3.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.ComponentModel.DataAnnotations;
namespace Oms.Application.Dtos.Payment;
/// <summary>创建微信在线支付入参。</summary>
public class CreateWeChatPayInput
{
/// <summary>客户主键(可选,默认取会话客户)。</summary>
public int? CustomerId { get; set; }
/// <summary>充值金额(元)。</summary>
[Range(typeof(decimal), "0.01", "999999999999")]
public decimal RechargeAmount { get; set; }
/// <summary>场景:native | jsapi。</summary>
[Required]
[StringLength(16)]
public string Scene { get; set; } = "native";
/// <summary>
/// 微信网页授权 code(JSAPI 且客户未绑定 OpenId 时传入;也可走 Header X-Wechat-OAuth-Code)。
/// </summary>
[StringLength(128)]
public string? OauthCode { get; set; }
}
/// <summary>创建微信支付出参。</summary>
public class CreateWeChatPayOutput
{
/// <summary>商户订单号。</summary>
public string OutTradeNo { get; set; } = string.Empty;
/// <summary>充值记录 Id。</summary>
public int RechargeRecordId { get; set; }
/// <summary>支付渠道。</summary>
public string Channel { get; set; } = string.Empty;
/// <summary>支付单状态名。</summary>
public string Status { get; set; } = string.Empty;
/// <summary>Native 二维码链接。</summary>
public string? CodeUrl { get; set; }
/// <summary>过期时间。</summary>
public DateTime? ExpireTime { get; set; }
/// <summary>JSAPI 调起参数。</summary>
public WeChatJsapiPayParams? Jsapi { get; set; }
}
/// <summary>JSAPI 调起收银台参数。</summary>
public class WeChatJsapiPayParams
{
public string AppId { get; set; } = string.Empty;
public string TimeStamp { get; set; } = string.Empty;
public string NonceStr { get; set; } = string.Empty;
public string Package { get; set; } = string.Empty;
public string SignType { get; set; } = "RSA";
public string PaySign { get; set; } = string.Empty;
}
/// <summary>支付状态查询出参。</summary>
public class WeChatPayStatusOutput
{
public string OutTradeNo { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public int StatusCode { get; set; }
public decimal Amount { get; set; }
public string? TransactionId { get; set; }
public DateTime? PaidTime { get; set; }
public int RechargeRecordId { get; set; }
public string? CodeUrl { get; set; }
}
/// <summary>关闭支付单入参。</summary>
public class CloseWeChatPayInput
{
[Required]
[StringLength(64)]
public string OutTradeNo { get; set; } = string.Empty;
}
/// <summary>微信支付商户配置(管理端)。</summary>
public class WeChatPayMerchantConfigOutput
{
public bool Configured { get; set; }
public bool Enabled { get; set; }
public string MchId { get; set; } = string.Empty;
public string MchSerialNo { get; set; } = string.Empty;
public string NotifyUrl { get; set; } = string.Empty;
public bool HasApiV3Key { get; set; }
public bool HasPrivateKey { get; set; }
public string? AppId { get; set; }
}
/// <summary>保存微信支付商户配置。</summary>
public class SaveWeChatPayMerchantConfigInput
{
public bool Enabled { get; set; }
[Required]
[StringLength(64)]
public string MchId { get; set; } = string.Empty;
[Required]
[StringLength(128)]
public string MchSerialNo { get; set; } = string.Empty;
/// <summary>APIv3 密钥;留空表示不修改。</summary>
[StringLength(64)]
public string? ApiV3Key { get; set; }
/// <summary>商户 API 私钥 PEM;留空表示不修改。</summary>
public string? PrivateKeyPem { get; set; }
/// <summary>支付回调完整 URL。</summary>
[StringLength(512)]
public string? NotifyUrl { get; set; }
}