diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteXDCExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteXDCExtensions.cs
new file mode 100644
index 00000000..137d5ada
--- /dev/null
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Extensions/WechatTenpayClientExecuteXDCExtensions.cs
@@ -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
+ {
+ ///
+ /// 异步调用 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=23_1&index=1
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/micropay_sl.php?chapter=23_1&index=1
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/jsapi_sl.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/app/app_sl.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/H5_sl.php?chapter=23_1&index=2
+ /// REF: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=23_1&index=2
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static async Task 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(flurlReq, data: request, cancellationToken: cancellationToken);
+ }
+ }
+}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyRequest.cs
new file mode 100644
index 00000000..f97f7a08
--- /dev/null
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyRequest.cs
@@ -0,0 +1,22 @@
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models
+{
+ ///
+ /// 表示 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口的请求。
+ ///
+ public class GetSandboxSignKeyRequest : WechatTenpaySignableRequest
+ {
+ ///
+ ///
+ ///
+ [Newtonsoft.Json.JsonProperty("mch_id")]
+ [System.Text.Json.Serialization.JsonPropertyName("mch_id")]
+ public override string? MerchantId { get; set; }
+
+ ///
+ ///
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ [System.Text.Json.Serialization.JsonIgnore]
+ public override string? AppId { get; set; }
+ }
+}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyResponse.cs
new file mode 100644
index 00000000..07ddc366
--- /dev/null
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/Models/XDC/GetSandboxSignKeyResponse.cs
@@ -0,0 +1,29 @@
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Models
+{
+ ///
+ /// 表示 [POST] /xdc/apiv2getsignkey/sign/getsignkey 接口的响应。
+ ///
+ public class GetSandboxSignKeyResponse : WechatTenpaySignableResponse
+ {
+ ///
+ ///
+ ///
+ [Newtonsoft.Json.JsonProperty("mch_id")]
+ [System.Text.Json.Serialization.JsonPropertyName("mch_id")]
+ public override string? MerchantId { get; set; }
+
+ ///
+ ///
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ [System.Text.Json.Serialization.JsonIgnore]
+ public override string? AppId { get; set; }
+
+ ///
+ /// 获取或设置沙箱密钥。
+ ///
+ [Newtonsoft.Json.JsonProperty("sandbox_signkey")]
+ [System.Text.Json.Serialization.JsonPropertyName("sandbox_signkey")]
+ public string SandboxSignKey { get; set; } = default!;
+ }
+}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs
index fd58389f..62f2659e 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayRequest.cs
@@ -1,4 +1,4 @@
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
{
///
/// 表示微信支付 API 请求的基类。
@@ -21,6 +21,7 @@
///
/// 获取或设置微信 AppId。如果不指定将使用构造 时的 参数。
+ /// 注意:部分接口不支持指定,请直接忽略此字段。
///
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
@@ -40,7 +41,8 @@
public virtual string? NonceString { get; set; }
///
- /// 获取或设置签名方式。需注意部分接口不支持指定签名方式。
+ /// 获取或设置签名方式。
+ /// 注意:部分接口不支持指定签名方式,请直接忽略此字段。
///
[Newtonsoft.Json.JsonProperty("sign_type")]
[System.Text.Json.Serialization.JsonPropertyName("sign_type")]
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs
index f0f03ce2..39c177f1 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV2/WechatTenpayResponse.cs
@@ -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
///
/// 获取或设置微信 AppId。
+ /// 注意:部分接口不支持获取,请直接忽略此字段。
///
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyRequest.json
new file mode 100644
index 00000000..1f178c9b
--- /dev/null
+++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyRequest.json
@@ -0,0 +1,5 @@
+{
+ "mch_id": "1305638280",
+ "nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
+ "sign": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS"
+}
diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyResponse.json
new file mode 100644
index 00000000..3c0c922b
--- /dev/null
+++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/ModelSamples/XDC/GetSandboxSignKeyResponse.json
@@ -0,0 +1,6 @@
+{
+ "return_code": "SUCCESS",
+ "return_msg": "签名失败",
+ "mch_id": "1305638280",
+ "sandbox_signkey": "013467007045764"
+}