private void payPostponeFee(decimal applyformId) { PostponeApplyform postponeApplyform = ApplyformQueryService.QueryPostponeApplyform(applyformId); if (postponeApplyform == null) { showErrorMessage("改期申请单 [" + applyformId + "] 不存在"); } else { flights = postponeApplyform.Flights.Select(f => f.NewFlight).ToList(); string errorMessage; if (ApplyformProcessService.Payable(applyformId, out errorMessage)) { string lockErrorMsg; if (Lock(applyformId, LockRole.Purchaser, "支付改期费", out lockErrorMsg)) { bindApplyform(postponeApplyform); bindPayTypes(); } else { showErrorMessage("锁定改期申请单失败。原因:" + lockErrorMsg); } } else { showErrorMessage(errorMessage); } } }
/// <summary> /// 支付改期手续费 /// 在线方式支付 /// </summary> /// <param name="postponeApplyformId">改期申请单号</param> /// <param name="bankInfo">银行信息</param> /// <param name="clientIP">客户端IP</param> /// <param name="operatorAccount">操作员账号</param> public static string OnlinePayPostponeFee(decimal postponeApplyformId, string bankInfo, string clientIP, string operatorAccount) { var applyform = ApplyformQueryService.QueryPostponeApplyform(postponeApplyformId); var payAccount = getPayAccountNo(applyform.PurchaserId); var bankInfoArray = bankInfo.Split('|'); var channelId = int.Parse(bankInfoArray[0]); var bankCode = bankInfoArray[1]; var postPoneRequest = new PayPostPoneRequestProcess(applyform.OrderId, postponeApplyformId, Math.Abs(applyform.PayBill.Applier.Amount), payAccount, applyform.PayBill.Tradement.PayeeAccount, "支付改期费", applyform.OriginalPNR == null ? string.Empty : (applyform.OriginalPNR.PNR ?? applyform.OriginalPNR.BPNR), PostponeApplyformPayType + "|" + payAccount + "|" + operatorAccount + "|", channelId.ToString(), bankCode); postPoneRequest.Execute(); return(postPoneRequest.PayUrl); }
private void process() { showMessage("开始下一批处理"); var noPorcess = AutoPayService.QueryNoPorcess(); //var str = Environment.CurrentDirectory; string msg = ""; foreach (var item in noPorcess) { if (!_run) { break; } AccountTradeDTO tradeView = null; //处理订单 if (item.OrderType == OrderType.Order) { OrderProcessService.Payable(item.OrderId, out msg); if (string.IsNullOrEmpty(msg)) { Order order = OrderQueryService.QueryOrder(item.OrderId); tradeView = getPayTradeView(order, getPayAccountNo(item.PayType, order.Purchaser.Amount, order.Purchaser.CompanyId), ""); } } //处理申请单 else if (item.OrderType == OrderType.Postpone) { ApplyformProcessService.Payable(item.OrderId, out msg); if (string.IsNullOrEmpty(msg)) { PostponeApplyform applyform = ApplyformQueryService.QueryPostponeApplyform(item.OrderId); if (applyform.PayBill.Tradement == null) { msg = "申请单:" + item.OrderId + " 不能进行代扣,无支付信息!"; } tradeView = getPayTradeView(applyform, getPayAccountNo(item.PayType, Math.Abs(applyform.PayBill.Applier.Amount), applyform.PurchaserId), ""); } } if (item.PayType == WithholdingAccountType.Alipay) { tradeView.BuyerEmail = item.PayAccountNo; } try { if (string.IsNullOrEmpty(msg)) { global::PoolPay.DomainModel.Trade.PayTrade pay = AutoPayService.AutoPay(tradeView, item.PayType); if (item.PayType == WithholdingAccountType.Poolpay) { //如果是国付通代扣就直接修改订单状态 if (pay != null && pay.Status == global::PoolPay.DataTransferObject.PayStatus.PaySuccess) { NotifyService.PaySuccess(item.OrderId, pay.CustomParameter, pay.Id.ToString(), pay.FillChargeId.ToString(), pay.PayDate.Value, "", (pay.BuyerAccount.Character as global::PoolPay.DomainModel.Accounts.CreditAccount) == null ? "0" : "1", pay.BuyerAccount.AccountNo); } } showMessage("处理成功"); } else { showMessage("处理失败" + Environment.NewLine + "原因:" + msg); } } catch (Exception ex) { showMessage("处理失败" + Environment.NewLine + "原因:" + ex.Message); } AutoPayService.UpdateProcess(item.OrderId); System.Threading.Thread.Sleep(50); } showMessage("当前批次处理结束,共处理 " + noPorcess.Count + " 条"); }
protected override string ExecuteCore() { var orderId = Context.GetParameterValue("id"); var payType = Context.GetParameterValue("payType"); var orderType = Context.GetParameterValue("businessType"); if (string.IsNullOrWhiteSpace(orderId)) { InterfaceInvokeException.ThrowParameterMissException("id"); } if (string.IsNullOrWhiteSpace(payType) || (payType != "0" && payType != "1")) { InterfaceInvokeException.ThrowParameterMissException("payType"); } if (string.IsNullOrWhiteSpace(orderType) || (orderType != "0" && orderType != "1")) { InterfaceInvokeException.ThrowParameterMissException("businessType"); } decimal oid; string msg = ""; if (decimal.TryParse(orderId, out oid)) { decimal amount = 0M; if (orderType == "0") { OrderProcessService.Payable(oid, out msg); if (!string.IsNullOrEmpty(msg)) { InterfaceInvokeException.ThrowCustomMsgException(msg); } var orderInfo = OrderQueryService.QueryOrder(oid); if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } amount = orderInfo.Purchaser.Amount; } else if (orderType == "1") { ApplyformProcessService.Payable(oid, out msg); if (!string.IsNullOrEmpty(msg)) { InterfaceInvokeException.ThrowCustomMsgException(msg); } var orderInfo = ApplyformQueryService.QueryPostponeApplyform(oid); if (orderInfo.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } amount = orderInfo.PayBill.Applier.Amount; } if (AutoPayService.QueryAuto(oid) != null) { InterfaceInvokeException.ThrowCustomMsgException("存在重复的代扣记录"); } var auto = AccountService.GetWithholding((WithholdingAccountType)byte.Parse(payType), Employee.Owner); if (auto == null || auto.Status == WithholdingProtocolStatus.Submitted) { InterfaceInvokeException.ThrowCustomMsgException("该账户还没有进行代扣设置,请先登录平台进行设置!"); } if (payType == "0" && amount > auto.Amount) { InterfaceInvokeException.ThrowCustomMsgException("订单[ " + orderId + " ] 需要支付的金额超过的代扣金额上限!"); } AutoPayService.InsertAutoPay(new ChinaPay.B3B.Service.Order.Domain.AutoPay.AutoPay() { PayAccountNo = auto.AccountNo, PayType = (WithholdingAccountType)byte.Parse(payType), OrderId = oid, OrderType = (OrderType)byte.Parse(orderType), ProcessState = false, Success = false, Time = DateTime.Now }); } else { InterfaceInvokeException.ThrowParameterMissException("orderId"); } return(""); }