feat(tenpayv3): 新增微工卡相关接口

This commit is contained in:
fudiwei 2022-11-24 13:00:26 +08:00
parent 492b7e4df3
commit 31bdc399b1
25 changed files with 1063 additions and 3 deletions

View File

@ -0,0 +1,166 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供微工卡相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecutePayrollCardExtensions
{
/// <summary>
/// <para>异步调用 [POST] /payroll-card/tokens 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePayrollCardTokenResponse> ExecuteCreatePayrollCardTokenAsync(this WechatTenpayClient client, Models.CreatePayrollCardTokenRequest 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, "payroll-card", "tokens");
return await client.SendRequestWithJsonAsync<Models.CreatePayrollCardTokenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /payroll-card/relations/{openid} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPayrollRelationByOpenIdResponse> ExecuteGetPayrollRelationByOpenIdAsync(this WechatTenpayClient client, Models.GetPayrollRelationByOpenIdRequest 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, "payroll-card", "relations", request.OpenId);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
if (request.AppId != null)
flurlReq.SetQueryParam("appid", request.AppId);
if (request.SubAppId != null)
flurlReq.SetQueryParam("sub_appid", request.SubAppId);
return await client.SendRequestWithJsonAsync<Models.GetPayrollRelationByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#region Authentications
/// <summary>
/// <para>异步调用 [POST] /payroll-card/authentications/pre-order-with-auth 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_29.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.PreOrderWithAuthPayrollCardAuthenticationResponse> ExecutePreOrderWithAuthPayrollCardAuthenticationAsync(this WechatTenpayClient client, Models.PreOrderWithAuthPayrollCardAuthenticationRequest 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, "payroll-card", "authentications", "pre-order-with-auth");
return await client.SendRequestWithJsonAsync<Models.PreOrderWithAuthPayrollCardAuthenticationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /payroll-card/authentications/{authenticate_number} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPayrollCardAuthenticationByAuthenticateNumberResponse> ExecuteGetPayrollCardAuthenticationByAuthenticateNumberAsync(this WechatTenpayClient client, Models.GetPayrollCardAuthenticationByAuthenticateNumberRequest 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, "payroll-card", "authentications", request.AuthenticateNumber);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestWithJsonAsync<Models.GetPayrollCardAuthenticationByAuthenticateNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /payroll-card/authentications 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.QueryPayrollCardAuthenticationsResponse> ExecuteQueryPayrollCardAuthenticationsAsync(this WechatTenpayClient client, Models.QueryPayrollCardAuthenticationsRequest 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, "payroll-card", "authentications")
.SetQueryParam("openid", request.OpenId);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
if (request.AppId != null)
flurlReq.SetQueryParam("appid", request.AppId);
if (request.SubAppId != null)
flurlReq.SetQueryParam("sub_appid", request.SubAppId);
if (request.AuthenticateDateString != null)
flurlReq.SetQueryParam("authenticate_date", request.AuthenticateDateString);
if (request.AuthenticateState != null)
flurlReq.SetQueryParam("authenticate_state", request.AuthenticateState);
if (request.Limit != null)
flurlReq.SetQueryParam("limit", request.Limit);
if (request.Offset != null)
flurlReq.SetQueryParam("offset", request.Offset);
return await client.SendRequestWithJsonAsync<Models.QueryPayrollCardAuthenticationsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region TransferBatches
/// <summary>
/// <para>异步调用 [POST] /payroll-card/transfer-batches 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_1_6.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePayrollCardTransferBatchResponse> ExecuteCreatePayrollCardTransferBatchAsync(this WechatTenpayClient client, Models.CreatePayrollCardTransferBatchRequest 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, "payroll-card", "transfer-batches");
return await client.SendRequestWithJsonAsync<Models.CreatePayrollCardTransferBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -217,5 +217,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.GetTransferDetailElectronicReceiptByOutDetailNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken); return await client.SendRequestWithJsonAsync<Models.GetTransferDetailElectronicReceiptByOutDetailNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
} }
#endregion #endregion
#region Transfer
#endregion
} }
} }

View File

