This commit is contained in:
Fu Diwei
2021-07-20 15:35:43 +08:00
93 changed files with 2866 additions and 127 deletions

View File

@@ -0,0 +1,12 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Constants
{
public static class SignAlgorithms
{
/// <summary>
/// WECHATPAY2-SHA256-RSA2048。
/// </summary>
public const string WECHATPAY2_SHA256_RSA2048 = "WECHATPAY2-SHA256-RSA2048";
}
}

View File

@@ -3,9 +3,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供回调通知事件的扩展方法。
/// 为 <see cref="WechatTenpayClient"/> 提供回调通知事件敏感数据解密的扩展方法。
/// </summary>
public static class WechatTenpayClientEventExtensions
public static class WechatTenpayClientEventDecryptionExtensions
{
/// <summary>
/// <para>反序列化得到 <see cref="WechatTenpayEvent"/> 对象。</para>

View File

@@ -0,0 +1,80 @@
using System;
using System.Text;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供回调通知事件签名验证的扩展方法。
/// </summary>
public static class WechatTenpayClientEventVerificationExtensions
{
/// <summary>
/// <para>验证回调通知事件签名。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_1.shtml </para>
/// </summary>
/// <typeparam name="TResponse"></typeparam>
/// <param name="client"></param>
/// <param name="callbackTimestamp">微信回调通知中的 Wechatpay-Timestamp 字段。</param>
/// <param name="callbackNonce">微信回调通知中的 Wechatpay-Nonce 字段。</param>
/// <param name="callbackBody">微信回调通知中请求正文。</param>
/// <param name="callbackSignature">微信回调通知中的 Wechatpay-Signature 字段。</param>
/// <param name="callbackSerialNumber">微信回调通知中的 Wechatpay-Serial 字段。</param>
/// <returns></returns>
public static bool VerifyEventSignature<TResponse>(
this WechatTenpayClient client,
string callbackTimestamp,
string callbackNonce,
string callbackBody,
string callbackSignature,
string callbackSerialNumber)
where TResponse : WechatTenpayResponse
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (callbackTimestamp == null) throw new ArgumentNullException(nameof(callbackTimestamp));
if (callbackNonce == null) throw new ArgumentNullException(nameof(callbackNonce));
if (callbackBody == null) throw new ArgumentNullException(nameof(callbackBody));
if (callbackSignature == null) throw new ArgumentNullException(nameof(callbackSignature));
if (callbackSerialNumber == null) throw new ArgumentNullException(nameof(callbackSerialNumber));
if (client.WechatCertificateStorer == null)
{
throw new Exceptions.WechatTenpayResponseVerificationException($"You must set an instance of `{nameof(Settings.ICertificateStorer)}` at first.");
}
else
{
string? certificate = client.WechatCertificateStorer.Get(callbackSerialNumber);
if (certificate == null)
throw new Exceptions.WechatTenpayResponseVerificationException("Cannot get certificate by the serial number, may not be stored.");
string? publicKey = null;
try
{
publicKey = Utilities.RSAUtility.ExportPublicKey(certificate);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Cannot get public key of the certificate, may not be a valid certificate data.", ex);
}
try
{
return Utilities.RSAUtility.VerifyWithSHA256(
publicKey: publicKey,
plainText: GetPlainTextForSignature(timestamp: callbackTimestamp, nonce: callbackNonce, body: callbackBody),
signature: callbackSignature
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Verify event signature failed.", ex);
}
}
}
private static string GetPlainTextForSignature(string timestamp, string nonce, string body)
{
return $"{timestamp}\n{nonce}\n{body}\n";
}
}
}

View File

@@ -108,6 +108,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_8.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter5_1_19.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_9_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>

View File

@@ -18,6 +18,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <para>异步调用 [GET] /ecommerce/fund/balance/{sub_mchid} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_7_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter5_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter5_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@@ -40,6 +42,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /ecommerce/fund/enddaybalance/{sub_mchid} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_7_2.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter5_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>

View File

@@ -17,6 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [POST] /ecommerce/fund/withdraw 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_2.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@@ -37,6 +38,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /ecommerce/fund/withdraw/out-request-no/{out_request_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@@ -57,6 +59,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /ecommerce/fund/withdraw/{withdraw_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>

View File

@@ -17,6 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /merchant/fund/balance/{account_type} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_7_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter5_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
@@ -36,6 +37,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /merchant/fund/dayendbalance/{account_type} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_7_4.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter5_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供来账识别相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecuteMerchantFundIncomeRecordsExtensions
{
/// <summary>
/// <para>异步调用 [GET] /merchantfund/merchant/income-records 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_7.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_7.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.QueryMerchantFundMerchantIncomeRecordsResponse> ExecuteQueryMerchantFundMerchantIncomeRecordsAsync(this WechatTenpayClient client, Models.QueryMerchantFundMerchantIncomeRecordsRequest 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.Get, "merchantfund", "merchant", "income-records")
.SetQueryParam("account_type", request.AccountType)
.SetQueryParam("date", request.DateString)
.SetQueryParam("limit", request.Limit);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset);
return await client.SendRequestWithJsonAsync<Models.QueryMerchantFundMerchantIncomeRecordsResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /merchantfund/partner/income-records 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_6.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.QueryMerchantFundPartnerIncomeRecordsResponse> ExecuteQueryMerchantFundPartnerIncomeRecordsAsync(this WechatTenpayClient client, Models.QueryMerchantFundPartnerIncomeRecordsRequest 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.Get, "merchantfund", "partner", "income-records")
.SetQueryParam("sub_mchid", request.SubMerchantId)
.SetQueryParam("account_type", request.AccountType)
.SetQueryParam("date", request.DateString)
.SetQueryParam("limit", request.Limit);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset);
return await client.SendRequestWithJsonAsync<Models.QueryMerchantFundPartnerIncomeRecordsResponse>(flurlReq, cancellationToken: cancellationToken);
}
}
}

View File

