| | |
| | | using Nest; |
| | | using Volo.Abp.Domain.Entities; |
| | | using Volo.Abp.ObjectMapping; |
| | | using NPOI.SS.Formula.Functions; |
| | | |
| | | namespace LifePayment.Application; |
| | | |
| | |
| | | private readonly IDataFilter dataFilter; |
| | | private readonly IChannelFilter _channelFilter; |
| | | private readonly IAliPayApi _aliPayApi; |
| | | private readonly IAlipayInterfaceManager _alipayInterfaceManager; |
| | | private readonly IWxPayApi _wxPayApi; |
| | | private readonly WxPayOption _wxPayOptions; |
| | | |
| | |
| | | IRepository<DallyStatistics, Guid> dallyStatisticsRepository, |
| | | IRepository<OperateHistory, Guid> operateHistory, |
| | | IAliPayApi aliPayApi, |
| | | IAlipayInterfaceManager aliPayInterfaceManager, |
| | | IWxPayApi wxPayApi, |
| | | IOptions<WxPayOption> wxPayOptions, |
| | | IRepository<LifePayChannles, Guid> lifePayChannlesRep, |
| | |
| | | _lifePayIntroInfoRepository = lifePayIntroInfoRepository; |
| | | _dallyStatisticsRepository = dallyStatisticsRepository; |
| | | _aliPayApi = aliPayApi; |
| | | _alipayInterfaceManager = aliPayInterfaceManager; |
| | | _wxPayApi = wxPayApi; |
| | | _wxPayOptions = wxPayOptions.Value; |
| | | _distributedEventBus = distributedEventBus; |
| | |
| | | }); |
| | | return result; |
| | | } |
| | | public async Task<string> GetBillErceiptExport(string orderNo) |
| | | { |
| | | try |
| | | { |
| | | var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); |
| | | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "未找到订单信息"); |
| | | if (order.LifePayType == LifePayTypeEnum.AliPay) |
| | | { |
| | | var elecInfoInput = new DataBillErceiptApplyInput |
| | | { |
| | | Type = "FUND_DETAIL", |
| | | Key = orderNo |
| | | }; |
| | | |
| | | var elecInfoOutput = await _alipayInterfaceManager.DataBillErceiptApply(elecInfoInput); |
| | | if (elecInfoOutput != null) |
| | | { |
| | | var elecFileInput = new DataBillEreceiptQueryInput |
| | | { |
| | | FileId = elecInfoOutput.FileId, |
| | | }; |
| | | var elecFileOutput = await _alipayInterfaceManager.DataBillEreceiptQuery(elecFileInput); |
| | | if (!string.IsNullOrEmpty(elecFileOutput.DownloadUrl)) |
| | | { |
| | | return elecFileOutput.DownloadUrl; |
| | | } |
| | | return ""; |
| | | } |
| | | return ""; |
| | | } |
| | | else |
| | | { |
| | | WxPayTradeBillApplyRequest req = new WxPayTradeBillApplyRequest |
| | | { |
| | | OutBillNo = order.OutOrderNo, |
| | | }; |
| | | |
| | | var res = await _wxPayApi.WxPayTradeBillApply(req); |
| | | return ""; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError("获取订单号为{0}电子回单出现错误:{1}", orderNo, ex.Message); |
| | | return ""; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 操作 |