feat(wxapi): 新增视频号小店运费模板相关接口

This commit is contained in:
Fu Diwei 2022-11-02 11:15:20 +08:00
parent 62b86d7c23
commit 9a4510796f
25 changed files with 969 additions and 10 deletions

View File

@ -0,0 +1,74 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace System.Text.Json.Converters
{
internal class TextualIntegerArrayConverter : JsonConverter<int[]?>
{
public override int[]? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Null)
{
return null;
}
else if (reader.TokenType == JsonTokenType.StartArray)
{
IList<int> list = new List<int>();
while (reader.Read())
{
switch (reader.TokenType)
{
case JsonTokenType.Number:
{
int value = reader.GetInt32();
list.Add(value);
}
break;
case JsonTokenType.String:
{
string? value = reader.GetString();
if (!int.TryParse(value, out int l))
throw new JsonException($"Could not parse String '{value}' to Integer.");
list.Add(l);
}
break;
case JsonTokenType.EndArray:
return list.ToArray();
case JsonTokenType.Comment:
break;
default:
throw new JsonException($"Unexpected JSON token type '{reader.TokenType}' when reading.");
}
}
}
throw new JsonException($"Unexpected JSON token type '{reader.TokenType}' when reading.");
}
public override void Write(Utf8JsonWriter writer, int[]? value, JsonSerializerOptions options)
{
if (value != null)
{
writer.WriteStartArray();
foreach (int i in value)
{
writer.WriteStringValue(i.ToString());
}
writer.WriteEndArray();
}
else
{
writer.WriteNullValue();
}
}
}
}

View File

@ -117,7 +117,92 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
}
#endregion
#region OrderDelivery
#region Merchant
#region Merchant/FreightTemplate
/// <summary>
/// <para>异步调用 [POST] /channels/ec/merchant/getfreighttemplatelist 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/order/deliverycompanylist_get.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECMerchantGetFreightTemplateListResponse> ExecuteChannelsECMerchantGetFreightTemplateListAsync(this WechatApiClient client, Models.ChannelsECMerchantGetFreightTemplateListRequest 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, "channels", "ec", "merchant", "getfreighttemplatelist")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECMerchantGetFreightTemplateListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/merchant/getfreighttemplatedetail 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/merchant/getfreighttemplatedetail.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECMerchantGetFreightTemplateDetailResponse> ExecuteChannelsECMerchantGetFreightTemplateDetailAsync(this WechatApiClient client, Models.ChannelsECMerchantGetFreightTemplateDetailRequest 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, "channels", "ec", "merchant", "getfreighttemplatedetail")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECMerchantGetFreightTemplateDetailResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/merchant/addfreighttemplate 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/merchant/addfreighttemplate.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECMerchantAddFreightTemplateResponse> ExecuteChannelsECMerchantAddFreightTemplateAsync(this WechatApiClient client, Models.ChannelsECMerchantAddFreightTemplateRequest 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, "channels", "ec", "merchant", "addfreighttemplate")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECMerchantAddFreightTemplateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/merchant/updatefreighttemplate 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/merchant/updatefreighttemplate.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECMerchantUpdateFreightTemplateResponse> ExecuteChannelsECMerchantUpdateFreightTemplateAsync(this WechatApiClient client, Models.ChannelsECMerchantUpdateFreightTemplateRequest 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, "channels", "ec", "merchant", "updatefreighttemplate")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.ChannelsECMerchantUpdateFreightTemplateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#endregion
#region Order
#region Order/Delivery
/// <summary>
/// <para>异步调用 [POST] /channels/ec/order/deliverycompanylist/get 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/channels/API/order/deliverycompanylist_get.html </para>
@ -158,6 +243,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.ChannelsECOrderDeliverySendResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#endregion
#region ECWindow
/// <summary>

View File

@ -10,6 +10,6 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("f_cat_id")]
[System.Text.Json.Serialization.JsonPropertyName("f_cat_id")]
public int ParentCategoryId { get; set; }
public long ParentCategoryId { get; set; }
}
}

View File

