mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-03-10 00:13:36 +08:00
feat(tenpaybusiness): 支持新版域名
This commit is contained in:
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
[](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayBusiness) [](https://mit-license.org/)
|
[](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat) [](https://www.nuget.org/packages/SKIT.FlurlHttpClient.Wechat.TenpayBusiness) [](https://mit-license.org/)
|
||||||
|
|
||||||
基于 `Flurl.Http` 的腾讯微企付 HTTP API SDK。
|
基于 `Flurl.Http` 的微企付 HTTP API SDK。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 【功能特性】
|
### 【功能特性】
|
||||||
|
|
||||||
- 基于腾讯微企付 API 封装。
|
- 基于微企付 API 封装。
|
||||||
- 请求时自动生成签名,无需开发者手动干预。
|
- 请求时自动生成签名,无需开发者手动干预。
|
||||||
- 提供了腾讯微企付所需的 RSA、SM3、SM4、SHA-256 等算法工具类。
|
- 提供了微企付所需的 RSA、SM3、SM4、SHA-256 等算法工具类。
|
||||||
- 提供了解析回调通知事件等扩展方法。
|
- 提供了解析回调通知事件等扩展方法。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -13,9 +13,9 @@
|
|||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
|
||||||
<PackageTags>Flurl.Http Tencent Tenpay 腾讯 微企付</PackageTags>
|
<PackageTags>Flurl.Http Tencent Tenpay 微企付</PackageTags>
|
||||||
<Version>2.0.1</Version>
|
<Version>2.0.1</Version>
|
||||||
<Description>基于 Flurl.Http 的腾讯微企付 API 客户端。</Description>
|
<Description>基于 Flurl.Http 的微企付 API 客户端。</Description>
|
||||||
<Authors>Fu Diwei</Authors>
|
<Authors>Fu Diwei</Authors>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl>
|
<RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl>
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ using Flurl.Http;
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 一个腾讯微企付 API HTTP 客户端。
|
/// 一个微企付 API HTTP 客户端。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WechatTenpayBusinessClient : CommonClientBase, ICommonClient
|
public class WechatTenpayBusinessClient : CommonClientBase, ICommonClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前客户端使用的腾讯微企付平台凭证。
|
/// 获取当前客户端使用的微企付平台凭证。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Settings.Credentials Credentials { get; }
|
public Settings.Credentials Credentials { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -12,39 +12,39 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
|||||||
public int Timeout { get; set; } = 30 * 1000;
|
public int Timeout { get; set; } = 30 * 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付 API 入口点。
|
/// 获取或设置微企付 API 入口点。
|
||||||
/// <para>默认值:<see cref="WechatTenpayBusinessEndpoints.DEFAULT"/></para>
|
/// <para>默认值:<see cref="WechatTenpayBusinessEndpoints.DEFAULT"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Endpoint { get; set; } = WechatTenpayBusinessEndpoints.DEFAULT;
|
public string Endpoint { get; set; } = WechatTenpayBusinessEndpoints.DEFAULT;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付 API 签名认证方式。
|
/// 获取或设置微企付 API 签名认证方式。
|
||||||
/// <para>默认值:<see cref="Constants.SignAlgorithms.SHA245_WITH_RSA"/></para>
|
/// <para>默认值:<see cref="Constants.SignAlgorithms.SHA245_WITH_RSA"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SignAlgorithm { get; set; } = Constants.SignAlgorithms.SHA245_WITH_RSA;
|
public string SignAlgorithm { get; set; } = Constants.SignAlgorithms.SHA245_WITH_RSA;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付平台账号。
|
/// 获取或设置微企付平台账号。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PlatformId { get; set; } = default!;
|
public string PlatformId { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付平台 API 证书序列号。
|
/// 获取或设置微企付平台 API 证书序列号。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PlatformCertificateSerialNumber { get; set; } = default!;
|
public string PlatformCertificateSerialNumber { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付平台 API 证书私钥。
|
/// 获取或设置微企付平台 API 证书私钥。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PlatformCertificatePrivateKey { get; set; } = default!;
|
public string PlatformCertificatePrivateKey { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付证书序列号。
|
/// 获取或设置微企付证书序列号。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TBEPCertificateSerialNumber { get; set; } = default!;
|
public string TBEPCertificateSerialNumber { get; set; } = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置腾讯微企付证书公钥。
|
/// 获取或设置微企付证书公钥。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TBEPCertificatePublicKey { get; set; } = default!;
|
public string TBEPCertificatePublicKey { get; set; } = default!;
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 腾讯微企付 API 接口域名。
|
/// 微企付 API 接口域名。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class WechatTenpayBusinessEndpoints
|
public static class WechatTenpayBusinessEndpoints
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主域名(默认)。
|
/// 主域名(默认)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string DEFAULT = "https://api-business.tenpay.com/v3";
|
public const string DEFAULT = "https://api.businesspay.qq.com/v3";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试域名。
|
/// 沙箱域名。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string DEVELOPMENT = "https://dev-api-business.tenpay.com/v3";
|
public const string SANDBOX = "https://sandbox-api.businesspay.qq.com/v3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示腾讯微企付 API 回调通知事件的基类。
|
/// 表示微企付 API 回调通知事件的基类。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class WechatTenpayBusinessEvent
|
public class WechatTenpayBusinessEvent
|
||||||
@@ -55,7 +55,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示腾讯微企付 API 回调通知事件的基类。
|
/// 表示微企付 API 回调通知事件的基类。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class WechatTenpayBusinessEvent<TEventContent> : WechatTenpayBusinessEvent
|
public class WechatTenpayBusinessEvent<TEventContent> : WechatTenpayBusinessEvent
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当调用腾讯微企付 API 出错时引发的异常。
|
/// 当调用微企付 API 出错时引发的异常。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WechatTenpayBusinessException : CommonExceptionBase
|
public class WechatTenpayBusinessException : CommonExceptionBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示腾讯微企付 API 请求的基类。
|
/// 表示微企付 API 请求的基类。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class WechatTenpayBusinessRequest : ICommonRequest
|
public abstract class WechatTenpayBusinessRequest : ICommonRequest
|
||||||
{
|
{
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
public virtual int? Timeout { get; set; }
|
public virtual int? Timeout { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或设置请求使用的腾讯微企付敏感字段加密参数。
|
/// 获取或设置请求使用的微企付敏感字段加密参数。
|
||||||
/// <para>如果启用了 <see cref="WechatTenpayBusinessClientOptions.AutoEncryptRequestSensitiveProperty"/> 参数,将由系统自动生成。</para>
|
/// <para>如果启用了 <see cref="WechatTenpayBusinessClientOptions.AutoEncryptRequestSensitiveProperty"/> 参数,将由系统自动生成。</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示腾讯微企付 API 响应的基类。
|
/// 表示微企付 API 响应的基类。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class WechatTenpayBusinessResponse : ICommonResponse
|
public abstract class WechatTenpayBusinessResponse : ICommonResponse
|
||||||
{
|
{
|
||||||
@@ -56,28 +56,28 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取腾讯微企付 API 返回的敏感字段加密参数。
|
/// 获取微企付 API 返回的敏感字段加密参数。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
[System.Text.Json.Serialization.JsonIgnore]
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
public WechatTenpayBusinessResponseTBEPEncryption? TBEPEncryption { get; internal set; }
|
public WechatTenpayBusinessResponseTBEPEncryption? TBEPEncryption { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取腾讯微企付请求链路 ID。
|
/// 获取微企付请求链路 ID。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonProperty("trace_id")]
|
[Newtonsoft.Json.JsonProperty("trace_id")]
|
||||||
[System.Text.Json.Serialization.JsonPropertyName("trace_id")]
|
[System.Text.Json.Serialization.JsonPropertyName("trace_id")]
|
||||||
public virtual string? TraceId { get; set; }
|
public virtual string? TraceId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取腾讯微企付 API 返回的错误详细信息。
|
/// 获取微企付 API 返回的错误详细信息。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonProperty("error")]
|
[Newtonsoft.Json.JsonProperty("error")]
|
||||||
[System.Text.Json.Serialization.JsonPropertyName("error")]
|
[System.Text.Json.Serialization.JsonPropertyName("error")]
|
||||||
public virtual WechatTenpayBusinessResponseError? Error { get; set; }
|
public virtual WechatTenpayBusinessResponseError? Error { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取一个值,该值指示调用腾讯微企付 API 是否成功(即 HTTP 状态码为 200、202 或 204)。
|
/// 获取一个值,该值指示调用微企付 API 是否成功(即 HTTP 状态码为 200、202 或 204)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual bool IsSuccessful()
|
public virtual bool IsSuccessful()
|
||||||
|
|||||||
Reference in New Issue
Block a user