@@ -74,6 +74,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>异步调用 [GET] /merchant/fund/withdraw/bill-type/{bill_type} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_8_4.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter6_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供服务商转账相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecutePartnerTransferExtensions
{
#region Batches
/// <summary>
/// <para>异步调用 [POST] /partner-transfer/batches 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePartnerTransferBatchResponse> ExecuteCreatePartnerTransferBatchAsync(this WechatTenpayClient client, Models.CreatePartnerTransferBatchRequest 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, "partner-transfer", "batches");
return await client.SendRequestWithJsonAsync<Models.CreatePartnerTransferBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /partner-transfer/batches/batch-id/{batch_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPartnerTransferBatchByBatchIdResponse> ExecuteGetPartnerTransferBatchByBatchIdAsync(this WechatTenpayClient client, Models.GetPartnerTransferBatchByBatchIdRequest 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.Get, "partner-transfer", "batches", "batch-id", request.BatchId)
.SetQueryParam("need_query_detail", request.RequireQueryDetail);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset.Value);
if (request.Limit.HasValue)
flurlReq.SetQueryParam("limit", request.Limit.Value);
if (!string.IsNullOrEmpty(request.DetailStatus))
flurlReq.SetQueryParam("detail_status", request.DetailStatus);
return await client.SendRequestWithJsonAsync<Models.GetPartnerTransferBatchByBatchIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /partner-transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPartnerTransferBatchDetailByDetailIdResponse> ExecuteGetPartnerTransferBatchDetailByDetailIdAsync(this WechatTenpayClient client, Models.GetPartnerTransferBatchDetailByDetailIdRequest 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.Get, "partner-transfer", "batches", "batch-id", request.BatchId, "details", "detail-id", request.DetailId);
return await client.SendRequestWithJsonAsync<Models.GetPartnerTransferBatchDetailByDetailIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPartnerTransferBatchByOutBatchNumberResponse> ExecuteGetPartnerTransferBatchByOutBatchNumberAsync(this WechatTenpayClient client, Models.GetPartnerTransferBatchByOutBatchNumberRequest 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.Get, "partner-transfer", "batches", "out-batch-no", request.OutBatchNumber)
.SetQueryParam("need_query_detail", request.RequireQueryDetail);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset.Value);
if (request.Limit.HasValue)
flurlReq.SetQueryParam("limit", request.Limit.Value);
if (!string.IsNullOrEmpty(request.DetailStatus))
flurlReq.SetQueryParam("detail_status", request.DetailStatus);
return await client.SendRequestWithJsonAsync<Models.GetPartnerTransferBatchByOutBatchNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter3_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPartnerTransferBatchDetailByOutDetailNumberResponse> ExecuteGetPartnerTransferBatchDetailByOutDetailNumberAsync(this WechatTenpayClient client, Models.GetPartnerTransferBatchDetailByOutDetailNumberRequest 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.Get, "partner-transfer", "batches", "out-batch-no", request.OutBatchNumber, "details", "out-detail-no", request.OutDetailNumber);
return await client.SendRequestWithJsonAsync<Models.GetPartnerTransferBatchDetailByOutDetailNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@@ -0,0 +1,223 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供转账相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecuteTransferExtensions
{
#region Batches
/// <summary>
/// <para>异步调用 [POST] /transfer/batches 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateTransferBatchResponse> ExecuteCreateTransferBatchAsync(this WechatTenpayClient client, Models.CreateTransferBatchRequest 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, "transfer", "batches");
return await client.SendRequestWithJsonAsync<Models.CreateTransferBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer/batches/batch-id/{batch_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferBatchByBatchIdResponse> ExecuteGetTransferBatchByBatchIdAsync(this WechatTenpayClient client, Models.GetTransferBatchByBatchIdRequest 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.Get, "transfer", "batches", "batch-id", request.BatchId)
.SetQueryParam("need_query_detail", request.RequireQueryDetail);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset.Value);
if (request.Limit.HasValue)
flurlReq.SetQueryParam("limit", request.Limit.Value);
if (!string.IsNullOrEmpty(request.DetailStatus))
flurlReq.SetQueryParam("detail_status", request.DetailStatus);
return await client.SendRequestWithJsonAsync<Models.GetTransferBatchByBatchIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferBatchDetailByDetailIdResponse> ExecuteGetTransferBatchDetailByDetailIdAsync(this WechatTenpayClient client, Models.GetTransferBatchDetailByDetailIdRequest 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.Get, "transfer", "batches", "batch-id", request.BatchId, "details", "detail-id", request.DetailId);
return await client.SendRequestWithJsonAsync<Models.GetTransferBatchDetailByDetailIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer/batches/out-batch-no/{out_batch_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferBatchByOutBatchNumberResponse> ExecuteGetTransferBatchByOutBatchNumberAsync(this WechatTenpayClient client, Models.GetTransferBatchByOutBatchNumberRequest 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.Get, "transfer", "batches", "out-batch-no", request.OutBatchNumber)
.SetQueryParam("need_query_detail", request.RequireQueryDetail);
if (request.Offset.HasValue)
flurlReq.SetQueryParam("offset", request.Offset.Value);
if (request.Limit.HasValue)
flurlReq.SetQueryParam("limit", request.Limit.Value);
if (!string.IsNullOrEmpty(request.DetailStatus))
flurlReq.SetQueryParam("detail_status", request.DetailStatus);
return await client.SendRequestWithJsonAsync<Models.GetTransferBatchByOutBatchNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter3_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferBatchDetailByOutDetailNumberResponse> ExecuteGetTransferBatchDetailByOutDetailNumberAsync(this WechatTenpayClient client, Models.GetTransferBatchDetailByOutDetailNumberRequest 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.Get, "transfer", "batches", "out-batch-no", request.OutBatchNumber, "details", "out-detail-no", request.OutDetailNumber);
return await client.SendRequestWithJsonAsync<Models.GetTransferBatchDetailByOutDetailNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region BillReceipt
/// <summary>
/// <para>异步调用 [POST] /transfer/bill-receipt 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter4_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateTransferBillReceiptResponse> ExecuteCreateTransferBillReceiptAsync(this WechatTenpayClient client, Models.CreateTransferBillReceiptRequest 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, "transfer", "bill-receipt");
return await client.SendRequestWithJsonAsync<Models.CreateTransferBillReceiptResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer/bill-receipt/{out_batch_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_2.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter4_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferBillReceiptByOutBatchNumberResponse> ExecuteGetTransferBillReceiptByOutBatchNumberAsync(this WechatTenpayClient client, Models.GetTransferBillReceiptByOutBatchNumberRequest 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.Get, "transfer", "bill-receipt", request.OutBatchNumber);
return await client.SendRequestWithJsonAsync<Models.GetTransferBillReceiptByOutBatchNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Detail
/// <summary>
/// <para>异步调用 [POST] /transfer-detail/electronic-receipts 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_4.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter4_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateTransferDetailElectronicReceiptResponse> ExecuteCreateTransferDetailElectronicReceiptAsync(this WechatTenpayClient client, Models.CreateTransferDetailElectronicReceiptRequest 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, "transfer-detail", "electronic-receipts");
return await client.SendRequestWithJsonAsync<Models.CreateTransferDetailElectronicReceiptResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /transfer-detail/electronic-receipts 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer/chapter4_5.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transfer_partner/chapter4_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetTransferDetailElectronicReceiptByOutDetailNumberResponse> ExecuteGetTransferDetailElectronicReceiptByOutDetailNumberAsync(this WechatTenpayClient client, Models.GetTransferDetailElectronicReceiptByOutDetailNumberRequest 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.Get, "transfer-detail", "electronic-receipts")
.SetQueryParam("accept_type", request.AcceptType)
.SetQueryParam("out_detail_no", request.OutDetailNumber);
if (!string.IsNullOrEmpty(request.OutBatchNumber))
flurlReq.SetQueryParam("out_batch_no", request.OutBatchNumber);
return await client.SendRequestWithJsonAsync<Models.GetTransferDetailElectronicReceiptByOutDetailNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@@ -11,13 +11,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetEcommerceApplymentByOutRequestNumberResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetEcommerceApplymentByOutRequestNumberResponse response)
public static Models.GetEcommerceApplymentByOutRequestNumberResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetEcommerceApplymentByOutRequestNumberResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -73,13 +71,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetEcommerceBillFundflowBillResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetEcommerceBillFundflowBillResponse response)
public static Models.GetEcommerceBillFundflowBillResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetEcommerceBillFundflowBillResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -121,13 +117,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetMerchantServiceComplaintByComplaintIdResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetMerchantServiceComplaintByComplaintIdResponse response)
public static Models.GetMerchantServiceComplaintByComplaintIdResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetMerchantServiceComplaintByComplaintIdResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -161,13 +155,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.QueryCertificatesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QueryCertificatesResponse response)
public static Models.QueryCertificatesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.QueryCertificatesResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -215,13 +207,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.QueryMerchantServiceComplaintsResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QueryMerchantServiceComplaintsResponse response)
public static Models.QueryMerchantServiceComplaintsResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.QueryMerchantServiceComplaintsResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -263,13 +253,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.QuerySmartGuidesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QuerySmartGuidesResponse response)
public static Models.QuerySmartGuidesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.QuerySmartGuidesResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -323,5 +311,145 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return response;
}
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetTransferBatchDetailByOutDetailNumberResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetTransferBatchDetailByOutDetailNumberResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(client.WechatMerchantCertPrivateKey))
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
if (!response.IsSuccessful())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
if (!string.IsNullOrEmpty(response.UserName))
{
try
{
response.UserName = Utilities.RSAUtility.DecryptWithECB(
client.WechatMerchantCertPrivateKey,
response.UserName
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", ex);
}
}
return response;
}
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetTransferBatchDetailByDetailIdResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetTransferBatchDetailByDetailIdResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(client.WechatMerchantCertPrivateKey))
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
if (!response.IsSuccessful())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
if (!string.IsNullOrEmpty(response.UserName))
{
try
{
response.UserName = Utilities.RSAUtility.DecryptWithECB(
client.WechatMerchantCertPrivateKey,
response.UserName
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", ex);
}
}
return response;
}
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetPartnerTransferBatchDetailByOutDetailNumberResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetPartnerTransferBatchDetailByOutDetailNumberResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(client.WechatMerchantCertPrivateKey))
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
if (!response.IsSuccessful())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
if (!string.IsNullOrEmpty(response.UserName))
{
try
{
response.UserName = Utilities.RSAUtility.DecryptWithECB(
client.WechatMerchantCertPrivateKey,
response.UserName
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", ex);
}
}
return response;
}
/// <summary>
/// <para>解密响应中返回的敏感数据。该方法会改变传入的响应信息。</para>
/// </summary>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static Models.GetPartnerTransferBatchDetailByDetailIdResponse DecryptResponseEncryptedData(this WechatTenpayClient client, ref Models.GetPartnerTransferBatchDetailByDetailIdResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(client.WechatMerchantCertPrivateKey))
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
if (!response.IsSuccessful())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
if (!string.IsNullOrEmpty(response.UserName))
{
try
{
response.UserName = Utilities.RSAUtility.DecryptWithECB(
client.WechatMerchantCertPrivateKey,
response.UserName
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", ex);
}
}
return response;
}
}
}

