feat(wxapi): 新增第三方平台复用商户号资质快速转正相关接口

This commit is contained in:
Fu Diwei 2022-05-01 21:48:33 +08:00
parent e963eb902e
commit 7f42ad1851
9 changed files with 260 additions and 0 deletions

View File

@ -0,0 +1,45 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Events
{
/// <summary>
/// <para>表示 EVENT.betaapp_reuse_merchant_ID_appid_administrator_authorization_apply_event 事件的数据。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastverifyV2.html </para>
/// </summary>
public class BetaAppReuseMerchantIdAppIdAdministratorAuthorizationApplyEvent : WechatApiEvent, WechatApiEvent.Serialization.IXmlSerializable
{
public static class Types
{
public class EventData
{
/// <summary>
/// 获取或设置小程序的 AppId。
/// </summary>
[System.Xml.Serialization.XmlElement("appid")]
public string MiniProgramAppId { get; set; } = default!;
/// <summary>
/// 获取或设置状态。
/// </summary>
[System.Xml.Serialization.XmlElement("status")]
public int Status { get; set; }
/// <summary>
/// 获取或设置操作时间戳。
/// </summary>
[System.Xml.Serialization.XmlElement("operation_time")]
public long OperateTimestamp { get; set; }
/// <summary>
/// 获取或设置错误信息。
/// </summary>
[System.Xml.Serialization.XmlElement("msg", IsNullable = true)]
public string? ErrorMessage { get; set; }
}
}
/// <summary>
/// 获取或设置事件数据。
/// </summary>
[System.Xml.Serialization.XmlElement("ApplyPersonalAuthorizationInfoNotify")]
public Types.EventData EventData { get; set; } = default!;
}
}

View File

@ -0,0 +1,63 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Events
{
/// <summary>
/// <para>表示 EVENT.betaapp_reuse_merchant_ID_merchant_administrator_authorization_apply_event 事件的数据。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastverifyV2.html </para>
/// </summary>
public class BetaAppReuseMerchantIdMerchantAdministratorAuthorizationApplyEvent : WechatApiEvent, WechatApiEvent.Serialization.IXmlSerializable
{
public static class Types
{
public class EventData
{
/// <summary>
/// 获取或设置小程序的 AppId。
/// </summary>
[System.Xml.Serialization.XmlElement("appid")]
public string MiniProgramAppId { get; set; } = default!;
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[System.Xml.Serialization.XmlElement("taskid")]
public string TaskId { get; set; } = default!;
/// <summary>
/// 获取或设置状态。
/// </summary>
[System.Xml.Serialization.XmlElement("status")]
public int Status { get; set; }
/// <summary>
/// 获取或设置小程序管理员访问的授权 URL。
/// </summary>
[System.Xml.Serialization.XmlElement("authorize_appid_administrator_url")]
public string AuthorizeAppIdAdministratorUrl { get; set; } = default!;
/// <summary>
/// 获取或设置商户号管理员授权的状态。
/// </summary>
[System.Xml.Serialization.XmlElement("authorize_merchant_administrator_status")]
public int AuthorizeMerchantAdministratorStatus { get; set; }
/// <summary>
/// 获取或设置操作时间戳。
/// </summary>
[System.Xml.Serialization.XmlElement("operation_time")]
public long OperateTimestamp { get; set; }
/// <summary>
/// 获取或设置错误信息。
/// </summary>
[System.Xml.Serialization.XmlElement("msg", IsNullable = true)]
public string? ErrorMessage { get; set; }
}
}
/// <summary>
/// 获取或设置事件数据。
/// </summary>
[System.Xml.Serialization.XmlElement("ApplyMerchantAdminAuthorizationInfoNotify")]
public Types.EventData EventData { get; set; } = default!;
}
}

View File