@ -14,7 +14,8 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("cat_id")]
[System.Text.Json.Serialization.JsonPropertyName("cat_id")]
public int CategoryId { get; set; }
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long CategoryId { get; set; }
/// <summary>
/// 获取或设置类目名称。
@ -28,7 +29,8 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("f_cat_id")]
[System.Text.Json.Serialization.JsonPropertyName("f_cat_id")]
public int ParentCategoryId { get; set; }
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long ParentCategoryId { get; set; }
}
}

View File

@ -0,0 +1,297 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/addfreighttemplate 接口的请求。</para>
/// </summary>
public class ChannelsECMerchantAddFreightTemplateRequest : WechatApiRequest, IInferable<ChannelsECMerchantAddFreightTemplateRequest, ChannelsECMerchantAddFreightTemplateResponse>
{
public static class Types
{
public class FreightTemplate
{
public static class Types
{
public class Address
{
/// <summary>
/// 获取或设置省份。
/// </summary>
[Newtonsoft.Json.JsonProperty("province_name")]
[System.Text.Json.Serialization.JsonPropertyName("province_name")]
public string? Province { get; set; }
/// <summary>
/// 获取或设置城市。
/// </summary>
[Newtonsoft.Json.JsonProperty("city_name")]
[System.Text.Json.Serialization.JsonPropertyName("city_name")]
public string? City { get; set; }
/// <summary>
/// 获取或设置区县。
/// </summary>
[Newtonsoft.Json.JsonProperty("county_name")]
[System.Text.Json.Serialization.JsonPropertyName("county_name")]
public string? District { get; set; }
/// <summary>
/// 获取或设置详细地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_info")]
[System.Text.Json.Serialization.JsonPropertyName("detail_info")]
public string? Detail { get; set; }
/// <summary>
/// 获取或设置收件人姓名。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_name")]
[System.Text.Json.Serialization.JsonPropertyName("user_name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置收件人电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("tel_number")]
[System.Text.Json.Serialization.JsonPropertyName("tel_number")]
public string? TeleNumber { get; set; }
/// <summary>
/// 获取或设置国家码。
/// </summary>
[Newtonsoft.Json.JsonProperty("national_code")]
[System.Text.Json.Serialization.JsonPropertyName("national_code")]
public string? NationalCode { get; set; }
/// <summary>
/// 获取或设置邮政编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("postal_code")]
[System.Text.Json.Serialization.JsonPropertyName("postal_code")]
public string? PostalCode { get; set; }
}
public class Area
{
/// <summary>
/// 获取或设置地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public IList<Address> AddressList { get; set; } = new List<Address>();
}
public class ConditionFreeDetailItem
{
/// <summary>
/// 获取或设置包邮地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_infos")]
[System.Text.Json.Serialization.JsonPropertyName("address_infos")]
public IList<Address> AddressList { get; set; } = new List<Address>();
/// <summary>
/// 获取或设置包邮最低件数。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_piece")]
[System.Text.Json.Serialization.JsonPropertyName("min_piece")]
public int? MinPiece { get; set; }
/// <summary>
/// 获取或设置包邮最低金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_amount")]
[System.Text.Json.Serialization.JsonPropertyName("min_amount")]
public int? MinAmount { get; set; }
/// <summary>
/// 获取或设置包邮最低重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_weight")]
[System.Text.Json.Serialization.JsonPropertyName("min_weight")]
public int? MinWeight { get; set; }
/// <summary>
/// 获取或设置计费方式对应选项是否已经设置。
/// </summary>
[Newtonsoft.Json.JsonProperty("valuation_flag")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("valuation_flag")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
public bool? HasSetValuation { get; set; }
/// <summary>
/// 获取或设置金额是否设置。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount_flag")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("amount_flag")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
public bool? HasSetAmount { get; set; }
}
public class ConditionFreeDetailList
{
/// <summary>
/// 获取或设置条件包邮详情列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("condition_free_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("condition_free_detail_list")]
public IList<ConditionFreeDetailItem> Items { get; set; } = new List<ConditionFreeDetailItem>();
}
public class FreightCalculateMethodItem
{
/// <summary>
/// 获取或设置指定地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public IList<Address> AddressList { get; set; } = new List<Address>();
/// <summary>
/// 获取或设置是否为默认运费。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_default")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("is_default")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
public bool IsDefault { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_id")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
public string? DeliveryId { get; set; }
/// <summary>
/// 获取或设置首段运费满足重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("first_val_amount")]
[System.Text.Json.Serialization.JsonPropertyName("first_val_amount")]
public int FirstValueWeight { get; set; }
/// <summary>
/// 获取或设置首段运费的金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("first_price")]
[System.Text.Json.Serialization.JsonPropertyName("first_price")]
public int FirstValuePrice { get; set; }
/// <summary>
/// 获取或设置增量运费满足重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("second_val_amount")]
[System.Text.Json.Serialization.JsonPropertyName("second_val_amount")]
public int SecondValueWeight { get; set; }
/// <summary>
/// 获取或设置增量运费的金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("second_price")]
[System.Text.Json.Serialization.JsonPropertyName("second_price")]
public int SecondValuePrice { get; set; }
}
public class FreightCalculateMethodList
{
/// <summary>
/// 获取或设置指定地区具体计费方法列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_calc_method_list")]
[System.Text.Json.Serialization.JsonPropertyName("freight_calc_method_list")]
public IList<FreightCalculateMethodItem> Items { get; set; } = new List<FreightCalculateMethodItem>();
}
}
/// <summary>
/// 获取或设置模板名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置计费类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("valuation_type")]
[System.Text.Json.Serialization.JsonPropertyName("valuation_type")]
public string ValuationType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发货时间类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("send_time")]
[System.Text.Json.Serialization.JsonPropertyName("send_time")]
public string SendTimeType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置快递方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_type")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_type")]
public string DeliveryType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置快递公司 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_id")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
public IList<string>? DeliveryIdList { get; set; }
/// <summary>
/// 获取或设置配送方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("shipping_method")]
[System.Text.Json.Serialization.JsonPropertyName("shipping_method")]
public string ShippingMethod { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发货地址信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public Types.Address? SendAddress { get; set; }
/// <summary>
/// 获取或设置不发货地区信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("not_send_area")]
[System.Text.Json.Serialization.JsonPropertyName("not_send_area")]
public Types.Area? NotSupportedArea { get; set; }
/// <summary>
/// 获取或设置是否为默认模版。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_default")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("is_default")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
public bool? IsDefault { get; set; }
/// <summary>
/// 获取或设置条件包邮详情信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("all_condition_free_detail")]
[System.Text.Json.Serialization.JsonPropertyName("all_condition_free_detail")]
public Types.ConditionFreeDetailList? ConditionFreeDetailList { get; set; }
/// <summary>
/// 获取或设置指定地区具体计费方法信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("all_freight_calc_method")]
[System.Text.Json.Serialization.JsonPropertyName("all_freight_calc_method")]
public Types.FreightCalculateMethodList? FreightCalculateMethodList { get; set; }
}
}
/// <summary>
/// 获取或设置运费模板信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_template")]
[System.Text.Json.Serialization.JsonPropertyName("freight_template")]
public Types.FreightTemplate FreightTemplate { get; set; } = new Types.FreightTemplate();
}
}

View File

@ -0,0 +1,16 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/addfreighttemplate 接口的响应。</para>
/// </summary>
public class ChannelsECMerchantAddFreightTemplateResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置运费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long TemplateId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/getfreighttemplatedetail 接口的请求。</para>
/// </summary>
public class ChannelsECMerchantGetFreightTemplateDetailRequest : WechatApiRequest, IInferable<ChannelsECMerchantGetFreightTemplateDetailRequest, ChannelsECMerchantGetFreightTemplateDetailResponse>
{
/// <summary>
/// 获取或设置运费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
public long TemplateId { get; set; }
}
}

