| | |
| | | Task GetAllLifePayConsumption(); |
| | | |
| | | Task CreatLifePayConsumption(ACOOLYStatusEnum status, string orderNo, string aCOOLYOrderNo, |
| | | decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime); |
| | | decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime, decimal? channleRate = 0, decimal? parValue = 0, decimal? actualParValue = 0); |
| | | } |
| | |
| | | /// <returns></returns> |
| | | Task LifePayRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus); |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 供应商回调处理 |
| | | /// </summary> |
| | |
| | | /// <param name="status"></param> |
| | | /// <param name="acoolyStatus"></param> |
| | | /// <param name="payAmount"></param> |
| | | /// <param name="refundApplyRemark"></param> |
| | | /// <param name="parValue"></param> |
| | | /// <param name="actualParValue"></param> |
| | | /// <returns></returns> |
| | | Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark); |
| | | Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark, decimal? parValue = 0, decimal? actualParValue = 0); |
| | | |
| | | /// <summary> |
| | | /// 创建生活缴费话费订单 |
| | |
| | | |
| | | #region 方法 |
| | | public async Task CreatLifePayConsumption(ACOOLYStatusEnum status, string orderNo, string aCOOLYOrderNo, |
| | | decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime) |
| | | decimal platformDeductionAmount, string channelId, DateTime orderCreationTime, DateTime? orderFinishTime, decimal? channelRate = 0, decimal? parValue = 0, decimal? actualParValue = 0) |
| | | { |
| | | LifePayConsumption lifePayConsumption = new LifePayConsumption() |
| | | { |
| | |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | break; |
| | | //case ACOOLYStatusEnum.部分充值成功: |
| | | // lifePayConsumption.FinishTime = orderCreationTime; |
| | | // lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.部分充值成功; |
| | | // lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | // lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | // lifePayConsumption.DeductionAmount = 0; |
| | | // lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | case ACOOLYStatusEnum.部分充值成功: |
| | | lifePayConsumption.FinishTime = orderCreationTime; |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.部分充值成功; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Out; |
| | | lifePayConsumption.DeductionAmount = lifePayConsumption.Amount; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | if ((parValue ?? 0) != 0 && (parValue ?? 0) != actualParValue) |
| | | { |
| | | LifePayConsumption lifePayConsumptionOther = new LifePayConsumption() |
| | | { |
| | | OrderNo = orderNo, |
| | | AcoolyOrderNo = aCOOLYOrderNo, |
| | | Amount = ((parValue ?? 0) - (actualParValue ?? 0)) * (channelRate ?? 0), |
| | | ChannelId = channelId, |
| | | FinishTime = orderCreationTime, |
| | | ACOOLYStatus = ACOOLYStatusEnum.部分充值成功, |
| | | FrozenStatus = ConsumptionFrozenStatusEnum.Thaw, |
| | | Flow = ConsumptionFlowEnum.Unchanged, |
| | | DeductionAmount = 0, |
| | | FrozenAmount = 0 |
| | | }; |
| | | await _lifePayConsumption.InsertAsync(lifePayConsumptionOther); |
| | | } |
| | | |
| | | // repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | // && x.ACOOLYStatus == lifePayConsumption.ACOOLYStatus && x.Flow == lifePayConsumption.Flow).FirstOrDefaultAsync(); |
| | | // if (repeat == null) |
| | | // { |
| | | // await _lifePayConsumption.InsertAsync(lifePayConsumption); |
| | | // } |
| | | |
| | | // break; |
| | | break; |
| | | default: break; |
| | | } |
| | | |
| | |
| | | using LifePayment.Application.Contracts; |
| | | using Alipay.EasySDK.Payment.Common.Models; |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Domain; |
| | | using LifePayment.Domain.LifePay; |
| | | using LifePayment.Domain.Models; |
| | |
| | | using Volo.Abp.EventBus.Distributed; |
| | | using Z.EntityFramework.Plus; |
| | | using ZeroD.Util; |
| | | using Alipay.EasySDK.Payment.Common.Models; |
| | | using static LifePayment.Domain.Shared.LifePaymentConstant; |
| | | using ZeroD.Util.Fadd; |
| | | using Nest; |
| | | using Volo.Abp.Domain.Entities; |
| | | using Volo.Abp.ObjectMapping; |
| | | using NPOI.SS.Formula.Functions; |
| | | using StackExchange.Redis; |
| | | using static Volo.Abp.Identity.Settings.IdentitySettingNames; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory; |
| | | using LifePayment.Application.LifePay; |
| | | using Alipay.AopSdk.Core.Domain; |
| | | |
| | | namespace LifePayment.Application; |
| | | |
| | |
| | | /// <param name="orderNo"></param> |
| | | /// <param name="outOrderNo"></param> |
| | | /// <returns></returns> |
| | | public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark) |
| | | public async Task ACOOLYOrderNotifyHandler(string orderNo, string acoolyOrderNo, LifePayOrderStatusEnum status, ACOOLYStatusEnum acoolyStatus, decimal payAmount, string refundApplyRemark, decimal? parValue = 0, decimal? actualParValue = 0) |
| | | { |
| | | var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | |
| | | |
| | | /// 创建生活缴费消费记录 |
| | | await _lifePayOrderService.CreatLifePayConsumption(acoolyStatus, order.OrderNo, order.ACOOLYOrderNo, |
| | | order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime); |
| | | order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime, order.ChannleRate, parValue, actualParValue); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [JsonProperty("parValue")] |
| | | public decimal ParValue { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 实际到账金额。 |
| | | /// </summary> |
| | | [JsonProperty("actualParValue")] |
| | | public decimal ActualParValue { get; set; } |
| | | /// <summary> |
| | | /// 实际扣款金额,单位为元。 |
| | | /// </summary> |
| | |
| | | [JsonProperty("statusText")] |
| | | public string StatusText { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 通知消息 |
| | | /// </summary> |
| | | [JsonProperty("responseMessage")] |
| | | public string ResponseMessage { get; set; } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | <param name="refundStatus"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="M:LifePayment.Application.Contracts.ILifePayService.ACOOLYOrderNotifyHandler(System.String,System.String,LifePayment.Domain.Shared.LifePayOrderStatusEnum,LifePayment.Domain.Shared.ACOOLYStatusEnum,System.Decimal,System.String)"> |
| | | <member name="M:LifePayment.Application.Contracts.ILifePayService.ACOOLYOrderNotifyHandler(System.String,System.String,LifePayment.Domain.Shared.LifePayOrderStatusEnum,LifePayment.Domain.Shared.ACOOLYStatusEnum,System.Decimal,System.String,System.Nullable{System.Decimal},System.Nullable{System.Decimal})"> |
| | | <summary> |
| | | 供应商回调处理 |
| | | </summary> |
| | |
| | | <param name="status"></param> |
| | | <param name="acoolyStatus"></param> |
| | | <param name="payAmount"></param> |
| | | <param name="refundApplyRemark"></param> |
| | | <param name="parValue"></param> |
| | | <param name="actualParValue"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="M:LifePayment.Application.Contracts.ILifePayService.CreateLifePayPhoneOrder(LifePayment.Application.Contracts.CreateLifePayOrderInput{LifePayment.Application.Contracts.LifePhoneData})"> |
| | |
| | | ACOOLYStatusEnum acoolyStatus = ACOOLYStatusEnum.充值失败; |
| | | var acoolyOrderNo = string.Empty; |
| | | decimal payAmount = 0; |
| | | decimal parValue = 0; |
| | | decimal actualParValue = 0; |
| | | string refundApplyRemark = string.Empty; |
| | | _logger.LogError("ACOOLY回调通处理类型:" + baseInfo.Service); |
| | | _logger.LogError("ACOOLY回调内容:" + body); |
| | |
| | | orderNo = confirmElectricOrderResponse.ElectricChargeOrder.OutOrderNo; |
| | | acoolyOrderNo = confirmElectricOrderResponse.ElectricChargeOrder.BusiOrderNo; |
| | | payAmount = confirmElectricOrderResponse.ElectricChargeOrder.PayAmount; |
| | | actualParValue = confirmElectricOrderResponse.ElectricChargeOrder.ActualParValue; |
| | | parValue = confirmElectricOrderResponse.ElectricChargeOrder.ParValue; |
| | | _logger.LogError("ACOOLY回调通处理结果状态:" + confirmElectricOrderResponse.ElectricChargeOrder.Status); |
| | | |
| | | if (!confirmElectricOrderResponse.Success |
| | |
| | | { |
| | | status = LifePayOrderStatusEnum.待退款; |
| | | acoolyStatus = ACOOLYStatusEnum.部分充值成功; |
| | | refundApplyRemark = confirmElectricOrderResponse.ElectricChargeOrder.ResponseMessage; |
| | | } |
| | | break; |
| | | case ACOOLYConstant.Sevice.ConfirmPhoneOrder: |
| | |
| | | throw new UserFriendlyException("ACOOLY回调通处理类型不存在"); |
| | | } |
| | | |
| | | await _lifePayService.ACOOLYOrderNotifyHandler(orderNo, acoolyOrderNo, status, acoolyStatus, payAmount, refundApplyRemark); |
| | | await _lifePayService.ACOOLYOrderNotifyHandler(orderNo, acoolyOrderNo, status, acoolyStatus, payAmount, refundApplyRemark, parValue, actualParValue); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo); |
| | | // 插入收支流水 |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() { OrderNo = input.OutTradeNo, |
| | | OutOrderNo = input.TradeNo ,LifePayType = LifePayTypeEnum.AliPay,ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses }); |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | | { |
| | | OrderNo = input.OutTradeNo, |
| | | OutOrderNo = input.TradeNo, |
| | | LifePayType = LifePayTypeEnum.AliPay, |
| | | ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses |
| | | }); |
| | | } |
| | | else if((input.TradeStatus == LifePaymentConstant.AliPayStatus.支付成功 && input.OutBizNo.IsNotNullOrEmpty() && input.RefundFee.HasValue) || |
| | | input.TradeStatus == LifePaymentConstant.AliPayStatus.超时关闭) |
| | | else if (((input.TradeStatus == LifePaymentConstant.AliPayStatus.支付成功 || input.TradeStatus == LifePaymentConstant.AliPayStatus.超时关闭) |
| | | && input.OutBizNo.IsNotNullOrEmpty() |
| | | && (input.RefundFee.HasValue && input.RefundFee > 0))) |
| | | { |
| | | await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.已退款); |
| | | // 插入收支流水 |