feat(tenpayv3): 新增电商收付通合单代扣相关接口

This commit is contained in:
Fu Diwei 2023-04-06 20:33:05 +08:00
parent 65af9282cf
commit acb0926554
29 changed files with 905 additions and 5 deletions

View File

@ -770,6 +770,20 @@
- 合单关闭订单:`CloseCombineTransaction`
- 电商收付通(合单代扣)
- APP 方式预签约:`PresignEcommerceCombinePAPayContractEntrustApp`
- 查询协议:`GetEcommerceCombinePAPPayContractByOutContractCode`
- 解约协议:`TerminatEcommerceCombinePAPPayContract`
- 支付:`CreateEcommerceCombinePAPPayTransaction`
- 撤销订单:`ReverseEcommerceCombinePAPPayTransaction`
- 查询订单:`GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumber`
- 电商收付通(分账)
- 请求分账:`CreateEcommerceProfitSharingOrder`

View File

@ -1,4 +1,4 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
/// <summary>
/// <para>表示 TRANSACTION.SUCCESS 通知的数据。</para>

View File

@ -0,0 +1,93 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
/// <summary>
/// <para>表示 ECOMMERCE_ENTRUST.SIGN 通知的数据。</para>
/// <para>表示 ECOMMERCE_ENTRUST.TERMINATE 通知的数据。</para>
/// </summary>
public class EcommerceEntrustResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
public class SubOrder : Models.GetCombineTransactionByCombineOutTradeNumberResponse.Types.SubOrder
{
}
public class Scene : Models.GetCombineTransactionByCombineOutTradeNumberResponse.Types.Scene
{
}
public class Payer : Models.GetCombineTransactionByCombineOutTradeNumberResponse.Types.Payer
{
}
}
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public virtual string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public virtual string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置商户侧签约协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_contract_code")]
[System.Text.Json.Serialization.JsonPropertyName("out_contract_code")]
public string OutContractCode { get; set; } = default!;
/// <summary>
/// 获取或设置委托代扣协议 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = default!;
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置操作时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("operate_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("operate_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset OperateTime { get; set; }
/// <summary>
/// 获取或设置到期时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_expired_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("contract_expired_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? ExpireTime { get; set; }
/// <summary>
/// 获取或设置解约方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_termination_mode")]
[System.Text.Json.Serialization.JsonPropertyName("contract_termination_mode")]
public string? TerminationMode { get; set; }
}
}

View File

