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