feat(wxapi): 新增服务平台增值服务登录验证接口

This commit is contained in:
Fu Diwei 2022-10-26 18:01:14 +08:00
parent eaf24df660
commit af22620caf
11 changed files with 119 additions and 12 deletions

View File

@ -940,6 +940,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketGetPaidOrderListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /wxa/servicemarket/service/login_auth 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/service_market/interface/value_added/servicemarket_login_auth.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.WxaServiceMarketServiceLoginAuthResponse> ExecuteWxaServiceMarketServiceLoginAuthAsync(this WechatApiClient client, Models.WxaServiceMarketServiceLoginAuthRequest 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", "servicemarket", "service", "login_auth")
.SetQueryParam("access_token", request.ComponentAccessToken);
return await client.SendRequestWithJsonAsync<Models.WxaServiceMarketServiceLoginAuthResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ShortLink

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
@ -279,7 +279,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenID { get; set; }
public string? OpenId { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/express/business/order/cancel 接口的请求。</para>
@ -17,7 +17,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenID { get; set; }
public string? OpenId { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/express/business/order/get 接口的请求。</para>
@ -17,7 +17,7 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenID { get; set; }
public string? OpenId { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenID { get; set; }
public string? OpenId { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
@ -380,7 +380,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenID { get; set; } = string.Empty;
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发件人信息。

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /product/coupon/push 接口的请求。</para>
@ -17,6 +17,6 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenID { get; set; } = string.Empty;
public string OpenId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/login_auth 接口的请求。</para>
/// </summary>
public class WxaServiceMarketServiceLoginAuthRequest : WechatApiRequest, IInferable<WxaServiceMarketServiceLoginAuthRequest, WxaServiceMarketServiceLoginAuthResponse>
{
/// <summary>
/// 获取或设置第三方平台 AccessToken。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ComponentAccessToken { get; set; } = string.Empty;
/// <summary>
/// 获取或设置登录 Code。
/// </summary>
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
public string Code { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,52 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /wxa/servicemarket/service/login_auth 接口的响应。</para>
/// </summary>
public class WxaServiceMarketServiceLoginAuthResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long OrderId { get; set; }
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string? AppId { get; set; }
/// <summary>
/// 获取或设置用户 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenId { get; set; }
/// <summary>
/// 获取或设置购买的服务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_id")]
[System.Text.Json.Serialization.JsonPropertyName("service_id")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))]
public string ServiceId { get; set; } = default!;
/// <summary>
/// 获取或设置购买的 SKU ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("sku_id")]
[System.Text.Json.Serialization.JsonPropertyName("sku_id")]
public string SKUId { get; set; } = default!;
/// <summary>
/// 获取或设置购买的规格 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("spec_id")]
[System.Text.Json.Serialization.JsonPropertyName("spec_id")]
public string SpecificationId { get; set; } = default!;
}
}

View File

@ -0,0 +1,10 @@
{
"errcode": 0,
"errmsg": "ok",
"order_id": 123,
"openid": "xxx",
"appid": "xxxx",
"service_id": 123,
"sku_id": "xxx",
"spec_id": "yyy"
}