mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 01:46:20 +08:00
feat(tenpayv3): 新增微信分付支付方式前置曝光相关接口
This commit is contained in:
parent
223232fe5b
commit
992bbf1ee0
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
{
|
||||
public static class WechatTenpayClientExecutePayAcquiringBankTransactionsExtensions
|
||||
{
|
||||
#region Exposure
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /pay/acquiring-bank/transactions/exposure 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://pay.weixin.qq.com/doc/v3/partner/4014326541 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreatePayAcquiringBankTransactionExposureResponse> ExecuteCreatePayAcquiringBankTransactionExposureAsync(this WechatTenpayClient client, Models.CreatePayAcquiringBankTransactionExposureRequest 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, "pay", "acquiring-bank", "transactions", "exposure");
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CreatePayAcquiringBankTransactionExposureResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -283,5 +283,32 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ReversePayPartnerTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#region Exposure
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /pay/partner/transactions/exposure 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://pay.weixin.qq.com/doc/v3/partner/4014326522 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreatePayPartnerTransactionExposureResponse> ExecuteCreatePayPartnerTransactionExposureAsync(this WechatTenpayClient client, Models.CreatePayPartnerTransactionExposureRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (request.MerchantId is null)
|
||||
request.MerchantId = client.Credentials.MerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "exposure");
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CreatePayPartnerTransactionExposureResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -248,5 +248,32 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.ReversePayTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
#region Exposure
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /pay/transactions/exposure 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://pay.weixin.qq.com/doc/v3/merchant/4014326314 ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreatePayTransactionExposureResponse> ExecuteCreatePayTransactionExposureAsync(this WechatTenpayClient client, Models.CreatePayTransactionExposureRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (request.MerchantId is null)
|
||||
request.MerchantId = client.Credentials.MerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "pay", "transactions", "exposure");
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CreatePayTransactionExposureResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/transactions/exposure 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreatePayTransactionExposureRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Payer
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openid")]
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置手机号哈希值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("phone_number_hash")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("phone_number_hash")]
|
||||
public string? PhoneNumberHash { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信商户号。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.MerchantId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付者信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payer")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payer")]
|
||||
public Types.Payer? Payer { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/transactions/exposure 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreatePayTransactionExposureResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否建议曝光微信分付。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("fqf_exposure")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("fqf_exposure")]
|
||||
public bool IsExposed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置曝光凭证。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("market_exposure_token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("market_exposure_token")]
|
||||
public string? MarketExposureToken { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/acquiring-bank/transactions/exposure 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreatePayAcquiringBankTransactionExposureRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Payer
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_openid")]
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户在特约商户下的唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("merchant_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("merchant_openid")]
|
||||
public string? SubOpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置手机号哈希值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("phone_number_hash")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("phone_number_hash")]
|
||||
public string? PhoneNumberHash { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_id")]
|
||||
public string AquiringBankId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从业机构 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("acquiring_bank_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("acquiring_bank_appid")]
|
||||
public string? AquiringBankAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置特约商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("merchant_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("merchant_id")]
|
||||
public string SubMerchantId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置特约商户 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("merchant_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("merchant_appid")]
|
||||
public string? SubAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("channel_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("channel_id")]
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付者信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payer")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payer")]
|
||||
public Types.Payer? Payer { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/acquiring-bank/transactions/exposure 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreatePayAcquiringBankTransactionExposureResponse : CreatePayTransactionExposureResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/partner/transactions/exposure 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreatePayPartnerTransactionExposureRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Payer
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_openid")]
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户在子商户下的唯一标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_openid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_openid")]
|
||||
public string? SubOpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置手机号哈希值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("phone_number_hash")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("phone_number_hash")]
|
||||
public string? PhoneNumberHash { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.MerchantId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string SubMerchantId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务商 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
|
||||
public string? SubAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付者信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payer")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payer")]
|
||||
public Types.Payer? Payer { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/partner/transactions/exposure 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreatePayPartnerTransactionExposureResponse : CreatePayTransactionExposureResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"mchid": "example_mchid",
|
||||
"appid": "wxd678efh567hg6787",
|
||||
"payer": {
|
||||
"openid": "oLTPCuEfSOSZA6X5uR_JxNKjrGLg",
|
||||
"phone_number_hash": "ABDEF3445546456B"
|
||||
},
|
||||
"out_trade_no": "example_out_trade_no"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"fqf_exposure": true,
|
||||
"market_exposure_token": "Dfkdsf324+-LKFD="
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"acquiring_bank_id": "1900000100",
|
||||
"acquiring_bank_appid": "wx8888888888888888",
|
||||
"merchant_id": "1900000109",
|
||||
"merchant_appid": "wx8888888888888888",
|
||||
"channel_id": "19000001",
|
||||
"payer": {
|
||||
"acquiring_bank_openid": "oLTPCuEfSOSZA6X5uR_JxNKjrGLg",
|
||||
"phone_number_hash": "ABDEF3445546456B",
|
||||
"merchant_openid": "oLTPCuEfSOSZA6X5uR_JxNKjrGLg"
|
||||
},
|
||||
"out_trade_no": "example_out_trade_no"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"fqf_exposure": true,
|
||||
"market_exposure_token": "Dfkdsf324+-LKFD="
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"sp_mchid": "example_sp_mchid",
|
||||
"sp_appid": "wxd678efh567hg6787",
|
||||
"sub_mchid": "example_sub_mchid",
|
||||
"sub_appid": "wxd678efh567hg6787",
|
||||
"payer": {
|
||||
"sp_openid": "oLTPCuEfSOSZA6X5uR_JxNKjrGLg",
|
||||
"phone_number_hash": "ABDEF3445546456B",
|
||||
"sub_openid": "oLTPCuEfSOSZA6X5uR_JxNKjrGLg"
|
||||
},
|
||||
"out_trade_no": "example_out_trade_no"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"fqf_exposure": true,
|
||||
"market_exposure_token": "Dfkdsf324+-LKFD="
|
||||
}
|
Loading…
Reference in New Issue
Block a user