@ -10,6 +10,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
public static class WechatApiClientExecuteWxaComponentExtensions
{
#region Register
/// <summary>
/// <para>异步调用 [POST] /wxa/component/reusemchidfastnormalizebetaweapp 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastverifyV2.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WxaComponentReuseMerchantIdFastMormalizeBetaWeappResponse> ExecuteWxaComponentReuseMerchantIdFastMormalizeBetaWeappAsync(this WechatApiClient client, Models.WxaComponentReuseMerchantIdFastMormalizeBetaWeappRequest 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, "wxa", "component", "reusemchidfastnormalizebetaweapp")
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("action", request.Action);
return await client.SendRequestWithJsonAsync<Models.WxaComponentReuseMerchantIdFastMormalizeBetaWeappResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /wxa/component/fastregisterbetaweapp 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastregister.html </para>

View File

@ -0,0 +1,43 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/component/reusemchidfastnormalizebetaweapp 接口的请求。</para>
/// </summary>
public class WxaComponentReuseMerchantIdFastMormalizeBetaWeappRequest : WechatApiRequest, IInferable<WxaComponentReuseMerchantIdFastMormalizeBetaWeappRequest, WxaComponentReuseMerchantIdFastMormalizeBetaWeappResponse>
{
/// <summary>
/// 获取或设置操作类型。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string Action { get; set; } = string.Empty;
/// <summary>
/// 获取或设置服务商商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("primary_merchant_code")]
[System.Text.Json.Serialization.JsonPropertyName("primary_merchant_code")]
public string? PrimaryMerchantId { get; set; }
/// <summary>
/// 获取或设置商家商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_merchant_code")]
[System.Text.Json.Serialization.JsonPropertyName("sub_merchant_code")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置第三方联系电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("component_phone")]
[System.Text.Json.Serialization.JsonPropertyName("component_phone")]
public string? ComponentPhoneNumber { get; set; }
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("taskid")]
[System.Text.Json.Serialization.JsonPropertyName("taskid")]
public string? TaskId { get; set; }
}
}

View File

@ -0,0 +1,45 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/component/reusemchidfastnormalizebetaweapp 接口的响应。</para>
/// </summary>
public class WxaComponentReuseMerchantIdFastMormalizeBetaWeappResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("taskid")]
[System.Text.Json.Serialization.JsonPropertyName("taskid")]
public string? TaskId { get; set; }
/// <summary>
/// 获取或设置商户号管理员授权的 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_merchant_administrator_url")]
[System.Text.Json.Serialization.JsonPropertyName("authorize_merchant_administrator_url")]
public string? AuthorizeMerchantAdministratorUrl { get; set; }
/// <summary>
/// 获取或设置商户管理员授权的任务状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_merchant_administrator_status")]
[System.Text.Json.Serialization.JsonPropertyName("authorize_merchant_administrator_status")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public int? AuthorizeMerchantAdministratorStatus { get; set; }
/// <summary>
/// 获取或设置待转正小程序管理员授权的 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_appid_administrator_url")]
[System.Text.Json.Serialization.JsonPropertyName("authorize_appid_administrator_url")]
public string? AuthorizeAppIdAdministratorUrl { get; set; }
/// <summary>
/// 获取或设置待转正小程序管理员授权的任务状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("authorize_appid_administrator_status")]
[System.Text.Json.Serialization.JsonPropertyName("authorize_appid_administrator_status")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public int? AuthorizeAppIdAdministratorStatus { get; set; }
}
}

View File

@ -0,0 +1,13 @@
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>123456</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[betaapp_reuse_merchant_ID_appid_administrator_authorization_apply_event]]></Event>
<ApplyPersonalAuthorizationInfoNotify>
<appid><![CDATA[小程序appid]]></appid>
<status><![CDATA[0]]></status>
<msg><![CDATA[ok]]></msg>
<operation_time>123456</operation_time>
</ApplyPersonalAuthorizationInfoNotify>
</xml>

View File

@ -0,0 +1,15 @@
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>123456</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[betaapp_reuse_merchant_ID_merchant_administrator_authorization_apply_event]]></Event>
<ApplyMerchantAdminAuthorizationInfoNotify>
<appid><![CDATA[小程序appid]]></appid>
<status>0</status>
<taskid><![CDATA[转正任务id]]></taskid>
<authorize_appid_administrator_url><![CDATA[小程序管理员访问的授权url]]></authorize_appid_administrator_url>
<authorize_merchant_administrator_status>1</authorize_merchant_administrator_status>
<operation_time>123456</operation_time>
</ApplyMerchantAdminAuthorizationInfoNotify>
</xml>

View File

@ -0,0 +1,6 @@
{
"primary_merchant_code": "1234567899",
"sub_merchant_code": "1234567890",
"component_phone": "88888888",
"taskid": "9e141c6158fdxxxx"
}

View File

@ -0,0 +1,9 @@
{
"errcode": "0",
"errmsg": "ok",
"authorize_merchant_administrator_url": "data:image/xxxxx",
"authorize_merchant_administrator_status": 0,
"authorize_appid_administrator_url": "https://mp.weixin.qq.com/publicpoc/reusemchidfastnormalizebetawxa?action=scan&tid=d836xxxxxxxxb3eb#wechat_redirect",
"authorize_appid_administrator_status": "0",
"taskid": "9e141c6158fdxxxx"
}