static bool PostponeApplyformPaySuccess(decimal applyformId, string payAccount, string payTradeNo, string channelTradeNo, DateTime payTime, PayInterface payInterface, PayAccountType payAccountType, string account) { var result = false; decimal?orderId = null; var request = string.Format("申请单:{0} 支付账号:{1} 流水号:{2} 支付时间:{3} 支付接口:{4} 支付账号类型:{5} 操作员账号:{6} 通道流水号:{7} ", applyformId, payAccount, payTradeNo, payTime, payInterface.GetDescription(), payAccountType.GetDescription(), account, channelTradeNo); var response = string.Empty; try { orderId = ApplyformProcessService.PostponeFeePaySuccess(applyformId, payAccount, payTradeNo, channelTradeNo, payTime, payInterface, payAccountType, account); result = true; response = "处理成功"; } catch (Exception ex) { LogService.SaveExceptionLog(ex, "申请单支付通知 " + request); response = "处理失败 " + ex.Message; } if (orderId.HasValue) { var tradementLog = new Log.Domain.TradementLog { OrderId = orderId.Value, ApplyformId = applyformId, Request = request, Response = response, Time = DateTime.Now, Remark = "支付成功通知" }; LogService.SaveTradementLog(tradementLog); } return(result); }
static bool OrderPaySuccess(decimal orderId, string payAccount, string payTradeNo, string channelTradeNo, DateTime payTime, PayInterface payInterface, PayAccountType payAccountType, string operatorAccount) { var result = false; var request = string.Format("订单:{0} 支付账号:{1} 流水号:{2} 支付时间:{3} 支付接口:{4} 支付账号类型:{5} 操作员账号:{6} 通道流水号:{7} ", orderId, payAccount, payTradeNo, payTime, payInterface.GetDescription(), payAccountType.GetDescription(), operatorAccount, channelTradeNo); var response = string.Empty; try { OrderProcessService.PaySuccess(orderId, payAccount, payTradeNo, channelTradeNo, payTime, payInterface, payAccountType, operatorAccount); result = true; response = "处理成功"; } catch (Exception ex) { LogService.SaveExceptionLog(ex, "订单支付通知 " + request); response = "处理失败 " + ex.Message; } var tradementLog = new Log.Domain.TradementLog { OrderId = orderId, Request = request, Response = response, Time = DateTime.Now, Remark = "支付成功通知", }; LogService.SaveTradementLog(tradementLog); return(result); }
/// <summary> /// 新增代扣记录 /// </summary> public static void InsertAutoPay(AutoPay auto) { using (var command = Factory.CreateCommand()) { var request = string.Format("订单号:{0},代扣账号:{1},代扣方式:{2}", auto.OrderId, auto.PayAccountNo, auto.PayType.GetDescription()); var response = string.Empty; var autoPayRepository = Factory.CreateAutoPayRepository(command); try { autoPayRepository.Insert(auto); response = "处理成功"; } catch (Exception ex) { LogService.SaveExceptionLog(ex, "添加代扣记录: " + request); response = "处理失败 " + ex.Message; } var tradementLog = new Log.Domain.TradementLog { OrderId = auto.OrderId, Request = request, Response = response, Time = DateTime.Now, Remark = "添加代扣记录", }; LogService.SaveTradementLog(tradementLog); } }
/// <summary> /// 代扣 /// </summary> /// <param name="tradeView"></param> public static global::PoolPay.DomainModel.Trade.PayTrade AutoPay(AccountTradeDTO tradeView, WithholdingAccountType type) { global::PoolPay.DomainModel.Trade.PayTrade pay = null; string success = ""; if (type == WithholdingAccountType.Poolpay) { pay = AccountTradeService.AccountPay(tradeView, ""); if (pay != null && pay.Status == global::PoolPay.DataTransferObject.PayStatus.PaySuccess) { success = "SUCCESS"; } else { throw new Exception("支付失败!"); } } else if (type == WithholdingAccountType.Alipay) { success = AccountTradeService.InterfacePay(tradeView); } if (success != "") { if (success.ToUpper() == "SUCCESS") { using (var command = Factory.CreateCommand()) { var autoPayRepository = Factory.CreateAutoPayRepository(command); autoPayRepository.UpdateSuccess(decimal.Parse(tradeView.OutOrderId)); } } else { throw new Exception("支付失败!"); } var tradementLog = new Log.Domain.TradementLog { OrderId = decimal.Parse(tradeView.OutOrderId), Request = "订单号:" + tradeView.OutOrderId, Response = success, Time = DateTime.Now, Remark = "修改代扣处理状态", }; LogService.SaveTradementLog(tradementLog); } return(pay); }