微信支付
This commit is contained in:
parent
976a1e7e43
commit
779a714409
@ -423,7 +423,7 @@ public class UserCreateOrderInput
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 支付结果输出
|
||||
/// 用户支付结果输出
|
||||
/// </summary>
|
||||
public class UserPaymentResultOutput
|
||||
{
|
||||
@ -433,14 +433,54 @@ public class UserPaymentResultOutput
|
||||
public string OrderNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付链接或二维码内容
|
||||
/// 支付链接或二维码
|
||||
/// </summary>
|
||||
public string PayUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 (0-待支付)
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式 (例如:JSAPI, NATIVE)
|
||||
/// </summary>
|
||||
public string? TradeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信Native支付参数 - 二维码链接
|
||||
/// </summary>
|
||||
public string? QrcodeUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - AppId
|
||||
/// </summary>
|
||||
public string? AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - 时间戳
|
||||
/// </summary>
|
||||
public string? TimeStamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - 随机字符串
|
||||
/// </summary>
|
||||
public string? NonceStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - 订单详情扩展字符串
|
||||
/// </summary>
|
||||
public string? Package { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - 签名方式
|
||||
/// </summary>
|
||||
public string? SignType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信JSAPI支付参数 - 签名
|
||||
/// </summary>
|
||||
public string? PaySign { get; set; }
|
||||
}
|
||||
|
||||
#region 参赛记录相关 DTOs
|
||||
|
||||
@ -17,6 +17,11 @@ using System.ComponentModel;
|
||||
using Furion.FriendlyException;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3;
|
||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models;
|
||||
using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings;
|
||||
using System.IO;
|
||||
|
||||
namespace YD_Event.Application.Event;
|
||||
|
||||
@ -36,8 +41,11 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
||||
private readonly ISqlSugarRepository<EventFeeConfig> _feeConfigRepository;
|
||||
private readonly ISqlSugarRepository<EventRegistrationLimit> _limitRepository;
|
||||
private readonly ISqlSugarRepository<PointsRule> _pointsRuleRepository;
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Order> _orderRepository;
|
||||
private readonly AuthManager _authManager;
|
||||
private readonly IIdGenerator _idGenerator;
|
||||
private readonly IOptionsMonitor<YD_Event.Core.Options.WechatTenpayClientOptions> _wechatTenpayClientOptionsMonitor;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public UserEventRegistrationService(
|
||||
ISqlSugarRepository<EventInfo> eventRepository,
|
||||
@ -51,8 +59,11 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
||||
ISqlSugarRepository<EventFeeConfig> feeConfigRepository,
|
||||
ISqlSugarRepository<EventRegistrationLimit> limitRepository,
|
||||
ISqlSugarRepository<PointsRule> pointsRuleRepository,
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.Order> orderRepository,
|
||||
AuthManager authManager,
|
||||
IIdGenerator idGenerator)
|
||||
IIdGenerator idGenerator,
|
||||
IOptionsMonitor<YD_Event.Core.Options.WechatTenpayClientOptions> wechatTenpayClientOptionsMonitor,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_eventRepository = eventRepository;
|
||||
_unitRepository = unitRepository;
|
||||
@ -65,8 +76,11 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
||||
_feeConfigRepository = feeConfigRepository;
|
||||
_limitRepository = limitRepository;
|
||||
_pointsRuleRepository = pointsRuleRepository;
|
||||
_orderRepository = orderRepository;
|
||||
_authManager = authManager;
|
||||
_idGenerator = idGenerator;
|
||||
_wechatTenpayClientOptionsMonitor = wechatTenpayClientOptionsMonitor;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -391,6 +405,9 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
||||
{
|
||||
var registration = await _registrationRepository.GetByIdAsync(input.RegistrationId);
|
||||
if (registration == null) throw Oops.Bah("报名信息不存在");
|
||||
|
||||
var eventInfo = await _eventRepository.GetByIdAsync(registration.EventId);
|
||||
if (eventInfo == null) throw Oops.Bah("赛事信息不存在");
|
||||
|
||||
var orderNo = _idGenerator.NewLong().ToString();
|
||||
registration.OrderNo = orderNo;
|
||||
@ -398,12 +415,199 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
||||
registration.PaymentStatus = 0; // 未支付
|
||||
await _registrationRepository.UpdateAsync(registration);
|
||||
|
||||
return new UserPaymentResultOutput
|
||||
// 创建内部订单记录
|
||||
var order = new YD_Event.Core.Entities.Order
|
||||
{
|
||||
Id = _idGenerator.NewLong(),
|
||||
OrderNo = orderNo,
|
||||
OrderType = 1, // Income
|
||||
PaymentMethod = input.PaymentMethod,
|
||||
RegistrationMode = registration.RegistrationMode,
|
||||
MerchantId = eventInfo.MerchantId,
|
||||
EventId = registration.EventId,
|
||||
RegistrationId = registration.Id,
|
||||
OriginalAmount = registration.TotalAmount,
|
||||
ActualAmount = registration.TotalAmount,
|
||||
DiscountAmount = 0,
|
||||
OrderStatus = OrderStatus.Pending,
|
||||
CreatedTime = DateTime.Now,
|
||||
CreatedUserId = registration.CreatedUserId
|
||||
};
|
||||
registration.TotalAmount = 1;
|
||||
await _orderRepository.InsertAsync(order);
|
||||
|
||||
var result = new UserPaymentResultOutput
|
||||
{
|
||||
OrderNo = orderNo,
|
||||
PayUrl = "http://mock-pay-url.com/" + orderNo,
|
||||
Status = 0
|
||||
};
|
||||
|
||||
// 如果是微信支付 (假设 1 是微信支付)
|
||||
if (input.PaymentMethod == 1)
|
||||
{
|
||||
var configOptions = _wechatTenpayClientOptionsMonitor.CurrentValue;
|
||||
var options = new WechatTenpayClientOptions()
|
||||
{
|
||||
MerchantId = configOptions.MerchantId,
|
||||
MerchantV3Secret = configOptions.MerchantV3Secret,
|
||||
MerchantCertificateSerialNumber = configOptions.MerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = configOptions.MerchantCertificatePrivateKey
|
||||
};
|
||||
var client = new WechatTenpayClient(options);
|
||||
|
||||
var request = new CreatePayTransactionNativeRequest()
|
||||
{
|
||||
OutTradeNumber = orderNo,
|
||||
AppId = configOptions.AppId,
|
||||
Description = $"{eventInfo.EventName} - 报名费",
|
||||
NotifyUrl = configOptions.NotifyUrl,
|
||||
Amount = new CreatePayTransactionNativeRequest.Types.Amount()
|
||||
{
|
||||
Total = (int)(registration.TotalAmount * 100), // 单位为分
|
||||
Currency = "CNY"
|
||||
},
|
||||
ExpireTime = DateTimeOffset.Now.AddMinutes(5) // 添加支付超时处理机制,默认设置为5分钟
|
||||
};
|
||||
|
||||
var response = await client.ExecuteCreatePayTransactionNativeAsync(request);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
result.PayUrl = response.QrcodeUrl ?? string.Empty; // Native支付返回的是二维码链接内容
|
||||
result.QrcodeUrl = response.QrcodeUrl;
|
||||
result.TradeType = "NATIVE";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah($"微信统一下单失败:{response.ErrorMessage}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.PayUrl = "http://mock-pay-url.com/" + orderNo;
|
||||
result.TradeType = "MOCK";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付回调
|
||||
/// </summary>
|
||||
[DisplayName("微信支付回调")]
|
||||
[HttpPost("wechat/notify")]
|
||||
[AllowAnonymous]
|
||||
[NonUnify]
|
||||
public async Task<IActionResult> WechatPayNotify()
|
||||
{
|
||||
var request = _httpContextAccessor.HttpContext.Request;
|
||||
using var reader = new StreamReader(request.Body);
|
||||
var body = await reader.ReadToEndAsync();
|
||||
|
||||
var signature = request.Headers["Wechatpay-Signature"].ToString();
|
||||
var timestamp = request.Headers["Wechatpay-Timestamp"].ToString();
|
||||
var nonce = request.Headers["Wechatpay-Nonce"].ToString();
|
||||
var serialNumber = request.Headers["Wechatpay-Serial"].ToString();
|
||||
|
||||
var configOptions = _wechatTenpayClientOptionsMonitor.CurrentValue;
|
||||
var options = new WechatTenpayClientOptions()
|
||||
{
|
||||
MerchantId = configOptions.MerchantId,
|
||||
MerchantV3Secret = configOptions.MerchantV3Secret,
|
||||
MerchantCertificateSerialNumber = configOptions.MerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = configOptions.MerchantCertificatePrivateKey
|
||||
};
|
||||
var client = new WechatTenpayClient(options);
|
||||
|
||||
// 验证签名
|
||||
bool valid = client.VerifyEventSignature(timestamp, nonce, body, signature, serialNumber);
|
||||
if (!valid)
|
||||
{
|
||||
return new BadRequestResult();
|
||||
}
|
||||
|
||||
var callbackModel = client.DeserializeEvent(body);
|
||||
if (callbackModel.EventType == "TRANSACTION.SUCCESS")
|
||||
{
|
||||
var eventData = client.DecryptEventResource<SKIT.FlurlHttpClient.Wechat.TenpayV3.Events.TransactionResource>(callbackModel);
|
||||
var orderNo = eventData.OutTradeNumber;
|
||||
var transactionId = eventData.TransactionId;
|
||||
|
||||
// 处理订单逻辑,增加幂等性处理
|
||||
var order = await _orderRepository.GetFirstAsync(x => x.OrderNo == orderNo);
|
||||
if (order != null && order.OrderStatus == OrderStatus.Pending)
|
||||
{
|
||||
// 更新订单状态
|
||||
order.OrderStatus = OrderStatus.Paid;
|
||||
order.PaymentTime = DateTime.Now;
|
||||
order.ActualAmount = eventData.Amount.Total / 100m;
|
||||
order.Remark = $"微信支付单号: {transactionId}";
|
||||
await _orderRepository.UpdateAsync(order);
|
||||
|
||||
// 更新报名状态
|
||||
var registration = await _registrationRepository.GetByIdAsync(order.RegistrationId);
|
||||
if (registration != null && registration.PaymentStatus != 1)
|
||||
{
|
||||
registration.PaymentStatus = 1;
|
||||
registration.RegistrationStatus = 1; // 假设1为审核中/已报名
|
||||
await _registrationRepository.UpdateAsync(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new OkObjectResult(new { code = "SUCCESS", message = "成功" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询订单支付状态
|
||||
/// </summary>
|
||||
[DisplayName("查询订单支付状态")]
|
||||
[HttpGet("order/status/{orderNo}")]
|
||||
public async Task<int> QueryOrderStatus([FromRoute] string orderNo)
|
||||
{
|
||||
var order = await _orderRepository.GetFirstAsync(x => x.OrderNo == orderNo);
|
||||
if (order == null) throw Oops.Bah("订单不存在");
|
||||
|
||||
if (order.OrderStatus == OrderStatus.Paid)
|
||||
return 1; // 已支付
|
||||
|
||||
// 主动向微信查询状态
|
||||
if (order.PaymentMethod == 1)
|
||||
{
|
||||
var configOptions = _wechatTenpayClientOptionsMonitor.CurrentValue;
|
||||
var options = new WechatTenpayClientOptions()
|
||||
{
|
||||
MerchantId = configOptions.MerchantId,
|
||||
MerchantV3Secret = configOptions.MerchantV3Secret,
|
||||
MerchantCertificateSerialNumber = configOptions.MerchantCertificateSerialNumber,
|
||||
MerchantCertificatePrivateKey = configOptions.MerchantCertificatePrivateKey
|
||||
};
|
||||
var client = new WechatTenpayClient(options);
|
||||
var request = new GetPayTransactionByOutTradeNumberRequest()
|
||||
{
|
||||
OutTradeNumber = orderNo,
|
||||
MerchantId = configOptions.MerchantId
|
||||
};
|
||||
var response = await client.ExecuteGetPayTransactionByOutTradeNumberAsync(request);
|
||||
if (response.IsSuccessful() && response.TradeState == "SUCCESS")
|
||||
{
|
||||
// 更新状态
|
||||
order.OrderStatus = OrderStatus.Paid;
|
||||
order.PaymentTime = response.SuccessTime?.DateTime;
|
||||
order.ActualAmount = response.Amount.Total / 100m;
|
||||
await _orderRepository.UpdateAsync(order);
|
||||
|
||||
var registration = await _registrationRepository.GetByIdAsync(order.RegistrationId);
|
||||
if (registration != null && registration.PaymentStatus != 1)
|
||||
{
|
||||
registration.PaymentStatus = 1;
|
||||
registration.RegistrationStatus = 1;
|
||||
await _registrationRepository.UpdateAsync(registration);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // 未支付
|
||||
}
|
||||
|
||||
private string GetRegistrationStatusDesc(int status)
|
||||
|
||||
@ -36,5 +36,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MiniExcel" Version="1.42.0" />
|
||||
<PackageReference Include="MiniWord" Version="0.9.2" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.16.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -169,7 +169,7 @@
|
||||
性别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.MemberQueryInput.Phone">
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.MemberQueryInput.Mobile">
|
||||
<summary>
|
||||
联系电话
|
||||
</summary>
|
||||
@ -254,7 +254,7 @@
|
||||
年龄
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.CreateOrUpdateMemberInput.IdCard">
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.CreateOrUpdateMemberInput.IdCardNumber">
|
||||
<summary>
|
||||
身份证号
|
||||
</summary>
|
||||
@ -269,7 +269,7 @@
|
||||
出生日期 (运动员等)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.CreateOrUpdateMemberInput.Phone">
|
||||
<member name="P:YD_Event.Application.AppUser.Dtos.CreateOrUpdateMemberInput.Mobile">
|
||||
<summary>
|
||||
联系电话
|
||||
</summary>
|
||||
@ -1302,46 +1302,6 @@
|
||||
占位符列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.Certificate.Dtos.CreateCertificateInput">
|
||||
<summary>
|
||||
创建证书输入参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.Name">
|
||||
<summary>
|
||||
证书名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.Title">
|
||||
<summary>
|
||||
证书标题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.IssueRule">
|
||||
<summary>
|
||||
发放规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.TemplateContent">
|
||||
<summary>
|
||||
证书模板内容
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.QrCodeUrl">
|
||||
<summary>
|
||||
二维码地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.Status">
|
||||
<summary>
|
||||
证书状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Certificate.Dtos.CreateCertificateInput.Sort">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.Certificate.Dtos.DeleteCertificateInput">
|
||||
<summary>
|
||||
删除证书输入参数
|
||||
@ -1842,7 +1802,7 @@
|
||||
姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.PersonInput.IdCard">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.PersonInput.IdCardNumber">
|
||||
<summary>
|
||||
身份证号
|
||||
</summary>
|
||||
@ -1852,7 +1812,7 @@
|
||||
性别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.PersonInput.Phone">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.PersonInput.Mobile">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
@ -1927,7 +1887,7 @@
|
||||
姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.UpdatePlayerInput.IdCard">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.UpdatePlayerInput.IdCardNumber">
|
||||
<summary>
|
||||
身份证号
|
||||
</summary>
|
||||
@ -1937,7 +1897,7 @@
|
||||
性别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.UpdatePlayerInput.Phone">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.UpdatePlayerInput.Mobile">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
@ -2097,7 +2057,7 @@
|
||||
姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.RegistrationPersonDto.IdCard">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.RegistrationPersonDto.IdCardNumber">
|
||||
<summary>
|
||||
身份证号
|
||||
</summary>
|
||||
@ -2107,7 +2067,7 @@
|
||||
性别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Client.Dtos.RegistrationPersonDto.Phone">
|
||||
<member name="P:YD_Event.Application.Client.Dtos.RegistrationPersonDto.Mobile">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
@ -4177,7 +4137,7 @@
|
||||
姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderQueryInput.Phone">
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderQueryInput.Mobile">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
@ -4207,12 +4167,12 @@
|
||||
性别
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderListOutput.IdCard">
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderListOutput.IdCardNumber">
|
||||
<summary>
|
||||
身份证号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderListOutput.Phone">
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CoachLeaderListOutput.Mobile">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
@ -4647,7 +4607,7 @@
|
||||
手机号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserTeamMemberOutput.IdCard">
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserTeamMemberOutput.IdCardNumber">
|
||||
<summary>
|
||||
身份证号 (脱敏显示)
|
||||
</summary>
|
||||
@ -4744,7 +4704,7 @@
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.Event.Dtos.UserPaymentResultOutput">
|
||||
<summary>
|
||||
支付结果输出
|
||||
用户支付结果输出
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.OrderNo">
|
||||
@ -4754,12 +4714,52 @@
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.PayUrl">
|
||||
<summary>
|
||||
支付链接或二维码内容
|
||||
支付链接或二维码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.Status">
|
||||
<summary>
|
||||
状态 (0-待支付)
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.TradeType">
|
||||
<summary>
|
||||
支付方式 (例如:JSAPI, NATIVE)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.QrcodeUrl">
|
||||
<summary>
|
||||
微信Native支付参数 - 二维码链接
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.AppId">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - AppId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.TimeStamp">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - 时间戳
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.NonceStr">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - 随机字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.Package">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - 订单详情扩展字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.SignType">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - 签名方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.UserPaymentResultOutput.PaySign">
|
||||
<summary>
|
||||
微信JSAPI支付参数 - 签名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.Event.Dtos.RegistrationListQueryInput">
|
||||
@ -5324,6 +5324,16 @@
|
||||
创建支付订单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:YD_Event.Application.Event.UserEventRegistrationService.WechatPayNotify">
|
||||
<summary>
|
||||
微信支付回调
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:YD_Event.Application.Event.UserEventRegistrationService.QueryOrderStatus(System.String)">
|
||||
<summary>
|
||||
查询订单支付状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.File.Dtos.UploadFileOutput">
|
||||
<summary>
|
||||
文件上传输出参数
|
||||
@ -6266,12 +6276,12 @@
|
||||
姓名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Order.Dtos.CreateOrderPersonInput.IdCard">
|
||||
<member name="P:YD_Event.Application.Order.Dtos.CreateOrderPersonInput.IdCardNumber">
|
||||
<summary>
|
||||
证件号码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Order.Dtos.CreateOrderPersonInput.Phone">
|
||||
<member name="P:YD_Event.Application.Order.Dtos.CreateOrderPersonInput.Mobile">
|
||||
<summary>
|
||||
手机号
|
||||
</summary>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||
"SpecificationDocumentSettings": {
|
||||
"DocumentTitle": "规范化接口",
|
||||
@ -102,6 +102,15 @@
|
||||
"AppId": "wxf5a3f98d44c3a563",
|
||||
"Secret": "ef6d17e0419700c137e066aa3dce23ca"
|
||||
},
|
||||
// 微信支付配置
|
||||
"WechatTenpayClient": {
|
||||
"AppId": "wxf5a3f98d44c3a563",
|
||||
"MerchantId": "1632370609",
|
||||
"MerchantV3Secret": "7k9P2sR5tG8bQzX1jL0hY7cV3mN6aD2f",
|
||||
"MerchantCertificateSerialNumber": "491F36D959969D79DF28581A25E3CE02823408DF",
|
||||
"MerchantCertificatePrivateKey": "PUB_KEY_ID_0116323706092026020600192124001600",
|
||||
"NotifyUrl": "https://yourdomain.com/api/wechat/notify"
|
||||
},
|
||||
// 雪花id 文档:https://github.com/yitter/IdGenerator
|
||||
"SnowId": {
|
||||
"Method": 1, //雪花计算方法(1-漂移算法|2-传统算法),默认1
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using YD_Event.Core.Options;
|
||||
using YD_Event.Core.Options;
|
||||
|
||||
namespace Easy.Core;
|
||||
|
||||
@ -17,6 +17,7 @@ public static class ServiceCollectionExtension
|
||||
service.AddConfigurableOptions<SmsOptions>();
|
||||
service.AddConfigurableOptions<AliyunOcrOptions>();
|
||||
service.AddConfigurableOptions<WeChatOptions>();
|
||||
service.AddConfigurableOptions<WechatTenpayClientOptions>();
|
||||
return service;
|
||||
}
|
||||
}
|
||||
47
YD_Event.Core/Options/WechatTenpayClientOptions.cs
Normal file
47
YD_Event.Core/Options/WechatTenpayClientOptions.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Furion.ConfigurableOptions;
|
||||
|
||||
namespace YD_Event.Core.Options;
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付客户端配置选项
|
||||
/// </summary>
|
||||
[OptionsSettings("WechatTenpayClient")]
|
||||
public class WechatTenpayClientOptions : IConfigurableOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信公众号/小程序的AppId
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "AppId不能为空")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付商户号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "商户号不能为空")]
|
||||
public string MerchantId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付 APIv3 密钥
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "APIv3密钥不能为空")]
|
||||
public string MerchantV3Secret { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付商户证书序列号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "商户证书序列号不能为空")]
|
||||
public string MerchantCertificateSerialNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付商户私钥(PEM格式)
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "商户私钥不能为空")]
|
||||
public string MerchantCertificatePrivateKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 支付回调通知地址
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "回调地址不能为空")]
|
||||
public string NotifyUrl { get; set; } = string.Empty;
|
||||
}
|
||||
@ -4588,6 +4588,41 @@
|
||||
雪花id配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Core.Options.WechatTenpayClientOptions">
|
||||
<summary>
|
||||
微信支付客户端配置选项
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.AppId">
|
||||
<summary>
|
||||
微信公众号/小程序的AppId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.MerchantId">
|
||||
<summary>
|
||||
微信支付商户号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.MerchantV3Secret">
|
||||
<summary>
|
||||
微信支付 APIv3 密钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.MerchantCertificateSerialNumber">
|
||||
<summary>
|
||||
微信支付商户证书序列号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.MerchantCertificatePrivateKey">
|
||||
<summary>
|
||||
微信支付商户私钥(PEM格式)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Options.WechatTenpayClientOptions.NotifyUrl">
|
||||
<summary>
|
||||
支付回调通知地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Core.Shared.AvailabilityDto.Status">
|
||||
<summary>
|
||||
状态
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user