mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(tenpayv3): 新增出行券切卡组件预下单接口
This commit is contained in:
parent
ffa4e2e540
commit
22de12aa20
@ -41,6 +41,7 @@
|
||||
| √ | 营销工具:委托营销 | 直连商户 & 服务商 | |
|
||||
| √ | 营销工具:消费卡 | 直连商户 & 服务商 | |
|
||||
| √ | 营销工具:支付有礼 | 直连商户 & 服务商 | |
|
||||
| √ | 营销工具:代扣服务切卡组件 | 直连商户 & 服务商 | |
|
||||
| √ | 营销工具:图片上传(营销专用) | 直连商户 & 服务商 | |
|
||||
| × | <del>营销工具:现金红包</del> | <del>直连商户 & 服务商</del> | 官方未提供 v3 API |
|
||||
| √ | 营销工具:银行定向促活 | 直连商户 & 服务商 | |
|
||||
@ -366,6 +367,10 @@
|
||||
|
||||
- 删除活动发券商户号:`DeleteMarketingPayGiftActivityMerchant`
|
||||
|
||||
- 代扣服务切卡组件
|
||||
|
||||
- 出行券切卡组件预下单:`CreateIndustryCouponToken`
|
||||
|
||||
- 图片上传(营销专用):`UploadMarketingMediaImage`
|
||||
|
||||
- 银行定向促活
|
||||
@ -922,6 +927,10 @@
|
||||
|
||||
- 删除活动发券商户号:`DeleteMarketingPayGiftActivityMerchant`
|
||||
|
||||
- 代扣服务切卡组件
|
||||
|
||||
- 出行券切卡组件预下单:`CreateIndustryCouponToken`
|
||||
|
||||
- 图片上传(营销专用):`UploadMarketingMediaImage`
|
||||
|
||||
- 资金应用
|
||||
|
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
/// <summary>
|
||||
/// 为 <see cref="WechatTenpayClient"/> 提供出行券相关的 API 扩展方法。
|
||||
/// </summary>
|
||||
public static class WechatTenpayClientExecuteIndustryCouponExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /industry-coupon/tokens 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_9_1.shtml </para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter9_9_1.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreateIndustryCouponTokenResponse> ExecuteCreateIndustryCouponTokenAsync(this WechatTenpayClient client, Models.CreateIndustryCouponTokenRequest 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, "industry-coupon", "tokens");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateIndustryCouponTokenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /industry-coupon/tokens 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreateIndustryCouponTokenRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Coupon
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置批次号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("stock_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("stock_id")]
|
||||
public int StockId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置券 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("coupon_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("coupon_id")]
|
||||
public string CouponId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户的 OpenId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("open_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("open_id")]
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置券列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("coupon_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("coupon_list")]
|
||||
public IList<Types.Coupon> CouponList { get; set; } = new List<Types.Coupon>();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /industry-coupon/tokens 接口的响应。</para>
|
||||
/// </summary>
|
||||
[WechatTenpaySensitive]
|
||||
public class CreateIndustryCouponTokenResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置切卡组件 Token。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("token")]
|
||||
public string Token { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 Token 过期时间。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expires_time")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expires_time")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
|
||||
public DateTimeOffset ExpireTime { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"coupon_list": [
|
||||
{
|
||||
"coupon_id": "11004999626",
|
||||
"stock_id": 16474341
|
||||
}
|
||||
],
|
||||
"open_id": "obLatjrR8kUDlj4-nofQsPAJAAFI"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"expires_time": "2015-05-20T13:29:35+08:00",
|
||||
"token": "16824f40-aec1-11e8-a69c-f7a44da04f19"
|
||||
}
|
Loading…
Reference in New Issue
Block a user