/// <summary> /// 修改提现后状态 /// </summary> /// <param name="SeriaNo"></param> public void SetCustomerWithdrawal(string SeriaNo) { var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; CustomerWithdrawalBLL bll = new CustomerWithdrawalBLL(loggingSessionInfo); bll.SetTradeCenterPay(SeriaNo); }
/// <summary> /// 获取客户提现信息 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string GetCustomerWithdrawal(string pRequest) { var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var rp = pRequest.DeserializeJSONTo <APIRequest <GetCustomerWithdrawalInfoRP> >(); var customerId = loggingSessionInfo.ClientID; var rd = new GetCustomerWithdrawalInfoRD(); var bll = new CustomerWithdrawalBLL(loggingSessionInfo); var ds = bll.GetCustomerWithrawalInfo(customerId); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { GetCustomerWithdrawalInfo customerWithdrawalInfo = new GetCustomerWithdrawalInfo(); foreach (DataRow row in ds.Tables[0].Rows) { customerWithdrawalInfo.CustomerName = row["CustomerName"].ToString(); //客户名称 customerWithdrawalInfo.ReceivingBank = row["ReceivingBank"].ToString(); //收款银行 if (row["BankAccount"] != DBNull.Value) { int i = 4; string strBankAccount = row["BankAccount"].ToString(); string strLeft = strBankAccount.Substring(0, i); string strRight = strBankAccount.Substring(strBankAccount.Length - i, i); customerWithdrawalInfo.BankAccount = strLeft + "**********" + strRight; //收款账号 } customerWithdrawalInfo.OpenBank = row["OpenBank"].ToString(); //开户行 } foreach (DataRow row in ds.Tables[2].Rows) { customerWithdrawalInfo.CountWithdrawalAmount = row["CountWithdrawalAmount"] != DBNull.Value ? Convert.ToDecimal(row["CountWithdrawalAmount"].ToString()) : 0; //提现总金额 customerWithdrawalInfo.BeenAmount = row["BeenAmount"] != DBNull.Value ? Convert.ToDecimal(row["BeenAmount"].ToString()) : 0; //已到账金额 customerWithdrawalInfo.WaitForAmount = row["WaitForAmount"] != DBNull.Value ? Convert.ToDecimal(row["WaitForAmount"].ToString()) : 0; //待出账金额 customerWithdrawalInfo.CanWithdrawalAmount = row["WithdrawalAmount"] != DBNull.Value ? Convert.ToDecimal(row["WithdrawalAmount"].ToString()) : 0; //可提现金额 if (row["LastWithdrawalTime"] != DBNull.Value) { customerWithdrawalInfo.LastWithdrawalTime = DateTimeExtensionMethods.To19FormatString(Convert.ToDateTime(row["LastWithdrawalTime"])); //上次提现时间 ; } customerWithdrawalInfo.CautionMoney = row["CautionMoney"] != DBNull.Value ? Convert.ToDecimal(row["CautionMoney"].ToString()) : 0; //保证金 customerWithdrawalInfo.RefundAmount = row["RefundAmount"] != DBNull.Value ? Convert.ToDecimal(row["RefundAmount"].ToString()) : 0; //退款金额 } //结算信息 foreach (DataRow row in ds.Tables[1].Rows) { customerWithdrawalInfo.PaypalRate = row["PaypalRate"] != DBNull.Value ? Convert.ToDecimal(row["PaypalRate"].ToString()) : 0; customerWithdrawalInfo.CUPRate = row["CUPRate"] != DBNull.Value ? Convert.ToDecimal(row["CUPRate"].ToString()) : 0; customerWithdrawalInfo.OffPeriod = row["OffPeriod"] != DBNull.Value ? Convert.ToInt32(row["OffPeriod"].ToString()) : 0; customerWithdrawalInfo.MinAmount = row["MinAmount"] != DBNull.Value ? Convert.ToInt32(row["MinAmount"].ToString()) : 0; customerWithdrawalInfo.PayRemark = row["PayRemark"].ToString(); } rd.GetCustomerWithdrawal = customerWithdrawalInfo; } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var OrderID = context.Request["OrderID"]; var OrderStatus = context.Request["OrderStatus"]; var CustomerID = context.Request["CustomerID"]; var UserID = context.Request["UserID"]; var ChannelID = context.Request["ChannelID"]; var SerialPay = context.Request["SerialPay"]; try { if (string.IsNullOrEmpty(OrderID) || string.IsNullOrEmpty(OrderStatus) || string.IsNullOrEmpty(CustomerID) || string.IsNullOrEmpty(UserID) || string.IsNullOrEmpty(ChannelID)) { throw new Exception("参数不全:OrderID,OrderStatus,CustomerID,UserID"); } else { var loggingSessionInfo = Default.GetBSLoggingSession(CustomerID, "1"); /// var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; CustomerWithdrawalBLL bll = new CustomerWithdrawalBLL(loggingSessionInfo); #region 更新通知代付信息 if (OrderStatus == "2") { bll.NotityTradeCenterPay(OrderID, "50"); } else if (OrderStatus == "3") { bll.NotityTradeCenterPay(OrderID, "0"); } #endregion context.Response.Write("SUCCESS"); } } catch (Exception ex) { //Loggers.Exception(new ExceptionLogInfo(ex)); //context.Response.Write("ERROR:" + ex.Message); context.Response.Write("ERROR:" + ex.Message); } }
public string GetCustomerOrderPayStatus(string pRequest) { // var rp = pRequest.DeserializeJSONTo<APIRequest<EmptyRequestParameter>>(); var rd = new GetCustomerOrderPayStatusRD(); // var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var bll = new CustomerWithdrawalBLL(loggingSessionInfo); var ds = bll.GetCustomerOrderPayStatus(); if (ds.Tables[0].Rows.Count > 0) { var tmp = ds.Tables[0].AsEnumerable().Select(t => new GetCustomerOrderPayStatusInfo() { StatusValue = t["OptionValue"].ToString(), StatusName = t["OptionText"].ToString() }); rd.GetCustomerOrderPayStatusList = tmp.ToArray(); } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }
public string GetTradeCenterPay(string pRequest) { ReqTradeCenterPay entity = pRequest.DeserializeJSONTo <ReqTradeCenterPay>(); var rsp = new SuccessResponse <IAPIResponseData>(); string SeriaNo = DateTime.Now.ToString("yyyyMMddhhmmss"); string result = string.Empty; try { var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; string Key = ""; if (!string.IsNullOrEmpty(entity.Parameters.SeriaNo)) { Key = entity.Parameters.SeriaNo; } string Parameters = ""; var bll = new CustomerWithdrawalBLL(loggingSessionInfo); DataSet ds = bll.GetTradeCenterPay(Key); if (ds == null || ds.Tables.Count < 2) { return(""); } if (ds.Tables[1] == null || ds.Tables[1].Rows.Count < 1) { rsp.ResultCode = 00001; rsp.Message = "无可代付数据"; return(rsp.ToJSON()); } if (ds.Tables[0] == null || ds.Tables[0].Rows.Count < 1) { rsp.ResultCode = 00001; rsp.Message = "无客户信息"; return(rsp.ToJSON()); } Parameters = GetXml(ds.Tables[0], ds.Tables[1], SeriaNo, Key); string str = "request={\"ClientID\":\"" + loggingSessionInfo.ClientID + "\"," + "\"UserID\":\"" + loggingSessionInfo.UserID + "\"," + "\"Token\":null,\"AppID\":1," + "\"Parameters\":" + Parameters + "}"; string url = ConfigurationManager.AppSettings["TradeCenterPayUrl"]; if (string.IsNullOrEmpty(Key)) { result = HttpWebClient.DoHttpRequest(url + "?action=BatchPay", str); } else { result = HttpWebClient.DoHttpRequest(url + "?action=Pay", str); } ResTradeCenterPay req = result.DeserializeJSONTo <ResTradeCenterPay>(); if (req.ResultCode == "0") { if (req.Datas.ResultCode == "0000") { SetCustomerWithdrawal(Key); string pRes = CreateCustomerWithdrawalTransfer(SeriaNo, str, ds.Tables[1], 40); return(result); } rsp.ResultCode = 00001; rsp.Message = req.Datas.Message; return(rsp.ToJSON()); } else { string pRes = CreateCustomerWithdrawalTransfer(SeriaNo, str, ds.Tables[1], 0); } } catch (Exception) { rsp.ResultCode = 00001; rsp.Message = "错误"; return(rsp.ToJSON()); } return(result); }
public string GetCustomerWithdrawalList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GetCustomerWithdrawalListRP> >(); var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var customerId = loggingSessionInfo.ClientID; var rd = new GetCustomerWithdrawalListRD(); var beginDate = rp.Parameters.BeginDate; var endDate = rp.Parameters.EndDate; //if (rp.Parameters.BeginDate == "" || string.IsNullOrEmpty(rp.Parameters.BeginDate)) //{ // beginDate = "1999-01-01"; //} //if (rp.Parameters.EndDate == "" || string.IsNullOrEmpty(rp.Parameters.EndDate)) //{ // endDate = DateTime.Now.ToString("yyyy-MM-dd"); //} var serialNo = rp.Parameters.SerialNo; var status = rp.Parameters.Status; var pageIndex = rp.Parameters.PageIndex; var pageSize = rp.Parameters.PageSize; if (pageIndex == null) { if (HttpContext.Current.Request["page"] != null) { pageIndex = int.Parse(HttpContext.Current.Request["page"]) - 1; } } var bll = new CustomerWithdrawalBLL(loggingSessionInfo); var ds = bll.GetCustomerWithdrawalList(customerId, serialNo, beginDate, endDate, status, pageIndex ?? 0, pageSize ?? 15); var pageDs = bll.GetCustomerWithdrawalList(customerId, serialNo, beginDate, endDate, status, 0, Int32.MaxValue); if (ds.Tables[0].Rows.Count > 0) { var tmp = ds.Tables[0].AsEnumerable().Select(t => new CustomerWithdrawalInfo { WithdrawalId = t["WithdrawalId"].ToString(), SerialNo = t["SerialNo"].ToString(), WithdrawalTime = t["WithdrawalTime"].ToString(), CustomerName = t["CustomerName"].ToString(), ReceivingBank = t["ReceivingBank"].ToString(), BankAccount = t["BankAccount"].ToString(), WithdrawalStatus = t["WithdrawalStatus"].ToString(), FailureReason = t["FailureReason"].ToString(), WithdrawalAmount = Convert.ToDecimal(t["WithdrawalAmount"]) }); rd.TotalPageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(pageDs.Tables[0].Rows.Count * 1.00 / (pageSize ?? 15) * 1.00))); rd.TotalCount = pageDs.Tables[0].Rows.Count; rd.CustomerWithdrawalList = tmp.ToArray(); } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }
/// <summary> /// 申请提现 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string ApplyForWithdrawal(string pRequest) { var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var rd = new ApplyForWithdrawalRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <ApplyForWithdrawalRP> >(); var customerId = loggingSessionInfo.ClientID; //客户ID var WithdrawalAmount = rp.Parameters.WithdrawalAmount; //提现金额 var WithdrawalPassword = rp.Parameters.WithdrawalPassword; //提现密码 var rsp = new SuccessResponse <IAPIResponseData>(); #region 1.根据CustomerID查询当前客户银行信息 CustomerBackBLL BackBLL = new CustomerBackBLL(loggingSessionInfo); CustomerBackEntity BackEntity = new CustomerBackEntity(); BackEntity.CustomerId = customerId; BackEntity.BackStatus = 1; var entityBack = BackBLL.QueryByEntity(BackEntity, null); if (entityBack != null && entityBack.Length > 0) { string Password = entityBack.First().WithdrawalPassword; //提现密码 if (!WithdrawalPassword.ToString().Equals(Password)) { rsp.ResultCode = 303; rsp.Message = "输入密码错误"; return(rsp.ToJSON()); throw new APIException(string.Format("输入密码错误!")) { ErrorCode = 303 }; } else if (Password == "e10adc3949ba59abbe56e057f20f883e") //1.未修改初始密码.跳转到输入密码页面 { rsp.ResultCode = 302; return(rsp.ToJSON()); throw new APIException(string.Format("您的初始密码没有修改。请修改初始密码!")) { ErrorCode = 302 }; } else { string MD5Pwd = WithdrawalPassword.ToString().Trim() + MD5Helper.Encryption(customerId.ToString().Trim()); //MD5密码 if ((Password.ToString().Trim().Equals(WithdrawalPassword.ToString().Trim())) && entityBack.FirstOrDefault() .MD5Pwd.ToString().Trim().Equals(MD5Pwd)) //2.当客户已经修改密码,并且输入的密码和数据库中客户密码一致.并且数据库中MD5的密码规则一样则提现 { #region 根据金额,客户。状态 查询提现主标识 #endregion var bll = new CustomerWithdrawalBLL(loggingSessionInfo); string UserId = loggingSessionInfo.CurrentUser.User_Id; // string strWithdrawalld = bll.GetWithdrawalID(customerId, 20); var tran = bll.GetTran(); try { if (!bll.GetWithdrawalDayByMaxPeriod(customerId)) { rsp.ResultCode = 305; rsp.Message = "没到提现周期。不能提现"; return(rsp.ToJSON()); throw new APIException("没到提现周期。不能提现") { ErrorCode = 305 }; } else { #region 老版本提现。废弃 //#region 1.根据提现主标识更新对应的状态和更新人。 //bll.UpdateWithdrawalStatus(customerId, strWithdrawalld, 30, UserId); //#endregion //#region 2。根据提现主标识,更新订单支付明细的状态和时间 ////提现明细 //CustomerWithdrawalDetailBLL blldetail = new CustomerWithdrawalDetailBLL(loggingSessionInfo); //CustomerOrderPayBLL orderPayBLL = new CustomerOrderPayBLL(loggingSessionInfo); //orderPayBLL.UpdateOrderPayList(strWithdrawalld, customerId, 30, UserId); //#endregion //#region 根据CustomerId 3更新客户可提取的现金金额。已提取的金额累加,当前余额-提取金额 //CustomerAmountBLL amountBLL = new CustomerAmountBLL(loggingSessionInfo); //CustomerAmountEntity amountentity = new CustomerAmountEntity(); //amountentity.CustomerId = customerId;//客户ID //decimal strOutAmount, strWithdrawalAmount, strEndAmount;//已提取金额。可提现金额,当前余额 //var temp = amountBLL.QueryByEntity(amountentity, null); //if (temp.Length > 0) //{ // strOutAmount = Convert.ToDecimal(temp.FirstOrDefault().OutAmount); // strWithdrawalAmount = Convert.ToDecimal(temp.FirstOrDefault().WithdrawalAmount); // strEndAmount = Convert.ToDecimal(temp.FirstOrDefault().EndAmount); // amountentity = temp[0]; // amountentity.WithdrawalAmount = 0;//可提现金额变为0; // amountentity.OutAmount = strOutAmount + rp.Parameters.WithdrawalAmount;//已提取金额累加 // amountentity.EndAmount = strEndAmount - WithdrawalAmount; //余额-提现金额 // amountBLL.Update(amountentity, null); //} //#endregion #endregion int returnValue = bll.getApplyForWithdrawal(customerId, UserId, WithdrawalAmount); if (returnValue == 0) { rsp.ResultCode = 0; rsp.Message = "OK"; return(rsp.ToJSON()); } if (returnValue == 1) { rsp.ResultCode = 306; rsp.Message = "提现失败!"; return(rsp.ToJSON()); } if (returnValue == 304) { rsp.ResultCode = 304; rsp.Message = "没有可提取金额!不能提现"; return(rsp.ToJSON()); throw new APIException("没有可提取金额!不能提现") { ErrorCode = 304 }; } } tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw new APIException(ex.Message); } } } } #endregion rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }