feat(tenpayv3): 新增查询爱心餐品牌信息接口

This commit is contained in:
Fu Diwei 2024-02-18 21:07:33 +08:00
parent 3dae2573df
commit f6c23b8c45
5 changed files with 79 additions and 0 deletions

View File

@ -83,6 +83,7 @@
| √ | 其他:银行周周惠 | 合作伙伴 | |
| √ | 其他:微工卡 | 合作伙伴 | |
| √ | 其他:优惠费率活动 | 合作伙伴 | |
| √ | 其他:爱心餐 | 直连商户 | |
| × | <del>其他:清关报关</del> | 直连商户 | 官方未提供 v3 API |
| √ | 境外支付:子商户进件 | 合作伙伴 | |
| √ | 境外支付:融合钱包 | 合作伙伴 | |
@ -547,6 +548,10 @@
- 查询用户保险订单领取资格:`GetHirePowerBankUserQualificationByOpenId`
- 爱心餐
- 查询爱心餐品牌信息:`GetLovefeastBrandByBrandId`
</details>
---

View File

@ -0,0 +1,33 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
public static class WechatTenpayClientExecuteLovefeastExtensions
{
/// <summary>
/// <para>异步调用 [GET] /lovefeast/brands/{brand_id} 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/merchant/apis/lovefeast/brands/get-brand.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetLovefeastBrandByBrandIdResponse> ExecuteGetLovefeastBrandByBrandIdAsync(this WechatTenpayClient client, Models.GetLovefeastBrandByBrandIdRequest 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
.CreateFlurlRequest(request, HttpMethod.Get, "lovefeast", "brands", request.BrandId);
return await client.SendFlurlRequestAsJsonAsync<Models.GetLovefeastBrandByBrandIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /lovefeast/brands/{brand_id} 接口的请求。</para>
/// </summary>
public class GetLovefeastBrandByBrandIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置品牌 ID。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string BrandId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /lovefeast/brands/{brand_id} 接口的响应。</para>
/// </summary>
public class GetLovefeastBrandByBrandIdResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置捐赠数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("donate_count")]
[System.Text.Json.Serialization.JsonPropertyName("donate_count")]
public int DonateCount { get; set; }
/// <summary>
/// 获取或设置供餐数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("consume_count")]
[System.Text.Json.Serialization.JsonPropertyName("consume_count")]
public int? ConsumeCount { get; set; }
}
}

View File

@ -0,0 +1,4 @@
{
"donate_count": 25000,
"consume_count": 1250
}