public RequestResult <Payment> QueryPayment(decimal orderId, string externalOrderId) { RequestResult <Payment> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "orderid", externalOrderId }, { "out_orderid", orderId.ToString() } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); response = platform.Order_Query(Platform.UserName, externalOrderId, orderId.ToString(), signText); result = parseQueryPaymentResponse(response); } catch (Exception ex) { result = new RequestResult <Payment> { Success = false, ErrMessage = ex.Message == "The operation has timed out" ? "操作超时,请稍后再试!" : "系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "获取易行订单信息"); response = ex.Message; } SaveRequestLog(response, request, "查询支付信息"); return(result); }
public RequestResult <TicketInfo> QueryTicketNo(decimal orderId, string externalOrderId) { RequestResult <TicketInfo> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "orderid", externalOrderId }, { "out_orderid", orderId.ToString() } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); response = platform.Order_QueryAirid(Platform.UserName, externalOrderId, orderId.ToString(), signText); result = parseTicketInfo(response); } catch (Exception ex) { result = new RequestResult <TicketInfo> { Success = false, ErrMessage = "系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "易行查询票号"); response = ex.Message; } SaveRequestLog(response, request, "查询票号"); return(result); }
public RequestResult <IEnumerable <ExternalPolicyView> > Match(PNRPair pnrPair, ExternalPolicyFilter filter) { RequestResult <IEnumerable <ExternalPolicyView> > result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address, Timeout = Platform.Timeout }; var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "pnr", pnrPair.PNR } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); var matchResponse = platform.PnrMatchAirp(Platform.UserName, pnrPair.PNR, signText); response = matchResponse; result = parseMatchResponse(matchResponse, filter); } catch (Exception ex) { LogService.SaveExceptionLog(ex, "通过编码匹配易行政策"); result = new RequestResult <IEnumerable <ExternalPolicyView> > { Success = false, ErrMessage = "系统错误,请联系平台" }; response = ex.Message; } SaveRequestLog(response, request, "匹配政策"); return(result); }
public BEServiceLogic(IEventAggregator aggregator, IBEService beService, ISettingsStoreSource settingsStoreSource, IBELogic beLogic) { _aggregator = aggregator; _beService = beService; _settingsStoreSource = settingsStoreSource; _beLogic = beLogic; _playersUpdater = new TimedAction(_settingsStoreSource.GetSettingsStore().PlayersUpdateSeconds, UpdatePlayers); _bansUpdater = new TimedAction(_settingsStoreSource.GetSettingsStore().BansUpdateSeconds, UpdateBans); _aggregator.GetEvent <SettingsChangedEvent>() .Subscribe(SettingsChanged); _beLogic.ServerUpdateHandler += _beLogic_ServerUpdateHandler; }
public RequestResult <AutoPayResult> AutoPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount) { RequestResult <AutoPayResult> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var amountText = amount.ToString("F2"); var payInterfaceValue = Platform.GetPayInterfaceValue(payInterface); var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "orderid", externalOrderId }, { "totalPrice", amountText }, { "payPlatform", payInterfaceValue }, { "pay_notify_url", Platform.NotifyUrl }, { "out_notify_url", Platform.NotifyUrl } }; var signText = Sign(externalOrderId + Platform.NotifyUrl + payInterfaceValue + Platform.NotifyUrl + amountText + Platform.UserName); request = GetRequestValue(signValue, signText); response = platform.PayOut(Platform.UserName, externalOrderId, amountText, payInterfaceValue, Platform.NotifyUrl, Platform.NotifyUrl, signText); result = parseAutoPayResponse(response); if (result.Success) { result.Result.Id = orderId; result.Result.Payment.PayInterface = payInterface; result.Result.Payment.IsAutoPay = true; result.Result.Payment.PayTime = DateTime.Now; } } catch (Exception ex) { result = new RequestResult <AutoPayResult> { Success = false, ErrMessage = ex.Message == "The operation has timed out"?"代扣超时,请稍后再试!":"系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "易行" + payInterface.GetDescription() + "代扣"); response = ex.Message; } SaveRequestLog(response, request, "代扣"); return(result); }
public RequestResult <ExternalOrderView> Produce(decimal orderId, DataTransferObject.Order.OrderView orderView, string pnrContent, string patContent, DataTransferObject.Policy.ExternalPolicyView policy) { if (orderView.UseBPNR) { return(Produce(orderId, orderView, policy)); } RequestResult <ExternalOrderView> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var pnr = orderView.UseBPNR?orderView.PNR.BPNR:orderView.PNR.PNR; var pnrText = GetPnrParameter(pnrContent, patContent); var yeexingPolicy = policy as DataTransferObject.Policy.YeexingPolicyView; var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "pnr", pnr }, { "pnrText", pnrText }, { "plcid", policy.Id }, { "ibePrice", yeexingPolicy.IBEPrice }, { "out_orderid", orderId.ToString() }, { "disc", yeexingPolicy.Disc }, { "extReward", yeexingPolicy.extReward } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); response = platform.ParsePnrBook(Platform.UserName, pnr, pnrText, policy.Id, yeexingPolicy.IBEPrice, orderId.ToString(), yeexingPolicy.Disc, yeexingPolicy.extReward, signText); result = parseProduceResponse(response); } catch (Exception ex) { result = new RequestResult <ExternalOrderView> { Success = false, ErrMessage = "系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "易行生成订单"); response = ex.Message; } SaveRequestLog(response, request, "生成订单"); return(result); }
public RequestResult <IEnumerable <ExternalPolicyView> > Match(PNRPair pnrPair, string pnrContent, string patContent, ExternalPolicyFilter filter) { if (filter.VoyageType != ItineraryType.OneWay) { return(new RequestResult <IEnumerable <ExternalPolicyView> > { Success = false, ErrMessage = "不支持行程:" + filter.VoyageType.GetDescription() }); } RequestResult <IEnumerable <ExternalPolicyView> > result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address, Timeout = Platform.Timeout }; var pnrCode = filter.UseBPNR?pnrPair.BPNR:pnrPair.PNR; var pnrText = GetPnrParameter(pnrContent, patContent); var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "pnr", pnrCode }, { "pnrText", pnrText } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); response = platform.ParsePnrMatchAirp(Platform.UserName, pnrCode, pnrText, signText); result = parseMatchResponse(response, filter); } catch (Exception ex) { LogService.SaveExceptionLog(ex, "通过编码内容匹配易行政策"); result = new RequestResult <IEnumerable <ExternalPolicyView> > { Success = false, ErrMessage = "系统错误,请联系平台" }; response = ex.Message; } SaveRequestLog(response, request, "匹配政策"); return(result); }
public RequestResult <bool> Cancel(decimal orderId, string externalOrderId, IEnumerable <string> passengers, string reason) { if (passengers == null || !passengers.Any()) { throw new ArgumentNullException("passengers"); } RequestResult <bool> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var passengerNames = string.Join("^", passengers); var canceledNotifyUrl = Platform.NotifyUrl; var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "orderid", externalOrderId }, { "passengerName", passengerNames }, { "cancel_notify_url", canceledNotifyUrl } }; var signText = Sign(signValue); request = GetRequestValue(signValue, signText); response = platform.CancelTicket(Platform.UserName, externalOrderId, passengerNames, canceledNotifyUrl, signText); result = parseCancelResponse(response); } catch (Exception ex) { result = new RequestResult <bool> { Success = false, ErrMessage = "系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "易行取消订单"); response = ex.Message; } SaveRequestLog(response, request, "取消订单"); return(result); }
public RequestResult <string> ManualPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount) { RequestResult <string> result; var request = string.Empty; var response = string.Empty; try { var platform = new IBEService { Url = Platform.Address }; var amountText = amount.ToString("F2"); var payInterfaceValue = Platform.GetPayInterfaceValue(payInterface); var signValue = new Dictionary <string, string> { { "userName", Platform.UserName }, { "orderid", externalOrderId }, { "totalPrice", amountText }, { "payPlatform", payInterfaceValue }, { "pay_notify_url", Platform.NotifyUrl }, { "out_notify_url", Platform.NotifyUrl } }; var signText = Sign(externalOrderId + Platform.NotifyUrl + payInterfaceValue + Platform.NotifyUrl + amountText + Platform.UserName); request = GetRequestValue(signValue, signText); response = platform.Pay(Platform.UserName, externalOrderId, amountText, payInterfaceValue, Platform.NotifyUrl, Platform.NotifyUrl, signText); result = parseManualPayResponse(response); } catch (Exception ex) { result = new RequestResult <string> { Success = false, ErrMessage = "系统错误,请联系平台" }; LogService.SaveExceptionLog(ex, "易行" + payInterface.GetDescription() + "手动支付"); response = ex.Message; } SaveRequestLog(response, request, "手动支付"); return(result); }
/// <summary> /// Constructor for the controller that sets a context for each of the services. /// Which service is passed is controlled by the Enviornment in the startup /// </summary> /// <seealso cref="Startup"/> /// <param name="damService">Either fake or live AI Damage Service</param> /// <param name="veService">Either fake or live Back End Service</param> /// <param name="blService">Either fake or live blob stroage service</param> public ClockController(IDamageService damService, IBEService veService, IBlobService blService) { _damageService = damService; _vehicleService = veService; _blobService = blService; }
/// <summary> /// Constructor for the controller that sets a context for each of the services. /// Which service is passed is controlled by the Enviornment in the startup /// </summary> /// <seealso cref="Startup"/> /// <param name="beService"></param> /// <param name="blobService"></param> public VehicleController(IBEService beService, IBlobService blobService) { _beService = beService; _blobService = blobService; }