mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 22:58:02 +08:00
feat(tenpayv3): 新增商户平台处置通知相关接口
This commit is contained in:
parent
80e30e595d
commit
70bc8f128a
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 VIOLATION.PUNISH 通知的数据。</para>
|
||||
/// <para>表示 VIOLATION.INTERCEPT 通知的数据。</para>
|
||||
/// <para>表示 VIOLATION.APPEAL 通知的数据。</para>
|
||||
/// </summary>
|
||||
public class ViolationResource : WechatTenpayEvent.Types.IDecryptedResource
|
||||
{
|
||||
/// <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("company_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("company_name")]
|
||||
public string CompanyName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户违约处理通知 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("record_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("record_id")]
|
||||
public string RecordId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处罚方案。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_plan")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_plan")]
|
||||
public string PunishPlan { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处罚时间。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_time")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_time")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
|
||||
public DateTimeOffset PunishTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处罚方案描述信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_description")]
|
||||
public string PunishDescription { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置风险类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_type")]
|
||||
public string RiskType { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置风险描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_description")]
|
||||
public string RiskDescription { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
/// <summary>
|
||||
/// 为 <see cref="WechatTenpayClient"/> 提供商户平台处置通知相关的 API 扩展方法。
|
||||
/// </summary>
|
||||
public static class WechatTenpayClientExecuteMerchantRiskManageExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /merchant-risk-manage/violation-notifications 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_3_1.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreateMerchantRiskManageViolationNotificationResponse> ExecuteCreateMerchantRiskManageViolationNotificationAsync(this WechatTenpayClient client, Models.CreateMerchantRiskManageViolationNotificationRequest 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, "merchant-risk-manage", "violation-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantRiskManageViolationNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /merchant-risk-manage/violation-notifications 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_3_2.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.GetMerchantRiskManageViolationNotificationResponse> ExecuteGetMerchantRiskManageViolationNotificationAsync(this WechatTenpayClient client, Models.GetMerchantRiskManageViolationNotificationRequest 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.Get, "merchant-risk-manage", "violation-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantRiskManageViolationNotificationResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [PUT] /merchant-risk-manage/violation-notifications 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_3_3.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.UpdateMerchantRiskManageViolationNotificationResponse> ExecuteUpdateMerchantRiskManageViolationNotificationAsync(this WechatTenpayClient client, Models.UpdateMerchantRiskManageViolationNotificationRequest 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.Put, "merchant-risk-manage", "violation-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UpdateMerchantRiskManageViolationNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [DELETE] /merchant-risk-manage/violation-notifications 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter10_3_4.shtml </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.DeleteMerchantRiskManageViolationNotificationResponse> ExecuteDeleteMerchantRiskManageViolationNotificationAsync(this WechatTenpayClient client, Models.DeleteMerchantRiskManageViolationNotificationRequest 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.Delete, "merchant-risk-manage", "violation-notifications");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteMerchantRiskManageViolationNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/violation-notifications 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreateMerchantRiskManageViolationNotificationRequest : WechatTenpayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置回调通知地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("notify_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
|
||||
public string NotifyUrl { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/violation-notifications 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreateMerchantRiskManageViolationNotificationResponse : GetMerchantRiskManageViolationNotificationResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [DELETE] /merchant-risk-manage/violation-notifications 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class DeleteMerchantRiskManageViolationNotificationRequest : WechatTenpayRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [DELETE] /merchant-risk-manage/violation-notifications 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class DeleteMerchantRiskManageViolationNotificationResponse : WechatTenpayResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /merchant-risk-manage/violation-notifications 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class GetMerchantRiskManageViolationNotificationRequest : WechatTenpayRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /merchant-risk-manage/violation-notifications 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class GetMerchantRiskManageViolationNotificationResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置回调通知地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("notify_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
|
||||
public string NotifyUrl { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [PUT] /merchant-risk-manage/violation-notifications 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class UpdateMerchantRiskManageViolationNotificationRequest : WechatTenpayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置回调通知地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("notify_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
|
||||
public string NotifyUrl { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [PUT] /merchant-risk-manage/violation-notifications 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class UpdateMerchantRiskManageViolationNotificationResponse : GetMerchantRiskManageViolationNotificationResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"sub_mchid": "1900009231",
|
||||
"company_name": "财付通支付科技有限公司",
|
||||
"record_id": "200201820200101080076610000",
|
||||
"punish_plan": "关闭支付权限",
|
||||
"punish_time": "2015-05-20T13:29:35+08:00",
|
||||
"punish_description": "利用特殊行业违规经营,加重处罚",
|
||||
"risk_type": "ONE_YUAN_PURCHASES",
|
||||
"risk_description": "涉嫌一元购"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php"
|
||||
}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"notify_url": "https://www.weixin.qq.com/wxpay/pay.php"
|
||||
}
|
Loading…
Reference in New Issue
Block a user