@ -209,7 +209,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public int UsageCount { get; set; } public int UsageCount { get; set; }
/// <summary> /// <summary>
/// 获取或设置优惠金额(单位:)。 /// 获取或设置优惠金额(单位:)。
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("amount")] [Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")] [System.Text.Json.Serialization.JsonPropertyName("amount")]

View File

@ -105,7 +105,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public int UsageCount { get; set; } public int UsageCount { get; set; }
/// <summary> /// <summary>
/// 获取或设置优惠金额(单位:)。 /// 获取或设置优惠金额(单位:)。
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("amount")] [Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")] [System.Text.Json.Serialization.JsonPropertyName("amount")]

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/authentications/{authenticate_number} 接口的请求。</para>
/// </summary>
public class GetPayrollCardAuthenticationByAuthenticateNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置商家核身单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string AuthenticateNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,96 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/authentications/{authenticate_number} 接口的响应。</para>
/// </summary>
public class GetPayrollCardAuthenticationByAuthenticateNumberResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("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; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置商家核身单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_number")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_number")]
public string AuthenticateNumber { get; set; } = default!;
/// <summary>
/// 获取或设置核身渠道。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_scene")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_scene")]
public string AuthenticateScene { get; set; } = default!;
/// <summary>
/// 获取或设置核身渠道标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_source")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_source")]
public string AuthenticateSource { get; set; } = default!;
/// <summary>
/// 获取或设置项目名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("project_name")]
[System.Text.Json.Serialization.JsonPropertyName("project_name")]
public string ProjectName { get; set; } = default!;
/// <summary>
/// 获取或设置单位名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("employer_name")]
[System.Text.Json.Serialization.JsonPropertyName("employer_name")]
public string EmployerName { get; set; } = default!;
/// <summary>
/// 获取或设置核身类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_type")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_type")]
public string AuthenticateType { get; set; } = default!;
/// <summary>
/// 获取或设置核身状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_state")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_state")]
public string AuthenticateState { get; set; } = default!;
/// <summary>
/// 获取或设置核身时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset AuthenticateTime { get; set; }
/// <summary>
/// 获取或设置核身失败原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_failed_reason")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_failed_reason")]
public string? AuthenticateFailedReason { get; set; }
}
}

View File

@ -0,0 +1,89 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/authentications/pre-order-with-auth 接口的请求。</para>
/// </summary>
public class PreOrderWithAuthPayrollCardAuthenticationRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("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("authenticate_number")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_number")]
public string AuthenticateNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置项目名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("project_name")]
[System.Text.Json.Serialization.JsonPropertyName("project_name")]
public string ProjectName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用工单位名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("employer_name")]
[System.Text.Json.Serialization.JsonPropertyName("employer_name")]
public string EmployerName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用户唯一标识。
/// </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")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserName { get; set; }
/// <summary>
/// 获取或设置身份证号码(需使用平台公钥/证书加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_card_number")]
[System.Text.Json.Serialization.JsonPropertyName("id_card_number")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? IdCardNumber { get; set; }
/// <summary>
/// 获取或设置用工类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("employment_type")]
[System.Text.Json.Serialization.JsonPropertyName("employment_type")]
public string EmploymentType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置核身类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_type")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_type")]
public string AuthenticateType { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,50 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/authentications/pre-order-with-auth 接口的响应。</para>
/// </summary>
public class PreOrderWithAuthPayrollCardAuthenticationResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("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; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置商家核身单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_number")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_number")]
public string AuthenticateNumber { get; set; } = default!;
/// <summary>
/// 获取或设置核身 Token。
/// </summary>
[Newtonsoft.Json.JsonProperty("token")]
[System.Text.Json.Serialization.JsonPropertyName("token")]
public string Token { get; set; } = default!;
/// <summary>
/// 获取或设置核身 Token 有效期(单位:秒)。
/// </summary>
[Newtonsoft.Json.JsonProperty("expires_in")]
[System.Text.Json.Serialization.JsonPropertyName("expires_in")]
public int ExpiresIn { get; set; }
}
}

View File

@ -0,0 +1,64 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/authentications 接口的请求。</para>
/// </summary>
public class QueryPayrollCardAuthenticationsRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置子商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置核身日期字符串格式yyyy-MM-dd
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? AuthenticateDateString { get; set; }
/// <summary>
/// 获取或设置核身状态。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? AuthenticateState { 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 int? Offset { get; set; }
}
}

View File

