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 <DataTransferObject.Order.External.ExternalOrderView> Produce(decimal orderId, DataTransferObject.Order.OrderView orderView, DataTransferObject.Policy.ExternalPolicyView policy) { throw new NotImplementedException(); }
/// <summary> /// 生成订单 /// </summary> public static RequestResult <ExternalOrderView> Produce(decimal orderId, DataTransferObject.Order.OrderView orderView, string pnrContent, string patContent, DataTransferObject.Policy.ExternalPolicyView policy) { if (orderView == null) { throw new ArgumentNullException("orderView"); } if (string.IsNullOrWhiteSpace(pnrContent)) { throw new ArgumentNullException("pnrContent"); } if (string.IsNullOrWhiteSpace(patContent)) { throw new ArgumentNullException("patContent"); } if (policy == null) { throw new ArgumentNullException("policy"); } pnrContent = pnrContent.RemovePrintedContent().RemoveETermSpecialContentOnWeb(); var processor = createOrderProcessor(policy.Platform); return(processor.Produce(orderId, orderView, pnrContent, patContent, policy)); }
public RequestResult <DataTransferObject.Order.External.ExternalOrderView> Produce(decimal orderId, DataTransferObject.Order.OrderView orderView, string pnrContent, string patContent, DataTransferObject.Policy.ExternalPolicyView policy) { RequestResult <DataTransferObject.Order.External.ExternalOrderView> result; var request = string.Empty; var response = string.Empty; try { pnrContent = pnrContent.Trim().TrimEnd('>'); patContent = patContent.Trim().TrimEnd('>'); var requestModel = new _51bookCreateOrder.createOrderByRtPatRequest() { agencyCode = Platform.UserName, pnrTxt = pnrContent, pataTxt = patContent, outOrderNo = orderId.ToString(), policyIdSpecified = true, policyId = int.Parse(policy.Id), allowSwitchPolicySpecified = true, allowSwitchPolicy = 0, needProductTypeSpecified = true, needProductType = 2, allowSwitchPnrSpecified = true, allowSwitchPnr = 1, doPaySpecified = true, payTypeSpecified = true, linkMan = Platform.Contact, linkPhone = Platform.ContactPhone, createdBy = Platform.UserName, ticketNotifiedUrl = Platform.ETDZNotifyUrl, paymentReturnUrl = Platform.PayReturnUrl }; var signValue = new Dictionary <string, string> { { "agencyCode", Platform.UserName }, { "createdBy", requestModel.createdBy }, { "doPay", requestModel.doPay.ToString() }, { "linkMan", requestModel.linkMan }, { "linkPhone", requestModel.linkPhone }, { "payBank", requestModel.payBank }, { "payType", requestModel.payType.ToString() }, { "policyId", requestModel.policyId.ToString() } }; requestModel.sign = Sign(signValue); var platform = new _51bookCreateOrder.CreateOrderByRtPatServiceImpl_1_0Service { Url = Platform.Address_CreateOrderByPnrText }; request = GetModelString(requestModel); var responseModel = platform.createOrderByRtPat(requestModel); response = GetModelString(responseModel); result = parseProduceResponse(responseModel); } catch (Exception ex) { LogService.SaveExceptionLog(ex, "51book生成订单"); result = new RequestResult <DataTransferObject.Order.External.ExternalOrderView> { Success = false, ErrMessage = "系统错误,请联系平台" }; response = ex.Message; } SaveRequestLog(response, request, "生成订单"); return(result); }
/// <summary> /// 生成订单 /// </summary> public static RequestResult <ExternalOrderView> Produce(decimal orderId, DataTransferObject.Order.OrderView orderView, DataTransferObject.Policy.ExternalPolicyView policy) { if (orderView == null) { throw new ArgumentNullException("orderView"); } if (policy == null) { throw new ArgumentNullException("policy"); } var processor = createOrderProcessor(policy.Platform); return(processor.Produce(orderId, orderView, policy)); }