mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 10:41:58 +08:00
feat(wxapi): 新增小游戏查询虚拟支付订单状态接口
This commit is contained in:
parent
eec1428ae6
commit
4e40454ce7
@ -68,7 +68,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <para>异步调用 [POST] /wxa/game/getbalance 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]> <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment-v2/pay_v2.getBalance.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
@ -96,7 +97,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <para>异步调用 [POST] /wxa/game/pay 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]> <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment-v2/pay_v2.pay.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
@ -124,7 +126,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <para>异步调用 [POST] /wxa/game/cancelpay 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]> <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment-v2/pay_v2.cancelPay.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
@ -152,7 +155,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
/// <para>异步调用 [POST] /wxa/game/present 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]>
|
||||
/// <![CDATA[ https://docs.qq.com/doc/DVUN0QWJja0J5c2x4 ]]> <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment-v2/pay_v2.present.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
@ -175,5 +179,33 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.WxaGamePresentResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/game/queryorderinfo 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment-v2/pay_v2.queryOrder.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaGameQueryOrderInfoResponse> ExecuteWxaGameQueryOrderInfoAsync(this WechatApiClient client, Models.WxaGameQueryOrderInfoRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
PreprocessRequest(client, ref request);
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "wxa", "game", "queryorderinfo")
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("sig_method", request.SignMethod)
|
||||
.SetQueryParam("signature", request.Signature)
|
||||
.SetQueryParam("pay_sig", request.PaySign);
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.WxaGameQueryOrderInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/game/queryorderinfo 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaGameQueryOrderInfoRequest : WxaGameRequestBase, IInferable<WxaGameQueryOrderInfoRequest, WxaGameQueryOrderInfoResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置外部订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置业务类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("biz_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("biz_id")]
|
||||
public int BusinessType { get; set; }
|
||||
|
||||
protected internal override string GetRequestPath()
|
||||
{
|
||||
return "/wxa/game/queryorderinfo";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/game/queryorderinfo 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaGameQueryOrderInfoResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置道具 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
|
||||
public string ProductId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置外部订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信支付商户单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mch_order_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mch_order_no")]
|
||||
public string? MerchantOrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信支付订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("transaction_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
|
||||
public string? TransactionId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("pay_state")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("pay_state")]
|
||||
public int PayState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置发货状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("deliver_state")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("deliver_state")]
|
||||
public int DeliverState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付完成时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("pay_finish_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("pay_finish_time")]
|
||||
public long? PayFinishTimestamp { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"openid": "oUrsfxxxxxxxxxx",
|
||||
"ts": 1668512806,
|
||||
"env": 0,
|
||||
"out_trade_no": "test_queryorderinfo_1668512806",
|
||||
"offer_id": "xxxx",
|
||||
"biz_id": 1
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"out_trade_no": "test_queryorderinfo_1668512806",
|
||||
"pay_finish_time": 1669364790,
|
||||
"product_id": "id_100001",
|
||||
"deliver_state": 1,
|
||||
"pay_state": 1,
|
||||
"mch_order_no": "1217752501201407033233368018",
|
||||
"transaction_id": "1217752501201407033233368018"
|
||||
}
|
Loading…
Reference in New Issue
Block a user