Files
juipnet/Services/Hncore.Pass.PaymentCenter/Pay/WeiFuTong/WeiFuTongResponseBase.cs
“wanyongkang” b562aba2b1 忽略dll文件git
2023-07-29 10:19:42 +08:00

66 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Xml.Serialization;
using Hncore.Infrastructure.Data;
using Hncore.Infrastructure.Extension;
using Newtonsoft.Json;
namespace Hncore.Pass.PaymentCenter.WeiFuTong
{
[XmlRoot("xml", Namespace = "")]
public class WeiFuTongResponseBase : WeiFuTongDTOBase
{
/// <summary>
/// 0表示成功非0表示失败此字段是通信标识非交易标识交易是否成功需要查看 result_code 来判断
/// </summary>
[XmlElement("status")]
public string Status { get; set; }
/// <summary>
/// 返回信息,如非空,为错误原因签名失败参数格式校验错误
/// </summary>
[XmlElement("message")]
public string Message { get; set; }
/// <summary>
/// 业务结果 0表示成功非0表示失败
/// </summary>
[XmlElement("result_code")]
public string ResultCode { get; set; }
/// <summary>
/// 错误代码
/// </summary>
[XmlElement("err_code")]
public string ErrCode { get; set; }
/// <summary>
/// 错误代码描述
/// </summary>
[XmlElement("err_msg")]
public string ErrMsg { get; set; }
/// <summary>
/// 可选值 UTF-8 ,默认为 UTF-8
/// </summary>
[JsonIgnore]
[XmlElement("charset")]
public string Charset { get; set; }
public virtual bool HasError()
{
return Status != "0" || ResultCode != "0";
}
public virtual void HandleError()
{
if (Status != "0")
{
BusinessException.Throw($"支付平台通讯失败,status:{Status},message:{Message}");
}
if (ResultCode != "0")
{
BusinessException.Throw($"支付平台业务处理失败,result_code:{ResultCode},err_msg:{ErrMsg }");
}
}
}
}