feat(tenpayv3): 新增分账相关 API 封装

This commit is contained in:
Fu Diwei
2021-07-06 13:05:42 +08:00
parent 80c1099ea5
commit 1702b01ca5
19 changed files with 1014 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供分账相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecuteProfitSharingExtensions
{
/// <summary>
/// <para>异步调用 [POST] /profitsharing/orders 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_1.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateProfitSharingOrderResponse> ExecuteCreateProfitSharingOrderAsync(this WechatTenpayClient client, Models.CreateProfitSharingOrderRequest 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(HttpMethod.Post, "profitsharing", "orders")
.SetOptions(request);
return await client.SendRequestWithJsonAsync<Models.CreateProfitSharingOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /profitsharing/orders 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetProfitSharingOrderByOutOrderNumberResponse> ExecuteGetProfitSharingOrderByOutOrderNumberAsync(this WechatTenpayClient client, Models.GetProfitSharingOrderByOutOrderNumberRequest 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(HttpMethod.Get, "profitsharing", "orders")
.SetOptions(request)
.SetQueryParam("transaction_id", request.TransactionId)
.SetQueryParam("out_order_no", request.OutOrderNumber);
return await client.SendRequestAsync<Models.GetProfitSharingOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /profitsharing/return-orders 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_3.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateProfitSharingReturnOrderResponse> ExecuteCreateProfitSharingReturnOrderAsync(this WechatTenpayClient client, Models.CreateProfitSharingReturnOrderRequest 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(HttpMethod.Post, "profitsharing", "return-orders")
.SetOptions(request);
return await client.SendRequestWithJsonAsync<Models.CreateProfitSharingReturnOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /profitsharing/return-orders 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_4.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_4.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetProfitSharingReturnOrderByOutOrderNumberResponse> ExecuteGetProfitSharingReturnOrderByOutOrderNumberAsync(this WechatTenpayClient client, Models.GetProfitSharingReturnOrderByOutOrderNumberRequest 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(HttpMethod.Get, "profitsharing", "return-orders")
.SetOptions(request)
.SetQueryParam("out_order_no", request.OutOrderNumber)
.SetQueryParam("out_return_no", request.OutReturnNumber);
if (!string.IsNullOrEmpty(request.SubMerchantId))
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestAsync<Models.GetProfitSharingReturnOrderByOutOrderNumberResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /profitsharing/orders/unfreeze 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_5.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.SetProfitSharingOrderUnfrozenResponse> ExecuteSetProfitSharingOrderUnfrozenAsync(this WechatTenpayClient client, Models.SetProfitSharingOrderUnfrozenRequest 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(HttpMethod.Post, "profitsharing", "orders", "unfreeze")
.SetOptions(request);
return await client.SendRequestWithJsonAsync<Models.SetProfitSharingOrderUnfrozenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /profitsharing/transactions/{transaction_id}/amounts 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_6.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_6.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetProfitSharingTransactionAmountsResponse> ExecuteGetProfitSharingTransactionAmountsAsync(this WechatTenpayClient client, Models.GetProfitSharingTransactionAmountsRequest 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(HttpMethod.Get, "profitsharing", "transactions", request.TransactionId, "amounts")
.SetOptions(request);
return await client.SendRequestAsync<Models.GetProfitSharingTransactionAmountsResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /profitsharing/merchant-configs/{sub_mchid} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_7.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetProfitSharingMerchantConfigsResponse> ExecuteGetProfitSharingMerchantConfigsAsync(this WechatTenpayClient client, Models.GetProfitSharingMerchantConfigsRequest 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(HttpMethod.Get, "profitsharing", "merchant-configs", request.SubMerchantId)
.SetOptions(request);
return await client.SendRequestAsync<Models.GetProfitSharingMerchantConfigsResponse>(flurlReq, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /profitsharing/receivers/add 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_8.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_8.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.AddProfitSharingReceiverResponse> ExecuteAddProfitSharingReceiverAsync(this WechatTenpayClient client, Models.AddProfitSharingReceiverRequest 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(HttpMethod.Post, "profitsharing", "receivers", "add")
.SetOptions(request);
return await client.SendRequestWithJsonAsync<Models.AddProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /profitsharing/receivers/delete 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_9.shtml </para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter8_1_9.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DeleteProfitSharingReceiverResponse> ExecuteDeleteProfitSharingReceiverAsync(this WechatTenpayClient client, Models.DeleteProfitSharingReceiverRequest 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(HttpMethod.Post, "profitsharing", "receivers", "delete")
.SetOptions(request);
return await client.SendRequestWithJsonAsync<Models.DeleteProfitSharingReceiverResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/transactions/{transaction_id}/amounts 接口的请求。</para>
/// </summary>
public class GetProfitSharingTransactionAmountsRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信订单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string TransactionId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/transactions/{transaction_id}/amounts 接口的响应。</para>
/// </summary>
public class GetProfitSharingTransactionAmountsResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信订单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("transaction_id")]
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
public string TransactionId { get; set; } = default!;
/// <summary>
/// 获取或设置订单剩余待分金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("unsplit_amount")]
[System.Text.Json.Serialization.JsonPropertyName("unsplit_amount")]
public int UnsplitAmount { get; set; }
}
}

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/orders 接口的请求。</para>
/// </summary>
public class CreateProfitSharingOrderRequest : WechatTenpayRequest
{
public static class Types
{
public class Receiver
{
/// <summary>
/// 获取或设置分账接收方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分账接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分账个人姓名(需使用微信支付平台公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? NameEncryptedData { get; set; }
/// <summary>
/// 获取或设置分账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置分账描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("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("transaction_id")]
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
public string TransactionId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户分账单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_order_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_order_no")]
public string OutOrderNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分账接收方列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("receivers")]
[System.Text.Json.Serialization.JsonPropertyName("receivers")]
public IList<Types.Receiver> ReceiverList { get; set; } = new List<Types.Receiver>();
/// <summary>
/// 获取或设置是否解冻剩余未分资金。
/// </summary>
[Newtonsoft.Json.JsonProperty("unfreeze_unsplit")]
[System.Text.Json.Serialization.JsonPropertyName("unfreeze_unsplit")]
public bool IsUnsplitAmountUnfrozen { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/orders 接口的响应。</para>
/// </summary>
public class CreateProfitSharingOrderResponse : GetProfitSharingOrderByOutOrderNumberResponse
{
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/return-orders 接口的请求。</para>
/// </summary>
public class CreateProfitSharingReturnOrderRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信二级商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置商户分账单号。与字段 <see cref="OrderId"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_order_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_order_no")]
public string? OutOrderNumber { get; set; }
/// <summary>
/// 获取或设置微信分账单号。与字段 <see cref="OutOrderNumber"/> 二选一。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string? OrderId { get; set; }
/// <summary>
/// 获取或设置商户回退单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_return_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_return_no")]
public string OutReturnNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置回退商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("return_mchid")]
public string ReturnMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置回退金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置回退描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/return-orders 接口的响应。</para>
/// </summary>
public class CreateProfitSharingReturnOrderResponse : GetProfitSharingReturnOrderByOutOrderNumberResponse
{
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/orders 接口的请求。</para>
/// </summary>
public class GetProfitSharingOrderByOutOrderNumberRequest : WechatTenpayRequest
{
/// <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 TransactionId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户分账单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutOrderNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/orders 接口的响应。</para>
/// </summary>
public class GetProfitSharingOrderByOutOrderNumberResponse : WechatTenpayResponse
{
public static class Types
{
public class Receiver
{
/// <summary>
/// 获取或设置分账接收方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置分账接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = default!;
/// <summary>
/// 获取或设置分账金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置分账描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置分账结果。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public string Result { get; set; } = default!;
/// <summary>
/// 获取或设置分账失败原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_reason")]
[System.Text.Json.Serialization.JsonPropertyName("fail_reason")]
public string? FailReason { get; set; }
/// <summary>
/// 获取或设置分账创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置分账完成时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("finish_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("finish_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? FinishTime { 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("transaction_id")]
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
public string TransactionId { get; set; } = default!;
/// <summary>
/// 获取或设置商户分账单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_order_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_order_no")]
public string OutOrderNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信分账单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = default!;
/// <summary>
/// 获取或设置分账单状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("state")]
[System.Text.Json.Serialization.JsonPropertyName("state")]
public string State { get; set; } = default!;
/// <summary>
/// 获取或设置分账接收方列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("receivers")]
[System.Text.Json.Serialization.JsonPropertyName("receivers")]
public Types.Receiver[]? ReceiverList { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/return-orders 接口的请求。</para>
/// </summary>
public class GetProfitSharingReturnOrderByOutOrderNumberRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户分账单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutOrderNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户回退单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OutReturnNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/return-orders 接口的响应。</para>
/// </summary>
public class GetProfitSharingReturnOrderByOutOrderNumberResponse : WechatTenpayResponse
{
/// <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_order_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_order_no")]
public string OutOrderNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信分账单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = default!;
/// <summary>
/// 获取或设置商户回退单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_return_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_return_no")]
public string OutReturnNumber { get; set; } = default!;
/// <summary>
/// 获取或设置微信回退单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_id")]
[System.Text.Json.Serialization.JsonPropertyName("return_id")]
public string ReturnId { get; set; } = default!;
/// <summary>
/// 获取或设置回退商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("return_mchid")]
public string ReturnMerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置回退金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置回退描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置回退结果。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public string Result { get; set; } = default!;
/// <summary>
/// 获取或设置回退失败原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_reason")]
[System.Text.Json.Serialization.JsonPropertyName("fail_reason")]
public string? FailReason { get; set; }
/// <summary>
/// 获取或设置回退创建时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset CreateTime { get; set; }
/// <summary>
/// 获取或设置回退完成时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("finish_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("finish_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? FinishTime { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/merchant-configs/{sub_mchid} 接口的请求。</para>
/// </summary>
public class GetProfitSharingMerchantConfigsRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string SubMerchantId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /profitsharing/merchant-configs/{sub_mchid} 接口的响应。</para>
/// </summary>
public class GetProfitSharingMerchantConfigsResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置最大分账比例(单位:万分比)。
/// </summary>
[Newtonsoft.Json.JsonProperty("max_ratio")]
[System.Text.Json.Serialization.JsonPropertyName("max_ratio")]
public int MaxRatio { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/receivers/add 接口的请求。</para>
/// </summary>
public class AddProfitSharingReceiverRequest : WechatTenpayRequest
{
/// <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("appid")]
[System.Text.Json.Serialization.JsonPropertyName("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("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 获取或设置接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = string.Empty;
/// <summary>
/// 获取或设置接收方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置与分账方的关系类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("relation_type")]
[System.Text.Json.Serialization.JsonPropertyName("relation_type")]
public string RelationType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置自定义的分账关系。
/// </summary>
[Newtonsoft.Json.JsonProperty("custom_relation")]
[System.Text.Json.Serialization.JsonPropertyName("custom_relation")]
public string? CustomRelation { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/receivers/add 接口的响应。</para>
/// </summary>
public class AddProfitSharingReceiverResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置接收方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = default!;
/// <summary>
/// 获取或设置接收方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置与分账方的关系类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("relation_type")]
[System.Text.Json.Serialization.JsonPropertyName("relation_type")]
public string RelationType { get; set; } = default!;
/// <summary>
/// 获取或设置自定义的分账关系。
/// </summary>
[Newtonsoft.Json.JsonProperty("custom_relation")]
[System.Text.Json.Serialization.JsonPropertyName("custom_relation")]
public string? CustomRelation { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/receivers/delete 接口的请求。</para>
/// </summary>
public class DeleteProfitSharingReceiverRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("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("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 获取或设置接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/receivers/delete 接口的响应。</para>
/// </summary>
public class DeleteProfitSharingReceiverResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置接收方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置接收方账户。
/// </summary>
[Newtonsoft.Json.JsonProperty("account")]
[System.Text.Json.Serialization.JsonPropertyName("account")]
public string Account { get; set; } = default!;
}
}

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/orders/unfreeze 接口的请求。</para>
/// </summary>
public class SetProfitSharingOrderUnfrozenRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置微信子商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sub_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置微信订单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("transaction_id")]
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
public string TransactionId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户分账单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_order_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_order_no")]
public string OutOrderNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置分账描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /profitsharing/orders/unfreeze 接口的响应。</para>
/// </summary>
public class SetProfitSharingOrderUnfrozenResponse : GetProfitSharingOrderByOutOrderNumberResponse
{
}
}