View File

@ -0,0 +1,317 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/getfreighttemplatedetail 接口的响应。</para>
/// </summary>
public class ChannelsECMerchantGetFreightTemplateDetailResponse : WechatApiResponse
{
public static class Types
{
public class FreightTemplate
{
public static class Types
{
public class Address
{
/// <summary>
/// 获取或设置省份。
/// </summary>
[Newtonsoft.Json.JsonProperty("province_name")]
[System.Text.Json.Serialization.JsonPropertyName("province_name")]
public string? Province { get; set; }
/// <summary>
/// 获取或设置城市。
/// </summary>
[Newtonsoft.Json.JsonProperty("city_name")]
[System.Text.Json.Serialization.JsonPropertyName("city_name")]
public string? City { get; set; }
/// <summary>
/// 获取或设置区县。
/// </summary>
[Newtonsoft.Json.JsonProperty("county_name")]
[System.Text.Json.Serialization.JsonPropertyName("county_name")]
public string? District { get; set; }
/// <summary>
/// 获取或设置详细地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("detail_info")]
[System.Text.Json.Serialization.JsonPropertyName("detail_info")]
public string? Detail { get; set; }
/// <summary>
/// 获取或设置收件人姓名。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_name")]
[System.Text.Json.Serialization.JsonPropertyName("user_name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置收件人电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("tel_number")]
[System.Text.Json.Serialization.JsonPropertyName("tel_number")]
public string? TeleNumber { get; set; }
/// <summary>
/// 获取或设置国家码。
/// </summary>
[Newtonsoft.Json.JsonProperty("national_code")]
[System.Text.Json.Serialization.JsonPropertyName("national_code")]
public string? NationalCode { get; set; }
/// <summary>
/// 获取或设置邮政编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("postal_code")]
[System.Text.Json.Serialization.JsonPropertyName("postal_code")]
public string? PostalCode { get; set; }
}
public class Area
{
/// <summary>
/// 获取或设置地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public Address[] AddressList { get; set; } = default!;
}
public class ConditionFreeDetailItem
{
/// <summary>
/// 获取或设置包邮地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_infos")]
[System.Text.Json.Serialization.JsonPropertyName("address_infos")]
public Address[] AddressList { get; set; } = default!;
/// <summary>
/// 获取或设置包邮最低件数。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_piece")]
[System.Text.Json.Serialization.JsonPropertyName("min_piece")]
public int? MinPiece { get; set; }
/// <summary>
/// 获取或设置包邮最低金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_amount")]
[System.Text.Json.Serialization.JsonPropertyName("min_amount")]
public int? MinAmount { get; set; }
/// <summary>
/// 获取或设置包邮最低重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("min_weight")]
[System.Text.Json.Serialization.JsonPropertyName("min_weight")]
public int? MinWeight { get; set; }
/// <summary>
/// 获取或设置计费方式对应选项是否已经设置。
/// </summary>
[Newtonsoft.Json.JsonProperty("valuation_flag")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("valuation_flag")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
public bool? HasSetValuation { get; set; }
/// <summary>
/// 获取或设置金额是否设置。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount_flag")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("amount_flag")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))]
public bool? HasSetAmount { get; set; }
}
public class ConditionFreeDetailList
{
/// <summary>
/// 获取或设置条件包邮详情列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("condition_free_detail_list")]
[System.Text.Json.Serialization.JsonPropertyName("condition_free_detail_list")]
public ConditionFreeDetailItem[] Items { get; set; } = default!;
}
public class FreightCalculateMethodItem
{
/// <summary>
/// 获取或设置指定地址列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public Address[] AddressList { get; set; } = default!;
/// <summary>
/// 获取或设置是否为默认运费。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_default")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("is_default")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
public bool IsDefault { get; set; }
/// <summary>
/// 获取或设置快递公司 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_id")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
public string? DeliveryId { get; set; }
/// <summary>
/// 获取或设置首段运费满足重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("first_val_amount")]
[System.Text.Json.Serialization.JsonPropertyName("first_val_amount")]
public int FirstValueWeight { get; set; }
/// <summary>
/// 获取或设置首段运费的金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("first_price")]
[System.Text.Json.Serialization.JsonPropertyName("first_price")]
public int FirstValuePrice { get; set; }
/// <summary>
/// 获取或设置增量运费满足重量(单位:千克)。
/// </summary>
[Newtonsoft.Json.JsonProperty("second_val_amount")]
[System.Text.Json.Serialization.JsonPropertyName("second_val_amount")]
public int SecondValueWeight { get; set; }
/// <summary>
/// 获取或设置增量运费的金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("second_price")]
[System.Text.Json.Serialization.JsonPropertyName("second_price")]
public int SecondValuePrice { get; set; }
}
public class FreightCalculateMethodList
{
/// <summary>
/// 获取或设置指定地区具体计费方法列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_calc_method_list")]
[System.Text.Json.Serialization.JsonPropertyName("freight_calc_method_list")]
public FreightCalculateMethodItem[] Items { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置运费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public long TemplateId { get; set; }
/// <summary>
/// 获取或设置模板名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置计费类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("valuation_type")]
[System.Text.Json.Serialization.JsonPropertyName("valuation_type")]
public string ValuationType { get; set; } = default!;
/// <summary>
/// 获取或设置发货时间类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("send_time")]
[System.Text.Json.Serialization.JsonPropertyName("send_time")]
public string SendTimeType { get; set; } = default!;
/// <summary>
/// 获取或设置快递方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_type")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_type")]
public string DeliveryType { get; set; } = default!;
/// <summary>
/// 获取或设置快递公司 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("delivery_id")]
[System.Text.Json.Serialization.JsonPropertyName("delivery_id")]
public string[] DeliveryIdList { get; set; } = default!;
/// <summary>
/// 获取或设置配送方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("shipping_method")]
[System.Text.Json.Serialization.JsonPropertyName("shipping_method")]
public string ShippingMethod { get; set; } = default!;
/// <summary>
/// 获取或设置发货地址信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("address_info")]
[System.Text.Json.Serialization.JsonPropertyName("address_info")]
public Types.Address SendAddress { get; set; } = default!;
/// <summary>
/// 获取或设置不发货地区信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("not_send_area")]
[System.Text.Json.Serialization.JsonPropertyName("not_send_area")]
public Types.Area NotSupportedArea { get; set; } = default!;
/// <summary>
/// 获取或设置是否为默认模版。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_default")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
[System.Text.Json.Serialization.JsonPropertyName("is_default")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
public bool IsDefault { get; set; }
/// <summary>
/// 获取或设置条件包邮详情信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("all_condition_free_detail")]
[System.Text.Json.Serialization.JsonPropertyName("all_condition_free_detail")]
public Types.ConditionFreeDetailList ConditionFreeDetailList { get; set; } = default!;
/// <summary>
/// 获取或设置指定地区具体计费方法信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("all_freight_calc_method")]
[System.Text.Json.Serialization.JsonPropertyName("all_freight_calc_method")]
public Types.FreightCalculateMethodList FreightCalculateMethodList { get; set; } = default!;
/// <summary>
/// 获取或设置更新时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("update_time")]
[System.Text.Json.Serialization.JsonPropertyName("update_time")]
public long UpdateTimestamp { get; set; }
/// <summary>
/// 获取或设置创建时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
public long CreateTimestamp { get; set; }
}
}
/// <summary>
/// 获取或设置运费模板信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_template")]
[System.Text.Json.Serialization.JsonPropertyName("freight_template")]
public Types.FreightTemplate FreightTemplate { get; set; } = default!;
}
}

View File

@ -0,0 +1,23 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/getfreighttemplatelist 接口的请求。</para>
/// </summary>
public class ChannelsECMerchantGetFreightTemplateListRequest : WechatApiRequest, IInferable<ChannelsECMerchantGetFreightTemplateListRequest, ChannelsECMerchantGetFreightTemplateListResponse>
{
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,16 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/getfreighttemplatelist 接口的响应。</para>
/// </summary>
public class ChannelsECMerchantGetFreightTemplateListResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置运费模板 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("template_id_list")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.TextualLongArrayConverter))]
public long[] TemplateIdList { get; set; } = default!;
}
}

View File

@ -0,0 +1,28 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/updatefreighttemplate 接口的请求。</para>
/// </summary>
public class ChannelsECMerchantUpdateFreightTemplateRequest : WechatApiRequest, IInferable<ChannelsECMerchantUpdateFreightTemplateRequest, ProductDeliveryUpdateFreightTemplateResponse>
{
public static class Types
{
public class FreightTemplate : ProductDeliveryInsertFreightTemplateRequest.Types.FreightTemplate
{
/// <summary>
/// 获取或设置运费模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("template_id")]
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
public long TemplateId { get; set; }
}
}
/// <summary>
/// 获取或设置运费模板信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_template")]
[System.Text.Json.Serialization.JsonPropertyName("freight_template")]
public Types.FreightTemplate FreightTemplate { get; set; } = new Types.FreightTemplate();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/merchant/updatefreighttemplate 接口的响应。</para>
/// </summary>
public class ChannelsECMerchantUpdateFreightTemplateResponse : WechatApiResponse
{
}
}

View File

@ -7,7 +7,7 @@
{
public static class Types
{
public class Template
public class FreightTemplate
{
public static class Types
{
@ -276,6 +276,6 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("template_list")]
[System.Text.Json.Serialization.JsonPropertyName("template_list")]
public Types.Template[] TemplateList { get; set; } = default!;
public Types.FreightTemplate[] FreightTemplateList { get; set; } = default!;
}
}

View File

@ -9,7 +9,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
public static class Types
{
public class Template
public class FreightTemplate
{
public static class Types
{
@ -257,6 +257,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_template")]
[System.Text.Json.Serialization.JsonPropertyName("freight_template")]
public Types.Template Template { get; set; } = new Types.Template();
public Types.FreightTemplate FreightTemplate { get; set; } = new Types.FreightTemplate();
}
}

View File

@ -7,7 +7,7 @@
{
public static class Types
{
public class Template : ProductDeliveryInsertFreightTemplateRequest.Types.Template
public class FreightTemplate : ProductDeliveryInsertFreightTemplateRequest.Types.FreightTemplate
{
/// <summary>
/// 获取或设置模板 ID。
@ -23,6 +23,6 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("freight_template")]
[System.Text.Json.Serialization.JsonPropertyName("freight_template")]
public Types.Template Template { get; set; } = new Types.Template();
public Types.FreightTemplate FreightTemplate { get; set; } = new Types.FreightTemplate();
}
}

View File

@ -0,0 +1,20 @@
{
"freight_template": {
"name": "测试api",
"valuation_type": "PIECE",
"send_time": "SendTime_FOUR_HOUR",
"address_info": {
"user_name": "",
"postal_code": "12345",
"province_name": "广东省",
"city_name": "广州市",
"county_name": "海珠区",
"detail_info": "新港中路",
"national_code": "23456",
"tel_number": "12345"
},
"delivery_type": "EXPRESS",
"shipping_method": "FREE",
"is_default": false
}
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"template_id": "123123"
}

View File

@ -0,0 +1,35 @@
{
"errcode": 0,
"errmsg": "ok",
"freight_template": {
"template_id": "38983386001",
"name": "运费险",
"valuation_type": "PIECE",
"send_time": "SendTime_FOUR_HOUR",
"address_info": {
"user_name": "",
"postal_code": "",
"province_name": "广东省",
"city_name": "广州市",
"county_name": "海珠区",
"detail_info": "",
"national_code": "",
"tel_number": ""
},
"delivery_type": "EXPRESS",
"delivery_id": [],
"shipping_method": "FREE",
"all_condition_free_detail": {
"condition_free_detail_list": []
},
"all_freight_calc_method": {
"freight_calc_method_list": []
},
"create_time": 1653892643,
"update_time": 1653892643,
"is_default": 0,
"not_send_area": {
"address_info": []
}
}
}

View File

@ -0,0 +1,16 @@
{
"errcode": 0,
"errmsg": "ok",
"template_id_list": [
"1061",
"2008",
"2047",
"5007",
"5055",
"5148",
"5182",
"5187",
"5188",
"5189"
]
}