121 lines
4.2 KiB
C#
121 lines
4.2 KiB
C#
using Hncore.Infrastructure.Extension;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Hncore.Pass.PaymentCenter.Domain.Refund;
|
|
namespace Hncore.Pass.PaymentCenter.Domain
|
|
{
|
|
public partial class RefundRecord
|
|
{
|
|
public int Id { get; set; }
|
|
public DateTime? CreateTime { get; set; }
|
|
public DateTime? UpdateTime { get; set; }
|
|
public int? DeleteTag { get; set; }
|
|
public int? TenantId { get; set; }
|
|
public int? StoreId { get; set; }
|
|
public int? PaymentRecordId { get; set; }
|
|
public DateTime? RequestTime { get; set; }
|
|
public string OrderId { get; set; }
|
|
public string TransactionId { get; set; }
|
|
public string RefundId { get; set; }
|
|
public string TransactionRefundId { get; set; }
|
|
public RefundStatus RefundStatus { get; set; }
|
|
public int? RefundFee { get; set; }
|
|
public int? OrderTotalFee { get; set; }
|
|
public PaymentChannel PaymentChannel { get; set; }
|
|
public int PaymentMethod { get; set; }
|
|
public PaymentType PaymentType { get; set; }
|
|
public DateTime? RefundSuccessTime { get; set; }
|
|
public string RefundReason { get; set; }
|
|
public DateTime? ApplyCancelTime { get; set; }
|
|
public string CancelReason { get; set; }
|
|
public CancelStatus CancelStatus { get; set; }
|
|
public DateTime? QueryJobPollTime { get; set; }
|
|
public DateTime? StatementJobPollTime { get; set; }
|
|
public string CompanyName { get; set; }
|
|
public int? OperatorId { get; set; }
|
|
public string OperatorName { get; set; }
|
|
public int? OffLineRefund { get; set; }
|
|
public int TaskStates { get; set; }
|
|
public string Bak { get; set; }
|
|
public string CallbackUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// 设置为退款成功
|
|
/// </summary>
|
|
/// <param name="transactionRefundId">交易平台退款单号</param>
|
|
/// <param name="refundSuccessTime">退款到账时间</param>
|
|
public void SetRefundSuccessed(string transactionRefundId, DateTime? refundSuccessTime)
|
|
{
|
|
this.RefundStatus = RefundStatus.Success;
|
|
this.UpdateTime = DateTime.Now;
|
|
|
|
if (refundSuccessTime != null)
|
|
{
|
|
this.RefundSuccessTime = refundSuccessTime;
|
|
}
|
|
|
|
if (transactionRefundId.Has())
|
|
{
|
|
this.TransactionRefundId = transactionRefundId;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置为退款失败
|
|
/// </summary>
|
|
public void SetRefundFailed()
|
|
{
|
|
this.RefundStatus = RefundStatus.Fail;
|
|
this.UpdateTime = DateTime.Now;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置为撤销成功
|
|
/// </summary>
|
|
public void SetCancelSuccessed()
|
|
{
|
|
// 撤销中,未到账
|
|
if (this.CancelStatus == CancelStatus.Canceling && this.RefundStatus != RefundStatus.Success)
|
|
{
|
|
this.CancelStatus = CancelStatus.Success;
|
|
this.RefundStatus = RefundStatus.Fail;
|
|
this.UpdateTime = DateTime.Now;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置为撤销失败
|
|
/// </summary>
|
|
public void SetCancelFailed()
|
|
{
|
|
// 撤销中,已到账
|
|
if (this.CancelStatus == CancelStatus.Canceling && this.RefundStatus == RefundStatus.Success)
|
|
{
|
|
this.CancelStatus = CancelStatus.Fail;
|
|
this.UpdateTime = DateTime.Now;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重置状态,失败的单子重新发起退款
|
|
/// </summary>
|
|
public void ReSetStatus(int refundFee)
|
|
{
|
|
this.RefundStatus = RefundStatus.Processing;
|
|
this.CancelStatus = CancelStatus.None;
|
|
this.RequestTime = DateTime.Now;
|
|
this.RefundSuccessTime = null;
|
|
this.RefundFee = refundFee;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置新的refundId
|
|
/// </summary>
|
|
public void SetNewRefundId()
|
|
{
|
|
this.RefundId = Guid.NewGuid().ToString().Replace("-", "");
|
|
}
|
|
|
|
}
|
|
}
|