| | |
| | | using ZeroD.Util; |
| | | using Alipay.EasySDK.Payment.Common.Models; |
| | | using static LifePayment.Domain.Shared.LifePaymentConstant; |
| | | using ZeroD.Util.Fadd; |
| | | using Nest; |
| | | |
| | | namespace LifePayment.Application; |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | public async Task<LifePayOrderOutput> GetLifePayOrderDetail(string orderNo) |
| | | { |
| | | var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); |
| | | var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.供应商折扣价); |
| | | var channleRate = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); |
| | | var premiumRate = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | var result = new LifePayOrderOutput() |
| | | { |
| | | DiscountAmount = order.DiscountAmount, |
| | | FinishTime = order.FinishTime, |
| | | Id = order.Id, |
| | | LifePayOrderStatus = order.LifePayOrderStatus, |
| | | LifePayOrderType = order.LifePayOrderType, |
| | | LifePayType = order.LifePayType, |
| | | OrderNo = order.OrderNo, |
| | | PayAmount = order.PayAmount, |
| | | RechargeAmount = order.RechargeAmount, |
| | | PayStatus = order.PayStatus, |
| | | PayTime = order.PayTime, |
| | | OrderParamDetailJsonStr = order.OrderParamDetailJsonStr, |
| | | RefundCredentialsImgUrl = order.RefundCredentialsImgUrl.GetOssPath(), |
| | | CreationTime = order.CreationTime, |
| | | RefundCheckRemark = order.RefundCheckRemark, |
| | | RefundApplyRemark = order.RefundApplyRemark, |
| | | RefundTime = order.RefundTime, |
| | | ACOOLYOrderNo = order.ACOOLYOrderNo, |
| | | LifePayRefundStatus = order.LifePayRefundStatus, |
| | | ActualRechargeAmount = order.ActualRechargeAmount, |
| | | RefundPrice = order.RefundPrice, |
| | | PlatformRate = platformRate.Rate, |
| | | PlatformPrice = order.PlatformDeductionAmount, |
| | | ChannleRate = channleRate.ChannlesRate, |
| | | ChannlesRakeRate = channleRate.ChannlesRakeRate, |
| | | ChannlesRakePrice = (order.PayAmount - order.PlatformDeductionAmount) * channleRate.ChannlesRakeRate / 100, |
| | | PremiumRate = premiumRate == null ? default : premiumRate.Rate, |
| | | PremiumPrice = premiumRate == null ? default : Math.Round(order.PayAmount * premiumRate.Rate, 2), |
| | | Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channleRate.ChannlesRakeRate / 100) - (premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2)) |
| | | }; |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取我的订单分页数据 |
| | | /// </summary> |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据订单号获取支付状态 |
| | |
| | | order.RefundCheckRemark = input.RefundCheckRemark; |
| | | order.RefundTime = DateTime.Now; |
| | | order.RefundCheckUserId = CurrentUser.Id; |
| | | order.RefundPrice = order.PayAmount; |
| | | |
| | | await _lifePayOrderRepository.UpdateAsync(order); |
| | | |
| | |
| | | private (decimal PayAmont, decimal DiscountAmount, decimal RechargeAmount) CalculateAmount(decimal amount, decimal rate) |
| | | { |
| | | /// 正常支付 |
| | | var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); |
| | | //var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); |
| | | |
| | | /// 1分钱支付 |
| | | //decimal payAmount = 0.01m; |
| | | decimal payAmount = 0.01m; |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "支付金额错误"); |
| | | |