feat(tenpayv3): 新增平台收付通赔付相关接口

This commit is contained in:
Fu Diwei 2024-09-04 11:36:15 +08:00
parent 00ca567802
commit 94b3441985
18 changed files with 195 additions and 2 deletions

View File

@ -1002,6 +1002,12 @@
- 关闭充值:`ClosePlatformSolutionEcommerceRecharge`
- 平台收付通(赔付)
- 开通保险理赔功能:`ApplyPlatformSolutionEcommerceInsuranceCompensationContract`
- 查询保险理赔功能开通状态:`GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantId`
- 代金券
- 创建代金券批次:`CreateMarketingFavorStock`

View File

@ -8,6 +8,53 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
public static class WechatTenpayClientExecutePlatformSolutionExtensions
{
#region EcommerceInsuranceCompensationContracts
/// <summary>
/// <para>异步调用 [POST] /platsolution/ecommerce/insurance-compensation-contracts 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/plat-compensation/plat-compensation/open-insurance-compensation.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ApplyPlatformSolutionEcommerceInsuranceCompensationContractResponse> ExecuteApplyPlatformSolutionEcommerceInsuranceCompensationContractAsync(this WechatTenpayClient client, Models.ApplyPlatformSolutionEcommerceInsuranceCompensationContractRequest 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.Post, "platsolution", "ecommerce", "insurance-compensation-contracts");
return await client.SendFlurlRequestAsJsonAsync<Models.ApplyPlatformSolutionEcommerceInsuranceCompensationContractResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [GET] /platsolution/ecommerce/insurance-compensation-contracts/sub-mchid/{sub_mchid}/check-opened 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/plat-compensation/plat-compensation/check-insurance-compensation-opened.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdResponse> ExecuteGetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdAsync(this WechatTenpayClient client, Models.GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdRequest 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, "platsolution", "ecommerce", "insurance-compensation-contracts", "sub-mchid", request.SubMerchantId, "check-opened")
.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendFlurlRequestAsJsonAsync<Models.GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region EcommerceRecharges
/// <summary>
/// <para>异步调用 [POST] /platsolution/ecommerce/recharges/apply 接口。</para>

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /platsolution/ecommerce/insurance-compensation-contracts 接口的请求。</para>
/// </summary>
public class ApplyPlatformSolutionEcommerceInsuranceCompensationContractRequest : WechatTenpayRequest
{
public static class Types
{
public class Agreement
{
/// <summary>
/// 获取或设置协议编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("agreement_code")]
[System.Text.Json.Serialization.JsonPropertyName("agreement_code")]
public string AgreementCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置协议版本号。
/// </summary>
[Newtonsoft.Json.JsonProperty("agreement_version")]
[System.Text.Json.Serialization.JsonPropertyName("agreement_version")]
public string AgreementVersion { get; set; } = string.Empty;
/// <summary>
/// 获取或设置签约主体。
/// </summary>
[Newtonsoft.Json.JsonProperty("sign_organization")]
[System.Text.Json.Serialization.JsonPropertyName("sign_organization")]
public string SignOrganization { get; set; } = string.Empty;
/// <summary>
/// 获取或设置签约时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("sign_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.Rfc3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("sign_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.Rfc3339DateTimeOffsetConverter))]
public DateTimeOffset SignTime { get; set; }
}
}
/// <summary>
/// 获取或设置二级商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户申请单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_apply_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_apply_no")]
public string OutApplyNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置签约协议列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("agreement_list")]
[System.Text.Json.Serialization.JsonPropertyName("agreement_list")]
public IList<Types.Agreement> AgreementList { get; set; } = new List<Types.Agreement>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /platsolution/ecommerce/insurance-compensation-contracts 接口的响应。</para>
/// </summary>
public class ApplyPlatformSolutionEcommerceInsuranceCompensationContractResponse : GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdResponse
{
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /platsolution/ecommerce/insurance-compensation-contracts/sub-mchid/{sub_mchid}/check-opened 接口的请求。</para>
/// </summary>
public class GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置二级商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string SubMerchantId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,33 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /platsolution/ecommerce/insurance-compensation-contracts/sub-mchid/{sub_mchid}/check-opened 接口的响应。</para>
/// </summary>
public class GetPlatformSolutionEcommerceInsuranceCompensationContractBySubMerchantIdResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置二级商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string SubMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置是否开通成功。
/// </summary>
[Newtonsoft.Json.JsonProperty("opened")]
[System.Text.Json.Serialization.JsonPropertyName("opened")]
public bool IsOpened { get; set; }
/// <summary>
/// 获取或设置开通成功时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.Rfc3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("success_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.Rfc3339DateTimeOffsetConverter))]
public DateTimeOffset? SuccessTime { get; set; }
}
}

View File

@ -0,0 +1,12 @@
{
"out_apply_no": "No123456",
"sub_mchid": "1900000109",
"agreement_list": [
{
"agreement_code": "微信支付运营功能服务协议(平台二级商户)",
"agreement_version": "20240815",
"sign_organization": "温州名优贸易",
"sign_time": "2024-08-08T10:34:56+08:00"
}
]
}

View File

@ -0,0 +1,5 @@
{
"sub_mchid": "1900000109",
"opened": true,
"success_time": "2024-08-09T13:29:35.120+08:00"
}