feat(tenpayv3): 新增 ETC 扣费相关接口

This commit is contained in:
Fu Diwei
2023-04-03 17:41:40 +08:00
parent 183d1afa1e
commit 7d019e0fb7
33 changed files with 1198 additions and 9 deletions

View File

@@ -0,0 +1,71 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
/// <summary>
/// <para>表示 TRANSACTION.SUCCESS仅限 ETC 扣费)通知的数据。</para>
/// </summary>
public class VehicleETCTransactionResource : WechatTenpayEvent.Types.IDecryptedResource
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
public string MerchantId { get; set; } = default!;
/// <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; } = default!;
/// <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("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>
/// 获取或设置 ETC 扣费授权协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = default!;
/// <summary>
/// 获取或设置车牌号。
/// </summary>
[Newtonsoft.Json.JsonProperty("plate_number")]
[System.Text.Json.Serialization.JsonPropertyName("plate_number")]
public string PlateNumber { get; set; } = default!;
/// <summary>
/// 获取或设置绑定状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("bind_state")]
[System.Text.Json.Serialization.JsonPropertyName("bind_state")]
public string BindState { get; set; } = default!;
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
@@ -12,6 +12,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// </summary>
public static class WechatTenpayClientExecuteVehicleExtensions
{
#region Parking
/// <summary>
/// <para>异步调用 [GET] /vehicle/parking/services/find 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_8_1.shtml </para>
@@ -58,7 +59,9 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.CreateVehicleParkingResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Transactions
/// <summary>
/// <para>异步调用 [POST] /vehicle/transactions/parking 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_8_3.shtml </para>
@@ -101,5 +104,136 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
return await client.SendRequestWithJsonAsync<Models.GetVehicleTransactionByOutTradeNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region ETC
/// <summary>
/// <para>异步调用 [POST] /vehicle/etc/preopen 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_1.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.PreopenVehicleETCResponse> ExecutePreopenVehicleETCAsync(this WechatTenpayClient client, Models.PreopenVehicleETCRequest 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, "vehicle", "etc", "preopen");
return await client.SendRequestWithJsonAsync<Models.PreopenVehicleETCResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /vehicle/etc/transactions/highway 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateVehicleETCTransactionHighwayResponse> ExecuteCreateVehicleETCTransactionHighwayAsync(this WechatTenpayClient client, Models.CreateVehicleETCTransactionHighwayRequest 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, "vehicle", "etc", "transactions", "highway");
return await client.SendRequestWithJsonAsync<Models.CreateVehicleETCTransactionHighwayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /vehicle/etc/users/{openid}/contracts 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetVehicleETCContractByOpenIdResponse> ExecuteGetVehicleETCContractByOpenIdAsync(this WechatTenpayClient client, Models.GetVehicleETCContractByOpenIdRequest 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, "vehicle", "etc", "users", request.OpenId, "contracts")
.SetQueryParam("plan_id", request.PlanId)
.SetQueryParam("plate_number", request.PlateNumber);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestWithJsonAsync<Models.GetVehicleETCContractByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /vehicle/etc/contracts/{contract_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetVehicleETCContractByContractIdResponse> ExecuteGetVehicleETCContractByContractIdAsync(this WechatTenpayClient client, Models.GetVehicleETCContractByContractIdRequest 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, "vehicle", "etc", "contracts", request.ContractId);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestWithJsonAsync<Models.GetVehicleETCContractByContractIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /vehicle/etc/transactions/out-trade-no/{out_trade_no} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_8.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetVehicleETCTransactionByOutTradeNumberResponse> ExecuteGetVehicleETCTransactionByOutTradeNumberAsync(this WechatTenpayClient client, Models.GetVehicleETCTransactionByOutTradeNumberRequest 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, "vehicle", "etc", "transactions", "out-trade-no", request.OutTradeNumber);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestWithJsonAsync<Models.GetVehicleETCTransactionByOutTradeNumberResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /vehicle/etc/transactions/id/{transaction_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_4_8.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetVehicleETCTransactionByTransactionIdResponse> ExecuteGetVehicleETCTransactionByTransactionIdAsync(this WechatTenpayClient client, Models.GetVehicleETCTransactionByTransactionIdRequest 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, "vehicle", "etc", "transactions", "id", request.TransactionId);
if (request.SubMerchantId != null)
flurlReq.SetQueryParam("sub_mchid", request.SubMerchantId);
return await client.SendRequestWithJsonAsync<Models.GetVehicleETCTransactionByTransactionIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@@ -63,7 +63,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// 获取或设置用户手机号码(需使用平台公钥/证书加密)
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
@@ -72,7 +72,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// 获取或设置用户邮箱地址(需使用平台公钥/证书加密)
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]

View File

@@ -144,7 +144,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// 获取或设置用户手机号码(需使用商户私钥解密)
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
@@ -153,7 +153,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// 获取或设置用户邮箱地址(需使用商户私钥解密)
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]

View File

@@ -56,7 +56,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// 获取或设置用户手机号码(需使用平台公钥/证书加密)
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
@@ -65,7 +65,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// 获取或设置用户邮箱地址(需使用平台公钥/证书加密)
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]

