| | |
| | | data.OrderNo = input.OrderNo; |
| | | data.ExtraProperties = JsonConvert.SerializeObject(query); |
| | | data.FinishTime = Convert.ToDateTime(query.SuccessTime); |
| | | data.Amount = Convert.ToDecimal(query.Amount.Total) / 100; |
| | | await _lifePayExpensesReceiptsRepository.InsertAsync(data); |
| | | } |
| | | } |
| | |
| | | data.OrderNo = input.OutRefundNo; |
| | | data.ExtraProperties = JsonConvert.SerializeObject(query); |
| | | data.FinishTime = Convert.ToDateTime(query.SuccessTime); |
| | | data.Amount = Convert.ToDecimal(query.Amount.Total) / 100; |
| | | await _lifePayExpensesReceiptsRepository.InsertAsync(data); |
| | | } |
| | | } |
| | |
| | | OrderNo = item.OrderNo, |
| | | AcoolyOrderNo = item.ACOOLYOrderNo, |
| | | Amount = item.PlatformDeductionAmount.HasValue? item.PlatformDeductionAmount.Value : 0, |
| | | ChannelId = item.ChannelId, |
| | | }; |
| | | if (item.ACOOLYStatus != null) |
| | | { |
| | |
| | | case ACOOLYStatusEnum.充值中: |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值中, item, lifePayConsumption); |
| | | break; |
| | | case ACOOLYStatusEnum.充值成功: |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值中, item, lifePayConsumption); |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值成功, item, lifePayConsumption); |
| | | break; |
| | | case ACOOLYStatusEnum.已完成: |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值中, item, lifePayConsumption); |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.已完成, item, lifePayConsumption); |
| | | break; |
| | | case ACOOLYStatusEnum.充值失败: |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值中, item, lifePayConsumption); |
| | | await CreatLifePayConsumption(ACOOLYStatusEnum.充值失败, item, lifePayConsumption); |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private async Task CreatLifePayConsumption(ACOOLYStatusEnum status, LifePayOrder order, LifePayConsumption lifePayConsumption) |
| | | { |
| | | LifePayConsumption repeat = new LifePayConsumption(); |
| | | switch (status) |
| | | { |
| | | case ACOOLYStatusEnum.充值中: |
| | |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | |
| | | var repeat = await _lifePayConsumption.Where(x => x.OrderNo == lifePayConsumption.OrderNo |
| | | 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; |
| | | case ACOOLYStatusEnum.已完成: |
| | | lifePayConsumption.FinishTime = order.FinishTime.Value; |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.已完成; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Out; |
| | | lifePayConsumption.DeductionAmount = lifePayConsumption.Amount; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | |
| | | 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; |
| | | case ACOOLYStatusEnum.充值失败: |
| | | lifePayConsumption.FinishTime = order.CreationTime; |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.充值失败; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Frozen; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | |
| | | 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; |
| | | case ACOOLYStatusEnum.已退款: |
| | | lifePayConsumption.FinishTime = order.FinishTime.Value; |
| | | lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.已退款; |
| | | lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | lifePayConsumption.DeductionAmount = 0; |
| | | lifePayConsumption.FrozenAmount = 0; |
| | | |
| | | 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; |
| | | |
| | | //case ACOOLYStatusEnum.部分充值成功: |
| | | // lifePayConsumption.FinishTime = order.CreationTime; |
| | | // lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.部分充值成功; |
| | | // lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw; |
| | | // lifePayConsumption.Flow = ConsumptionFlowEnum.Unchanged; |
| | | // lifePayConsumption.DeductionAmount = 0; |
| | | // lifePayConsumption.FrozenAmount = lifePayConsumption.Amount; |
| | | |
| | | // 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; |
| | | default: break; |
| | | } |
| | | } |