mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(work): 新增接口调用许可余额支付相关接口
This commit is contained in:
parent
894a7c20fe
commit
1c116397d6
@ -442,6 +442,48 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PayJob
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/license/submit_pay_job 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/99415 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinLicenseSubmitPayJobResponse> ExecuteCgibinLicenseSubmitPayJobAsync(this WechatWorkClient client, Models.CgibinLicenseSubmitPayJobRequest 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, "cgi-bin", "license", "submit_pay_job")
|
||||
.SetQueryParam("provider_access_token", request.ProviderAccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinLicenseSubmitPayJobResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/license/pay_job_result 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/99415 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinLicensePayJobResultResponse> ExecuteCgibinLicensePayJobResultAsync(this WechatWorkClient client, Models.CgibinLicensePayJobResultRequest 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, "cgi-bin", "license", "pay_job_result")
|
||||
.SetQueryParam("provider_access_token", request.ProviderAccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinLicensePayJobResultResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/license/support_policy_query 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/96515 </para>
|
||||
|
@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/license/pay_job_result 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinLicensePayJobResultRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商 AccessToken。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string ProviderAccessToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付任务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("jobid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
|
||||
public string JobId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/license/pay_job_result 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinLicensePayJobResultResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class JobResult
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class FailedCorp
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置企业 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||
public string CorpId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errcode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errcode")]
|
||||
public int ErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误码描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errmsg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errmsg")]
|
||||
public string? ErrorMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errcode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errcode")]
|
||||
public int ErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置错误码描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("errmsg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("errmsg")]
|
||||
public string? ErrorMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付失败的企业列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("fail_corp_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("fail_corp_list")]
|
||||
public Types.FailedCorp[]? FailedCorpList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付任务状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int JobStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付任务结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("pay_job_result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("pay_job_result")]
|
||||
public Types.JobResult JobResult { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/license/submit_pay_job 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinLicenseSubmitPayJobRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商 AccessToken。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string ProviderAccessToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付人成员账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payer_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payer_userid")]
|
||||
public string PayerUserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("order_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
|
||||
public string OrderId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/license/submit_pay_job 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinLicenseSubmitPayJobResponse : WechatWorkResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置支付任务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("jobid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
|
||||
public string JobId { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"jobid": "JOBID"
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"status": 3,
|
||||
"pay_job_result": {
|
||||
"errcode": 700001,
|
||||
"errmsg": "xxx",
|
||||
"fail_corp_list": [
|
||||
{
|
||||
"corpid": "wwxxx",
|
||||
"errcode": 700002,
|
||||
"errmsg": "xxx"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"payer_userid": "USERID",
|
||||
"order_id": "ORDERID"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"jobid": "JOBID"
|
||||
}
|
Loading…
Reference in New Issue
Block a user