View File

@@ -0,0 +1,195 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /vehicle/etc/transactions/highway 接口的请求。</para>
/// </summary>
public class CreateVehicleETCTransactionHighwayRequest : WechatTenpayRequest
{
public static class Types
{
public class Amount
{
/// <summary>
/// 获取或设置总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total")]
[System.Text.Json.Serialization.JsonPropertyName("total")]
public int Total { get; set; }
/// <summary>
/// 获取或设置币种。
/// <para>默认值CNY</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("currency")]
[System.Text.Json.Serialization.JsonPropertyName("currency")]
public string Currency { get; set; } = "CNY";
}
public class Highway
{
/// <summary>
/// 获取或设置车牌号。
/// </summary>
[Newtonsoft.Json.JsonProperty("plate_number")]
[System.Text.Json.Serialization.JsonPropertyName("plate_number")]
public string PlateNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置入站时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("start_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("start_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset StartTime { get; set; }
/// <summary>
/// 获取或设置出站时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("end_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("end_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset EndTime { get; set; }
/// <summary>
/// 获取或设置通道类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("channel_type")]
[System.Text.Json.Serialization.JsonPropertyName("channel_type")]
public string ChannelType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置车辆类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("car_type")]
[System.Text.Json.Serialization.JsonPropertyName("car_type")]
public string CarType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置入口名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("entrance")]
[System.Text.Json.Serialization.JsonPropertyName("entrance")]
public string? Entrance { get; set; }
/// <summary>
/// 获取或设置出口名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("exit")]
[System.Text.Json.Serialization.JsonPropertyName("exit")]
public string? Exit { get; set; }
/// <summary>
/// 获取或设置承载人数。
/// </summary>
[Newtonsoft.Json.JsonProperty("carrying_capacity")]
[System.Text.Json.Serialization.JsonPropertyName("carrying_capacity")]
public int? CarryingCapacity { get; set; }
/// <summary>
/// 获取或设置荷载范围字符串。
/// </summary>
[Newtonsoft.Json.JsonProperty("carrying_range")]
[System.Text.Json.Serialization.JsonPropertyName("carrying_range")]
public string? CarryingRangeString { get; set; }
}
public class Device
{
/// <summary>
/// 获取或设置商户端设备号。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_id")]
[System.Text.Json.Serialization.JsonPropertyName("device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// 获取或设置商户端设备 IP。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_ip")]
[System.Text.Json.Serialization.JsonPropertyName("device_ip")]
public string? DeviceIp { get; set; }
}
}
/// <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("out_trade_no")]
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
public string OutTradeNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 ETC 扣费授权协议号。
/// </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("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
/// <summary>
/// 获取或设置附加信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("attach")]
[System.Text.Json.Serialization.JsonPropertyName("attach")]
public string? Attachment { get; set; }
/// <summary>
/// 获取或设置订单优惠标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_tag")]
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
public string? GoodsTag { get; set; }
/// <summary>
/// 获取或设置金额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public Types.Amount Amount { get; set; } = new Types.Amount();
/// <summary>
/// 获取或设置高速信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("highway_info")]
[System.Text.Json.Serialization.JsonPropertyName("highway_info")]
public Types.Highway Highway { get; set; } = new Types.Highway();
/// <summary>
/// 获取或设置设备信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_info")]
[System.Text.Json.Serialization.JsonPropertyName("device_info")]
public Types.Device? Device { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /vehicle/etc/transactions/highway 接口的响应。</para>
/// </summary>
public class CreateVehicleETCTransactionHighwayResponse : GetVehicleETCTransactionByOutTradeNumberResponse
{
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/contracts/{contract_id} 接口的请求。</para>
/// </summary>
public class GetVehicleETCContractByContractIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置子商户号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SubMerchantId { get; set; }
/// <summary>
/// 获取或设置 ETC 扣费授权协议号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string ContractId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/contracts/{contract_id} 接口的响应。</para>
/// </summary>
public class GetVehicleETCContractByContractIdResponse : GetVehicleETCContractByOpenIdResponse
{
}
}

View File

@@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/users/{openid}/contracts 接口的请求。</para>
/// </summary>
public class GetVehicleETCContractByOpenIdRequest : 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 OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 ETC 授权扣费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string PlanId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置车牌号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string PlateNumber { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,71 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/users/{openid}/contracts 接口的响应。</para>
/// </summary>
public class GetVehicleETCContractByOpenIdResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("sp_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
public string MerchantId { get; set; } = default!;
/// <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; } = default!;
/// <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("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>
/// 获取或设置 ETC 扣费授权协议号。
/// </summary>
[Newtonsoft.Json.JsonProperty("contract_id")]
[System.Text.Json.Serialization.JsonPropertyName("contract_id")]
public string ContractId { get; set; } = default!;
/// <summary>
/// 获取或设置车牌号。
/// </summary>
[Newtonsoft.Json.JsonProperty("plate_number")]
[System.Text.Json.Serialization.JsonPropertyName("plate_number")]
public string PlateNumber { get; set; } = default!;
/// <summary>
/// 获取或设置绑定状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("bind_state")]
[System.Text.Json.Serialization.JsonPropertyName("bind_state")]
public string BindState { get; set; } = default!;
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/transactions/out-trade-no/{out_trade_no} 接口的请求。</para>
/// </summary>
public class GetVehicleETCTransactionByOutTradeNumberRequest : WechatTenpayRequest
{
/// <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? SubMerchantId { get; set; }
}
}

View File

@@ -0,0 +1,218 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/transactions/out-trade-no/{out_trade_no} 接口的响应。</para>
/// </summary>
public class GetVehicleETCTransactionByOutTradeNumberResponse : WechatTenpayResponse
{
public static class Types
{
public class Payer : GetVehicleTransactionByOutTradeNumberResponse.Types.Payer
{
}
public class Amount : GetVehicleTransactionByOutTradeNumberResponse.Types.Amount
{
}
public class Device
{
/// <summary>
/// 获取或设置商户端设备号。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_id")]
[System.Text.Json.Serialization.JsonPropertyName("device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// 获取或设置商户端设备 IP。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_ip")]
[System.Text.Json.Serialization.JsonPropertyName("device_ip")]
public string? DeviceIp { get; set; }
}
public class Promotion
{
/// <summary>
/// 获取或设置券 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("promotion_id")]
[System.Text.Json.Serialization.JsonPropertyName("promotion_id")]
public string PromotionId { 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("scope")]
[System.Text.Json.Serialization.JsonPropertyName("scope")]
public string? Scope { get; set; }
/// <summary>
/// 获取或设置优惠类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string? Type { get; set; }
/// <summary>
/// 获取或设置优惠券面额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置活动 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("activity_id")]
[System.Text.Json.Serialization.JsonPropertyName("activity_id")]
public string? ActivityId { get; set; }
/// <summary>
/// 获取或设置微信出资(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("wxpay_contribute")]
[System.Text.Json.Serialization.JsonPropertyName("wxpay_contribute")]
public int? WechatpayContribute { get; set; }
/// <summary>
/// 获取或设置商户出资(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("merchant_contribute")]
[System.Text.Json.Serialization.JsonPropertyName("merchant_contribute")]
public int? MerchantContribute { get; set; }
/// <summary>
/// 获取或设置其他出资(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("other_contribute")]
[System.Text.Json.Serialization.JsonPropertyName("other_contribute")]
public int? OtherContribute { get; set; }
}
}
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <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; } = default!;
/// <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; } = default!;
/// <summary>
/// 获取或设置微信支付订单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("transaction_id")]
[System.Text.Json.Serialization.JsonPropertyName("transaction_id")]
public string? TransactionId { get; set; }
/// <summary>
/// 获取或设置交易类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("trade_type")]
[System.Text.Json.Serialization.JsonPropertyName("trade_type")]
public string TradeType { get; set; } = default!;
/// <summary>
/// 获取或设置交易状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("trade_state")]
[System.Text.Json.Serialization.JsonPropertyName("trade_state")]
public string TradeState { get; set; } = default!;
/// <summary>
/// 获取或设置交易状态描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("trade_state_desc")]
[System.Text.Json.Serialization.JsonPropertyName("trade_state_desc")]
public string TradeStateDescription { get; set; } = default!;
/// <summary>
/// 获取或设置付款银行类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_type")]
[System.Text.Json.Serialization.JsonPropertyName("bank_type")]
public string? BankType { get; set; }
/// <summary>
/// 获取或设置附加数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("attach")]
[System.Text.Json.Serialization.JsonPropertyName("attach")]
public string? Attachment { get; set; }
/// <summary>
/// 获取或设置支付完成时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("success_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("success_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? SuccessTime { get; set; }
/// <summary>
/// 获取或设置支付者信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置金额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public Types.Amount Amount { get; set; } = default!;
/// <summary>
/// 获取或设置设备信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_info")]
[System.Text.Json.Serialization.JsonPropertyName("device_info")]
public Types.Device? Device { get; set; }
/// <summary>
/// 获取或设置优惠信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("promotion_detail")]
[System.Text.Json.Serialization.JsonPropertyName("promotion_detail")]
public Types.Promotion[]? PromotionList { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/transactions/id/{transaction_id} 接口的请求。</para>
/// </summary>
public class GetVehicleETCTransactionByTransactionIdRequest : WechatTenpayRequest
{
/// <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? SubMerchantId { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /vehicle/etc/transactions/id/{transaction_id} 接口的响应。</para>
/// </summary>
public class GetVehicleETCTransactionByTransactionIdResponse : GetVehicleETCTransactionByOutTradeNumberResponse
{
}
}

View File

@@ -0,0 +1,116 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /vehicle/etc/preopen 接口的请求。</para>
/// </summary>
[WechatTenpaySensitive]
public class PreopenVehicleETCRequest : WechatTenpayRequest
{
public static class Types
{
public class Identify
{
/// <summary>
/// 获取或设置真实姓名(需使用平台公钥/证书加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("encrypted_real_name")]
[System.Text.Json.Serialization.JsonPropertyName("encrypted_real_name")]
[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 EncryptedRealName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置证件号码(需使用平台公钥/证书加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("encrypted_credential_id")]
[System.Text.Json.Serialization.JsonPropertyName("encrypted_credential_id")]
[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 EncryptedCredentialNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置证件类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("credential_type")]
[System.Text.Json.Serialization.JsonPropertyName("credential_type")]
public string? CredentialType { get; set; }
}
}
/// <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("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("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 ETC 授权扣费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("plan_id")]
[System.Text.Json.Serialization.JsonPropertyName("plan_id")]
public string PlanId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 ETC 设备号。
/// </summary>
[Newtonsoft.Json.JsonProperty("etc_device_id")]
[System.Text.Json.Serialization.JsonPropertyName("etc_device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// 获取或设置车牌号。
/// </summary>
[Newtonsoft.Json.JsonProperty("plate_number")]
[System.Text.Json.Serialization.JsonPropertyName("plate_number")]
public string PlateNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置入场时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("start_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("start_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset StartTime { get; set; }
/// <summary>
/// 获取或设置实名认证信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("identify")]
[System.Text.Json.Serialization.JsonPropertyName("identify")]
public Types.Identify Identify { get; set; } = new Types.Identify();
/// <summary>
/// 获取或设置银行卡号(需使用平台公钥/证书加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_card_no")]
[System.Text.Json.Serialization.JsonPropertyName("bank_card_no")]
[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? BankCardNumber { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /vehicle/etc/preopen 接口的响应。</para>
/// </summary>
public class PreopenVehicleETCResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置预开通 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("preopen_id")]
[System.Text.Json.Serialization.JsonPropertyName("preopen_id")]
public string PreopenId { get; set; } = default!;
}
}

View File

@@ -15,7 +15,7 @@
<PackageProjectUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat</PackageProjectUrl>
<PackageTags>Flurl.Http Wechat Weixin MicroMessage Tenpay WechatPay WeixinPay Wxpay 微信 微信支付 微信商户</PackageTags>
<Version>2.16.0</Version>
<Description>基于 Flurl.Http 的微信支付 API v3 版客户端,支持直连商户、服务商模式,支持基础支付、代金券、商家券、委托营销、消费卡、支付有礼、银行定向促活、微信支付分、微信先享卡、支付即服务、点金计划、智慧商圈、电商收付通、二级商户进件、小微商户进件、消费者投诉、商户违规通知、批量转账到零钱、银行组件、海关报关、融合钱包、微工卡、电子发票等功能。</Description>
<Description>基于 Flurl.Http 的微信支付 API v3 版客户端,支持直连商户、服务商模式,支持基础支付、代金券、商家券、委托营销、消费卡、支付有礼、银行定向促活、微信支付分、微信先享卡、支付即服务、点金计划、智慧商圈、电商收付通、二级商户进件、小微商户进件、消费者投诉、商户违规通知、批量转账到零钱、银行组件、海关报关、融合钱包、微工卡、电子发票、ETC 扣费等功能。</Description>
<Authors>Fu Diwei</Authors>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git</RepositoryUrl>