feat(tenpayv3): 随官方更新消费者投诉单相关接口模型

This commit is contained in:
Fu Diwei
2023-03-09 19:49:06 +08:00
parent 68c1a7ba93
commit 0b072609e7
6 changed files with 205 additions and 56 deletions

View File

@@ -74,6 +74,38 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[System.Text.Json.Serialization.JsonPropertyName("state")]
public string? State { get; set; }
}
public class AdditionalInfo
{
public static class Types
{
public class SharePowerInfo
{
/// <summary>
/// 获取或设置归还时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("return_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("return_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? ReturnTime { 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("share_power_info")]
[System.Text.Json.Serialization.JsonPropertyName("share_power_info")]
public Types.SharePowerInfo? SharePowerInfo { get; set; }
}
}
/// <summary>
@@ -111,6 +143,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("complainted_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("complainted_mchid")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))]
public string? ComplaintedMerchantId { get; set; }
/// <summary>
@@ -198,5 +231,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[Newtonsoft.Json.JsonProperty("service_order_info")]
[System.Text.Json.Serialization.JsonPropertyName("service_order_info")]
public Types.ServiceOrder[]? ServiceOrderList { get; set; }
/// <summary>
/// 获取或设置补充信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("additional_info")]
[System.Text.Json.Serialization.JsonPropertyName("additional_info")]
public Types.AdditionalInfo? AdditionalInfo { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System;
using Flurl.Http.Configuration;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
@@ -66,11 +67,101 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// 获取或设置投诉资料列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("complaint_media_list")]
[Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyNegotiationHistoryItemComplaintMediaListNewtonsoftJsonConverter))]
[System.Text.Json.Serialization.JsonPropertyName("complaint_media_list")]
[System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyNegotiationHistoryItemComplaintMediaListSystemTextJsonConverter))]
public Types.ComplaintMedia[]? ComplaintMediaList { get; set; }
}
}
internal static class Converters
{
internal class ResponsePropertyNegotiationHistoryItemComplaintMediaListNewtonsoftJsonConverter : Newtonsoft.Json.JsonConverter<Types.NegotiationHistory.Types.ComplaintMedia[]?>
{
public override bool CanWrite
{
get { return false; }
}
public override Types.NegotiationHistory.Types.ComplaintMedia[]? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, Types.NegotiationHistory.Types.ComplaintMedia[]? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
{
/*
* NOTICE:
* 2023-03-07 微信支付调整了返回结果的数据结构。
* 原 "complaint_media_list" 字段是数组形式,现改为对象形式。
* 此转换器为了适配并同时兼容新旧两种数据结构。
*/
switch (reader.TokenType)
{
case Newtonsoft.Json.JsonToken.Null:
{
return existingValue;
}
case Newtonsoft.Json.JsonToken.StartArray:
{
return serializer.Deserialize<Types.NegotiationHistory.Types.ComplaintMedia[]>(reader);
}
case Newtonsoft.Json.JsonToken.StartObject:
{
Types.NegotiationHistory.Types.ComplaintMedia[] array = new Types.NegotiationHistory.Types.ComplaintMedia[1];
array[0] = serializer.Deserialize<Types.NegotiationHistory.Types.ComplaintMedia>(reader)!;
return array;
}
}
throw new Newtonsoft.Json.JsonException();
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, Types.NegotiationHistory.Types.ComplaintMedia[]? value, Newtonsoft.Json.JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
internal class ResponsePropertyNegotiationHistoryItemComplaintMediaListSystemTextJsonConverter : System.Text.Json.Serialization.JsonConverter<Types.NegotiationHistory.Types.ComplaintMedia[]?>
{
public override Types.NegotiationHistory.Types.ComplaintMedia[]? Read(ref System.Text.Json.Utf8JsonReader reader, Type typeToConvert, System.Text.Json.JsonSerializerOptions options)
{
/*
* NOTICE:
* 2023-03-07 微信支付调整了返回结果的数据结构。
* 原 "complaint_media_list" 字段是数组形式,现改为对象形式。
* 此转换器为了适配并同时兼容新旧两种数据结构。
*/
switch (reader.TokenType)
{
case System.Text.Json.JsonTokenType.Null:
{
return default;
}
case System.Text.Json.JsonTokenType.StartArray:
{
return System.Text.Json.JsonSerializer.Deserialize<Types.NegotiationHistory.Types.ComplaintMedia[]>(ref reader, options);
}
case System.Text.Json.JsonTokenType.StartObject:
{
Types.NegotiationHistory.Types.ComplaintMedia[] array = new Types.NegotiationHistory.Types.ComplaintMedia[1];
array[0] = System.Text.Json.JsonSerializer.Deserialize<Types.NegotiationHistory.Types.ComplaintMedia>(ref reader, options)!;
return array;
}
}
throw new System.Text.Json.JsonException();
}
public override void Write(System.Text.Json.Utf8JsonWriter writer, Types.NegotiationHistory.Types.ComplaintMedia[]? value, System.Text.Json.JsonSerializerOptions options)
{
writer.WriteRawValue(System.Text.Json.JsonSerializer.Serialize(value, typeof(Types.NegotiationHistory.Types.ComplaintMedia[]), options));
}
}
}
/// <summary>
/// 获取或设置投诉协商历史列表。
/// </summary>

View File

@@ -21,6 +21,14 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public class ComplaintMedia : GetMerchantServiceComplaintByComplaintIdResponse.Types.ComplaintMedia
{
}
public class ServiceOrder : GetMerchantServiceComplaintByComplaintIdResponse.Types.ServiceOrder
{
}
public class AdditionalInfo : GetMerchantServiceComplaintByComplaintIdResponse.Types.AdditionalInfo
{
}
}
/// <summary>
@@ -58,6 +66,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("complainted_mchid")]
[System.Text.Json.Serialization.JsonPropertyName("complainted_mchid")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalStringReadOnlyConverter))]
public string? ComplaintedMerchantId { get; set; }
/// <summary>
@@ -138,10 +147,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[Newtonsoft.Json.JsonProperty("user_tag_list")]
[System.Text.Json.Serialization.JsonPropertyName("user_tag_list")]
public string[]? UserTagList { get; set; }
}
public class ServiceOrder : GetMerchantServiceComplaintByComplaintIdResponse.Types.ServiceOrder
{
/// <summary>
/// 获取或设置关联服务单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_order_info")]
[System.Text.Json.Serialization.JsonPropertyName("service_order_info")]
public Types.ServiceOrder[]? ServiceOrderList { get; set; }
/// <summary>
/// 获取或设置补充信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("additional_info")]
[System.Text.Json.Serialization.JsonPropertyName("additional_info")]
public Types.AdditionalInfo? AdditionalInfo { get; set; }
}
}
@@ -152,13 +171,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Complaint[] ComplaintList { get; set; } = default!;
/// <summary>
/// 获取或设置关联服务单列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("service_order_info")]
[System.Text.Json.Serialization.JsonPropertyName("service_order_info")]
public Types.ServiceOrder[]? ServiceOrderList { get; set; }
/// <summary>
/// 获取或设置分页大小。
/// </summary>