@ -554,5 +554,142 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.CancelEcommerceSubsidyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region CombinePAPPay
/// <summary>
/// <para>异步调用 [POST] /ecommerce/combine-papay/contracts/pre-entrust-sign 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.PresignEcommerceCombinePAPayContractEntrustAppResponse> ExecutePresignEcommerceCombinePAPayContractEntrustAppAsync(this WechatTenpayClient client, Models.PresignEcommerceCombinePAPayContractEntrustAppRequest 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, "ecommerce", "combine-papay", "contracts", "pre-entrust-sign");
return await client.SendRequestWithJsonAsync<Models.PresignEcommerceCombinePAPayContractEntrustAppResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetEcommerceCombinePAPPayContractByOutContractCodeResponse> ExecuteGetEcommerceCombinePAPPayContractByOutContractCodeAsync(this WechatTenpayClient client, Models.GetEcommerceCombinePAPPayContractByOutContractCodeRequest 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, "ecommerce", "combine-papay", "contracts", "plan-id", request.PlanId, "out-contract-code", request.OutContractCode);
return await client.SendRequestWithJsonAsync<Models.GetEcommerceCombinePAPPayContractByOutContractCodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code}/terminate 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.TerminatEcommerceCombinePAPPayContractResponse> ExecuteTerminatEcommerceCombinePAPPayContractAsync(this WechatTenpayClient client, Models.TerminatEcommerceCombinePAPPayContractRequest 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, "ecommerce", "combine-papay", "contracts", "plan-id", request.PlanId, "out-contract-code", request.OutContractCode, "terminate");
return await client.SendRequestWithJsonAsync<Models.TerminatEcommerceCombinePAPPayContractResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /ecommerce/combine-papay/transactions 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateEcommerceCombinePAPPayTransactionResponse> ExecuteCreateEcommerceCombinePAPPayTransactionAsync(this WechatTenpayClient client, Models.CreateEcommerceCombinePAPPayTransactionRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
if (request.CombineMerchantId != null)
request.CombineMerchantId = client.Credentials.MerchantId;
if (request.SubOrderList != null)
{
foreach (var subOrder in request.SubOrderList)
{
if (subOrder.MerchantId == null)
subOrder.MerchantId = request.CombineMerchantId;
}
}
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "ecommerce", "combine-papay", "transactions");
return await client.SendRequestWithJsonAsync<Models.CreateEcommerceCombinePAPPayTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /ecommerce/combine-papay/transactions/{combine_out_trade_no}/reverse 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ReverseEcommerceCombinePAPPayTransactionResponse> ExecuteReverseEcommerceCombinePAPPayTransactionAsync(this WechatTenpayClient client, Models.ReverseEcommerceCombinePAPPayTransactionRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
if (request.SubOrderList != null)
{
foreach (var subOrder in request.SubOrderList)
{
if (subOrder.MerchantId == null)
subOrder.MerchantId = client.Credentials.MerchantId;
}
}
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "ecommerce", "combine-papay", "transactions", request.CombineOutTradeNumber, "reverse");
return await client.SendRequestWithJsonAsync<Models.ReverseEcommerceCombinePAPPayTransactionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /ecommerce/combine-papay/transactions/{combine_out_trade_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter5_5_6.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberResponse> ExecuteGetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberAsync(this WechatTenpayClient client, Models.GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberRequest 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, "ecommerce", "combine-papay", "transactions", request.CombineOutTradeNumber);
return await client.SendRequestWithJsonAsync<Models.GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
@ -25,6 +25,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置子单子商户 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_appid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
public string? SubAppId { get; set; }
/// <summary>
/// 获取或设置子单商户订单号。
/// </summary>

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
@ -75,7 +75,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("attach")]
[System.Text.Json.Serialization.JsonPropertyName("attach")]
public string Attachment { get; set; } = string.Empty;
public string? Attachment { get; set; }
/// <summary>
/// 获取或设置商品描述。

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
@ -141,6 +141,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string? OpenId { get; set; }
}
public class Scene
{
/// <summary>

View File

@ -0,0 +1,76 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/transactions 接口的请求。</para>
/// </summary>
public class CreateEcommerceCombinePAPPayTransactionRequest : WechatTenpayRequest
{
public static class Types
{
public class SubOrder : CreateCombineTransactionAppRequest.Types.SubOrder
{
public static new class Types
{
public class Amount : CreateCombineTransactionAppRequest.Types.SubOrder.Types.Amount
{
}
public class Settlement : CreateCombineTransactionAppRequest.Types.SubOrder.Types.Settlement
{
}
}
/// <summary>
/// 获取或设置金额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public new Types.Amount Amount { get; set; } = new Types.Amount();
/// <summary>
/// 获取或设置结算信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("settle_info")]
[System.Text.Json.Serialization.JsonPropertyName("settle_info")]
public new Types.Settlement? Settlement { get; set; }
}
}
/// <summary>
/// 获取或设置合单发起方的微信商户号。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.MerchantId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("combine_mchid")]
public string? CombineMerchantId { get; set; }
/// <summary>
/// 获取或设置合单发起方的微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_appid")]
[System.Text.Json.Serialization.JsonPropertyName("combine_appid")]
public string CombineAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置委托代扣协议 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置合单商户订单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_out_trade_no")]
[System.Text.Json.Serialization.JsonPropertyName("combine_out_trade_no")]
public string CombineOutTradeNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_orders")]
[System.Text.Json.Serialization.JsonPropertyName("sub_orders")]
public IList<Types.SubOrder> SubOrderList { get; set; } = new List<Types.SubOrder>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/transactions 接口的响应。</para>
/// </summary>
public class CreateEcommerceCombinePAPPayTransactionResponse : GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberResponse
{
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code} 接口的请求。</para>
/// </summary>
public class GetEcommerceCombinePAPPayContractByOutContractCodeRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户侧签约协议号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutContractCode { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,120 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code} 接口的响应。</para>
/// </summary>
public class GetEcommerceCombinePAPPayContractByOutContractCodeResponse : WechatTenpayResponse
{
public static class Types
{
public class Termination
{
/// <summary>
/// 获取或设置解约时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_terminated_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("contract_terminated_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset TerminateTime { get; set; }
/// <summary>
/// 获取或设置解约方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_termination_mode")]
[System.Text.Json.Serialization.JsonPropertyName("contract_termination_mode")]
public string TerminationMode { get; set; } = default!;
/// <summary>
/// 获取或设置解约备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_termination_remark")]
[System.Text.Json.Serialization.JsonPropertyName("contract_termination_remark")]
public string TerminationRemark { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户签约协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_contract_code")]
[System.Text.Json.Serialization.JsonPropertyName("out_contract_code")]
public string OutContractCode { get; set; } = default!;
/// <summary>
/// 获取或设置委托代扣协议 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = default!;
/// <summary>
/// 获取或设置用户账户展示名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_display_account")]
[System.Text.Json.Serialization.JsonPropertyName("contract_display_account")]
public string DisplayName { get; set; } = default!;
/// <summary>
/// 获取或设置协议状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_state")]
[System.Text.Json.Serialization.JsonPropertyName("contract_state")]
public string State { get; set; } = default!;
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置签署时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_signed_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("contract_signed_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset SignTime { get; set; }
/// <summary>
/// 获取或设置到期时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_expired_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("contract_expired_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset ExpireTime { get; set; }
/// <summary>
/// 获取或设置解约信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_terminate_info")]
[System.Text.Json.Serialization.JsonPropertyName("contract_terminate_info")]
public Types.Termination? Termination { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /ecommerce/combine-papay/transactions/{combine_out_trade_no} 接口的请求。</para>
/// </summary>
public class GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置合单商户订单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string CombineOutTradeNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,67 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /ecommerce/combine-papay/transactions/{combine_out_trade_no} 接口的响应。</para>
/// </summary>
public class GetEcommerceCombinePAPPayTransactionByCombineOutTradeNumberResponse : WechatTenpayResponse
{
public static class Types
{
public class SubOrder : GetCombineTransactionByCombineOutTradeNumberResponse.Types.SubOrder
{
public static new class Types
{
public class Amount : GetCombineTransactionByCombineOutTradeNumberResponse.Types.SubOrder.Types.Amount
{
}
}
/// <summary>
/// 获取或设置金额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public new Types.Amount Amount { get; set; } = default!;
}
public class Payer : GetCombineTransactionByCombineOutTradeNumberResponse.Types.Payer
{
}
}
/// <summary>
/// 获取或设置合单发起方的微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_appid")]
[System.Text.Json.Serialization.JsonPropertyName("combine_appid")]
public string CombineAppId { get; set; } = default!;
/// <summary>
/// 获取或设置合单发起方的微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("combine_mchid")]
public string CombineMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置合单商户订单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_out_trade_no")]
[System.Text.Json.Serialization.JsonPropertyName("combine_out_trade_no")]
public string CombineOutTradeNumber { get; set; } = default!;
/// <summary>
/// 获取或设置子单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_orders")]
[System.Text.Json.Serialization.JsonPropertyName("sub_orders")]
public Types.SubOrder[]? SubOrderList { get; set; } = default!;
/// <summary>
/// 获取或设置支付者信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_payer_info")]
[System.Text.Json.Serialization.JsonPropertyName("combine_payer_info")]
public Types.Payer? CombinePayer { get; set; }
}
}

View File

@ -0,0 +1,50 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/contracts/pre-entrust-sign 接口的请求。</para>
/// </summary>
public class PresignEcommerceCombinePAPayContractEntrustAppRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string AppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户签约协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_contract_code")]
[System.Text.Json.Serialization.JsonPropertyName("out_contract_code")]
public string OutContractCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用户账户展示名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_display_account")]
[System.Text.Json.Serialization.JsonPropertyName("contract_display_account")]
public string DisplayName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置回调通知地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public string NotifyUrl { get; set; } = string.Empty;
/// <summary>
/// 获取或设置是否签约后返回 App。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_app")]
[System.Text.Json.Serialization.JsonPropertyName("return_app")]
public bool? RequireReturnApp { get; set; }
}
}

View File

@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/contracts/pre-entrust-sign 接口的响应。</para>
/// </summary>
public class PresignEcommerceCombinePAPayContractEntrustAppResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户签约协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_contract_code")]
[System.Text.Json.Serialization.JsonPropertyName("out_contract_code")]
public string OutContractCode { get; set; } = default!;
/// <summary>
/// 获取或设置委托代扣签约会话 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("pre_entrustweb_id")]
[System.Text.Json.Serialization.JsonPropertyName("pre_entrustweb_id")]
public string SessionId { get; set; } = default!;
}
}

View File

@ -0,0 +1,45 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/transactions/{combine_out_trade_no}/reverse 接口的请求。</para>
/// </summary>
public class ReverseEcommerceCombinePAPPayTransactionRequest : WechatTenpayRequest
{
public static class Types
{
public class SubOrder : CloseCombineTransactionRequest.Types.SubOrder
{
}
}
/// <summary>
/// 获取或设置合单发起方的微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("combine_appid")]
[System.Text.Json.Serialization.JsonPropertyName("combine_appid")]
public string CombineAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置委托代扣协议 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置合单商户订单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string CombineOutTradeNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置子单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_orders")]
[System.Text.Json.Serialization.JsonPropertyName("sub_orders")]
public IList<Types.SubOrder> SubOrderList { get; set; } = new List<Types.SubOrder>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/transactions/{combine_out_trade_no}/reverse 接口的响应。</para>
/// </summary>
public class ReverseEcommerceCombinePAPPayTransactionResponse : WechatTenpayResponse
{
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code}/terminate 接口的请求。</para>
/// </summary>
public class TerminatEcommerceCombinePAPPayContractRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户侧签约协议号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutContractCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置解约备注。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_termination_remark")]
[System.Text.Json.Serialization.JsonPropertyName("contract_termination_remark")]
public string? TerminationRemark { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /ecommerce/combine-papay/contracts/plan-id/{plan_id}/out-contract-code/{out_contract_code}/terminate 接口的响应。</para>
/// </summary>
public class TerminatEcommerceCombinePAPPayContractResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public int PlanId { get; set; }
/// <summary>
/// 获取或设置商户签约协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_contract_code")]
[System.Text.Json.Serialization.JsonPropertyName("out_contract_code")]
public string OutContractCode { get; set; } = default!;
}
}

View File

@ -0,0 +1,9 @@
{
"mchid": "1230000109",
"out_contract_code": "wxwtdk20200910100000",
"plan_id": 12535,
"appid": "wxd678efh567hg6787",
"openid": "o-MYE42l80oelYMDE34nYD456Xoy",
"contract_termination_mode": "MCH_API_TERMINATE",
"operate_time": "2020-05-20T13:29:35.120+08:00"
}

View File

@ -0,0 +1,24 @@
{
"combine_appid": "wxd678efh567hg6787",
"combine_mchid": "1900000109",
"combine_out_trade_no": "P20150806125346",
"contract_id": "123124412412423431",
"sub_orders": [
{
"mchid": "1900000109",
"attach": "深圳分店",
"amount": {
"total_amount": 100,
"currency": "CNY"
},
"out_trade_no": "20150806125346",
"sub_mchid": "1900000109",
"sub_appid": "wxd678efh567hg6787",
"description": "腾讯充值中心-QQ会员充值",
"settle_info": {
"profit_sharing": true,
"subsidy_amount": 10
}
}
]
}

View File

@ -0,0 +1,28 @@
{
"combine_appid": "wxd678efh567hg6787",
"combine_mchid": "1900000109",
"combine_out_trade_no": "P20150806125346",
"sub_orders": [
{
"mchid": "1900000109",
"trade_type": "PAP",
"trade_state": "SUCCESS",
"bank_type": "CMC",
"attach": "深圳分店",
"success_time": "2015-05-20T13:29:35.120+08:00",
"transaction_id": "1009660380201506130728806387",
"out_trade_no": "20150806125346",
"sub_mchid": "1900000109",
"sub_appid": "wxd678efh567hg6787",
"amount": {
"total_amount": 100,
"currency": "CNY",
"payer_amount": 10,
"payer_currency": "CNY"
}
}
],
"combine_payer_info": {
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
}
}

View File

@ -0,0 +1,17 @@
{
"mchid": "1900000109",
"contract_id": "123124412412423431",
"appid": "wxd678efh567hg6787",
"plan_id": 12535,
"out_contract_code": "wxwtdk20200910100000",
"contract_display_account": "微信代扣用户A",
"contract_state": "SIGNED",
"contract_signed_time": "2020-09-10T13:29:35.120+08:00",
"contract_expired_time": "2021-09-10T13:29:35.120+08:00",
"contract_terminate_info": {
"contract_termination_mode": "MCH_API_TERMINATE",
"contract_terminated_time": "2020-10-10T13:29:35.120+08:00",
"contract_termination_remark": "用户解约"
},
"openid": "o-MYE42l80oelYMDE34nYD456Xoy"
}

View File

@ -0,0 +1,28 @@
{
"combine_appid": "wxd678efh567hg6787",
"combine_mchid": "1900000109",
"combine_out_trade_no": "P20150806125346",
"sub_orders": [
{
"mchid": "1900000109",
"trade_type": "PAP",
"trade_state": "SUCCESS",
"bank_type": "CMC",
"attach": "深圳分店",
"success_time": "2015-05-20T13:29:35.120+08:00",
"transaction_id": "1009660380201506130728806387",
"out_trade_no": "20150806125346",
"sub_mchid": "1900000109",
"sub_appid": "wxd678efh567hg6787",
"amount": {
"total_amount": 100,
"currency": "CNY",
"payer_amount": 10,
"payer_currency": "CNY"
}
}
],
"combine_payer_info": {
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
}
}

View File

@ -0,0 +1,8 @@
{
"appid": "wxd678efh567hg6787",
"plan_id": 12535,
"out_contract_code": "wxwtdk20200910100000",
"contract_display_account": "微信代扣用户A",
"notify_url": "https://yourapp.com/notify",
"return_app": true
}

View File

@ -0,0 +1,6 @@
{
"pre_entrustweb_id": "5778aadY9nltAsZzXixCkFIGYnV2V",
"mchid": "1900000109",
"plan_id": 12535,
"out_contract_code": "wxwtdk20200910100000"
}

View File

@ -0,0 +1,11 @@
{
"combine_appid": "wxd678efh567hg6787",
"sub_orders": [
{
"mchid": "1900000109",
"out_trade_no": "20150806125346",
"sub_mchid": "1900000109",
"sub_appid": "wxd678efh567hg6787"
}
]
}

View File

@ -0,0 +1,5 @@
{
"mchid": "1900000109",
"plan_id": 12535,
"out_contract_code": "wxwtdk20200910100000"
}