zhengyuxuan
2025-03-24 d64a364e912bb0d34c3efabd1bdee9a2f6ec0878
fix:微信退款bug修复、新增获取渠道折扣接口
7个文件已修改
77 ■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
@@ -143,6 +143,13 @@
    /// <returns></returns>
    Task<List<LifePayRateListOutput>> GetRate();
    /// <summary>
    /// 获取渠道折扣
    /// </summary>
    /// <returns></returns>
    Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input);
    /// <summary>
    /// 获取手续费费率
    /// </summary>
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -935,4 +935,9 @@
    /// </summary>
    public int YesterdayActiveUsers { get; set; }
}
public class ChannelRateOutput
{
    public decimal ChannlesRate { get; set; }
}
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -152,6 +152,16 @@
    }
    /// <summary>
    /// 获取渠道折扣
    /// </summary>
    /// <returns></returns>
    public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input)
    {
        return  _lifePayChannlesRep.Where(x => x.IsDeleted == false && x.ChannlesNum == input.CheckChannelId).Select(x => new ChannelRateOutput() { ChannlesRate = x.ChannlesRate })
                                           .FirstOrDefault();
    }
    /// <summary>
    /// 获取手续费费率
    /// </summary>
    /// <returns></returns>
@@ -1327,12 +1337,16 @@
                    order.LifePayOrderStatus = LifePayOrderStatusEnum.退款中;
                    order.LifePayRefundStatus = LifePayRefundStatusEnum.退款中;
                }
                else if (wxRefundResult.Message == "订单已全额退款")
                {
                    order.LifePayOrderStatus = LifePayOrderStatusEnum.已退款;
                    order.LifePayRefundStatus = LifePayRefundStatusEnum.已退款;
                }
                else
                {
                    order.LifePayOrderStatus = LifePayOrderStatusEnum.待退款;
                    order.LifePayRefundStatus = LifePayRefundStatusEnum.待退款;
                }
                break;
            case LifePayTypeEnum.AliPay:
                var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() });
@@ -1351,7 +1365,7 @@
        order.RefundCheckUserId = CurrentUser.Id;
        order.RefundPrice = input.RefundPrice;
        await _lifePayOrderRepository.UpdateAsync(order);
        //await _lifePayOrderRepository.UpdateAsync(order);
        #region 记录日志
@@ -1390,6 +1404,10 @@
            await _lifePayOrderRepository.UpdateAsync(order);
        }
        else if (order.LifePayOrderStatus == LifePayOrderStatusEnum.已退款 || order.LifePayRefundStatus == LifePayRefundStatusEnum.已退款)
        {
            throw new UserFriendlyException("当前订单无法重复申请退款");
        }
        else
        {
            throw new UserFriendlyException("当前订单状态无法申请退款");
@@ -1411,7 +1429,7 @@
        {
            OutTradeNo = outTradeNo,
            OutRefundNo = outRefundNo,
            Reason = reason,
            //Reason = reason,
            Amount = new Model_WxPayDomesticRefunds_Amount
            {
                Refund = refund,
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs
@@ -613,11 +613,11 @@
        [JsonProperty("out_refund_no")]
        public string OutRefundNo { get; set; }
        /// <summary>
        ///  退款原因
        /// </summary>
        [JsonProperty("reason")]
        public string Reason { get; set; }
        ///// <summary>
        /////  退款原因
        ///// </summary>
        //[JsonProperty("reason")]
        //public string Reason { get; set; }
        /// <summary>
        /// 退款结果回调url
@@ -721,6 +721,13 @@
        [JsonProperty("amount")]
        public Model_WxPayRetuenDomesticRefunds_Amount Amount { get; set; }
        /// <summary>
        /// 返回信息
        /// </summary>
        [JsonProperty("message")]
        public string Message { get; set; }
    }
    public class Model_WxPayRetuenDomesticRefunds_Amount: Model_WxPayDomesticRefunds_Amount
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -104,6 +104,12 @@
            </summary>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.LifePayController.GetChannelRate(LifePayment.Domain.Shared.ChannelsBaseInput)">
            <summary>
            获取渠道折扣
            </summary>
            <returns></returns>
        </member>
        <member name="M:LifePayment.HttpApi.LifePayController.GetPremium">
            <summary>
            获取手续费费率
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -130,6 +130,12 @@
            </summary>
            <returns></returns>
        </member>
        <member name="M:LifePayment.Application.Contracts.ILifePayService.GetChannelRate(LifePayment.Domain.Shared.ChannelsBaseInput)">
            <summary>
            获取渠道折扣
            </summary>
            <returns></returns>
        </member>
        <member name="M:LifePayment.Application.Contracts.ILifePayService.GetPremium">
            <summary>
            获取手续费费率
LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -150,6 +150,18 @@
        }
        /// <summary>
        /// 获取渠道折扣
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        [ChannelFilter]
        public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input)
        {
            return await _lifePayService.GetChannelRate(input);
        }
        /// <summary>
        /// 获取手续费费率
        /// </summary>
        /// <returns></returns>