private bool IsValid(EyouSoft.Model.TicketStructure.OrderInfo orderInfo, EyouSoft.Model.TicketStructure.OrderChangeInfo orderChangeInfo, EyouSoft.Model.TicketStructure.OrderState?orderState, EyouSoft.Model.TicketStructure.OrderChangeType?orderChangeType) { return(false); }
/// <summary> /// 检查支付宝退款是否成功 /// </summary> private void IsAlipayRefund() { string OrderId = Utils.GetFormValue(this.CancleOrder_hidOrderId.UniqueID);//订单ID //根据ID获取订单明细 EyouSoft.IBLL.TicketStructure.ITicketOrder OrderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); orderInfo = OrderBll.GetOrderInfoById(OrderId); //判断是否有当前订单内容 if (orderInfo == null)//没有 { //输出提示信息 Utils.ResponseMeg(false, "当前订单不存在"); } string batchno = Utils.GetQueryStringValue("batchno");//退款批次号 //根据订单ID,批次号,获取 拒绝出票退款请求 记录 IList <EyouSoft.Model.TicketStructure.TicketPay> PayList = OrderBll.GetPayList(orderInfo.OrderId, EyouSoft.Model.TicketStructure.ItemType.平台到采购商_订单, string.Empty, batchno); EyouSoft.Model.TicketStructure.TicketPay payModel = null;//支付记录 //判断该请求交易 是否存在 if (PayList != null && PayList.Count > 0)//存在 { payModel = PayList[0]; //判断交易 是否成功 if (payModel.PayState == EyouSoft.Model.TicketStructure.PayState.交易完成) { Utils.ResponseMeg(true, "款项已经成功退到采购商帐户中"); } else if (payModel.PayState == EyouSoft.Model.TicketStructure.PayState.交易失败) { Utils.ResponseMeg(false, "退款失败(退款错误码:" + payModel.Remark + "),请稍候再试"); } else if (payModel.PayState == EyouSoft.Model.TicketStructure.PayState.支付接口正在处理) { Response.Clear(); Response.Write(string.Format("{{success:'1',message:'支付接口正在处理中...',search:'{0}'}}", "1")); Response.End(); } else { Utils.ResponseMeg(false, "退款请求提交失败,请稍候再试"); } } else//不存在 { Utils.ResponseMeg(false, "退款请求不存在"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int PriorNum = 0; int NextNum = 0; string orderNo = Utils.GetQueryStringValue("SearchOrderNumber"); IList <EyouSoft.Model.TicketStructure.OrderTravellerInfo> travellerinfo = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().GetTravells(orderNo); if (travellerinfo != null && travellerinfo.Count > 0) { if (travellerinfo.Count > 1) //处理上一位下一位编号 { PriorNum = 0; NextNum = 2; } else { hidTraveJson.Visible = false; } //获取订单里面的pnr EyouSoft.Model.TicketStructure.OrderInfo orderinfo = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().GetOrderInfoByNo(orderNo); if (orderinfo != null) { foreach (EyouSoft.Model.TicketStructure.OrderTravellerInfo item in travellerinfo) { if (item.TravellerState == EyouSoft.Model.TicketStructure.TravellerState.作废成功 || item.TravellerState == EyouSoft.Model.TicketStructure.TravellerState.退票成功) { item.TicketNumber = ""; } } orderinfo = null; } txtpnr.Value = travellerinfo[0].TicketNumber; txtTraName.Value = travellerinfo[0].TravellerName; txtTraNum.Value = travellerinfo[0].CertNo; hidTraveJson.Value = JsonConvert.SerializeObject(travellerinfo); //把目标对象序列化为Json字符 hfprior.Attributes.Add("showpage", PriorNum.ToString()); hfnext.Attributes.Add("showpage", NextNum.ToString()); //hfprior.Attributes.Add("onclick", "PrintTicketJournal.ShowPriorOrNext(" + PriorNum + ")"); //hfnext.Attributes.Add("onclick", "PrintTicketJournal.ShowPriorOrNext(" + NextNum + ")"); } else { Response.Clear(); Response.Write("暂无该订单信息"); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { order_no = Utils.GetQueryStringValue("order_no"); total_fee = Utils.GetQueryStringValue("total_fee"); proName = string.Format("同业114机票平台(订单号:{0})", order_no); EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo info = orderBll.GetOrderInfoByNo(order_no); orderid = info.OrderId; if (info.FreightType == EyouSoft.Model.TicketStructure.FreightType.单程) { proDetail = string.Format("订单号:{0}/航程信息:单程 {1}/{2}至{3}/", order_no, info.LeaveTime.ToString("yyyy-MM-dd"), info.HomeCityName, info.DestCityName); } else { proDetail = string.Format("订单号:{0}/航程信息:去程 {1}/{2}至{3}/回程 {4}/{5}-{6}", order_no, info.LeaveTime.ToString("yyyy-MM-dd"), info.HomeCityName, info.DestCityName, info.ReturnTime.ToString("yyyy-MM-dd"), info.DestCityName, info.HomeCityName); } resultMess = Utils.GetQueryStringValue("result") == "1" ? "交易成功" : "交易失败"; }
protected EyouSoft.Model.TicketStructure.TicketWholesalersAllInfo supplierInfo; //供应商信息 protected void Page_Load(object sender, EventArgs e) { this.Master.Naviagtion = AirTicketNavigation.团队预定散拼; this.Title = "预定-组团预定/散拼-机票"; string method = Utils.GetFormValue("method"); //当前操作 if (method == "") //初次进来显示运价信息 { startDate = Utils.GetQueryStringValue("startDate"); backDate = Utils.GetQueryStringValue("backDate"); startCity = Utils.GetQueryStringValue("startCity"); toCity = Utils.GetQueryStringValue("toCity"); airType = Utils.GetQueryStringValue("airType"); peopleTypeInt = Utils.GetInt(Utils.GetQueryStringValue("peopleType")); peopleType = (EyouSoft.Model.TicketStructure.TravellerType)peopleTypeInt; id = Utils.GetQueryStringValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id);//获取运价信息实体 if (info != null) { freightDate = GetDate(info); freightDateBack = GetBackDate(info); startCityName = info.NoGadHomeCityIdName; toCityName = info.NoGadDestCityName; supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); //touristCount = info.MaxPCount; touristCount = 100; companyId = SiteUserInfo.CompanyID; } } if (method == "save") //下订单 { id = Utils.GetFormValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id); supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); string[] touristNames = Utils.GetFormValues("tb_tourName1"); string[] tourTypes = Utils.GetFormValues("tb_tourType1"); string[] tourSex = Utils.GetFormValues("tb_tourSex1"); string[] cerTypes = Utils.GetFormValues("tb_cerType1"); string[] cerNos = Utils.GetFormValues("tb_cerNo1"); int length = touristNames.Length; List <EyouSoft.Model.TicketStructure.TicketVistorInfo> visitorList = new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>(); List <EyouSoft.Model.TicketStructure.OrderTravellerInfo> orderVisitorList = new List <EyouSoft.Model.TicketStructure.OrderTravellerInfo>(); int isTableNum = 0;//是否购买行程单的人数 EyouSoft.IBLL.TicketStructure.ITicketVisitor visitorBll = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance(); for (int i = 0; i < length; i++) { EyouSoft.Model.TicketStructure.TicketVistorInfo visitorInfo = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); EyouSoft.Model.TicketStructure.OrderTravellerInfo orderVisitorInfo = new EyouSoft.Model.TicketStructure.OrderTravellerInfo(); //添加订单旅客 orderVisitorInfo.TravellerName = touristNames[i]; orderVisitorInfo.CertNo = cerNos[i]; orderVisitorInfo.TravellerId = Guid.NewGuid().ToString(); orderVisitorInfo.CertType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); orderVisitorInfo.Gender = (EyouSoft.Model.CompanyStructure.Sex)Utils.GetInt(tourSex[i]); orderVisitorInfo.InsPrice = 0; orderVisitorInfo.TravellerType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); orderVisitorInfo.IsBuyIns = Utils.GetFormValue("tb_isInsure1_" + (i + 1)) == "1"; orderVisitorInfo.IsBuyItinerary = Utils.GetFormValue("tb_isTable1_" + (i + 1)) == "1"; if (orderVisitorInfo.IsBuyItinerary) { isTableNum++; } orderVisitorInfo.TravellerState = EyouSoft.Model.TicketStructure.TravellerState.正常; orderVisitorList.Add(orderVisitorInfo); if (Utils.GetFormValue("tb_isOften1_" + (i + 1)) == "1") { //添加常旅客 if (IsLetter(touristNames[i])) { visitorInfo.EnglishName = touristNames[i]; } else { visitorInfo.ChinaName = touristNames[i]; } visitorInfo.Id = orderVisitorInfo.TravellerId; visitorInfo.CardType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); visitorInfo.CardNo = cerNos[i]; visitorInfo.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); visitorInfo.IssueTime = DateTime.Now; visitorInfo.ContactSex = orderVisitorInfo.Gender; visitorInfo.CompanyId = SiteUserInfo.CompanyID; if (!visitorBll.VisitorIsExists(visitorInfo.CardNo, SiteUserInfo.CompanyID, "")) { visitorList.Add(visitorInfo); } } } //添加常旅客到数据库 visitorBll.AddTicketVisitorList(visitorList); //构造订单信息 EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo orderInfo = new EyouSoft.Model.TicketStructure.OrderInfo(); orderInfo.Travellers = orderVisitorList; orderInfo.TravellerType = (EyouSoft.Model.TicketStructure.TravellerType)Utils.GetInt(Utils.GetFormValue("peopleType")); if (info.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { orderInfo.TotalAmount = (info.FromSetPrice + info.ToSetPrice + info.FromFuelPrice + info.ToFuelPrice + info.ToBuildPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } else { orderInfo.TotalAmount = (info.FromSetPrice + info.FromFuelPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } if (isTableNum > 0) { orderInfo.TotalAmount += supplierInfo.DeliveryPrice; } orderInfo.BuyerCId = SiteUserInfo.CompanyID; orderInfo.BuyerCName = SiteUserInfo.CompanyName; orderInfo.BuyerContactAddress = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID).CompanyAddress; orderInfo.BuyerContactMobile = SiteUserInfo.ContactInfo.Mobile; orderInfo.BuyerContactMQ = SiteUserInfo.ContactInfo.MQ; orderInfo.BuyerContactName = SiteUserInfo.ContactInfo.ContactName; orderInfo.BuyerRemark = Utils.InputText(Utils.GetFormValue("tb_remark"), 250);//特殊要求备注 orderInfo.BuyerUId = SiteUserInfo.ID; orderInfo.DestCityId = info.NoGadDestCityId; orderInfo.DestCityName = info.NoGadDestCityName; orderInfo.EMSPrice = supplierInfo.DeliveryPrice; orderInfo.FlightId = info.FlightId; orderInfo.FreightType = info.FreightType; orderInfo.HomeCityId = info.NoGadHomeCityId; orderInfo.HomeCityName = info.NoGadHomeCityIdName; orderInfo.ItineraryPrice = supplierInfo.ServicePrice; orderInfo.LeaveTime = DateTime.Parse(Utils.GetFormValue("startDate")); EyouSoft.Model.TicketStructure.OrderRateInfo rateInfo = new EyouSoft.Model.TicketStructure.OrderRateInfo(); rateInfo.DestCityId = info.NoGadDestCityId; rateInfo.DestCityName = info.NoGadDestCityName; rateInfo.FlightId = info.FlightId; rateInfo.FreightType = info.FreightType; rateInfo.HomeCityId = info.NoGadHomeCityId; rateInfo.HomeCityName = info.NoGadHomeCityIdName; rateInfo.LBuildPrice = info.FromBuildPrice; rateInfo.LeaveDiscount = info.FromReferRate; rateInfo.LeaveFacePrice = info.FromReferPrice; rateInfo.LeavePrice = info.FromSetPrice; //计算去程运价有效期 rateInfo.LeaveTimeLimit = GetDate(info); rateInfo.LFuelPrice = info.FromFuelPrice; rateInfo.MaxPCount = info.MaxPCount; rateInfo.RBuildPrice = info.ToBuildPrice; rateInfo.ReturnDiscount = info.ToReferRate; rateInfo.ReturnFacePrice = info.ToReferPrice; rateInfo.ReturnPrice = info.ToSetPrice; //计算回程运价有效期 rateInfo.ReturnTimeLimit = GetBackDate(info); rateInfo.RFuelPrice = info.ToFuelPrice; rateInfo.SupplierRemark = info.SupplierRemark; orderInfo.OrderRateInfo = rateInfo; string act = Utils.GetFormValue("act"); if (act == "0") { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.等待审核; } else { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.审核通过; } orderInfo.OrderTime = DateTime.Now; orderInfo.PCount = length; orderInfo.RateType = info.RateType; orderInfo.ReturnTime = Utils.GetDateTime(Utils.GetFormValue("backDate"), DateTime.Now); orderInfo.SupplierCId = info.Company.ID; orderInfo.SupplierCName = info.Company.CompanyName; orderInfo.OrderId = Guid.NewGuid().ToString(); if (orderBll.CreateOrder(orderInfo)) { Utils.ResponseMeg(true, orderInfo.OrderId); } else { Utils.ResponseMegError(); } } }
protected void Page_Load(object sender, EventArgs e) { //判断是否登录 if (this.IsLogin == false)//没有登录 { //输出提示信息 Response.Clear(); Response.Write("请重新登录"); Response.End(); } string flag = Utils.GetQueryStringValue("flag"); //当前请求类型 if (flag != string.Empty) //请求类型不为空 { //判断请求类型 if (flag.Equals("save", StringComparison.OrdinalIgnoreCase))//保存数据 { SaveData(); } else if (flag.Equals("refund", StringComparison.OrdinalIgnoreCase))//检查支付宝退款是否成功 { IsAlipayRefund(); } } //页面初始化 if (!Page.IsPostBack) { string OrderId = Utils.GetQueryStringValue("orderid"); //订单ID this.CancleOrder_hidOrderId.Value = OrderId; //存储订单iD //根据订单ID获取订单明细 EyouSoft.IBLL.TicketStructure.ITicketOrder ibll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); orderInfo = ibll.GetOrderInfoById(OrderId); //根据订单ID获取订单最新的变更信息 orderChangeInfo = ibll.GetLatestChange(OrderId); //判断是否有当前订单内容 if (orderInfo == null)//没有 { //输出提示信息 Response.Clear(); Response.Write("当前订单不存在"); Response.End(); } EyouSoft.Model.TicketStructure.OrderState? OrderState = null; //请求的订单状态 EyouSoft.Model.TicketStructure.OrderChangeType?ChangeType = null; //请求的订单变更类型 //初始化请求订单状态 int tmpOrderStateid = Utils.GetInt(Request.QueryString["orderstate"], -1); //请求的订单状态ID if (tmpOrderStateid != -1) //有效 { OrderState = (EyouSoft.Model.TicketStructure.OrderState)tmpOrderStateid; this.CancleOrder_hidOrderState.Value = tmpOrderStateid.ToString(); } //初始化请求订单变更类型 int tmpChangeTypeId = Utils.GetInt(Request.QueryString["changetype"], -1);//请求的订单变更类型ID if (tmpChangeTypeId != -1) { ChangeType = (EyouSoft.Model.TicketStructure.OrderChangeType)tmpChangeTypeId; this.CancleOrder_hidChangeType.Value = tmpChangeTypeId.ToString(); } ////请求的订单状态ID是否有效 //if (tmpOrderStateid != -1)//有效 //{ // //将ID转换为请求的订单状态 // OrderState = (EyouSoft.Model.TicketStructure.OrderState)tmpOrderStateid; // this.CancleOrder_hidOrderState.Value = tmpOrderStateid.ToString(); // //判断请求的订单状态是否 与订单当前状态是否同步 // if (OrderState != orderInfo.OrderState) // { // Response.Clear(); // Response.Write("订单状态已经修改"); // Response.End(); // } //} //else//无效 //{ // Response.Clear(); // Response.Write("参数错误"); // Response.End(); //} /* * 判断请求的订单处理状态 是否与 订单的当前状态 是否同步 * */ if (OrderState == EyouSoft.Model.TicketStructure.OrderState.等待审核 || OrderState == EyouSoft.Model.TicketStructure.OrderState.支付成功) //拒绝审核请求,拒绝出票请求 { if (OrderState != orderInfo.OrderState) { Utils.ResponseNoPermit("当前订单的状态已经被修改"); } } if (OrderState == EyouSoft.Model.TicketStructure.OrderState.出票完成)//拒绝 退/废/改/签 请求 { if (orderChangeInfo == null) { Utils.ResponseNoPermit("当前订单不能【退/废/改/签】处理"); } if (ChangeType != orderChangeInfo.ChangeType || orderChangeInfo.ChangeState == EyouSoft.Model.TicketStructure.OrderChangeState.接受 || orderChangeInfo.ChangeState == EyouSoft.Model.TicketStructure.OrderChangeState.拒绝) { Utils.ResponseNoPermit("当前订单的状态已经被修改"); } } } }
private void SaveData() { bool IsResult = false; string OrderId = Utils.GetFormValue(this.CancleOrder_hidOrderId.UniqueID);//订单ID //根据ID获取订单明细 EyouSoft.IBLL.TicketStructure.ITicketOrder OrderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); orderInfo = OrderBll.GetOrderInfoById(OrderId); //根据订单ID获取订单最新的变更信息 orderChangeInfo = OrderBll.GetLatestChange(OrderId); //判断是否有当前订单内容 if (orderInfo == null)//没有 { //输出提示信息 Utils.ResponseMeg(false, "当前订单不存在"); } EyouSoft.Model.TicketStructure.OrderState?OrderState = null; //请求的订单状态 int tmpOrderStateId = Utils.GetInt(Utils.GetFormValue(this.CancleOrder_hidOrderState.UniqueID), -1); //订单状态ID if (tmpOrderStateId != -1) { OrderState = (EyouSoft.Model.TicketStructure.OrderState)tmpOrderStateId; } EyouSoft.Model.TicketStructure.OrderChangeType?ChangeType = null; //请求的订单变更类型 int tmpOrderChangeTypeId = Utils.GetInt(Utils.GetFormValue(this.CancleOrder_hidChangeType.UniqueID), -1); //订单变更类型ID if (tmpOrderChangeTypeId != -1) { ChangeType = (EyouSoft.Model.TicketStructure.OrderChangeType)tmpOrderChangeTypeId; } EyouSoft.Model.TicketStructure.OrderInfo OrderModel = orderInfo; //订单明细 string Remark = Server.UrlDecode(Utils.GetFormValue("txtRemark", 250)); //备注信息 /* * 根据请求的订单状态,请求的订单变更类型,获取请求类型 */ if (OrderState == EyouSoft.Model.TicketStructure.OrderState.等待审核)// 拒绝审核订单请求 { #region 拒绝审核 //判断当前订单状态与 请求的订单状态是否同步 if (OrderState == OrderModel.OrderState) { IsResult = OrderBll.SupplierNotCheckOrder(OrderId, Remark, SiteUserInfo.ID, SiteUserInfo.CompanyID); Utils.ResponseMeg(IsResult, IsResult ? "订单修改成功" : "订单修改失败,请稍候再试"); } else { Utils.ResponseMeg(false, "页面已经过期"); } #endregion } else if (OrderState == EyouSoft.Model.TicketStructure.OrderState.支付成功)// 拒绝出票订单请求 { #region 拒绝出票 //判断当前订单状态与 请求的订单状态是否同步 if (OrderState != OrderModel.OrderState) { Utils.ResponseMeg(false, "页面已经过期"); } string BatchNo = string.Empty; // 判断是否有写入支付记录 IList <EyouSoft.Model.TicketStructure.TicketPay> PayList = OrderBll.GetPayList(OrderModel.OrderId, EyouSoft.Model.TicketStructure.ItemType.平台到采购商_订单, string.Empty, string.Empty); if (PayList == null || PayList.Count == 0 || PayList.Where(item => item.PayState == EyouSoft.Model.TicketStructure.PayState.交易完成).Count() == 0) { // 拒绝出票完成前写入支付明细记录 IsResult = OrderBll.NoOutputTicketBefore(OrderId, OrderModel.OrderNo, SiteUserInfo.ID, SiteUserInfo.CompanyID, OrderModel.TotalAmount, OrderModel.PayType, Remark, out BatchNo); } // 获取当前订单上相关的支付接口信息和账户信息 #region 获取当前订单上相关的支付接口信息和账户信息 string AccountNumber = string.Empty; string PayNumber = string.Empty;//支付接口返回的交易号 EyouSoft.Model.TicketStructure.OrderAccountInfo AccountModel = OrderBll.GetOrderAccountInfo(OrderModel.OrderId); if (AccountModel != null) { AccountNumber = AccountModel.PayAccount; //AccountNumber = "*****@*****.**"; PayNumber = AccountModel.PayNumber; } AccountModel = null; #endregion #region 退款 if (OrderModel.PayType == EyouSoft.Model.TicketStructure.TicketAccountType.支付宝) { #region 支付宝退款 string partner = AlipayParameters.Partner; //合作身份者ID string key = AlipayParameters.Key; //安全检验码 string input_charset = AlipayParameters.Input_Charset; //字符编码格式 目前支持 gbk 或 utf-8 string sign_type = AlipayParameters.SignType; //加密方式 不需修改 string notify_url = AlipayParameters.DomainPath + "/TicketsCenter/alipay/refund/notify3_url.aspx"; //通知地址 string batch_no = BatchNo; //批次号 string refund_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //退款日期 string batch_num = "1"; //退款数量 string detail_data = ""; //退款请求数据集 //计算支付宝退款金额对应的手续费 decimal alipayFee = Refund_Platform_Parameter.ComputeAlipayFee(OrderModel.TotalAmount); if (alipayFee > 0) { Refund_Platform_Parameter parameter = new Refund_Platform_Parameter( PayNumber, OrderModel.TotalAmount.ToString("F2"), Remark, AlipayParameters.Seller_mailer, alipayFee.ToString("F2"), Remark); detail_data = parameter.ToString(); } else { Refund_Platform_Parameter parameter = new Refund_Platform_Parameter(PayNumber, OrderModel.TotalAmount.ToString("F2"), Remark); detail_data = parameter.ToString(); } RefundNoPwd refund = new RefundNoPwd(partner, key, sign_type, input_charset, notify_url, batch_no, refund_date, batch_num, detail_data); string url = refund.Create_url(); CreateSSL ssl = new CreateSSL(url); string responseFromServer = ssl.GetResponse(); Distribute_royalty_Result result = new Distribute_royalty_Result(responseFromServer); IsResult = result.IsSuccess; //判断退款请求是否提交成功 if (result.IsSuccess == false)//退款请求提交失败 { OrderBll.PayAfterCallBack(PayNumber, OrderModel.TotalAmount, EyouSoft.Model.TicketStructure.PayState.未提交到支付接口, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, string.Empty, result.ErrorCode, OrderModel.OrderNo, DateTime.Now, batch_no); Utils.ResponseMeg(false, "退款请求提交失败,请稍候再试"); } else//退款请求提交成功 { //因为支付宝的退款成功信息,是通过异步通知的方式通知 //返回到客户端后,在客户端需要启用 实时的请求 查询 数据库,查看退款成功或者失败 Response.Clear(); Response.Write(string.Format("{{success:'1',message:'{0}',paytype:'{1}',batchno:'{2}'}}", "退款请求提交成功,正在退款中...", "2", batch_no)); Response.End(); } #endregion } else if (OrderModel.PayType == EyouSoft.Model.TicketStructure.TicketAccountType.财付通) { #region 财付通退款 //商户号 string bargainor_id = TenpayParameters.Bargainor_ID; //密钥 string key = TenpayParameters.Key; //创建请求对象 BaseSplitRequestHandler reqHandler = new BaseSplitRequestHandler(Context); //通信对象 TenpayHttpClient httpClient = new TenpayHttpClient(); //应答对象 ScriptClientResponseHandler resHandler = new ScriptClientResponseHandler(); //----------------------------- //设置请求参数 //----------------------------- reqHandler.init(); reqHandler.setKey(key); reqHandler.setGateUrl("https://mch.tenpay.com/cgi-bin/refund_b2c_split.cgi"); reqHandler.setParameter("cmdno", "93"); reqHandler.setParameter("version", "4"); reqHandler.setParameter("fee_type", "1"); reqHandler.setParameter("bargainor_id", bargainor_id); //商户号 reqHandler.setParameter("sp_billno", OrderModel.OrderNo); //商家订单号 reqHandler.setParameter("transaction_id", PayNumber); //财付通交易单号 reqHandler.setParameter("return_url", "http://127.0.0.1/"); //后台系统调用,必现填写为http://127.0.0.1/ reqHandler.setParameter("total_fee", Utils.GetMoney(OrderModel.TotalAmount * 100)); //退款ID,同个ID财付通认为是同一个退款,格式为109+10位商户号+8位日期+7位序列号 reqHandler.setParameter("refund_id", "109" + bargainor_id + BatchNo); reqHandler.setParameter("refund_fee", Utils.GetMoney(OrderModel.TotalAmount * 100)); //----------------------------- //设置通信参数 //----------------------------- //证书必须放在用户下载不到的目录,避免证书被盗取 httpClient.setCertInfo(Server.MapPath(TenpayParameters.PfxPath), TenpayParameters.PfxPwd); string requestUrl = reqHandler.getRequestURL(); //设置请求内容 httpClient.setReqContent(requestUrl); //设置超时 httpClient.setTimeOut(10); string rescontent = ""; IList <EyouSoft.Model.TicketStructure.TicketPay> tmpPayList = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().GetPayList(string.Empty, EyouSoft.Model.TicketStructure.ItemType.平台到采购商_订单, string.Empty, BatchNo); //后台调用 if (httpClient.call()) { //获取结果 rescontent = httpClient.getResContent(); resHandler.setKey(key); //设置结果参数 resHandler.setContent(rescontent); //判断签名及结果 if (resHandler.isTenpaySign() && resHandler.getParameter("pay_result") == "0") { //取结果参数做业务处理 if (tmpPayList != null && tmpPayList.Count > 0) { EyouSoft.Model.TicketStructure.TicketPay PayModel = tmpPayList[0]; // 拒绝出票完成后更新订单状态为‘拒绝出票’,并修改支付明细状态 IsResult = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().PayAfterCallBack(PayNumber, PayModel.PayPrice, EyouSoft.Model.TicketStructure.PayState.交易完成, PayModel.PayType, string.Empty, PayModel.Remark, PayModel.TradeNo, DateTime.Now, BatchNo); //判断支付记录 修改是否成功 if (IsResult)//成功 { Utils.ResponseMeg(true, "款项已经成功退到采购商帐户中,拒绝出票成功"); } else//失败 { Utils.ResponseMeg(true, "款项已经成功退到采购商帐户中,订单状态修改失败,请联系客服"); } PayModel = null; } tmpPayList = null; } else { string errorCode = resHandler.getParameter("pay_result"); //错误时,返回结果未签名。 //如包格式错误或未确认结果的,请使用原来订单号重新发起,确认结果,避免多次操作 if (tmpPayList != null && tmpPayList.Count > 0) { EyouSoft.Model.TicketStructure.TicketPay PayModel = tmpPayList[0]; //修改之前的支付记录 为 交易失败 EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().PayAfterCallBack(PayNumber, PayModel.PayPrice, EyouSoft.Model.TicketStructure.PayState.交易失败, PayModel.PayType, string.Empty, PayModel.Remark, PayModel.TradeNo, DateTime.Now, BatchNo); PayModel = null; } IsResult = false; tmpPayList = null; Utils.ResponseMeg(false, "退款失败,修改订单失败(错误码:" + errorCode + ")"); } } else { //后台调用通信失败 if (tmpPayList != null && tmpPayList.Count > 0) { EyouSoft.Model.TicketStructure.TicketPay PayModel = tmpPayList[0]; EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().PayAfterCallBack(PayNumber, PayModel.PayPrice, EyouSoft.Model.TicketStructure.PayState.交易失败, PayModel.PayType, string.Empty, PayModel.Remark, PayModel.TradeNo, DateTime.Now, BatchNo); PayModel = null; } IsResult = false; tmpPayList = null; //有可能因为网络原因,请求已经处理,但未收到应答。 Utils.ResponseMeg(false, "操作失败,有可能因为网络原因,请求已经处理,但未收到应答。"); } #endregion } #endregion #endregion } else if (OrderState == EyouSoft.Model.TicketStructure.OrderState.出票完成) { if (ChangeType.HasValue == false) { Utils.ResponseMeg(false, "参数错误"); } #region 拒绝退票、改签、改期、作废 string ChangeID = string.Empty; EyouSoft.Model.TicketStructure.OrderChangeInfo ChangeModel = orderChangeInfo; //OrderBll.GetLatestChange(OrderModel.OrderId); /* * 判断请求的订单处理状态 是否与 订单的当前状态 是否同步 * */ if (ChangeModel == null) { Utils.ResponseNoPermit("当前订单不能进行【退/废/改/签】处理"); } if (ChangeType.Value != ChangeModel.ChangeType || ChangeModel.ChangeState == EyouSoft.Model.TicketStructure.OrderChangeState.接受 || ChangeModel.ChangeState == EyouSoft.Model.TicketStructure.OrderChangeState.拒绝) { Utils.ResponseNoPermit("当前订单的状态已经被修改"); } ChangeID = ChangeModel.ChangeId; IsResult = OrderBll.CheckOrderChange(ChangeID, SiteUserInfo.ID, Remark, EyouSoft.Model.TicketStructure.OrderChangeState.拒绝); Utils.ResponseMeg(IsResult, IsResult ? "订单修改成功" : "订单修改失败,请稍候再试"); #endregion } //return IsResult; }
private void LoadBindData(string orderId) { EyouSoft.Model.TicketStructure.OrderInfo orderInfo = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().GetOrderInfoById(orderId); if (orderInfo != null) { hidOrderId.Value = orderInfo.OrderId; #region 航班信息 EyouSoft.Model.TicketStructure.TicketFlightCompany companyModel = EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(orderInfo.FlightId); if (companyModel != null) { ltr_gysCompanyName.Text = companyModel.AirportName; //航空公司名 companyModel = null; } ltr_gysGoDate.Text = orderInfo.LeaveTime.ToString("yyyy-MM-dd"); //ltr_gysGoRun.Text = orderInfo.HomeCityName + "(" + orderInfo.ReturnTime.ToString("hh:mm") + ")-->" + orderInfo.DestCityName + "(" + orderInfo.LeaveTime.ToString("hh:mm") + ")"; ltr_gysGoRun.Text = orderInfo.HomeCityName + "-->" + orderInfo.DestCityName; ltr_gyshbType.Text = orderInfo.FreightType.ToString(); ltr_gyslkType.Text = orderInfo.TravellerType.ToString(); ltr_gysPlaneNum.Text = orderInfo.LFlightCode; //航班号 ltr_gysLinkPerson.Text = ""; ltr_gysdllevel.Text = ""; ltr_OrderNo.Text = orderInfo.OrderNo; ltr_OrderPnr.Text = string.IsNullOrEmpty(orderInfo.PNR) == true ? orderInfo.OPNR : ""; ltr_IsChangePnr.Text = string.IsNullOrEmpty(orderInfo.PNR) == true ? "" : orderInfo.PNR; ltr_gysCompanyName1.Text = orderInfo.SupplierCName; ltr_TeamType.Text = orderInfo.RateType.ToString(); //团队类型 #endregion #region 供应商详细信息 EyouSoft.Model.TicketStructure.TicketWholesalersAllInfo gysInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(orderInfo.SupplierCId);//orderInfo.SupplierCId if (gysInfo != null) { GysContactMQ = gysInfo.ContactMQ; ltr_gysLinkPerson.Text = gysInfo.ContactName; ltr_gysWorkDate.Text = gysInfo.WorkStartTime + "-" + gysInfo.WorkEndTime; ltr_gysMainPage.Text = string.IsNullOrEmpty(gysInfo.WebSite) == true?"":"<a target=\"_blank\" href=\"http://" + gysInfo.WebSite + "\">http://" + gysInfo.WebSite + "</a>"; //供应商主页 ltr_gysLinkPhone.Text = gysInfo.ContactTel; ltr_gysOutTickets.Text = (gysInfo.SuccessRate * 100).ToString("F1") + "%"; ltr_gysdllevel.Text = gysInfo.ProxyLev; ltr_gysBackTicAgvDate.Text = "自愿/非自愿:" + gysInfo.RefundAvgTime.ToString() + "/" + gysInfo.NoRefundAvgTime.ToString();//平均退票时间 gysInfo = null; } ltr_gysRemark.Text = orderInfo.OrderRateInfo.SupplierRemark; string CgsPayInfo = ""; //运价信息 string strhtml = "<tr><td align=\"center\" height=\"25\">{0}</td><td align=\"center\">¥{1}</td><td align=\"center\"><font color=\"#ff6600\">{2}</font></td><td align=\"center\">{3}</td><td align=\"center\"><span class=\"jiesuanjia\">¥{4}</span></td><td align=\"center\">{5}</td><td align=\"center\">¥{6}</td></tr>"; //回程显示的html string backrunhtml = "<td align=\"center\" height=\"25\">回程:</td> <td align=\"left\">{0}</td><td align=\"left\">返回时间:{1}</td><td width=\"12%\" align=\"center\">航班号:{2}</td><td align=\"left\">旅客类型:{3}</td>"; //单程信息 OrderRateInfo = string.Format(strhtml, "去程", Utils.GetMoney(orderInfo.OrderRateInfo.LeaveFacePrice), Utils.GetMoney(orderInfo.OrderRateInfo.LeaveDiscount) + "%", orderInfo.OrderRateInfo.LeaveTimeLimit, Utils.GetMoney(orderInfo.OrderRateInfo.LeavePrice), orderInfo.OrderRateInfo.MaxPCount.ToString(), Utils.GetMoney(orderInfo.OrderRateInfo.LFuelPrice) + "/" + Utils.GetMoney(orderInfo.OrderRateInfo.LBuildPrice)); if (orderInfo.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { CgsPayInfo = "航班信息(往返程):去程" + orderInfo.LeaveTime.ToString("yyyy-MM-dd") + "/" + orderInfo.HomeCityName + "至" + orderInfo.DestCityName + ";" + " 回程" + orderInfo.ReturnTime.ToString("yyyy-MM-dd") + "/" + orderInfo.DestCityName + "至" + orderInfo.HomeCityName; //航班回程信息 OrderRateInfo += string.Format(strhtml, "回程", Utils.GetMoney(orderInfo.OrderRateInfo.ReturnFacePrice), Utils.GetMoney(orderInfo.OrderRateInfo.ReturnDiscount) + "%", orderInfo.OrderRateInfo.ReturnTimeLimit, Utils.GetMoney(orderInfo.OrderRateInfo.ReturnPrice), orderInfo.OrderRateInfo.MaxPCount, Utils.GetMoney(orderInfo.OrderRateInfo.RFuelPrice) + "/" + Utils.GetMoney(orderInfo.OrderRateInfo.RBuildPrice)); //显示回程信息 //string cityinfo = orderInfo.DestCityName + "(" + orderInfo.ReturnTime.ToString("hh:mm") + ")-->" + orderInfo.HomeCityName + "(" + orderInfo.LeaveTime.ToString("hh:mm") + ")"; //回程格式 string cityinfo = orderInfo.DestCityName + "-->" + orderInfo.HomeCityName; //回程格式 BackRunInfo = string.Format(backrunhtml, cityinfo, orderInfo.ReturnTime.ToString("yyyy-MM-dd"), orderInfo.RFlightCode, orderInfo.TravellerType.ToString()); } if (orderInfo.FreightType == EyouSoft.Model.TicketStructure.FreightType.单程) { CgsPayInfo = "航班信息(单程):" + orderInfo.LeaveTime.ToString("yyyy-MM-dd") + "/" + orderInfo.HomeCityName + "至" + orderInfo.DestCityName; } #endregion #region 旅客信息 ltr_perCount.Text = orderInfo.PCount.ToString(); IList <EyouSoft.Model.TicketStructure.OrderTravellerInfo> traveller = orderInfo.Travellers; if (traveller != null && traveller.Count > 0) { crptPassengersList.DataSource = traveller; crptPassengersList.DataBind(); } BuySafetyCount = orderInfo.Travellers.Where(i => i.IsBuyIns).Count(); //保险数 BuyRoutingCount = orderInfo.Travellers.Where(i => i.IsBuyItinerary).Count(); //行程单数 #endregion #region 支付方式和支付金额 ltr_PassCount.Text = orderInfo.PCount.ToString(); ltr_TotalPrice.Text = orderInfo.TotalAmount.ToString("0.00"); #endregion #region 采购商联系方式 txtcgsAddress.Value = orderInfo.BuyerContactAddress;//SiteUserInfo.ContactInfo//联系人地址 txtcgsComapanyName.Value = orderInfo.BuyerCName; txtcgsLinkName.Value = orderInfo.BuyerContactName; txtcgsTel.Value = orderInfo.BuyerContactMobile; txaExpressRemark.Value = orderInfo.BuyerRemark; //特殊备注 #endregion #region 订单处理状态 IList <EyouSoft.Model.TicketStructure.TicketOrderLog> orderLogs = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance().GetTicketOrderState(orderInfo.OrderId); if (orderLogs.Count > 0 && orderLogs != null) { crptOrdState.DataSource = orderLogs; crptOrdState.DataBind(); OrderStateLog = orderLogs[orderLogs.Count - 1].State; //当前订单状态赋值 if (OrderStateLog != "申请改期" && OrderStateLog != "申请退票" && OrderStateLog != "申请作废" && OrderStateLog != "申请改签") { OrderStateLog = string.Empty; } foreach (EyouSoft.Model.TicketStructure.TicketOrderLog item in orderLogs) { item.Remark = CutStr(item.Remark, 50); } orderLogs = null; } #endregion switch (orderInfo.OrderState) { case EyouSoft.Model.TicketStructure.OrderState.等待审核: case EyouSoft.Model.TicketStructure.OrderState.拒绝审核: divOperateOrder.Visible = false; //支付操作div divPayType.Visible = false; //支付类型div divSpecRemark.Visible = false; //特殊备注div break; case EyouSoft.Model.TicketStructure.OrderState.出票完成: divPayType.Visible = false; //支付类型div divOperateOrder.Visible = true; #region 绑定退作废控件值 sltBlack.Items.Add(new ListItem("-请选择-", "0")); sltBlankOut.Items.Add(new ListItem("-请选择-", "0")); string[] arrback = Enum.GetNames(typeof(EyouSoft.Model.TicketStructure.RefundTicketType)); if (arrback.Length > 0 && arrback != null) { foreach (string item in arrback) { if ((EyouSoft.Model.TicketStructure.RefundTicketType)Enum.Parse(typeof(EyouSoft.Model.TicketStructure.RefundTicketType), item) == EyouSoft.Model.TicketStructure.RefundTicketType.当日作废) { sltBlankOut.Items.Add(new ListItem(item, item)); break; } else { sltBlack.Items.Add(new ListItem(item, item)); } } } #endregion break; case EyouSoft.Model.TicketStructure.OrderState.审核通过: divOperateOrder.Visible = false; //根据当前采购商用户绑定的支付类型显示支付链接 ShowCgSPayType(orderInfo.OrderNo, orderInfo.TotalAmount, CgsPayInfo, orderInfo.SupplierCId, orderInfo.OrderId); OrderNo = orderInfo.OrderNo; SupplierCId = orderInfo.SupplierCId; TotalAmount = orderInfo.TotalAmount.ToString(); break; case EyouSoft.Model.TicketStructure.OrderState.拒绝出票: case EyouSoft.Model.TicketStructure.OrderState.支付成功: divOperateOrder.Visible = false; //支付操作div divPayType.Visible = false; //支付类型div break; case EyouSoft.Model.TicketStructure.OrderState.无效订单: divOperateOrder.Visible = false; //支付操作div divPayType.Visible = false; //支付类型div divSpecRemark.Visible = false; //特殊备注div divcgsInfo.Visible = false; break; default: break; } traveller = null; orderInfo = null; } else { Response.Redirect("CurrentOrderList.aspx"); return; } }
protected void Page_Load(object sender, EventArgs e) { //密钥 string key = TenpayParameters.Key; //创建PayResponseHandler实例 PayResponseHandler resHandler = new PayResponseHandler(Context); resHandler.setKey(key); //判断签名 if (resHandler.isTenpaySign()) { //交易单号 string trade_no = resHandler.getParameter("transaction_id"); //金额金额,以分为单位 decimal total_fee = decimal.Parse(resHandler.getParameter("total_fee")) / 100; //支付结果 string pay_result = resHandler.getParameter("pay_result"); //订单号 string order_no = resHandler.getParameter("sp_billno"); //支付账号 string buyer_email = ""; EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo info = orderBll.GetOrderInfoByNo(order_no); if (info.OrderState == EyouSoft.Model.TicketStructure.OrderState.审核通过) { IList <EyouSoft.Model.TicketStructure.TicketCompanyAccount> list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(info.SupplierCId); //获取供应商所有账户 string sellAccount = ""; //供应商账户 EyouSoft.Model.TicketStructure.TicketCompanyAccount accountModel = list.FirstOrDefault(i => i.InterfaceType == EyouSoft.Model.TicketStructure.TicketAccountType.财付通); //获取供应商账户实体 if (accountModel != null) { sellAccount = accountModel.AccountNumber;//赋值供应商账户 } string batchNo = ""; decimal IntoRatio = decimal.Parse(TenpayParameters.TongyeFee); IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList(info.OrderId, EyouSoft.Model.TicketStructure.ItemType.采购商付款到平台_订单, order_no, null); if ("0".Equals(pay_result)) { if (payList != null && payList.Count > 0) { orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, ""); } else { orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, total_fee, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, ""); } //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示show.aspx页面. resHandler.doShow(string.Format("/AirTickets/tenpay/directpay/Show.aspx?order_no={0}&total_fee={1}&result={2}", order_no, total_fee, "1")); } else { //当做不成功处理 if (payList != null && payList.Count > 0) { orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, ""); } else { orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, total_fee, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, total_fee, EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.财付通, buyer_email, "", order_no, DateTime.Now, ""); } resHandler.doShow(string.Format("/AirTickets/tenpay/directpay/Show.aspx?order_no={0}&total_fee={1}&result={2}", order_no, total_fee, "0")); //Response.Write("支付失败"); } } //获取debug信息,建议把debug信息写入日志,方便定位问题 //string debuginfo = resHandler.getDebugInfo(); //Response.Write("<br/>debuginfo:" + debuginfo + "<br/>"); } else { Response.Write("认证签名失败"); } }
protected void Page_Load(object sender, EventArgs e) { string method = Utils.GetFormValue("method"); this.Title = "支付-组团预定/散拼-机票"; if (method != "InsertAccount") { this.Master.Naviagtion = AirTicketNavigation.团队预定散拼; orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); string orderId = Utils.GetQueryStringValue("orderId"); orderInfo = orderBll.GetOrderInfoById(orderId); EyouSoft.Model.TicketStructure.TicketFlightCompany companyModel = EyouSoft.BLL.TicketStructure.TicketFlightCompany.CreateInstance().GetTicketFlightCompany(orderInfo.FlightId); if (companyModel != null) { flightName = companyModel.AirportName; } companyName = SiteUserInfo.CompanyName; contactName = SiteUserInfo.ContactInfo.ContactName; address = ""; moible = SiteUserInfo.ContactInfo.Mobile; buyInsCount = orderInfo.Travellers.Where(i => i.IsBuyIns).Count(); //保险数 buyItineraryCount = orderInfo.Travellers.Where(i => i.IsBuyItinerary).Count(); //行程单数 supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(orderInfo.SupplierCId); acl_rptCustomerList.DataSource = orderInfo.Travellers; acl_rptCustomerList.DataBind(); list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(orderInfo.SupplierCId); } else { string payWhich = Utils.GetFormValue("paywhich"); string freightType = Utils.GetFormValue("freightType"); string orderId = Utils.GetFormValue("orderId"); string orderNo = Utils.GetFormValue("orderNo"); string sellCId = Utils.GetFormValue("sellcId"); string batchNo = ""; decimal total = decimal.Parse(Utils.GetFormValue("total")); string companyName = Utils.GetFormValue("companyname"); string contactName = Utils.GetFormValue("contactname"); string moible = Utils.GetFormValue("moible"); string address = Utils.GetFormValue("address"); string currUId = SiteUserInfo.ID; string currCId = SiteUserInfo.CompanyID; string theUrl = GetPayUrl(payWhich, orderNo, total, freightType); decimal IntoRatio = decimal.Parse(AlipayParameters.TongyeFee); //平台交易费 orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); orderBll.UpdateBuyerContact(orderId, companyName, contactName, moible, address); //修改订单联系方式 EyouSoft.Model.TicketStructure.ItemType? itemType = EyouSoft.Model.TicketStructure.ItemType.采购商付款到平台_订单; //流水金额记录项类型 IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList(orderId, itemType, orderNo, ""); //获取交易记录 list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(sellCId); //获取供应商所有账户 EyouSoft.Model.TicketStructure.TicketAccountType accountType = (EyouSoft.Model.TicketStructure.TicketAccountType)Utils.GetInt(payWhich); //获取支付类型 string sellAccount = ""; //供应商账户 EyouSoft.Model.TicketStructure.TicketCompanyAccount accountModel = list.FirstOrDefault(i => i.InterfaceType == accountType); //获取供应商账户实体 if (accountModel != null) { sellAccount = accountModel.AccountNumber; //赋值供应商账户 } else { Utils.ResponseMegError(); //如果对应接口账户不存在则输出失败 return; } if (payList == null || payList.Count == 0 || (payList != null && payList.Where(i => i.PayState == EyouSoft.Model.TicketStructure.PayState.交易完成).Count() < 1))//如果交易记录不存在或交易状态不是完成则添加支付前交易记录 { if (orderBll.PayBefore(orderId, orderNo, sellAccount, IntoRatio, SiteUserInfo.ID, SiteUserInfo.CompanyID, total, accountType, sellCId, "", out batchNo)) { Utils.ResponseMeg(true, theUrl); } else { Utils.ResponseMegError(); } } else if (payList != null && payList.Where(i => i.PayState == EyouSoft.Model.TicketStructure.PayState.交易完成).Count() > 0) { Utils.ResponseMeg(false, "你已经支付过,并且交易完成了!"); } else { Utils.ResponseMeg(true, theUrl); } } }
protected string orderid; //订单编号 protected void Page_Load(object sender, EventArgs e) { this.Title = "完成-组团预定/散拼-机票"; SortedDictionary <string, string> sArrary = GetRequestGet(); ///////////////////////以下参数是需要设置的相关配置参数,设置后不会更改的////////////////////// string partner = AlipayParameters.Partner; //合作身份者ID string key = AlipayParameters.Key; //安全检验码 string input_charset = AlipayParameters.Input_Charset; //字符编码格式 目前支持 gbk 或 utf-8 string sign_type = AlipayParameters.SignType; //加密方式 不需修改 string transport = "http"; //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http ////////////////////////////////////////////////////////////////////////////////////////////// if (sArrary.Count > 0)//判断是否有带返回参数 { AlipayNotify aliNotify = new AlipayNotify(sArrary, Request.QueryString["notify_id"], partner, key, input_charset, sign_type, transport); string responseTxt = aliNotify.ResponseTxt; //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求 string sign = Request.QueryString["sign"]; //获取支付宝反馈回来的sign结果 string mysign = aliNotify.Mysign; //获取通知返回后计算后(验证)的加密结果 ////写日志记录(若要调试,请取消下面两行注释) //string sWord = "Return_URL:responseTxt=" + responseTxt + "\n return_url_log:sign=" + Request.QueryString["sign"] + "&mysign=" + mysign + "\n return回来的参数:" + aliNotify.PreSignStr; //AlipayFunction.log_result(Server.MapPath("../log/" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord); //判断responsetTxt是否为ture,生成的签名结果mysign与获得的签名结果sign是否一致 //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 //mysign与sign不等,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 if (responseTxt == "true" && sign == mysign)//验证成功 { //请根据您的业务逻辑来编写程序(以下代码仅作参考) //获取支付宝的通知返回参数 string trade_no = Request.QueryString["trade_no"]; //支付宝交易号 order_no = Request.QueryString["out_trade_no"]; //获取订单号 total_fee = Request.QueryString["total_fee"]; //获取总金额 string subject = Request.QueryString["subject"]; //商品名称、订单名称 string body = Request.QueryString["body"]; //商品描述、订单备注、描述 string buyer_email = Request.QueryString["buyer_email"]; //买家支付宝账号 string trade_status = Request.QueryString["trade_status"]; //交易状态 int sOld_trade_status = 0; //获取商户数据库中查询得到该笔交易当前的交易状态 proName = string.Format("同业114机票平台(订单号:{0})", order_no); buyerAccount = buyer_email; string notify_id = Request.QueryString["notify_id"]; string notify_time = Request.QueryString["notify_time"]; string buyer_id = Request.QueryString["buyer_id"]; //打印页面 //lbTrade_no.Text = trade_no; //lbOut_trade_no.Text = order_no; //lbTotal_fee.Text = total_fee; //lbSubject.Text = subject; //lbBody.Text = body; //lbBuyer_email.Text = buyer_email; //lbTrade_status.Text = trade_status; //lbVerify.Text = "验证成功"; //lblNotifyId.Text = notify_id; //lblNotifyTime.Text = notify_time; //lblBuyerID.Text = buyer_id; //假设: //sOld_trade_status="0" 表示订单未处理; //sOld_trade_status="1" 表示交易成功(TRADE_FINISHED/TRADE_SUCCESS) EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo info = orderBll.GetOrderInfoByNo(order_no); orderid = info.OrderId; if (info.FreightType == EyouSoft.Model.TicketStructure.FreightType.单程) { proDetail = string.Format("订单号:{0}/航程信息:单程 {1}/{2}至{3}/", order_no, info.LeaveTime.ToString("yyyy-MM-dd"), info.HomeCityName, info.DestCityName); } else { proDetail = string.Format("订单号:{0}/航程信息:去程 {1}/{2}至{3}/回程 {4}/{5}-{6}", order_no, info.LeaveTime.ToString("yyyy-MM-dd"), info.HomeCityName, info.DestCityName, info.ReturnTime, info.DestCityName, info.HomeCityName); } if (info.OrderState == EyouSoft.Model.TicketStructure.OrderState.审核通过) { IList <EyouSoft.Model.TicketStructure.TicketCompanyAccount> list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(info.SupplierCId); //获取供应商所有账户 string sellAccount = ""; //供应商账户 EyouSoft.Model.TicketStructure.TicketCompanyAccount accountModel = list.FirstOrDefault(i => i.InterfaceType == EyouSoft.Model.TicketStructure.TicketAccountType.支付宝); //获取供应商账户实体 if (accountModel != null) { sellAccount = accountModel.AccountNumber;//赋值供应商账户 } string batchNo = ""; //decimal IntoRatio = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.SupplierCId).IntoRatio; decimal IntoRatio = decimal.Parse(AlipayParameters.TongyeFee); IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList(info.OrderId, EyouSoft.Model.TicketStructure.ItemType.采购商付款到平台_订单, order_no, null); if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { //为了保证不被重复调用,或重复执行数据库更新程序,请判断该笔交易状态是否是订单未处理状态 //string order_no="201011080010"; //string trade_no="2010110861004313"; //string total_fee="0.01"; //string buyer_email="*****@*****.**"; //string seller_mailer="*****@*****.**"; if (payList != null && payList.Count > 0) { orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } else { orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } resultMess = "交易成功"; //if (sOld_trade_status < 1) //{ // //根据订单号更新订单,把订单状态处理成交易成功 //} } else { if (payList != null && payList.Count > 0) { orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } else { orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } //Response.Write("trade_status=" + Request.QueryString["trade_status"]); resultMess = "交易失败"; } } else { resultMess = info.OrderState.ToString(); } // 请根据您的业务逻辑来编写程序(以上代码仅作参考) } else//验证失败 { resultMess = "验证失败"; } } else { resultMess = "无返回参数"; } }
protected void Page_Load(object sender, EventArgs e) { Page.Error += new EventHandler(Page_Error); SortedDictionary <string, string> sArrary = GetRequestPost(); ///////////////////////以下参数是需要设置的相关配置参数,设置后不会更改的////////////////////// string partner = AlipayParameters.Partner; //合作身份者ID string key = AlipayParameters.Key; //安全检验码 string input_charset = AlipayParameters.Input_Charset; //字符编码格式 目前支持 gbk 或 utf-8 string sign_type = AlipayParameters.SignType; //加密方式 不需修改 string transport = "http"; //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http ////////////////////////////////////////////////////////////////////////////////////////////// if (sArrary.Count > 0)//判断是否有带返回参数 { AlipayNotify aliNotify = new AlipayNotify(sArrary, Request.Form["notify_id"], partner, key, input_charset, sign_type, transport); string responseTxt = aliNotify.ResponseTxt; //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求 string sign = Request.Form["sign"]; //获取支付宝反馈回来的sign结果 string mysign = aliNotify.Mysign; //获取通知返回后计算后(验证)的加密结果 ////写日志记录(若要调试,请取消下面两行注释) string sWord = "Notify_URL:responseTxt=" + responseTxt + "\n notify_url_log:sign=" + Request.Form["sign"] + "&mysign=" + mysign + "\n notify回来的参数:" + aliNotify.PreSignStr; //判断responsetTxt是否为ture,生成的签名结果mysign与获得的签名结果sign是否一致 //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 //mysign与sign不等,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 if (responseTxt == "true" && sign == mysign)//验证成功 { //请根据您的业务逻辑来编写程序(以下代码仅作参考) //获取支付宝的通知返回参数 string trade_no = Request.Form["trade_no"]; //支付宝交易号 string order_no = Request.Form["out_trade_no"]; //获取订单号 string total_fee = Request.Form["total_fee"]; //获取总金额 string subject = Request.Form["subject"]; //商品名称、订单名称 string body = Request.Form["body"]; //商品描述、订单备注、描述 string buyer_email = Request.Form["buyer_email"]; //买家支付宝账号 string trade_status = Request.Form["trade_status"]; //交易状态 //string notify_id = Request.QueryString["notify_id"]; //string notify_time = Request.QueryString["notify_time"]; //string buyer_id = Request.QueryString["buyer_id"]; //string gmt_create = Request.QueryString["gmt_create"]; //string gmt_payment = Request.QueryString["gmt_payment"]; sWord += "\n TRUE"; //表示交易成功(TRADE_FINISHED/TRADE_SUCCESS) EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo info = orderBll.GetOrderInfoByNo(order_no); if (info.OrderState == EyouSoft.Model.TicketStructure.OrderState.审核通过) { IList <EyouSoft.Model.TicketStructure.TicketCompanyAccount> list = EyouSoft.BLL.TicketStructure.TicketCompanyAccount.CreateInstance().GetTicketCompanyAccountList(info.SupplierCId); //获取供应商所有账户 string sellAccount = ""; //供应商账户 EyouSoft.Model.TicketStructure.TicketCompanyAccount accountModel = list.FirstOrDefault(i => i.InterfaceType == EyouSoft.Model.TicketStructure.TicketAccountType.支付宝); //获取供应商账户实体 if (accountModel != null) { sellAccount = accountModel.AccountNumber;//赋值供应商账户 } string batchNo = ""; decimal IntoRatio = decimal.Parse(AlipayParameters.TongyeFee); IList <EyouSoft.Model.TicketStructure.TicketPay> payList = orderBll.GetPayList(info.OrderId, EyouSoft.Model.TicketStructure.ItemType.采购商付款到平台_订单, order_no, null); if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS") { sWord += "/n 交易成功"; //为了保证不被重复调用,或重复执行数据库更新程序,请判断该笔交易状态是否是订单未处理状态 //string order_no="201011080010"; //string trade_no="2010110861004313"; //string total_fee="0.01"; //string buyer_email="*****@*****.**"; //string seller_mailer="*****@*****.**"; if (payList != null && payList.Count > 0) { sWord += "/n you"; orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } else { sWord += "/n meiyou"; orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易完成, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } } else { sWord += "/n 交易失败"; if (payList != null && payList.Count > 0) { orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } else { orderBll.PayBefore(info.OrderId, order_no, sellAccount, IntoRatio, info.BuyerUId, info.BuyerCId, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, info.SupplierCId, "", out batchNo); orderBll.PayAfterCallBack(trade_no, decimal.Parse(total_fee), EyouSoft.Model.TicketStructure.PayState.交易失败, EyouSoft.Model.TicketStructure.TicketAccountType.支付宝, buyer_email, "", order_no, DateTime.Now, ""); } } AlipayFunction.log_result(Server.MapPath("../log/" + order_no + "-" + DateTime.Now.ToString().Replace(":", "")) + ".txt", sWord); } Response.Write("success"); } else//验证失败 { //sWord += "\n FAIL"; Response.Write("fail"); } } else { Response.Write("无通知参数"); } }