| | |
| | | private readonly IAlipayInterfaceManager _alipayInterfaceManager; |
| | | private readonly IWxPayApi _wxPayApi; |
| | | private readonly WxPayOption _wxPayOptions; |
| | | private readonly InitSetting _initSettingOptions; |
| | | |
| | | private readonly IACOOLYManager _aCOOLYManager; |
| | | |
| | |
| | | IAlipayInterfaceManager aliPayInterfaceManager, |
| | | IWxPayApi wxPayApi, |
| | | IOptions<WxPayOption> wxPayOptions, |
| | | IOptions<InitSetting> initSettingOptions, |
| | | IRepository<LifePayChannles, Guid> lifePayChannlesRep, |
| | | IRepository<LifePayAccount, Guid> lifePayAccount, |
| | | IDataFilter dataFilter, |
| | |
| | | _alipayInterfaceManager = aliPayInterfaceManager; |
| | | _wxPayApi = wxPayApi; |
| | | _wxPayOptions = wxPayOptions.Value; |
| | | _initSettingOptions = initSettingOptions.Value; |
| | | _distributedEventBus = distributedEventBus; |
| | | _lifePayChannlesRep = lifePayChannlesRep; |
| | | _lifePayAccount = lifePayAccount; |
| | |
| | | .WhereIf(!string.IsNullOrEmpty(input.QueryCondition), x => x.PhoneNumber.Contains(input.QueryCondition) || x.Name.Contains(input.QueryCondition)) |
| | | .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin) |
| | | .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd) |
| | | .WhereIf(input.LoginTimeBegin.HasValue, x => x.LastLoginTime >= input.LoginTimeBegin) |
| | | .WhereIf(input.LoginTimeEnd.HasValue, x => x.LastLoginTime <= input.LoginTimeEnd) |
| | | .Select(x => |
| | | new UserListOutput() |
| | | { |
| | |
| | | var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.话费订单 && x.PayStatus == LifePayStatusEnum.已支付 |
| | | && x.LifePayOrderStatus == LifePayOrderStatusEnum.充值中 && x.OrderParamDetailJsonStr.Contains(input.ProductData.IspCode) |
| | | && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).ToListAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "您有同户号订单正在充值中,请勿重复充值"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "您有同户号订单正在充值中,请勿重复充值"); |
| | | |
| | | //var rate = await GetRate(); |
| | | //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "未配置折扣"); |
| | |
| | | var userAccount = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.Id == input.Id) |
| | | .FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(userAccount == null, "户号不存在"); |
| | | var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id) |
| | | var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id && x.IsDeleted == false) |
| | | .FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "户号已存在"); |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content) |
| | | var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.IsDeleted == false) |
| | | .FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "户号已存在"); |
| | | var userAccount = new LifePayAccount |
| | | /// CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "户号已存在"); |
| | | if (repeatAccountContent != null) |
| | | { |
| | | Id = Guid.NewGuid(), |
| | | UserId = input.UserId, |
| | | Content = input.Content, |
| | | Province = input.Province, |
| | | LifePayType = input.LifePayType, |
| | | City = input.City, |
| | | Remark = input.Remark, |
| | | Operators = input.Operators, |
| | | ExtraProperties = input.ExtraProperties, |
| | | }; |
| | | await _lifePayAccount.InsertAsync(userAccount); |
| | | repeatAccountContent.LifePayType = input.LifePayType; |
| | | repeatAccountContent.Content = input.Content; |
| | | repeatAccountContent.Province = input.Province; |
| | | repeatAccountContent.City = input.City; |
| | | repeatAccountContent.Remark = input.Remark; |
| | | repeatAccountContent.Operators = input.Operators; |
| | | repeatAccountContent.ExtraProperties = input.ExtraProperties; |
| | | } |
| | | else |
| | | { |
| | | var userAccount = new LifePayAccount |
| | | { |
| | | Id = Guid.NewGuid(), |
| | | UserId = input.UserId, |
| | | Content = input.Content, |
| | | Province = input.Province, |
| | | LifePayType = input.LifePayType, |
| | | City = input.City, |
| | | Remark = input.Remark, |
| | | Operators = input.Operators, |
| | | ExtraProperties = input.ExtraProperties, |
| | | }; |
| | | await _lifePayAccount.InsertAsync(userAccount); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (input.LifePayType == LifePayOrderTypeEnum.话费订单) |
| | |
| | | |
| | | private (decimal PayAmont, decimal DiscountAmount, decimal RechargeAmount) CalculateAmount(decimal amount, decimal rate) |
| | | { |
| | | /// 正常支付 |
| | | var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); |
| | | if (_initSettingOptions.OpenTheOnePennyTest) |
| | | { |
| | | /// 1分钱支付 |
| | | decimal payAmount = 0.01m; |
| | | |
| | | /// 1分钱支付 |
| | | //decimal payAmount = 0.01m; |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "支付金额错误"); |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(payAmount < 0.01m, "支付金额错误"); |
| | | |
| | | return (payAmount, amount - payAmount, amount); |
| | | return (payAmount, amount - payAmount, amount); |
| | | } |
| | | else |
| | | { |
| | | /// 正常支付 |
| | | var payAmount = decimal.Round(amount * rate / 100, 2, MidpointRounding.AwayFromZero); |
| | | return (payAmount, amount - payAmount, amount); |
| | | } |
| | | } |
| | | |
| | | private void SetOrderStatus(LifePayOrder order, string code) |