View File

@@ -1,9 +1,9 @@
{
{
"complaint_id": "200201820200101080076610000",
"complaint_time": "2015-05-20T13:29:35.120+08:00",
"complaint_detail": "反馈一个重复扣费的问题",
"complaint_state": "PENDING",
"complainted_mchid": "1900012181",
"complaint_state": "PENDING",
"payer_phone": "sGdNeTHMQGlxCWiUyHu6XNO9GCYln2Luv4HhwJzZBfcL12sB",
"payer_openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"complaint_media_list": [
@@ -21,15 +21,21 @@
"amount": 3
}
],
"complaint_full_refunded": true,
"incoming_user_response": true,
"problem_description": "不满意商家服务",
"user_complaint_times": 1,
"service_order_info": [
{
"order_id": "15646546545165651651",
"out_order_no": "1234323JKHDFE1243252",
"state": "CREATED"
"state": "DOING"
}
]
],
"complaint_full_refunded": true,
"incoming_user_response": true,
"problem_description": "不满意商家服务",
"user_complaint_times": 1,
"additional_info": {
"share_power_info": {
"return_time": "2023-02-10T14:44:00+08:00"
},
"type": "SHARE_POWER_TYPE"
}
}

View File

@@ -1,23 +1,23 @@
{
{
"data": [
{
"complaint_media_list": [
{
"media_type": "USER_COMPLAINT_IMAGE",
"media_url": [
"https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx"
]
}
],
"complaint_media_list": {
"media_type": "USER_COMPLAINT_IMAGE",
"media_url": [
"https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx"
]
},
"log_id": "300285320210322170000071077",
"operator": "投诉人",
"operate_time": "2015-05-20T13:29:35.120+08:00",
"operate_type": "USER_CREATE_COMPLAINT",
"operate_details": "已与用户电话沟通解决",
"image_list": ["https://qpic.cn/xxx"]
"image_list": [
"https://qpic.cn/xxx"
]
}
],
"limit": 10,
"limit": 50,
"offset": 50,
"total_count": 1000
}

View File

@@ -1,12 +1,34 @@
{
{
"data": [
{
"additional_info": {
"share_power_info": {
"return_time": "2023-02-10T14:44:00+08:00"
},
"type": "SHARE_POWER_TYPE"
},
"complaint_id": "200201820200101080076610000",
"complaint_time": "2015-05-20T13:29:35.120+08:00",
"complaint_detail": "反馈一个重复扣费的问题",
"complaint_state": "PENDING",
"complainted_mchid": "1900012181",
"payer_phone": "Qe41VhP/sGdNeTHMQGlxCWiUyHu6XNO9GCYln2Luv4HhwJzZBfcL12sB+PgZcS5NhePBog30NgJ1xRaK+gbGDKwpg==",
"complaint_order_info": [
{
"transaction_id": "4200000404201909069117582536",
"out_trade_no": "20190906154617947762231",
"amount": 3
}
],
"service_order_info": [
{
"order_id": "15646546545165651651",
"out_order_no": "1234323JKHDFE1243252",
"state": "DOING"
}
],
"complaint_full_refunded": true,
"incoming_user_response": true,
"user_complaint_times": 1,
"complaint_media_list": [
{
"media_type": "USER_COMPLAINT_IMAGE",
@@ -15,32 +37,10 @@
]
}
],
"complaint_order_info": [
{
"transaction_id": "4200000404201909069117582536",
"out_trade_no": "20190906154617947762231",
"amount": 3
},
{
"transaction_id": "4200000404201909069117582836",
"out_trade_no": "20190906154617947762291",
"amount": 4
}
],
"complaint_full_refunded": true,
"incoming_user_response": true,
"problem_description": "不满意商家服务",
"user_complaint_times": 1
"problem_description": "不满意商家服务"
}
],
"limit": 5,
"offset": 10,
"total_count": 1000,
"service_order_info": [
{
"order_id": "15646546545165651651",
"out_order_no": "1234323JKHDFE1243252",
"state": "CREATED"
}
]
"total_count": 1000
}