private static void Vaild(string departure, string arrival, string flightDate) { if (string.IsNullOrWhiteSpace(departure)) { InterfaceInvokeException.ThrowParameterMissException("departure"); } if (string.IsNullOrWhiteSpace(arrival)) { InterfaceInvokeException.ThrowParameterMissException("arrival"); } if (string.IsNullOrWhiteSpace(flightDate)) { InterfaceInvokeException.ThrowParameterMissException("flightDate"); } if (!Regex.IsMatch(departure, "(\\w{3})")) { InterfaceInvokeException.ThrowParameterErrorException("departure"); } if (!Regex.IsMatch(arrival, "(\\w{3})")) { InterfaceInvokeException.ThrowParameterErrorException("arrival"); } if (!Regex.IsMatch(flightDate, "([0-9]{4}-[0-9]{2}-[0-9]{2})")) { InterfaceInvokeException.ThrowParameterErrorException("flightDate"); } }
private static Guid Vaild(string batchNo, string airlineCode, string flightNo, Guid id) { if (string.IsNullOrWhiteSpace(batchNo)) { InterfaceInvokeException.ThrowParameterMissException("batchNo"); } if (string.IsNullOrWhiteSpace(airlineCode)) { InterfaceInvokeException.ThrowParameterMissException("airlineCode"); } if (string.IsNullOrWhiteSpace(flightNo)) { InterfaceInvokeException.ThrowParameterMissException("flightNo"); } if (!Guid.TryParse(batchNo, out id)) { InterfaceInvokeException.ThrowParameterErrorException("batchNo"); } if (!Regex.IsMatch(airlineCode, "(\\w{2})")) { InterfaceInvokeException.ThrowParameterErrorException("airlineCode"); } if (flightNo.Length >= 6) { InterfaceInvokeException.ThrowParameterErrorException("flightNo"); } return(id); }
private static void Vaild(string airlineCode, string flightNo, string flightDate) { if (string.IsNullOrWhiteSpace(airlineCode)) { InterfaceInvokeException.ThrowParameterMissException("airlineCode"); } if (string.IsNullOrWhiteSpace(flightNo)) { InterfaceInvokeException.ThrowParameterMissException("flightNo"); } if (string.IsNullOrWhiteSpace(flightDate)) { InterfaceInvokeException.ThrowParameterMissException("flightDate"); } if (!Regex.IsMatch(airlineCode, "(\\w{2})")) { InterfaceInvokeException.ThrowParameterErrorException("airlineCode"); } if (flightNo.Length >= 6) { InterfaceInvokeException.ThrowParameterErrorException("flightNo"); } if (!Regex.IsMatch(flightDate, "([0-9]{4}-[0-9]{2}-[0-9]{2})")) { InterfaceInvokeException.ThrowParameterErrorException("flightDate"); } }
protected override string ExecuteCore() { var idText = Context.GetParameterValue("id"); var payInterfaceCode = Context.GetParameterValue("payType"); var businessType = Context.GetParameterValue("businessType"); if (string.IsNullOrWhiteSpace(idText)) { InterfaceInvokeException.ThrowParameterMissException("id"); } if (string.IsNullOrWhiteSpace(payInterfaceCode)) { InterfaceInvokeException.ThrowParameterMissException("payType"); } if (string.IsNullOrWhiteSpace(businessType)) { InterfaceInvokeException.ThrowParameterMissException("businessType"); } decimal id; var url = string.Empty; if (decimal.TryParse(idText, out id)) { string message; if (businessType == "0") { if (Service.OrderProcessService.Payable(id, out message)) { var payInterface = PayUtility.GetPayInterface(payInterfaceCode); url = Service.Tradement.PaymentService.OnlinePayOrder(id, payInterface, Context.ClientIP, Employee.UserName); } else { InterfaceInvokeException.ThrowException("9", message); } } else if (businessType == "1") { if (Service.ApplyformProcessService.Payable(id, out message)) { var payInterface = PayUtility.GetPayInterface(payInterfaceCode); url = Service.Tradement.PaymentService.OnlinePayPostponeFee(id, payInterface, Context.ClientIP, Employee.UserName); } else { InterfaceInvokeException.ThrowException("9", message); } } } else { InterfaceInvokeException.ThrowParameterErrorException("id"); } return("<payUrl>" + HttpUtility.UrlEncode(url) + "</payUrl>"); }
protected override string ExecuteCore() { var applyformId = Context.GetParameterValue("id"); if (string.IsNullOrWhiteSpace(applyformId)) { InterfaceInvokeException.ThrowParameterMissException("id"); } return(PayUtility.GetPayUrl(applyformId, "2", Context.UserName)); }
protected override string ExecuteCore() { var orderId = Context.GetParameterValue("orderId"); var passengers = Context.GetParameterValue("passengers"); var voyages = Context.GetParameterValue("voyages"); var refundType = Context.GetParameterValue("refundType"); var reason = Context.GetParameterValue("reason"); if (string.IsNullOrWhiteSpace(orderId)) { InterfaceInvokeException.ThrowParameterMissException("orderId"); } if (string.IsNullOrWhiteSpace(passengers)) { InterfaceInvokeException.ThrowParameterMissException("passengers"); } if (string.IsNullOrWhiteSpace(voyages)) { InterfaceInvokeException.ThrowParameterMissException("voyages"); } if (string.IsNullOrWhiteSpace(refundType)) { InterfaceInvokeException.ThrowParameterMissException("refundType"); } if (string.IsNullOrWhiteSpace(reason)) { InterfaceInvokeException.ThrowParameterMissException("reason"); } decimal id; if (!decimal.TryParse(orderId, out id)) { InterfaceInvokeException.ThrowParameterErrorException("订单号"); } var order = Service.OrderQueryService.QueryOrder(id); if (order == null) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } if (order.Purchaser.CompanyId != Company.CompanyId) { InterfaceInvokeException.ThrowCustomMsgException("暂无此订单"); } id = ApplyRefundObj(order, refundType, passengers, voyages, reason); var obj = Service.ApplyformQueryService.QueryApplyform(id); return(ReturnStringUtility.GetApplyform(obj)); }
private static void Vaild(string flights, string passengers, string contact, string policyType, Service.Organization.Domain.ExternalInterfaceSetting setting) { if (string.IsNullOrEmpty(flights)) { InterfaceInvokeException.ThrowParameterMissException("flights"); } if (string.IsNullOrEmpty(passengers)) { InterfaceInvokeException.ThrowParameterMissException("passengers"); } if (string.IsNullOrEmpty(policyType)) { InterfaceInvokeException.ThrowParameterMissException("policyType"); } if (flights.Split('|').Count() != 16) { InterfaceInvokeException.ThrowParameterErrorException("flights"); } foreach (var item in passengers.Split('^')) { if (item.Split('|').Count() != 4) { InterfaceInvokeException.ThrowParameterErrorException("passengers"); } } if (contact != "" && contact.Split('|').Count() != 3) { InterfaceInvokeException.ThrowParameterErrorException("contact"); } if ((setting.PolicyTypes & PolicyType.Bargain) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Normal) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Team) != (PolicyType)byte.Parse(policyType) && (setting.PolicyTypes & PolicyType.Special) != (PolicyType)byte.Parse(policyType)) { InterfaceInvokeException.ThrowNoAccessException(); } if (policyType != "2" && policyType != "4" && policyType != "8" && policyType != "16") { InterfaceInvokeException.ThrowParameterErrorException("policyType"); } }
protected void ValidateBusinessParameters(string _pnrContent) { if (string.IsNullOrWhiteSpace(_pnrContent)) { InterfaceInvokeException.ThrowParameterMissException("编码内容"); } try { var result = CommandService.GetReservedPnr(_pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (_pnr == null) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { InterfaceInvokeException.ThrowParameterErrorException("内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { InterfaceInvokeException.ThrowParameterErrorException("编码信息不全"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { InterfaceInvokeException.ThrowCustomMsgException("编码中缺少航班信息"); } _policyType = ReturnStringUtility.QueryPolicyType(_flights, _pnr); var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <PriceView> { new PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { //没有传入pat信息 就虚拟一个高价的pat _patPrices = new List <PriceView> { new PriceView { AirportTax = 100000, BunkerAdjustmentFactor = 100000, Fare = 100000, Total = 300000 } }; } //验证 CommandService.ValidatePNR(_pnr, _pnr.Passengers.First().Type); }
protected void ValidateBusinessParameters(string pnrContent, string patContent) { if (string.IsNullOrWhiteSpace(pnrContent)) { InterfaceInvokeException.ThrowParameterErrorException("编码"); } if (string.IsNullOrWhiteSpace(patContent)) { InterfaceInvokeException.ThrowParameterErrorException("PAT内容"); } if (string.IsNullOrWhiteSpace(_policyId)) { InterfaceInvokeException.ThrowParameterErrorException("政策编号"); } if (!Guid.TryParse(_policyId, out _Id)) { InterfaceInvokeException.ThrowParameterErrorException("政策编号"); } if (string.IsNullOrWhiteSpace(_orgbatchNo)) { InterfaceInvokeException.ThrowParameterErrorException("导入批次号"); } _batchNo = _orgbatchNo.Substring(0, _orgbatchNo.Length - 1); _isNeedPat = _orgbatchNo.Substring(_orgbatchNo.Length - 1, 1); if (_contact.Trim() != "") { if (_contact.Split('|').Count() < 3) { InterfaceInvokeException.ThrowParameterErrorException("联系信息不完整"); } if (_contact.Split('|')[0].Trim() == "") { InterfaceInvokeException.ThrowParameterMissException("联系信息中姓名"); } if (_contact.Split('|')[1].Trim() == "") { InterfaceInvokeException.ThrowParameterMissException("联系信息中手机"); } } if (_associatePNR != "") { if (!Regex.IsMatch(_associatePNR, "(\\w)+")) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } if (_associatePNR.Split('|').Any() && _associatePNR.Split('|')[0] != "" && _associatePNR.Split('|')[0].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } if (_associatePNR.Split('|').Count() == 2 && _associatePNR.Split('|')[1] != "" && _associatePNR.Split('|')[1].Length != 6) { InterfaceInvokeException.ThrowParameterErrorException("关联编码"); } } try { var result = CommandService.GetReservedPnr(pnrContent); if (result.Success) { _pnr = result.Result; } } catch (Exception) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (_pnr == null) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { InterfaceInvokeException.ThrowCustomMsgException("编码中缺少航班信息"); } var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <DataTransferObject.Command.PNR.PriceView> { new DataTransferObject.Command.PNR.PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { _patPrices = Service.Command.Domain.Utility.Parser.GetPatPrices(patContent); if (_patPrices == null) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } if (_patPrices.Count == 0) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { InterfaceInvokeException.ThrowCustomMsgException("内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { InterfaceInvokeException.ThrowCustomMsgException("编码信息不全"); } //上次导入内容是没有传入pat信息,需要重新匹配政策 if (_isNeedPat == "1") { PNRHelper.SaveImportInfo(_pnr, _pnr.PnrPair, _patPrices.MinOrDefaultElement(item => item.Fare), _pnr.Passengers.First().Type, _patPrices.MaxOrDefaultElement(item => item.Fare), out fdSuccess); var policyFilterCondition = GetPolicyFilter(_flights); //匹配政策 List <MatchedPolicy> matchedPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, false, _pnr.Passengers.First().Type, 10).ToList(); List <MatchedPolicy> matchedSpeciafPolicies = null; if ((_policyType & PolicyType.Special) != PolicyType.Special && (_policyType & PolicyType.Team) != PolicyType.Team) { policyFilterCondition = GetPolicyFilter(_flights, PolicyType.Special); matchedSpeciafPolicies = Service.PolicyMatch.PolicyMatchServcie.MatchBunk(policyFilterCondition, false, _pnr.Passengers.First().Type, 10).ToList(); if (!matchedPolicies.Any() && !matchedSpeciafPolicies.Any()) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } if (!matchedPolicies.Any()) { InterfaceInvokeException.ThrowNotFindPolicyException(); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { _matchedPolicy = matchedSpeciafPolicies.FirstOrDefault(item => item.Id == _Id); } if (_matchedPolicy == null && policyFilterCondition.SuitReduce) { InterfaceInvokeException.ThrowCustomMsgException("您选择的政策不支持低打。请重新选择"); } if (_matchedPolicy == null) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } else { //从缓存中取出政策 _customContext = ContextCenter.Instance[_batchNo]; if (_customContext == null) { InterfaceInvokeException.ThrowCustomMsgException("政策选择超时,请重新导入pnr内容"); } var matchedPolicies = _customContext[_pnr.PnrPair.BPNR + _pnr.PnrPair.PNR] as List <MatchedPolicy>; if (matchedPolicies == null) { InterfaceInvokeException.ThrowCustomMsgException("政策选择超时,请重新导入pnr内容"); } _matchedPolicy = matchedPolicies.FirstOrDefault(item => item.Id == _Id); if (_matchedPolicy == null) { InterfaceInvokeException.ThrowNotFindPolicyException(); } } }
protected void ValidateBusinessParameters(string pnrContext, string patContext) { if (string.IsNullOrWhiteSpace(pnrContext)) { InterfaceInvokeException.ThrowParameterMissException("编码内容"); } if (string.IsNullOrWhiteSpace(patContext)) { InterfaceInvokeException.ThrowParameterMissException("PAT内容"); } try { var result = CommandService.GetReservedPnr(pnrContext); if (result.Success) { _pnr = result.Result; } } catch (Exception) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (_pnr == null) { InterfaceInvokeException.ThrowParameterErrorException("编码内容"); } if (DataTransferObject.Common.PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { InterfaceInvokeException.ThrowParameterErrorException("内容中缺少编码"); } if (string.IsNullOrWhiteSpace(_pnr.PnrPair.PNR) && string.IsNullOrWhiteSpace(_pnr.PnrPair.BPNR)) { InterfaceInvokeException.ThrowParameterErrorException("编码信息不全"); } //如果遇到证件号不全体提编码 if (_pnr.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(_pnr.PnrPair)) { var rtResult = CommandService.GetReservedPnr(_pnr.PnrPair, Guid.Empty); if (rtResult.Success && !rtResult.Result.HasCanceled) { _pnr = rtResult.Result; } } _flights = ReserveViewConstuctor.GetQueryFlightView(_pnr.Voyage.Segments, _pnr.Voyage.Type, _pnr.Passengers.First().Type, _pnr.IsTeam).ToList(); if (!_flights.Any()) { InterfaceInvokeException.ThrowCustomMsgException("编码中缺少航班信息"); } _policyType = ReturnStringUtility.QueryPolicyType(_flights, _pnr); var flight = _flights.FirstOrDefault(); if (flight.BunkType != null && flight.BunkType.Value == BunkType.Free) { _patPrices = new List <PriceView> { new PriceView { AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF, Fare = 0, Total = flight.AirportFee + flight.BAF } }; } else { _patPrices = Service.Command.Domain.Utility.Parser.GetPatPrices(patContext); if (_patPrices == null) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } if (_patPrices.Count == 0) { InterfaceInvokeException.ThrowCustomMsgException("缺少PAT内容"); } } //if (!_pnr.IsTeam && !_pnr.IsFilled) InterfaceInvokeException.ThrowCustomMsgException( "缺口程编码,需要搭桥"); //验证 CommandService.ValidatePNR(_pnr, _pnr.Passengers.First().Type); PNRHelper.SaveImportInfo(_pnr, _pnr.PnrPair, _patPrices.MinOrDefaultElement(item => item.Fare), _pnr.Passengers.First().Type, _patPrices.MaxOrDefaultElement(item => item.Fare), out fdSuccess); }
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(""); }