@ -0,0 +1,130 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/authentications 接口的响应。</para>
/// </summary>
public class QueryPayrollCardAuthenticationsResponse : WechatTenpayResponse
{
public static class Types
{
public class Authentication
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("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; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置商家核身单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_number")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_number")]
public string AuthenticateNumber { get; set; } = default!;
/// <summary>
/// 获取或设置核身渠道。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_scene")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_scene")]
public string AuthenticateScene { get; set; } = default!;
/// <summary>
/// 获取或设置核身渠道标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_source")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_source")]
public string AuthenticateSource { get; set; } = default!;
/// <summary>
/// 获取或设置项目名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("project_name")]
[System.Text.Json.Serialization.JsonPropertyName("project_name")]
public string ProjectName { get; set; } = default!;
/// <summary>
/// 获取或设置单位名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("employer_name")]
[System.Text.Json.Serialization.JsonPropertyName("employer_name")]
public string EmployerName { get; set; } = default!;
/// <summary>
/// 获取或设置核身类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_type")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_type")]
public string AuthenticateType { get; set; } = default!;
/// <summary>
/// 获取或设置核身状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_state")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_state")]
public string AuthenticateState { get; set; } = default!;
/// <summary>
/// 获取或设置核身时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset AuthenticateTime { get; set; }
/// <summary>
/// 获取或设置核身失败原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("authenticate_failed_reason")]
[System.Text.Json.Serialization.JsonPropertyName("authenticate_failed_reason")]
public string? AuthenticateFailedReason { get; set; }
}
}
/// <summary>
/// 获取或设置核身记录列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Authentication[] AuthenticationList { get; set; } = default!;
/// <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,61 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/tokens 接口的请求。</para>
/// </summary>
public class CreatePayrollCardTokenRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("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("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")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserName { get; set; }
/// <summary>
/// 获取或设置身份证号码(需使用平台公钥/证书加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_card_number")]
[System.Text.Json.Serialization.JsonPropertyName("id_card_number")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? IdCardNumber { get; set; }
/// <summary>
/// 获取或设置用工类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("employment_type")]
[System.Text.Json.Serialization.JsonPropertyName("employment_type")]
public string EmploymentType { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,43 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/tokens 接口的响应。</para>
/// </summary>
public class CreatePayrollCardTokenResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("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; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置授权 Token。
/// </summary>
[Newtonsoft.Json.JsonProperty("token")]
[System.Text.Json.Serialization.JsonPropertyName("token")]
public string Token { get; set; } = default!;
/// <summary>
/// 获取或设置授权 Token 有效期(单位:秒)。
/// </summary>
[Newtonsoft.Json.JsonProperty("expires_in")]
[System.Text.Json.Serialization.JsonPropertyName("expires_in")]
public int ExpiresIn { get; set; }
}
}

View File

@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/relations/{openid} 接口的请求。</para>
/// </summary>
public class GetPayrollRelationByOpenIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置子商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,95 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /payroll-card/relations/{openid} 接口的响应。</para>
/// </summary>
public class GetPayrollRelationByOpenIdResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("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; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = default!;
/// <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("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置授权状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_state")]
[System.Text.Json.Serialization.JsonPropertyName("authorize_state")]
public string AuthorizeState { get; set; } = default!;
/// <summary>
/// 获取或设置授权时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("authorize_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? AuthorizeTime { get; set; }
/// <summary>
/// 获取或设置取消授权时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("deauthorize_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("deauthorize_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? DeauthorizeTime { get; set; }
/// <summary>
/// 获取或设置开通状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("register_state")]
[System.Text.Json.Serialization.JsonPropertyName("register_state")]
public string RegisterState { get; set; } = default!;
/// <summary>
/// 获取或设置开通时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("register_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("register_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? RegisterTime { get; set; }
/// <summary>
/// 获取或设置关闭时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("close_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("close_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? CloseTime { get; set; }
}
}

View File

@ -0,0 +1,101 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/transfer-batches 接口的请求。</para>
/// </summary>
public class CreatePayrollCardTransferBatchRequest : 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; }
/// <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("employment_type")]
[System.Text.Json.Serialization.JsonPropertyName("employment_type")]
public string EmploymentType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用工场景。
/// </summary>
[Newtonsoft.Json.JsonProperty("employment_scene")]
[System.Text.Json.Serialization.JsonPropertyName("employment_scene")]
public string EmploymentScene { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /payroll-card/transfer-batches 接口的响应。</para>
/// </summary>
public class CreatePayrollCardTransferBatchResponse : CreateTransferBatchResponse
{
}
}

View File