View File

@@ -0,0 +1,72 @@
using System;
using System.Text;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供响应签名验证的扩展方法。
/// </summary>
public static class WechatTenpayClientResponseVerificationExtensions
{
/// <summary>
/// <para>验证响应签名。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_1.shtml </para>
/// </summary>
/// <typeparam name="TResponse"></typeparam>
/// <param name="client"></param>
/// <param name="response"></param>
/// <returns></returns>
public static bool VerifyResponseSignature<TResponse>(this WechatTenpayClient client, TResponse response)
where TResponse : WechatTenpayResponse
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (client.WechatCertificateStorer == null)
{
throw new Exceptions.WechatTenpayResponseVerificationException($"You must set an instance of `{nameof(Settings.ICertificateStorer)}` at first.");
}
else
{
if (response.WechatpayCertSerialNumber == null)
throw new Exceptions.WechatTenpayResponseVerificationException("Cannot read the serial number in headers of this response.");
string? certificate = client.WechatCertificateStorer.Get(response.WechatpayCertSerialNumber);
if (certificate == null)
throw new Exceptions.WechatTenpayResponseVerificationException("Cannot get certificate by the serial number, may not be stored.");
string? publicKey = null;
try
{
publicKey = Utilities.RSAUtility.ExportPublicKey(certificate);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Cannot get public key of the certificate, may not be a valid certificate data.", ex);
}
try
{
return Utilities.RSAUtility.VerifyWithSHA256(
publicKey: publicKey,
plainText: GetPlainTextForSignature(response),
signature: response.WechatpaySignature
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Verify response signature failed.", ex);
}
}
}
private static string GetPlainTextForSignature(WechatTenpayResponse response)
{
string timestamp = response.WechatpayTimestamp;
string nonce = response.WechatpayNonce;
string body = Encoding.UTF8.GetString(response.RawBytes);
return $"{timestamp}\n{nonce}\n{body}\n";
}
}
}

View File

@@ -1,81 +0,0 @@
using System;
using System.Text;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供响应签名验证的扩展方法。
/// </summary>
public static class WechatTenpayClientResponseVerifyExtensions
{
/// <summary>
/// <para>验证响应签名(使用微信支付平台证书公钥)。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_1.shtml </para>
/// </summary>
/// <typeparam name="TResponse"></typeparam>
/// <param name="client"></param>
/// <param name="response"></param>
/// <param name="publicKey"></param>
/// <returns></returns>
public static bool VerifyResponseSignature<TResponse>(this WechatTenpayClient client, TResponse response, string publicKey)
where TResponse : WechatTenpayResponse
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(publicKey)) throw new ArgumentNullException(publicKey);
try
{
return Utilities.RSAUtility.VerifyWithSHA256(
publicKey: publicKey,
plainText: GetPlainTextForSignature(response),
signature: response.WechatpaySignature
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Verify response signature failed.", ex);
}
}
/// <summary>
/// <para>验证响应签名(使用微信支付平台证书)。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_1.shtml </para>
/// </summary>
/// <typeparam name="TResponse"></typeparam>
/// <param name="client"></param>
/// <param name="response"></param>
/// <param name="certificate"></param>
/// <returns></returns>
public static bool VerifyResponseSignatureByCertificate<TResponse>(this WechatTenpayClient client, TResponse response, string certificate)
where TResponse : WechatTenpayResponse
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
if (string.IsNullOrEmpty(certificate)) throw new ArgumentNullException(certificate);
try
{
return Utilities.RSAUtility.VerifyWithSHA256ByCertificate(
certificate: certificate,
plainText: GetPlainTextForSignature(response),
signature: response.WechatpaySignature
);
}
catch (Exception ex)
{
throw new Exceptions.WechatTenpayResponseVerificationException("Verify response signature failed.", ex);
}
}
private static string GetPlainTextForSignature(WechatTenpayResponse response)
{
string timestamp = response.WechatpayTimestamp;
string nonce = response.WechatpayNonce;
string body = Encoding.UTF8.GetString(response.RawBytes);
return $"{timestamp}\n{nonce}\n{body}\n";
}
}
}

View File

