mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(tenpayv2): 新增获取仿真测试系统验签密钥接口
This commit is contained in:
parent
0472223bb6
commit
6e922ca65e
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
{
|
||||
public static class WechatTenpayClientExecuteXDCExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=23_1&index=1 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=23_1&index=1 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=23_1&index=2 </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=23_1&index=2 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.GetSandboxSignKeyResponse> ExecuteGetSandboxSignKeyAsync(this WechatTenpayClient client, Models.GetSandboxSignKeyRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "xdc", "apiv2getsignkey", "sign", "getsignkey");
|
||||
|
||||
return await client.SendRequestWithXmlAsync<Models.GetSandboxSignKeyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class GetSandboxSignKeyRequest : WechatTenpaySignableRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mch_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mch_id")]
|
||||
public override string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public override string? AppId { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class GetSandboxSignKeyResponse : WechatTenpaySignableResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mch_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mch_id")]
|
||||
public override string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public override string? AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置沙箱密钥。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sandbox_signkey")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sandbox_signkey")]
|
||||
public string SandboxSignKey { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示微信支付 API 请求的基类。
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.AppId"/> 参数。
|
||||
/// <para>注意:部分接口不支持指定,请直接忽略此字段。</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
@ -40,7 +41,8 @@
|
||||
public virtual string? NonceString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置签名方式。需注意部分接口不支持指定签名方式。
|
||||
/// 获取或设置签名方式。
|
||||
/// <para>注意:部分接口不支持指定签名方式,请直接忽略此字段。</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sign_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sign_type")]
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
{
|
||||
@ -106,6 +106,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。
|
||||
/// <para>注意:部分接口不支持获取,请直接忽略此字段。</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"mch_id": "1305638280",
|
||||
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
|
||||
"sign": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS"
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"return_code": "SUCCESS",
|
||||
"return_msg": "签名失败",
|
||||
"mch_id": "1305638280",
|
||||
"sandbox_signkey": "013467007045764"
|
||||
}
|
Loading…
Reference in New Issue
Block a user