@ -15,7 +15,7 @@
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl> <PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
<PackageTags>Flurl.Http Wechat Weixin MicroMessage Tenpay WechatPay WeixinPay Wxpay 微信 微信支付 微信商户</PackageTags> <PackageTags>Flurl.Http Wechat Weixin MicroMessage Tenpay WechatPay WeixinPay Wxpay 微信 微信支付 微信商户</PackageTags>
<Version>2.13.1</Version> <Version>2.13.1</Version>
<Description>基于 Flurl.Http 的微信支付 API v3 版客户端,支持直连商户、服务商模式,支持基础支付、代金券、商家券、委托营销、消费卡、支付有礼、银行定向促活、微信支付分、微信先享卡、支付即服务、点金计划、智慧商圈、电商收付通、二级商户进件、小微商户进件、消费者投诉、商户违规通知、批量转账到零钱、银行组件、海关报关、融合钱包等功能。</Description> <Description>基于 Flurl.Http 的微信支付 API v3 版客户端,支持直连商户、服务商模式,支持基础支付、代金券、商家券、委托营销、消费卡、支付有礼、银行定向促活、微信支付分、微信先享卡、支付即服务、点金计划、智慧商圈、电商收付通、二级商户进件、小微商户进件、消费者投诉、商户违规通知、批量转账到零钱、银行组件、海关报关、融合钱包、微工卡等功能。</Description>
<Authors>Fu Diwei</Authors> <Authors>Fu Diwei</Authors>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl> <RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl>

View File

@ -0,0 +1,13 @@
{
"appid": "wxa1111111",
"authenticate_number": "mcdhehfgisdhfjghed39384564i83",
"authenticate_type": "SIGN_IN",
"employer_name": "某用工企业",
"employment_type": "LONG_TERM_EMPLOYMENT",
"id_card_number": "7FzH5XksJG3a8HLLsaaUV6K54y1OnPMY5",
"openid": "onqOjjmo8wmTOOtSKwXtGjg9Gb58",
"project_name": "某项目",
"sub_appid": "wxa1111111",
"sub_mchid": "1111111",
"user_name": "LP7bT4hQXUsOZCEvK2YrSiqFsnP0oRMfeoLN0vBg"
}

View File

@ -0,0 +1,8 @@
{
"authenticate_number": "mcdhehfgisdhfjghed39384564i83",
"expires_in": 300,
"mchid": "1111111",
"openid": "onqOjjmo8wmTOOtSKwXtGjg9Gb58",
"sub_mchid": "1111111",
"token": "abcdefghijklmn"
}

View File

@ -0,0 +1,20 @@
{
"data": [
{
"mchid": "1111111",
"sub_mchid": "111111",
"openid": "onqOjjmo8wmTOOtSKwXtGjg9Gb58",
"authenticate_scene": "FROM_MINI_APP",
"authenticate_source": "wdiooewl7587443649000",
"authenticate_type": "SIGN_IN",
"project_name": "某项目",
"employer_name": "某单位名称",
"authenticate_state": "FROM_MINI_APP",
"authenticate_time": "2015-05-20T13:29:35+08:00",
"authenticate_number": "mcdhehfgisdhfjghed39384564i83"
}
],
"total_count": 9,
"offset": 0,
"limit": 10
}

View File

@ -0,0 +1,9 @@
{
"openid": "onqOjjmo8wmTOOtSKwXtGjg9Gb58",
"appid": "wxa1111111",
"sub_mchid": "1111111",
"sub_appid": "wxa1111111",
"user_name": "LP7bT4hQXUsOZCEvK2YrSiqFsnP0oRMfeoLN0vBg",
"id_card_number": "7FzH5XksJG3a8HLLsaaUV6K54y1OnPMY5",
"employment_type": "LONG_TERM_EMPLOYMENT"
}

View File

@ -0,0 +1,7 @@
{
"openid": "9x111111",
"mchid": "1111111",
"sub_mchid": "1111111",
"token": "abcdefghijklmn",
"expires_in": 1800
}

View File

@ -0,0 +1,11 @@
{
"authorize_state": "UNAUTHORIZED",
"authorize_time": "2015-05-20T13:29:35+08:00",
"close_time": "2015-05-22T13:29:35+08:00",
"deauthorize_time": "2015-05-20T13:29:35+08:00",
"mchid": "1111111",
"openid": "onqOjjmo8wmTOOtSKwXtGjg9Gb58",
"register_state": "UNDEFINED",
"register_time": "2015-05-20T13:29:35+08:00",
"sub_mchid": "1111111"
}

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"
}
],
"sp_appid": "wxf636efh567hg4388",
"employment_type": "LONG_TERM_EMPLOYMENT",
"employment_scene": "LOGISTICS"
}

View File

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