@@ -53,7 +53,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Interceptors
switch (_scheme)
{
case WechatTenpayAuthSchemes.WECHATPAY2_SHA256_RSA2048:
case Constants.SignAlgorithms.WECHATPAY2_SHA256_RSA2048:
{
try
{

View File

@@ -738,7 +738,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankBranchId { get; set; }
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// 获取或设置开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankBranchId { get; set; }
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。
/// 获取或设置开户银行全称(含支行)。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -51,7 +51,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankBranchId { get; set; }
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// 获取或设置开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -231,7 +231,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankBranchId { get; set; }
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// 获取或设置开户银行全称(含支行)。与字段 <see cref="BankBranchId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -86,7 +86,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string AccountBank { get; set; } = default!;
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。
/// 获取或设置开户银行全称(含支行)。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchantfund/merchant/income-records 接口的请求。</para>
/// </summary>
public class QueryMerchantFundMerchantIncomeRecordsRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置账户类型。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string AccountType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置日期格式yyyy-MM-dd
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string DateString { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分页开始位置。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int? Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int Limit { get; set; } = 10;
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchantfund/merchant/income-records 接口的响应。</para>
/// </summary>
public class QueryMerchantFundMerchantIncomeRecordsResponse : WechatTenpayResponse
{
public static class Types
{
public class IncomeRecord
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置账户类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("account_type")]
[System.Text.Json.Serialization.JsonPropertyName("account_type")]
public string AccountType { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("income_record_type")]
[System.Text.Json.Serialization.JsonPropertyName("income_record_type")]
public string IncomeRecordType { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账微信单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("income_record_id")]
[System.Text.Json.Serialization.JsonPropertyName("income_record_id")]
public string IncomeRecordId { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置企业微信的员工工号。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("success_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset SuccessTime { get; set; }
/// <summary>
/// 获取或设置付款方银行名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string BankName { get; set; } = default!;
/// <summary>
/// 获取或设置付款方银行户名。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_name")]
public string BankAccountName { get; set; } = default!;
/// <summary>
/// 获取或设置付款方银行卡号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_number")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_number")]
public string BankAccountNumber { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置银行来账记录列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.IncomeRecord[]? IncomeRecordList { get; set; }
/// <summary>
/// 获取或设置分页大小。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; }
/// <summary>
/// 获取或设置分页开始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置银行来账记录总数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
public int TotalCount { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchantfund/partner/income-records 接口的请求。</para>
/// </summary>
public class QueryMerchantFundPartnerIncomeRecordsRequest : QueryMerchantFundMerchantIncomeRecordsRequest
{
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string SubMerchantId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /merchantfund/partner/income-records 接口的响应。</para>
/// </summary>
public class QueryMerchantFundPartnerIncomeRecordsResponse : WechatTenpayResponse
{
public static class Types
{
public class IncomeRecord
{
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置账户类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("account_type")]
[System.Text.Json.Serialization.JsonPropertyName("account_type")]
public string AccountType { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("income_record_type")]
[System.Text.Json.Serialization.JsonPropertyName("income_record_type")]
public string IncomeRecordType { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账微信单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("income_record_id")]
[System.Text.Json.Serialization.JsonPropertyName("income_record_id")]
public string IncomeRecordId { get; set; } = default!;
/// <summary>
/// 获取或设置银行来账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置企业微信的员工工号。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("success_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset SuccessTime { get; set; }
/// <summary>
/// 获取或设置付款方银行名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string BankName { get; set; } = default!;
/// <summary>
/// 获取或设置付款方银行户名。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_name")]
public string BankAccountName { get; set; } = default!;
/// <summary>
/// 获取或设置付款方银行卡号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_number")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_number")]
public string BankAccountNumber { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置银行来账记录列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.IncomeRecord[]? IncomeRecordList { get; set; }
/// <summary>
/// 获取或设置分页大小。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; }
/// <summary>
/// 获取或设置分页开始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置银行来账记录总数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
public int TotalCount { get; set; }
}
}

View File

@@ -72,7 +72,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string AccountBank { get; set; } = default!;
/// <summary>
/// 获取或设置开户开户银行全称(含支行)。
/// 获取或设置开户银行全称(含支行)。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]

View File

@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /partner-transfer/batches 接口的请求。</para>
/// </summary>
public class CreatePartnerTransferBatchRequest : WechatTenpayRequest
{
public static class Types
{
public class TransferDetail : CreateTransferBatchRequest.Types.TransferDetail
{
}
}
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置服务商 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_appid")]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置特约商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置特约商户授权类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorization_type")]
[System.Text.Json.Serialization.JsonPropertyName("authorization_type")]
public string AuthorizationType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置批次名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_name")]
[System.Text.Json.Serialization.JsonPropertyName("batch_name")]
public string BatchName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置批次备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_remark")]
[System.Text.Json.Serialization.JsonPropertyName("batch_remark")]
public string BatchRemark { get; set; } = string.Empty;
/// <summary>
/// 获取或设置转账总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置转账总笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
public int TotalNumber { get; set; }
/// <summary>
/// 获取或设置转账明细列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public IList<Types.TransferDetail> TransferDetailList { get; set; } = new List<Types.TransferDetail>();
/// <summary>
/// 获取或设置转账用途。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_purpose")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_purpose")]
public string? TransferPurpose { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /partner-transfer/batches 接口的响应。</para>
/// </summary>
public class CreatePartnerTransferBatchResponse : CreateTransferBatchResponse
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/batch-id/{batch_id} 接口的请求。</para>
/// </summary>
public class GetPartnerTransferBatchByBatchIdRequest : GetTransferBatchByBatchIdRequest
{
}
}

View File

@@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/batch-id/{batch_id} 接口的响应。</para>
/// </summary>
public class GetPartnerTransferBatchByBatchIdResponse : WechatTenpayResponse
{
public static class Types
{
public class TransferDetail : GetPartnerTransferBatchByOutBatchNumberResponse.Types.TransferDetail
{
}
}
/// <summary>
/// 获取或设置服务商商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置服务商 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_appid")]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置特约商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_id")]
[System.Text.Json.Serialization.JsonPropertyName("batch_id")]
public string BatchId { get; set; } = default!;
/// <summary>
/// 获取或设置批次状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_status")]
[System.Text.Json.Serialization.JsonPropertyName("batch_status")]
public string BatchStatus { get; set; } = default!;
/// <summary>
/// 获取或设置批次类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_type")]
[System.Text.Json.Serialization.JsonPropertyName("batch_type")]
public string BatchType { get; set; } = default!;
/// <summary>
/// 获取或设置特约商户授权类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorization_type")]
[System.Text.Json.Serialization.JsonPropertyName("authorization_type")]
public string AuthorizationType { get; set; } = default!;
/// <summary>
/// 获取或设置批次名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_name")]
[System.Text.Json.Serialization.JsonPropertyName("batch_name")]
public string BatchName { get; set; } = default!;
/// <summary>
/// 获取或设置批次备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_remark")]
[System.Text.Json.Serialization.JsonPropertyName("batch_remark")]
public string BatchRemark { get; set; } = default!;
/// <summary>
/// 获取或设置批次关闭原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("close_reason")]
[System.Text.Json.Serialization.JsonPropertyName("close_reason")]
public string? CloseReason { get; set; }
/// <summary>
/// 获取或设置转账总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置转账总笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
public int TotalNumber { get; set; }
/// <summary>
/// 获取或设置批次创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置批次更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? UpdateTime { get; set; }
/// <summary>
/// 获取或设置转账成功金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_amount")]
[System.Text.Json.Serialization.JsonPropertyName("success_amount")]
public int SuccessAmount { get; set; }
/// <summary>
/// 获取或设置转账成功笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_num")]
[System.Text.Json.Serialization.JsonPropertyName("success_num")]
public int SuccessNumber { get; set; }
/// <summary>
/// 获取或设置转账失败金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_amount")]
[System.Text.Json.Serialization.JsonPropertyName("fail_amount")]
public int FailAmount { get; set; }
/// <summary>
/// 获取或设置转账失败笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_num")]
[System.Text.Json.Serialization.JsonPropertyName("fail_num")]
public int FailNumber { get; set; }
/// <summary>
/// 获取或设置转账用途。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_purpose")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_purpose")]
public string? TransferPurpose { get; set; }
/// <summary>
/// 获取或设置转账明细单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public Types.TransferDetail[]? TransferDetailList { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no} 接口的请求。</para>
/// </summary>
public class GetPartnerTransferBatchByOutBatchNumberRequest : GetTransferBatchByOutBatchNumberRequest
{
}
}

View File

@@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no} 接口的响应。</para>
/// </summary>
public class GetPartnerTransferBatchByOutBatchNumberResponse : WechatTenpayResponse
{
public static class Types
{
public class TransferDetail : GetTransferBatchByOutBatchNumberResponse.Types.TransferDetail
{
}
}
/// <summary>
/// 获取或设置服务商商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置特约商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置服务商 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_appid")]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置特约商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_id")]
[System.Text.Json.Serialization.JsonPropertyName("batch_id")]
public string BatchId { get; set; } = default!;
/// <summary>
/// 获取或设置批次状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_status")]
[System.Text.Json.Serialization.JsonPropertyName("batch_status")]
public string BatchStatus { get; set; } = default!;
/// <summary>
/// 获取或设置批次类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_type")]
[System.Text.Json.Serialization.JsonPropertyName("batch_type")]
public string BatchType { get; set; } = default!;
/// <summary>
/// 获取或设置特约商户授权类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorization_type")]
[System.Text.Json.Serialization.JsonPropertyName("authorization_type")]
public string AuthorizationType { get; set; } = default!;
/// <summary>
/// 获取或设置批次名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_name")]
[System.Text.Json.Serialization.JsonPropertyName("batch_name")]
public string BatchName { get; set; } = default!;
/// <summary>
/// 获取或设置批次备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_remark")]
[System.Text.Json.Serialization.JsonPropertyName("batch_remark")]
public string BatchRemark { get; set; } = default!;
/// <summary>
/// 获取或设置批次关闭原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("close_reason")]
[System.Text.Json.Serialization.JsonPropertyName("close_reason")]
public string? CloseReason { get; set; }
/// <summary>
/// 获取或设置转账总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置转账总笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
public int TotalNumber { get; set; }
/// <summary>
/// 获取或设置批次创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置批次更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? UpdateTime { get; set; }
/// <summary>
/// 获取或设置转账成功金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_amount")]
[System.Text.Json.Serialization.JsonPropertyName("success_amount")]
public int SuccessAmount { get; set; }
/// <summary>
/// 获取或设置转账成功笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_num")]
[System.Text.Json.Serialization.JsonPropertyName("success_num")]
public int SuccessNumber { get; set; }
/// <summary>
/// 获取或设置转账失败金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_amount")]
[System.Text.Json.Serialization.JsonPropertyName("fail_amount")]
public int FailAmount { get; set; }
/// <summary>
/// 获取或设置转账失败笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_num")]
[System.Text.Json.Serialization.JsonPropertyName("fail_num")]
public int FailNumber { get; set; }
/// <summary>
/// 获取或设置转账用途。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_purpose")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_purpose")]
public string? TransferPurpose { get; set; }
/// <summary>
/// 获取或设置转账明细单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public Types.TransferDetail[]? TransferDetailList { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口的请求。</para>
/// </summary>
public class GetPartnerTransferBatchDetailByDetailIdRequest : GetTransferBatchDetailByDetailIdRequest
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口的响应。</para>
/// </summary>
public class GetPartnerTransferBatchDetailByDetailIdResponse : GetPartnerTransferBatchDetailByOutDetailNumberResponse
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口的请求。</para>
/// </summary>
public class GetPartnerTransferBatchDetailByOutDetailNumberRequest : GetTransferBatchDetailByOutDetailNumberRequest
{
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /partner-transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口的响应。</para>
/// </summary>
public class GetPartnerTransferBatchDetailByOutDetailNumberResponse : GetTransferBatchDetailByOutDetailNumberResponse
{
/// <summary>
/// 获取或设置服务商商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置收款用户姓名(需使用商户私钥解密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("username")]
[System.Text.Json.Serialization.JsonPropertyName("username")]
public override string UserName { get; set; } = default!;
}
}

View File

@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer/batches 接口的请求。</para>
/// </summary>
public class CreateTransferBatchRequest : WechatTenpayRequest
{
public static class Types
{
public class TransferDetail
{
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_detail_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_detail_no")]
public string OutDetailNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置转账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_amount")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_amount")]
public int TransferAmount { get; set; }
/// <summary>
/// 获取或设置转账备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_remark")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_remark")]
public string TransferRemark { get; set; } = string.Empty;
/// <summary>
/// 获取或设置收款用户 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置收款用户姓名(需使用微信支付平台公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_name")]
[System.Text.Json.Serialization.JsonPropertyName("user_name")]
public string UserName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置收款用户身份证号(需使用微信支付平台公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_id_card")]
[System.Text.Json.Serialization.JsonPropertyName("user_id_card")]
public string UserIdCardNumber { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置批次名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_name")]
[System.Text.Json.Serialization.JsonPropertyName("batch_name")]
public string BatchName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置批次备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_remark")]
[System.Text.Json.Serialization.JsonPropertyName("batch_remark")]
public string BatchRemark { get; set; } = string.Empty;
/// <summary>
/// 获取或设置转账总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置转账总笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
public int TotalNumber { get; set; }
/// <summary>
/// 获取或设置转账明细列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public IList<Types.TransferDetail> TransferDetailList { get; set; } = new List<Types.TransferDetail>();
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer/batches 接口的响应。</para>
/// </summary>
public class CreateTransferBatchResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_id")]
[System.Text.Json.Serialization.JsonPropertyName("batch_id")]
public string BatchId { get; set; } = default!;
/// <summary>
/// 获取或设置批次创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; } = default!;
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/batch-id/{batch_id} 接口的请求。</para>
/// </summary>
public class GetTransferBatchByBatchIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string BatchId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置是否查询转账明细单。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool RequireQueryDetail { get; set; }
/// <summary>
/// 获取或设置分页开始位置。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int? Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int? Limit { get; set; }
/// <summary>
/// 获取或设置明细状态。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? DetailStatus { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/batch-id/{batch_id} 接口的响应。</para>
/// </summary>
public class GetTransferBatchByBatchIdResponse : WechatTenpayResponse
{
public static class Types
{
public class TransferBatch : GetTransferBatchByOutBatchNumberResponse.Types.TransferBatch
{
}
public class TransferDetail : GetTransferBatchByOutBatchNumberResponse.Types.TransferDetail
{
}
}
/// <summary>
/// 获取或设置转账批次单信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_batch")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_batch")]
public Types.TransferBatch TransferBatch { get; set; } = default!;
/// <summary>
/// 获取或设置转账明细单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public Types.TransferDetail[]? TransferDetailList { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/out-batch-no/{out_batch_no} 接口的请求。</para>
/// </summary>
public class GetTransferBatchByOutBatchNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutBatchNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置是否查询转账明细单。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool RequireQueryDetail { get; set; }
/// <summary>
/// 获取或设置分页开始位置。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int? Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int? Limit { get; set; }
/// <summary>
/// 获取或设置明细状态。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? DetailStatus { get; set; }
}
}

View File

@@ -0,0 +1,178 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/out-batch-no/{out_batch_no} 接口的响应。</para>
/// </summary>
public class GetTransferBatchByOutBatchNumberResponse : WechatTenpayResponse
{
public static class Types
{
public class TransferBatch
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_id")]
[System.Text.Json.Serialization.JsonPropertyName("batch_id")]
public string BatchId { get; set; } = default!;
/// <summary>
/// 获取或设置批次状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_status")]
[System.Text.Json.Serialization.JsonPropertyName("batch_status")]
public string BatchStatus { get; set; } = default!;
/// <summary>
/// 获取或设置批次类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_type")]
[System.Text.Json.Serialization.JsonPropertyName("batch_type")]
public string BatchType { get; set; } = default!;
/// <summary>
/// 获取或设置批次名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_name")]
[System.Text.Json.Serialization.JsonPropertyName("batch_name")]
public string BatchName { get; set; } = default!;
/// <summary>
/// 获取或设置批次备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_remark")]
[System.Text.Json.Serialization.JsonPropertyName("batch_remark")]
public string BatchRemark { get; set; } = default!;
/// <summary>
/// 获取或设置批次关闭原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("close_reason")]
[System.Text.Json.Serialization.JsonPropertyName("close_reason")]
public string? CloseReason { get; set; }
/// <summary>
/// 获取或设置转账总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置转账总笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_num")]
public int TotalNumber { get; set; }
/// <summary>
/// 获取或设置批次创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置批次更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? UpdateTime { get; set; }
/// <summary>
/// 获取或设置转账成功金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_amount")]
[System.Text.Json.Serialization.JsonPropertyName("success_amount")]
public int SuccessAmount { get; set; }
/// <summary>
/// 获取或设置转账成功笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_num")]
[System.Text.Json.Serialization.JsonPropertyName("success_num")]
public int SuccessNumber { get; set; }
/// <summary>
/// 获取或设置转账失败金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_amount")]
[System.Text.Json.Serialization.JsonPropertyName("fail_amount")]
public int FailAmount { get; set; }
/// <summary>
/// 获取或设置转账失败笔数。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_num")]
[System.Text.Json.Serialization.JsonPropertyName("fail_num")]
public int FailNumber { get; set; }
}
public class TransferDetail
{
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_detail_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_detail_no")]
public string OutDetailNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_id")]
[System.Text.Json.Serialization.JsonPropertyName("detail_id")]
public string DetailId { get; set; } = default!;
/// <summary>
/// 获取或设置明细状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_status")]
[System.Text.Json.Serialization.JsonPropertyName("detail_status")]
public string DetailStatus { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置转账批次单信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_batch")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_batch")]
public Types.TransferBatch TransferBatch { get; set; } = default!;
/// <summary>
/// 获取或设置转账明细单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_detail_list")]
public Types.TransferDetail[]? TransferDetailList { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口的请求。</para>
/// </summary>
public class GetTransferBatchDetailByDetailIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string BatchId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置微信明细单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string DetailId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id} 接口的响应。</para>
/// </summary>
public class GetTransferBatchDetailByDetailIdResponse : GetTransferBatchDetailByOutDetailNumberResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口的请求。</para>
/// </summary>
public class GetTransferBatchDetailByOutDetailNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutBatchNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutDetailNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no} 接口的响应。</para>
/// </summary>
public class GetTransferBatchDetailByOutDetailNumberResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("batch_id")]
[System.Text.Json.Serialization.JsonPropertyName("batch_id")]
public string BatchId { get; set; } = default!;
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_detail_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_detail_no")]
public string OutDetailNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_id")]
[System.Text.Json.Serialization.JsonPropertyName("detail_id")]
public string DetailId { get; set; } = default!;
/// <summary>
/// 获取或设置明细状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_status")]
[System.Text.Json.Serialization.JsonPropertyName("detail_status")]
public string DetailStatus { get; set; } = default!;
/// <summary>
/// 获取或设置转账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_amount")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_amount")]
public int TransferAmount { get; set; }
/// <summary>
/// 获取或设置转账备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("transfer_remark")]
[System.Text.Json.Serialization.JsonPropertyName("transfer_remark")]
public string TransferRemark { get; set; } = default!;
/// <summary>
/// 获取或设置失败原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_reason")]
[System.Text.Json.Serialization.JsonPropertyName("fail_reason")]
public string? FailReason { get; set; }
/// <summary>
/// 获取或设置收款用户 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置收款用户姓名(需使用商户私钥解密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_name")]
[System.Text.Json.Serialization.JsonPropertyName("user_name")]
public virtual string UserName { get; set; } = default!;
/// <summary>
/// 获取或设置转账发起时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("initiate_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("initiate_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset InitiateTime { get; set; }
/// <summary>
/// 获取或设置明细更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset UpdateTime { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer/bill-receipt 接口的请求。</para>
/// </summary>
public class CreateTransferBillReceiptRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer/bill-receipt 接口的响应。</para>
/// </summary>
public class CreateTransferBillReceiptResponse : GetTransferBillReceiptByOutBatchNumberResponse
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/bill-receipt/{out_batch_no} 接口的请求。</para>
/// </summary>
public class GetTransferBillReceiptByOutBatchNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutBatchNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer/bill-receipt/{out_batch_no} 接口的响应。</para>
/// </summary>
public class GetTransferBillReceiptByOutBatchNumberResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置电子回单申请单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("signature_no")]
[System.Text.Json.Serialization.JsonPropertyName("signature_no")]
public string SignatureNumber { get; set; } = default!;
/// <summary>
/// 获取或设置电子回单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("signature_status")]
[System.Text.Json.Serialization.JsonPropertyName("signature_status")]
public string? SignatureStatus { get; set; }
/// <summary>
/// 获取或设置电子回单文件的哈希方法。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_type")]
[System.Text.Json.Serialization.JsonPropertyName("hash_type")]
public string? HashType { get; set; }
/// <summary>
/// 获取或设置电子回单文件的哈希值。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_value")]
[System.Text.Json.Serialization.JsonPropertyName("hash_value")]
public string? HashValue { get; set; }
/// <summary>
/// 获取或设置电子回单文件的下载地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_url")]
[System.Text.Json.Serialization.JsonPropertyName("download_url")]
public string? DownloadUrl { get; set; }
/// <summary>
/// 获取或设置创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? CreateTime { get; set; }
/// <summary>
/// 获取或设置更新时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? UpdateTime { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer-detail/electronic-receipts 接口的请求。</para>
/// </summary>
public class CreateTransferDetailElectronicReceiptRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置受理类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("accept_type")]
[System.Text.Json.Serialization.JsonPropertyName("accept_type")]
public string AcceptType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string? OutBatchNumber { get; set; }
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_detail_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_detail_no")]
public string OutDetailNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /transfer-detail/electronic-receipts 接口的响应。</para>
/// </summary>
public class CreateTransferDetailElectronicReceiptResponse : GetTransferDetailElectronicReceiptByOutDetailNumberResponse
{
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer-detail/electronic-receipts 接口的请求。</para>
/// </summary>
public class GetTransferDetailElectronicReceiptByOutDetailNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置受理类型。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string AcceptType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? OutBatchNumber { get; set; }
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutDetailNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /transfer-detail/electronic-receipts 接口的响应。</para>
/// </summary>
public class GetTransferDetailElectronicReceiptByOutDetailNumberResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置受理类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("accept_type")]
[System.Text.Json.Serialization.JsonPropertyName("accept_type")]
public string AcceptType { get; set; } = default!;
/// <summary>
/// 获取或设置商户批次单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_batch_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_batch_no")]
public string OutBatchNumber { get; set; } = default!;
/// <summary>
/// 获取或设置商户明细单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_detail_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_detail_no")]
public string OutDetailNumber { get; set; } = default!;
/// <summary>
/// 获取或设置电子回单申请单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("signature_no")]
[System.Text.Json.Serialization.JsonPropertyName("signature_no")]
public string SignatureNumber { get; set; } = default!;
/// <summary>
/// 获取或设置电子回单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("signature_status")]
[System.Text.Json.Serialization.JsonPropertyName("signature_status")]
public string? SignatureStatus { get; set; }
/// <summary>
/// 获取或设置电子回单文件的哈希方法。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_type")]
[System.Text.Json.Serialization.JsonPropertyName("hash_type")]
public string? HashType { get; set; }
/// <summary>
/// 获取或设置电子回单文件的哈希值。
/// </summary>
[Newtonsoft.Json.JsonProperty("hash_value")]
[System.Text.Json.Serialization.JsonPropertyName("hash_value")]
public string? HashValue { get; set; }
/// <summary>
/// 获取或设置电子回单文件的下载地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_url")]
[System.Text.Json.Serialization.JsonPropertyName("download_url")]
public string? DownloadUrl { get; set; }
}
}

View File

@@ -12,7 +12,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
<PackageTags>Flurl.Http Wechat Weixin MicroMessage Tenpay WechatPay WeixinPay Wxpay 微信 微信支付 微信商户</PackageTags>
<Version>1.2.1</Version>
<Version>1.3.0</Version>
<Description>Flurl.Http client for Wechat Tenpay API. 基于 Flurl.Http 的微信支付 API v3 版客户端,支持直连商户、服务商模式,支持基础支付、代金券、商家券、委托营销、消费卡、支付有礼、微信支付分、微信先享卡、支付即服务、点金计划、智慧商圈、电商收付通、消费者投诉等功能。</Description>
<Authors>Fu Diwei</Authors>
<RepositoryType>git</RepositoryType>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings
{
/// <summary>
/// 微信商户平台证书存储器接口。
/// </summary>
public interface ICertificateStorer
{
/// <summary>
/// 根据证书序列号获取证书cer 格式)。
/// </summary>
/// <param name="serialNumber"></param>
/// <returns></returns>
string? Get(string serialNumber);
/// <summary>
/// 设置证书序列号与证书cer 格式)的映射关系。
/// </summary>
/// <param name="serialNumber"></param>
/// <param name="certificate"></param>
void Set(string serialNumber, string certificate);
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings
{
/// <summary>
/// 一个基于内存实现的 <see cref="ICertificateStorer"/>。
/// </summary>
public class InMemoryCertificateStorer : ICertificateStorer
{
public IDictionary<string, string> _dict;
public InMemoryCertificateStorer()
{
_dict = new ConcurrentDictionary<string, string>();
}
string? ICertificateStorer.Get(string serialNumber)
{
if (serialNumber == null) throw new ArgumentNullException(nameof(serialNumber));
return _dict[serialNumber];
}
void ICertificateStorer.Set(string serialNumber, string certificate)
{
if (serialNumber == null) throw new ArgumentNullException(nameof(serialNumber));
if (certificate == null) throw new ArgumentNullException(nameof(certificate));
_dict[serialNumber] = certificate;
}
}
}

View File

@@ -1,15 +0,0 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 微信支付 API 接口签名认证方式。
/// </summary>
public static class WechatTenpayAuthSchemes
{
/// <summary>
/// WECHATPAY2-SHA256-RSA2048默认
/// </summary>
public const string WECHATPAY2_SHA256_RSA2048 = "WECHATPAY2-SHA256-RSA2048";
}
}

View File

@@ -39,6 +39,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// </summary>
internal string WechatMerchantV3Secret { get; }
/// <summary>
/// 获取当前客户端使用的微信商户平台证书存储器。
/// </summary>
internal Settings.ICertificateStorer? WechatCertificateStorer { get; }
/// <summary>
/// 获取当前客户端使用的 JSON 序列化器。
/// </summary>
@@ -59,6 +64,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
WechatMerchantCertSerialNumber = options.MerchantCertSerialNumber;
WechatMerchantCertPrivateKey = options.MerchantCertPrivateKey;
WechatMerchantV3Secret = options.MerchantV3Secret;
WechatCertificateStorer = options.CertificateStorer;
FlurlClient.BaseUrl = options.Endpoints ?? WechatTenpayEndpoints.DEFAULT;
FlurlClient.Headers.Remove("Accept");

View File

@@ -34,9 +34,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// <summary>
/// 获取或设置微信支付 API 签名认证方式。
/// <para>默认值:<see cref="WechatTenpayAuthSchemes.WECHATPAY2_SHA256_RSA2048"/></para>
/// <para>默认值:<see cref="Constants.SignAlgorithms.WECHATPAY2_SHA256_RSA2048"/></para>
/// </summary>
public string AuthScheme { get; set; } = WechatTenpayAuthSchemes.WECHATPAY2_SHA256_RSA2048;
public string AuthScheme { get; set; } = Constants.SignAlgorithms.WECHATPAY2_SHA256_RSA2048;
/// <summary>
/// 获取或设置微信商户号。
@@ -57,5 +57,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// 获取或设置微信商户 API 证书私钥。
/// </summary>
public string MerchantCertPrivateKey { get; set; } = default!;
/// <summary>
/// 获取或设置微信商户平台证书存储器。
/// <para>默认值:<see cref="Settings.InMemoryCertificateStorer"/></para>
/// </summary>
public Settings.ICertificateStorer? CertificateStorer { get; set; } = new Settings.InMemoryCertificateStorer();
}
}

View File

@@ -0,0 +1,18 @@
{
"total_count": 100,
"offset": 0,
"limit": 100,
"data": [
{
"mchid": "2480253391",
"account_type": "BASIC",
"income_record_type": "OFFLINERECHARGE",
"income_record_id": "4200000811202011056138519459",
"amount": 100,
"success_time": "2017-12-08T00:08:00.00+08:00",
"bank_name": "招商银行",
"bank_account_name": "财付通支付科技有限公司",
"bank_account_number": "****6473"
}
]
}

View File

@@ -0,0 +1,18 @@
{
"total_count": 0,
"offset": 0,
"limit": 0,
"data": [
{
"sub_mchid": "2480253391",
"account_type": "BASIC",
"income_record_type": "OFFLINERECHARGE",
"income_record_id": "4200000811202011056138519459",
"amount": 2734921,
"success_time": "2017-12-08T00:08:00.00+08:00",
"bank_name": "招商银行",
"bank_account_name": "北京三快科技有限公司",
"bank_account_number": "****6473"
}
]
}

View File

@@ -0,0 +1,22 @@
{
"sub_mchid": "1900000109",
"sub_appid": "wxf636efh567hg4356",
"authorization_type": "INFORMATION_AUTHORIZATION_TYPE",
"out_batch_no": "plfk2020042013",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"total_amount": 4000000,
"total_num": 200,
"transfer_detail_list": [
{
"out_detail_no": "x23zy545Bd5436",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"user_name": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"user_id_card": "8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f"
}
],
"sp_appid": "wxf636efh567hg4388",
"transfer_purpose": "COMMISSION"
}

View File

@@ -0,0 +1,5 @@
{
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"create_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,29 @@
{
"sp_mchid": "1900001109",
"sub_mchid": "1900000109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"sub_appid": "wxf636efh567hg4356",
"batch_status": "ACCEPTED",
"batch_type": "API",
"authorization_type": "INFORMATION_AUTHORIZATION_TYPE",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"close_reason": "OVERDUE_CLOSE",
"total_amount": 4000000,
"total_num": 200,
"create_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00",
"success_amount": 3900000,
"success_num": 199,
"fail_amount": 100000,
"fail_num": 1,
"transfer_detail_list": [
{
"detail_id": "1040000071100999991182020050700019500100",
"out_detail_no": "x23zy545Bd5436",
"detail_status": "SUCCESS"
}
],
"transfer_purpose": "COMMISSION"
}

View File

@@ -0,0 +1,29 @@
{
"sp_mchid": "1900001109",
"sub_mchid": "1900000109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"sub_appid": "wxf636efh567hg4356",
"batch_status": "ACCEPTED",
"batch_type": "API",
"authorization_type": "INFORMATION_AUTHORIZATION_TYPE",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"close_reason": "OVERDUE_CLOSE",
"total_amount": 4000000,
"total_num": 200,
"create_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00",
"success_amount": 3900000,
"success_num": 199,
"fail_amount": 100000,
"fail_num": 1,
"transfer_detail_list": [
{
"detail_id": "1040000071100999991182020050700019500100",
"out_detail_no": "x23zy545Bd5436",
"detail_status": "SUCCESS"
}
],
"transfer_purpose": "COMMISSION"
}

View File

@@ -0,0 +1,16 @@
{
"sp_mchid": "1900001109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"out_detail_no": "x23zy545Bd5436",
"detail_id": "1040000071100999991182020050700019500100",
"detail_status": "SUCCESS",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"fail_reason": "ACCOUNT_FROZEN",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"username": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"initiate_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,16 @@
{
"sp_mchid": "1900001109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"out_detail_no": "x23zy545Bd5436",
"detail_id": "1040000071100999991182020050700019500100",
"detail_status": "SUCCESS",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"fail_reason": "ACCOUNT_FROZEN",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"username": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"initiate_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,18 @@
{
"appid": "wxf636efh567hg4356",
"out_batch_no": "plfk2020042013",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"total_amount": 4000000,
"total_num": 200,
"transfer_detail_list": [
{
"out_detail_no": "x23zy545Bd5436",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"user_name": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"user_id_card": "8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f"
}
]
}

View File

@@ -0,0 +1,5 @@
{
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"create_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,28 @@
{
"transfer_batch": {
"mchid": "1900001109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"batch_status": "ACCEPTED",
"batch_type": "API",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"close_reason": "OVERDUE_CLOSE",
"total_amount": 4000000,
"total_num": 200,
"create_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00",
"success_amount": 3900000,
"success_num": 199,
"fail_amount": 100000,
"fail_num": 1
},
"transfer_detail_list": [
{
"detail_id": "1040000071100999991182020050700019500100",
"out_detail_no": "x23zy545Bd5436",
"detail_status": "SUCCESS"
}
]
}

View File

@@ -0,0 +1,28 @@
{
"transfer_batch": {
"mchid": "1900001109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"batch_status": "ACCEPTED",
"batch_type": "API",
"batch_name": "2019年1月深圳分部报销单",
"batch_remark": "2019年1月深圳分部报销单",
"close_reason": "OVERDUE_CLOSE",
"total_amount": 4000000,
"total_num": 200,
"create_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00",
"success_amount": 3900000,
"success_num": 199,
"fail_amount": 100000,
"fail_num": 1
},
"transfer_detail_list": [
{
"detail_id": "1040000071100999991182020050700019500100",
"out_detail_no": "x23zy545Bd5436",
"detail_status": "SUCCESS"
}
]
}

View File

@@ -0,0 +1,16 @@
{
"mchid": "1900001109",
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"out_detail_no": "x23zy545Bd5436",
"detail_id": "1040000071100999991182020050700019500100",
"detail_status": "SUCCESS",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"fail_reason": "ACCOUNT_FROZEN",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"user_name": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"initiate_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,15 @@
{
"out_batch_no": "plfk2020042013",
"batch_id": "1030000071100999991182020050700019480001",
"appid": "wxf636efh567hg4356",
"out_detail_no": "x23zy545Bd5436",
"detail_id": "1040000071100999991182020050700019500100",
"detail_status": "SUCCESS",
"transfer_amount": 200000,
"transfer_remark": "2020年4月报销",
"fail_reason": "ACCOUNT_FROZEN",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"user_name": "757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45",
"initiate_time": "2015-05-20T13:29:35.120+08:00",
"update_time": "2015-05-20T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,3 @@
{
"out_batch_no": "plfk2020042013"
}

View File

@@ -0,0 +1,10 @@
{
"out_batch_no": "plfk2020042013",
"signature_no": "1050000010509999485212020110200058820001",
"signature_status": "ACCEPTED",
"hash_type": "SHA256",
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
"download_url": "https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx",
"create_time": "2020-05-20T13:29:35.120+08:00",
"update_time": "2020-05-21T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,10 @@
{
"out_batch_no": "plfk2020042013",
"signature_no": "1050000010509999485212020110200058820001",
"signature_status": "ACCEPTED",
"hash_type": "SHA256",
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
"download_url": "https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx",
"create_time": "2020-05-20T13:29:35.120+08:00",
"update_time": "2020-05-21T13:29:35.120+08:00"
}

View File

@@ -0,0 +1,5 @@
{
"accept_type": "BATCH_TRANSFER",
"out_batch_no": "GD2021011610162610BBdkkIwcu3",
"out_detail_no": "mx0911231610162610v4CNkO4HAf"
}

View File

@@ -0,0 +1,10 @@
{
"accept_type": "BATCH_TRANSFER",
"out_batch_no": "GD2021011610162610BBdkkIwcu3",
"out_detail_no": "mx0911231610162610v4CNkO4HAf",
"signature_no": "1050000010509999485212020110200058820001",
"signature_status": "ACCEPTED",
"hash_type": "SHA256",
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
"download_url": "https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx"
}

View File

@@ -0,0 +1,10 @@
{
"accept_type": "BATCH_TRANSFER",
"out_batch_no": "GD2021011610162610BBdkkIwcu3",
"out_detail_no": "mx0911231610162610v4CNkO4HAf",
"signature_no": "1050000010509999485212020110200058820001",
"signature_status": "ACCEPTED",
"hash_type": "SHA256",
"hash_value": "DE731F35146A0BEFADE5DB9D1E468D96C01CA8898119C674FEE9F11F4DBE5529",
"download_url": "https://api.mch.weixin.qq.com/v3/billdownload/file?token=xxx"
}

View File

@@ -21,7 +21,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
Assert.NotNull(response.WechatpayCertSerialNumber);
Assert.NotNull(response.WechatpaySignature);
TestClients.Instance.DecryptResponseEncryptedData(response);
TestClients.Instance.DecryptResponseEncryptedData(ref response);
var certificateModel = response.CertificateList.SingleOrDefault(e => e.SerialNumber == response.WechatpayCertSerialNumber);
Assert.NotNull(certificateModel);