mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 01:58:14 +08:00
feat(tenpayv3): 新增商户风险管理相关接口
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,6 +8,82 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
public static class WechatTenpayClientExecuteMerchantRiskManageExtensions
|
||||
{
|
||||
#region TradeRisk
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /merchant-risk-manage/report-trade-union-information 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/docs/partner/apis/risk-manage/trade-risk/report-trade-risk-information.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreateMerchantRiskManageTradeUnionInformationReportResponse> ExecuteCreateMerchantRiskManageTradeUnionInformationReportAsync(this WechatTenpayClient client, Models.CreateMerchantRiskManageTradeUnionInformationReportRequest 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", "report-trade-union-information");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantRiskManageTradeUnionInformationReportResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /merchant-risk-manage/trade-risk-information 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/docs/partner/apis/risk-manage/trade-risk/query-trade-risk-information.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.GetMerchantRiskManageTradeRiskInformationResponse> ExecuteGetMerchantRiskManageTradeRiskInformationAsync(this WechatTenpayClient client, Models.GetMerchantRiskManageTradeRiskInformationRequest 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", "trade-risk-information")
|
||||
.SetQueryParam("out_trade_no", request.OutTradeNumber);
|
||||
|
||||
if (request.MerchantId != null)
|
||||
flurlReq.SetQueryParam("sp_mchid", request.MerchantId);
|
||||
|
||||
if (request.AcquiringBankId != null)
|
||||
flurlReq.SetQueryParam("acquiring_bank_id", request.AcquiringBankId);
|
||||
|
||||
if (request.ChannelId != null)
|
||||
flurlReq.SetQueryParam("channel_id", request.ChannelId);
|
||||
|
||||
if (request.SubMerchantId != null)
|
||||
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
|
||||
|
||||
if (request.ComplaintsInformation != null)
|
||||
flurlReq.SetQueryParam("complaints_information", request.ComplaintsInformation);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.GetMerchantRiskManageTradeRiskInformationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /merchant-risk-manage/trade-risk-result 接口。</para>
|
||||
/// <para>REF: https://pay.weixin.qq.com/docs/partner/apis/risk-manage/trade-risk/report-trade-risk-information.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreateMerchantRiskManageTradeRiskResultResponse> ExecuteCreateMerchantRiskManageTradeRiskResultAsync(this WechatTenpayClient client, Models.CreateMerchantRiskManageTradeRiskResultRequest 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", "trade-risk-result");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CreateMerchantRiskManageTradeRiskResultResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ViolationNotification
|
||||
/// <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>
|
||||
@@ -83,5 +159,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.DeleteMerchantRiskManageViolationNotificationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_url")]
|
||||
public string[] MediaUrl { get; set; } = default!;
|
||||
public string[] MediaUrlList { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class ServiceOrder
|
||||
|
@@ -0,0 +1,71 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/trade-risk-result 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreateMerchantRiskManageTradeRiskResultRequest : WechatTenpayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
|
||||
public string? AcquiringBankId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("channel_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
|
||||
public string? ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string? SubMerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string? OutTradeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置投诉信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("complaints_information")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("complaints_information")]
|
||||
public string? ComplaintsInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置风险类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_type")]
|
||||
public string? RiskType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_type")]
|
||||
public string? PunishType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段补充。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("additional_punish_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("additional_punish_type")]
|
||||
public string? AdditionalPunishType { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/trade-risk-result 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreateMerchantRiskManageTradeRiskResultResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
|
||||
public string? AcquiringBankId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("channel_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
|
||||
public string? ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string? SubMerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string? OutTradeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置风险类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_type")]
|
||||
public string? RiskType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_type")]
|
||||
public string? PunishType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_description")]
|
||||
public string? PunishDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段补充。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("additional_punish_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("additional_punish_type")]
|
||||
public string? AdditionalPunishType { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,253 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/report-trade-union-information 接口的请求。</para>
|
||||
/// </summary>
|
||||
[WechatTenpaySensitive]
|
||||
public class CreateMerchantRiskManageTradeUnionInformationReportRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class RechargeField
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置充值账号类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("account_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("account_type")]
|
||||
public int? AccountType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置充值账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("account")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("account")]
|
||||
public string? Account { get; set; }
|
||||
}
|
||||
|
||||
public class LivingExpensesField
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acc_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acc_no")]
|
||||
public string? AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置户名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acc_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acc_name")]
|
||||
public string? AccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置费种。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置城市。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("city")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("city")]
|
||||
public string? City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("address")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("address")]
|
||||
public string? Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置机构名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("company_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("company_name")]
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置缴费金额(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("amount")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("amount")]
|
||||
public int? Amount { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
|
||||
public string? AcquiringBankId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("channel_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
|
||||
public string? ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string? SubMerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string? OutTradeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户手机号(需使用平台公钥/证书加密)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("phone")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("phone")]
|
||||
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
|
||||
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
|
||||
public string? PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户实名证件号(需使用平台公钥/证书加密)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("certificates_number")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("certificates_number")]
|
||||
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
|
||||
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
|
||||
public string? IdCardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置终端 IP。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("client_ip")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("client_ip")]
|
||||
public string? ClientIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户判定交易的风险等级。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_level")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_level")]
|
||||
public int? RiskLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置线上线下标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("line_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("line_type")]
|
||||
public int? LineType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置虚拟实物标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_type")]
|
||||
public int? GoodsType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置物品发布类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("seller_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("seller_type")]
|
||||
public int? SellerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否需要物流发货。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_need_deliver")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_need_deliver")]
|
||||
public bool? IsNeedDeliver { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户设备类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("device_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("device_type")]
|
||||
public int? DeviceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置付款方用户标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("userid")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置手机号来源。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("phone_from")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("phone_from")]
|
||||
public int? PhoneFrom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置收款方用户标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("seller_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("seller_userid")]
|
||||
public string? SellerUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置业务场景。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scene")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scene")]
|
||||
public int? Scene { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置充值业务场景字段信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("recharge_fields")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("recharge_fields")]
|
||||
public Types.RechargeField? RechargeField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置生活缴费业务场景字段信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("living_expenses_fields")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("living_expenses_fields")]
|
||||
public Types.LivingExpensesField? LivingExpensesField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扩展字段 1。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("extra_fields1")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("extra_fields1")]
|
||||
public string? ExtraField1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扩展字段 2。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("extra_fields2")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("extra_fields2")]
|
||||
public string? ExtraField2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扩展字段 3。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("extra_fields3")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("extra_fields3")]
|
||||
public string? ExtraField3 { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /merchant-risk-manage/report-trade-union-information 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreateMerchantRiskManageTradeUnionInformationReportResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
|
||||
public string? AcquiringBankId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("channel_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
|
||||
public string? ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string? SubMerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string? OutTradeNumber { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /merchant-risk-manage/trade-risk-information 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class GetMerchantRiskManageTradeRiskInformationRequest : WechatTenpayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? AcquiringBankId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? SubMerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置投诉信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? ComplaintsInformation { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /merchant-risk-manage/trade-risk-information 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class GetMerchantRiskManageTradeRiskInformationResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置风险系数值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_score")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_score")]
|
||||
public int RiskScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置风险类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("risk_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("risk_type")]
|
||||
public string? RiskType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_type")]
|
||||
public string? PunishType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置处置手段描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("punish_description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("punish_description")]
|
||||
public string? PunishDescription { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"sp_mchid": "1900000109",
|
||||
"acquiring_bank_id": "1356485",
|
||||
"channel_id": "1900000108\t",
|
||||
"sub_mchid": "1900009231",
|
||||
"out_trade_no": "1217752501201407033233368018",
|
||||
"risk_type": "OTHER_RISK",
|
||||
"punish_type": "OTHER_PUNISH",
|
||||
"additional_punish_type": "SUSPEND_SETTLEMENT_NDAYS:10",
|
||||
"complaints_information": "商家说高额返利,支付很大金额之后发现并没有返利,是骗子"
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"sp_mchid": "1900000109",
|
||||
"acquiring_bank_id": "1356485",
|
||||
"channel_id": "1900000108",
|
||||
"sub_mchid": "1900009231",
|
||||
"out_trade_no": "1217752501201407033233368018",
|
||||
"risk_type": "OTHER_RISK",
|
||||
"punish_type": "OTHER_PUNISH",
|
||||
"additional_punish_type": "SUSPEND_SETTLEMENT_NDAYS:10",
|
||||
"punish_description": "延长商户账期7天"
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"sp_mchid": "1900000109",
|
||||
"acquiring_bank_id": "1356485",
|
||||
"channel_id": "1900000108",
|
||||
"sub_mchid": "1900009231",
|
||||
"out_trade_no": "1217752501201407033233368018",
|
||||
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
|
||||
"phone": "ca775af5f841bdf424b2e6eb86a6e21e",
|
||||
"certificates_number": "ca775af5f841bdf424b2e6eb86a6e21e",
|
||||
"client_ip": "123.12.12.123",
|
||||
"risk_level": 1,
|
||||
"line_type": 1,
|
||||
"goods_type": 1,
|
||||
"seller_type": 1,
|
||||
"is_need_deliver": false,
|
||||
"device_type": 1,
|
||||
"userid": "华为的账号:260XXX",
|
||||
"phone_from": 1,
|
||||
"seller_userid": "抖音的账号:XXXXX",
|
||||
"scene": 1,
|
||||
"recharge_fields": {
|
||||
"account_type": 1,
|
||||
"account": "example_account"
|
||||
},
|
||||
"living_expenses_fields": {
|
||||
"acc_no": "123456",
|
||||
"type": 1,
|
||||
"city": "湖南衡阳",
|
||||
"address": "广东省深圳市南山区海天二路33号",
|
||||
"acc_name": "詹讯",
|
||||
"company_name": "深圳电力",
|
||||
"amount": 500
|
||||
},
|
||||
"extra_fields1": "{\"key1\":\"value1\"}",
|
||||
"extra_fields2": "{\"key1\":\"value1\"}",
|
||||
"extra_fields3": "{\"key1\":\"value1\"}"
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"sp_mchid": "1900000109",
|
||||
"acquiring_bank_id": "1356485",
|
||||
"channel_id": "1900000108",
|
||||
"sub_mchid": "1900009231",
|
||||
"out_trade_no": "1217752501201407033233368018"
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"risk_score": 1,
|
||||
"risk_type": "OTHER_RISK",
|
||||
"punish_type": "OTHER_PUNISH",
|
||||
"punish_description": "延长商户账期7天"
|
||||
}
|
@@ -653,6 +653,44 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /merchant-risk-manage/report-trade-union-information)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_CreateMerchantRiskManageTradeUnionInformationReportRequest()
|
||||
{
|
||||
static Models.CreateMerchantRiskManageTradeUnionInformationReportRequest GenerateMockRequestModel()
|
||||
{
|
||||
return new Models.CreateMerchantRiskManageTradeUnionInformationReportRequest()
|
||||
{
|
||||
PhoneNumber = MOCK_PLAIN_STR,
|
||||
IdCardNumber = MOCK_PLAIN_STR
|
||||
};
|
||||
}
|
||||
|
||||
static void AssertMockRequestModel(Models.CreateMerchantRiskManageTradeUnionInformationReportRequest request, Func<string, string> decryptor)
|
||||
{
|
||||
Assert.NotEqual(MOCK_PLAIN_STR, request.PhoneNumber!);
|
||||
Assert.NotEqual(MOCK_PLAIN_STR, request.IdCardNumber!);
|
||||
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.PhoneNumber!));
|
||||
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.IdCardNumber!));
|
||||
Assert.Equal(MOCK_CERT_SN, request.WechatpayCertificateSerialNumber!, ignoreCase: true);
|
||||
}
|
||||
|
||||
var reqA1 = GenerateMockRequestModel();
|
||||
CreateMockClientUseRSA(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA1);
|
||||
AssertMockRequestModel(reqA1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
|
||||
|
||||
var reqA2 = GenerateMockRequestModel();
|
||||
CreateMockClientUseSM2(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA2);
|
||||
AssertMockRequestModel(reqA2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
|
||||
|
||||
var reqB1 = GenerateMockRequestModel();
|
||||
await CreateMockClientUseRSA(autoEncrypt: true).ExecuteCreateMerchantRiskManageTradeUnionInformationReportAsync(reqB1);
|
||||
AssertMockRequestModel(reqB1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
|
||||
|
||||
var reqB2 = GenerateMockRequestModel();
|
||||
await CreateMockClientUseSM2(autoEncrypt: true).ExecuteCreateMerchantRiskManageTradeUnionInformationReportAsync(reqB2);
|
||||
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /merchants)")]
|
||||
public async Task TestEncryptRequestSensitiveProperty_AddHKSubMerchantRequest()
|
||||
{
|
||||
|
Reference in New Issue
Block a user