mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 14:04:32 +08:00
feat(wxapi): 新增标准版交易组件验证二维码相关接口
This commit is contained in:
parent
9b4e6c12c1
commit
ea5042d26e
@ -1583,5 +1583,67 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.ProductFundsSetBankAccountResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Qrcode
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /product/qrcode/gen 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/qrcode/gen_qrcode.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ProductQrcodeGenerateResponse> ExecuteProductQrcodeGenerateAsync(this WechatApiClient client, Models.ProductQrcodeGenerateRequest 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, "product", "qrcode", "gen")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ProductQrcodeGenerateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /product/qrcode/get 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/qrcode/get_qrcode.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ProductQrcodeGetResponse> ExecuteProductQrcodeGetAsync(this WechatApiClient client, Models.ProductQrcodeGetRequest 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, "product", "qrcode", "get")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ProductQrcodeGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /product/qrcode/check 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/qrcode/check_qrcode.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.ProductQrcodeCheckResponse> ExecuteProductQrcodeCheckAsync(this WechatApiClient client, Models.ProductQrcodeCheckRequest 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, "product", "qrcode", "check")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.ProductQrcodeCheckResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/check 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeCheckRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二维码 Ticket。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ticket")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ticket")]
|
||||
public string QrcodeTicket { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/check 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeCheckResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置自检业务返回错误码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("self_check_err_code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("self_check_err_code")]
|
||||
public int SelfCheckErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置自检业务返回错误码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("self_check_err_msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("self_check_err_msg")]
|
||||
public string? SelfCheckErrorMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扫码状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扫码者身份。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scan_user_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scan_user_type")]
|
||||
public int? ScanUserType { get; set; }
|
||||
|
||||
public override bool IsSuccessful()
|
||||
{
|
||||
return base.IsSuccessful() && SelfCheckErrorCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/gen 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeGenerateRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置需要验证的身份。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int Type { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/gen 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeGenerateResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二维码 Ticket。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("qrcode_ticket")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("qrcode_ticket")]
|
||||
public string QrcodeTicket { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/get 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeGetRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二维码 Ticket。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ticket")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ticket")]
|
||||
public string QrcodeTicket { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /product/qrcode/get 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class ProductQrcodeGetResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置经 Base64 编码的二维码二进制流。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("qrcode_buf")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("qrcode_buf")]
|
||||
public string EncodingQrcodeBuffer { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ticket": "05ba627d5b73b6f3ef0dcfc7"
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"status": 0,
|
||||
"self_check_err_code": 0,
|
||||
"self_check_err_msg": "",
|
||||
"scan_user_type": 1
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": 1
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"qrcode_ticket": "xxxxx"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ticket": "05ba627d5b73b6f3ef0dcfc7"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"qrcode_buf": "xxxxx"
|
||||
}
|
Loading…
Reference in New Issue
Block a user