protected void Page_Load(object sender, EventArgs e) { CustID = Request["CustID"]; SPID = Request["SPID"]; ReturnUrl = Request["ReturnUrl"]; this.hdCustID.Value = CustID; this.hdSPID.Value = SPID; this.hdReturnUrl.Value = ReturnUrl; if (String.IsNullOrEmpty(CustID)) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "您尚未登录,请登录", this.Context); return; } BesttoneAccount _besttoneAccount_entity = _besttoneAccount_dao.QueryByCustID(CustID); if (_besttoneAccount_entity == null) { HttpContext.Current.Response.Redirect("AccountNotBind.aspx"); return; } else { _bestPayAccount = _besttoneAccount_entity.BestPayAccount; } this.OnceRechargeLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne); this.DayRechargeLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay); this.AccountBalanceLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited); }
/// <summary> /// 加载数据 /// </summary> void LoadDataForm() { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; this.LiteralBusiness.Text = "无记录"; this.LiteralRecharge.Text = "无记录"; this.LiteralRefund.Text = "无记录"; try { DateTime startDate = Convert.ToDateTime(this.hdStartDate.Value); DateTime endDate = Convert.ToDateTime(this.hdEndDate.Value); IList <TxnItem> txnList_business, txnList_recharge, txnList_refund; //调用接口查询 Result = BesttoneAccountHelper.QueryBusinessTxnHistory(startDate, endDate, "18918790558", 10, 0, out txnList_business, out ErrMsg); Result = BesttoneAccountHelper.QueryRechargeTxnHistory(startDate, endDate, "18918790558", 10, 0, out txnList_recharge, out ErrMsg); Result = BesttoneAccountHelper.QueryRefundTxnHistory(startDate, endDate, "18918790558", 10, 0, out txnList_refund, out ErrMsg); //生成表单 this.LiteralBusiness.Text = TxnFormUtility.CreateForm_Business(txnList_business); this.LiteralRecharge.Text = TxnFormUtility.CreateForm_Recharge(txnList_recharge); this.LiteralRefund.Text = TxnFormUtility.CreateForm_Refund(txnList_refund); } catch { } }
protected void Button1_Click(object sender, EventArgs e) { StringBuilder strLog = new StringBuilder(); try { //checkCode = Request["checkCode"]; BesttoneAccount = Request["mobile"]; //strLog.AppendFormat(String.Format("重置密码页面验证码:{0}", checkCode)); //判断手机验证码 //if (checkCode != null && !"".Equals(checkCode)) //{ // Result = PhoneBO.SelSendSMSMassage("", BesttoneAccount, checkCode, out ErrMsg); // if (Result != 0) // { // hintCode.InnerHtml = "手机验证码错误,请重新输入"; // 这里如何控制样式 // return; // } //} //else //{ // hintCode.InnerHtml = "手机验证不能为空,请重新输入"; // 这里如何控制样式 // return; //} Linkage.BestTone.Interface.Rule.CustInfo custinfo = new Linkage.BestTone.Interface.Rule.CustInfo(); Result = BesttoneAccountHelper.QueryCustInfo(BesttoneAccount, out custinfo, out ErrMsg); if (Result == 0) { if (custinfo != null) { int ret = BesttoneAccountHelper.ResetBesttoneAccountPayPassword(BesttoneAccount, custinfo.IdType, custinfo.IdNo, custinfo.CustomerName, out ErrMsg); if (ret == 0) { //提示密码重置成功 success = "0"; sendmsg = "支付密码已发送至" + BesttoneAccount; //Response.Redirect(ReturnUrl); } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { //测试用117663797 //this.hdCustID.Value = "117663797";//116694907 //this.hdSPID.Value = "35000000"; //this.hdReturnUrl.Value = "http://www.118114.cn"; this.hdCustID.Value = base.CustID; this.hdSPID.Value = base.SPID; this.hdReturnUrl.Value = base.ReturnUrl; this.hdHeadFoot.Value = base.IsNeedHeadFoot == "yes" ? "1" : "0"; this.OnceRechargeLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne); this.DayRechargeLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay); this.AccountBalanceLimited = BesttoneAccountHelper.ConvertAmountToYuan(BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited); }
/// <summary> /// 暂时不用 /// </summary> protected List <TxnItem> QueryHistoryDetails(DateTime startDate, DateTime endDate) { StringBuilder returnMsg = new StringBuilder(); Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; //历史交易记录只查询近2年的数据,所以从去年的1月1日到距离现在三个月前的那一天 String bestPayAccount = Request["BestPayAccount"]; List <TxnItem> list = new List <TxnItem>(); IList <TxnItem> txnList_business, txnList_recharge, txnList_refund; //历史消费记录 Result = BesttoneAccountHelper.QueryBusinessTxnHistory(startDate, endDate, bestPayAccount, 0, 0, out txnList_business, out ErrMsg); //历史充值记录 Result = BesttoneAccountHelper.QueryRechargeTxnHistory(startDate, endDate, bestPayAccount, 0, 0, out txnList_recharge, out ErrMsg); //历史退款记录 Result = BesttoneAccountHelper.QueryRefundTxnHistory(startDate, endDate, bestPayAccount, 0, 0, out txnList_refund, out ErrMsg); //历史交易记录 if (txnList_business != null && txnList_business.Count > 0) { foreach (TxnItem item in txnList_business) { list.Add(item); } } if (txnList_recharge != null && txnList_recharge.Count > 0) { foreach (TxnItem item in txnList_recharge) { list.Add(item); } } if (txnList_refund != null && txnList_refund.Count > 0) { foreach (TxnItem item in txnList_refund) { list.Add(item); } } return(list); }
protected void register_Click(object sender, EventArgs e) { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; //判断手机验证码 if (checkCode != null && !"".Equals(checkCode)) { Result = PhoneBO.SelSendSMSMassage("", this.mobile.Text, checkCode, out ErrMsg); if (Result != 0) { hintCode.InnerHtml = "手机验证码错误,请重新输入"; // 这里如何控制样式 return; } } //String realName,String contactTel,String sex,String certtype,String certnum, Result = BesttoneAccountHelper.RegisterBesttoneAccount(this.mobile.Text, realName, this.contactTel.Text, contactMail, sex, this.certtype.Value, certnum, TransactionID, out ErrMsg); if (Result == 0) { log(String.Format("开户结果:{0},{1},{2}", Result, ErrMsg, this.myCustID.Value)); // todo 建立绑定关系,插入绑定关系表 int ret = 0; ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg); if (ret == 0) { log(String.Format("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl)); Response.Redirect(this.myReturnUrl.Value); } else { log(String.Format("绑定结果:{0},{1}", ret, ErrMsg)); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { log(String.Format("开户结果:{0},{1}", Result, ErrMsg)); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } }
/// <summary> /// 账户余额查询 /// </summary> protected string QueryAcountBalance() { String bestPayAccount = Request["BestPayAccount"]; long balance; Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; //查询余额 Result = BesttoneAccountHelper.QueryAccountBalance(bestPayAccount, out balance, out ErrMsg); if (Result == 0) { return("[{\"result\":\"true\",\"balance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(balance) + "\"}]"); } else { return("[{\"result\":\"false\",\"info\":\"查询余额失败\"}]"); } }
/// <summary> /// 暂时不用 /// </summary> protected List <TxnItem> QueryCurrentDayDetails() { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; List <TxnItem> list = new List <TxnItem>(); IList <TxnItem> txnList_business_currentDay, txnList_recharge_currentDay, txnList_refund_currentDay; String bestPayAccount = Request["BestPayAccount"]; //当日消费记录 Result = BesttoneAccountHelper.QueryBusinessTxnCurrentDay(bestPayAccount, out txnList_business_currentDay, out ErrMsg); //当日充值记录 Result = BesttoneAccountHelper.QueryRechargeTxnCurrentDay(bestPayAccount, out txnList_recharge_currentDay, out ErrMsg); //当日退款记录 Result = BesttoneAccountHelper.QueryRefundTxnICurrentDay(bestPayAccount, out txnList_refund_currentDay, out ErrMsg); if (txnList_business_currentDay != null && txnList_business_currentDay.Count > 0) { foreach (TxnItem item in txnList_business_currentDay) { list.Add(item); } } if (txnList_recharge_currentDay != null && txnList_recharge_currentDay.Count > 0) { foreach (TxnItem item in txnList_recharge_currentDay) { list.Add(item); } } if (txnList_refund_currentDay != null && txnList_refund_currentDay.Count > 0) { foreach (TxnItem item in txnList_refund_currentDay) { list.Add(item); } } return(list); }
/// <summary> /// 卡余额查询 /// </summary> protected String CardBalanceQuery() { String cardNo = Request["CardNo"]; String cardPwd = Request["CardPassword"]; String cardType = Request["CardType"]; long balance; Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; //查询余额 Result = BesttoneAccountHelper.CardAuthen(cardNo, cardPwd, cardType, out balance, out ErrMsg); if (Result == 0) { return("[{\"result\":\"true\",\"balance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(balance) + "\"}]"); } else { return("[{\"result\":\"false\",\"info\":\"查询余额失败\"}]"); } }
protected void Page_Load(object sender, EventArgs e) { StringBuilder strLog = new StringBuilder(); try { if (!IsPostBack) { strLog.AppendFormat("BesttoneAccountMain"); ParseSPTokenRequest(); if (Result == 0) { CreateSPTokenRequest(); //int QueryResult = 0; strLog.AppendFormat("CustID:{0},SPID{1},HeadFooter{2}", CustID, SPID, HeadFooter); if ("yes".Equals(HeadFooter)) { this.header.Visible = true; this.footer.Visible = true; } else { this.header.Visible = false; this.footer.Visible = false; } //PhoneRecord[] phones = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg); String qryPhone = ""; //if (QueryResult == 0 && phones != null && phones.Length > 0) { // strLog.AppendFormat("getPhoneRecord成功!"); // phoneNum = phones[0].Phone; // strLog.AppendFormat("根据CustID获得手机号:CustID:{0},phoneNum:{1}", CustID, phoneNum); string BindedBestpayAccount = ""; IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg); strLog.AppendFormat("IsBesttoneAccountBindV5Result:{0},ErrMsg:{1},CustID:{2},CreateTime:{3},BindedBestpayAccount:{4}", IsBesttoneAccountBindV5Result, ErrMsg, CustID, CreateTime, BindedBestpayAccount); // 0 代表 绑定 if (IsBesttoneAccountBindV5Result == 0) { AccountItem ai = new AccountItem(); BesttoneAccount = phoneNum; BesttoneAccount = ai.AccountName; if (!String.IsNullOrEmpty(BindedBestpayAccount)) { qryPhone = BindedBestpayAccount; } else { qryPhone = phoneNum; } String ResponseCode = ""; int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(qryPhone, out ai, out ResponseCode, out ErrMsg); Linkage.BestTone.Interface.Rule.CustInfo custInfo = new Linkage.BestTone.Interface.Rule.CustInfo(); int resultQuerycustInfo = BesttoneAccountHelper.QueryCustInfo(qryPhone, out custInfo, out ErrMsg); if (resultQuerycustInfo == 0) { BesttoneAccount = custInfo.CustomerName; } if (QueryBesttoneAccountResult == 0) { if (ai != null) { //页面赋值 if ("0".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "未激活"; BesttoneAccountStatus = "未激活"; } else if ("1".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "正常"; BesttoneAccountStatus = "正常"; } else if ("2".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "挂失"; BesttoneAccountStatus = "挂失"; } else if ("3".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "冻结"; BesttoneAccountStatus = "冻结"; } else if ("4".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "锁定"; BesttoneAccountStatus = "锁定"; } else if ("9".Equals(ai.AccountStatus)) { //this.AccountStatus.InnerText = "已销户"; BesttoneAccountStatus = "已销户"; } else { //this.AccountStatus.InnerText = ""; BesttoneAccountStatus = ""; } BesttoneAccountBalance = BesttoneAccountHelper.ConvertAmountToYuan(ai.AccountBalance); } else { } } else { if ("200010".Equals(ResponseCode)) { BesttoneAccountStatus = "账户未开通"; BesttoneAccountBalance = "0.00"; } } } Int64 balance = 0; // 最近交易查询 String txnType = ""; // 121020充值 //131010消费 //131030退费 String txnChannel = "02"; //WEB int maxReturnRecord = 30; int startRecord = 1; //int QueryAllTypeTxnResult = BesttoneAccountHelper.QueryAllTypeTxn(phoneNum, txnType, txnChannel, out txnItemList, out ErrMsg); int QueryChargeResult = CIP2BizRules.QueryBestPayAllTxn(qryPhone, txnType, txnChannel, maxReturnRecord, startRecord, out txnItemList, out ErrMsg); //txnType = "131090"; //} // custphone query end //else // custphone query end //{ // strLog.AppendFormat("ErrMsg:{0}", ErrMsg); //} // custphone query end } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { System.Threading.Thread.Sleep(200); //客户ID,账户号,订单号 String CustID, BestPayAccount, OrderSeq; //充值金额,账户余额 long RechargeBalance, Balance; try { #region 获取支付平台post过来的一些变量 //获取支付平台post过来的一些变量 String uptranSeq = Request.Form["UPTRANSEQ"]; //支付平台交易流水号 String tranDate = Request.Form["TRANDATE"]; //支付平台交易日期 String retnCode = Request.Form["RETNCODE"]; //处理结果码 String retnInfo = Request.Form["RETNINFO"]; //处理结果解释码 String orderReqtranSeq = Request.Form["ORDERREQTRANSEQ"]; //订单请求交易流水号 String orderSeq = Request.Form["ORDERSEQ"]; //订单号 String orderAmount = Request.Form["ORDERAMOUNT"]; //订单总金额 String productAmount = Request.Form["PRODUCTAMOUNT"]; //产品金额 String attachAmount = Request.Form["ATTACHAMOUNT"]; //附加金额 String curType = Request.Form["CURTYPE"]; //币种 String encodeType = Request.Form["ENCODETYPE"]; //加密方式 String attach = Request.Form["ATTACH"]; //SP附加信息 String sign = Request.Form["SIGN"]; //数字签名 //验证签名 #endregion #region 查看订单状态 //根据订单号查询该订单是否已经支付 RechargeOrder _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq); if (_recharge_order == null) { return; } CustID = _recharge_order.CustID; BestPayAccount = _recharge_order.TargetAccount; OrderSeq = _recharge_order.OrderSeq; RechargeBalance = _recharge_order.OrderAmount; //如果不是待付款状态则跳转错误页面 if (_recharge_order.Status != 3) { this.lblMsg.Text = "提示:您的充值申请已提交,系统正在处理中……请耐心等待!"; } else { //查询账户余额 Result = BesttoneAccountHelper.QueryAccountBalance(BestPayAccount, out Balance, out ErrMsg); this.lblMsg.Text = "您已成功充值<font color=red> " + BesttoneAccountHelper.ConvertAmountToYuan(_recharge_order.OrderAmount) + " </font>元,账户余额 <font color=red>" + BesttoneAccountHelper.ConvertAmountToYuan(Balance) + "</font> 元"; } #endregion } catch { } } }
protected void Modify_Click(object sender, EventArgs e) { /////////////////////////////////////////// StringBuilder strLog = new StringBuilder(); try { String oldPassWord = Request.Form["oldPassWord"]; String newPassWord = Request.Form["newPassWord"]; String confirmPassWord = Request.Form["confirmPassWord"]; string BindedBestpayAccount = ""; string CreateTime = ""; IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg); if (IsBesttoneAccountBindV5Result == 0) { if (!String.IsNullOrEmpty(BindedBestpayAccount)) { BesttoneAccount = BindedBestpayAccount; } } strLog.AppendFormat("【开始修改密码,事件:{0}】", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); strLog.AppendFormat("参数:oldPassWord:{0},newPassWord:{1},confirmPassWord:{2},BesttonePayAccount:{3}", oldPassWord, newPassWord, confirmPassWord, BesttoneAccount); BestPayEncryptService bpes = new BestPayEncryptService(); string e_oldPassWord = ""; string e_newPassWord = ""; string e_confirmPassWord = ""; AccountItem ai = new AccountItem(); String ResCode = ""; int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BesttoneAccount, out ai, out ResCode, out ErrMsg); if (QueryBesttoneAccountResult == 0) { if (ai != null) { e_oldPassWord = bpes.encryptNoKey(oldPassWord, ai.AccountNo); e_newPassWord = bpes.encryptNoKey(newPassWord, ai.AccountNo); e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo); strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord); int ModifyBestPayPasswordResult = BesttoneAccountHelper.ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg); if (ModifyBestPayPasswordResult == 0) { success = "0"; } else { strLog.Append(",失败3"); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { strLog.Append(",失败2"); Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取"); } } else { strLog.Append(",失败1"); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 获取近三个月交易明细 /// </summary> protected String GetThreeMonthsHistoryDetails(String SPID, String CustID, String wt) { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; StringBuilder returnMsg = new StringBuilder(); DateTime startDate = new DateTime(DateTime.Now.AddMonths(-2).Year, DateTime.Now.AddMonths(-2).Month, 1); DateTime endDate = DateTime.Now; wt = "json"; //仅支持json if (String.IsNullOrEmpty(SPID)) { returnMsg.Length = 0; if ("json".Equals(wt)) { returnMsg.Append("{"); returnMsg.AppendFormat("\"errcode\":\"{0}\",", "995"); returnMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!"); returnMsg.Append("}"); } else { returnMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); returnMsg.Append("<PayPlatRequestParameter>"); returnMsg.Append("<PARAMETERS>"); returnMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995"); returnMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!"); returnMsg.Append("</PARAMETERS>"); returnMsg.Append("</PayPlatRequestParameter>"); } return(returnMsg.ToString()); } if (String.IsNullOrEmpty(CustID)) { returnMsg.Length = 0; if ("json".Equals(wt)) { returnMsg.Append("{"); returnMsg.AppendFormat("\"errcode\":\"{0}\",", "996"); returnMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!"); returnMsg.Append("}"); } else { returnMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); returnMsg.Append("<PayPlatRequestParameter>"); returnMsg.Append("<PARAMETERS>"); returnMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996"); returnMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!"); returnMsg.Append("</PARAMETERS>"); returnMsg.Append("</PayPlatRequestParameter>"); } return(returnMsg.ToString()); } String bestPayAccount = String.Empty; try { BesttoneAccount _besttoneAccount_entity = _besttoneAccount_dao.QueryByCustID(CustID); if (_besttoneAccount_entity == null) { returnMsg.Length = 0; if ("json".Equals(wt)) { returnMsg.Append("{"); returnMsg.AppendFormat("\"errcode\":\"{0}\",", "997"); returnMsg.AppendFormat("\"errmsg\":\"{0}\"", "号码百事通账户未开通!"); returnMsg.Append("}"); } else { returnMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); returnMsg.Append("<PayPlatRequestParameter>"); returnMsg.Append("<PARAMETERS>"); returnMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997"); returnMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "号码百事通账户未开通!"); returnMsg.Append("</PARAMETERS>"); returnMsg.Append("</PayPlatRequestParameter>"); } return(returnMsg.ToString()); } else { bestPayAccount = _besttoneAccount_entity.BestPayAccount; } List <TxnItem> list = new List <TxnItem>(); IList <TxnItem> list1, list2; Result = BesttoneAccountHelper.QueryAllTxnCurrentDay(bestPayAccount, out list1, out ErrMsg); Result = BesttoneAccountHelper.QueryAllTxnHistory(startDate, endDate, bestPayAccount, 10000, 1, out list2, out ErrMsg); if (list1 != null && list1.Count > 0) { foreach (TxnItem item in list1) { list.Add(item); } } if (list2 != null && list2.Count > 0) { foreach (TxnItem item in list2) { list.Add(item); } } //测试数据 //list = CreateTestList(); if (list != null && list.Count > 0) { list.Sort(); returnMsg.Length = 0; foreach (TxnItem item in list) { //如果是交易类型是“退货退还手续费”记录,则过滤掉不显示 if (item.TxnType == "261020") { continue; } String sign = "+"; String txnType = BesttoneAccountHelper.ConvertTxnType(item.TxnType); String flag = item.CancelFlag == "1" ? "已撤销" : "成功"; if (item.TxnType == "131090") { sign = "-"; } AccountRechargeRecord _recharge_redcord = _accountRechargeRecord_dao.QueryByTransactionID(item.AcceptSeqNO); returnMsg.Append("{"); returnMsg.AppendFormat("\"AcceptSeqNO\":\"{0}\",", item.AcceptSeqNO); returnMsg.AppendFormat("\"AcceptDate\":\"{0}\",", item.AcceptDate); returnMsg.AppendFormat("\"AcceptTime\":\"{0}\",", item.AcceptTime); returnMsg.AppendFormat("\"TxnAmount\":\"{0}\",", sign + BesttoneAccountHelper.ConvertAmountToYuan(item.TxnAmount)); returnMsg.AppendFormat("\"TxnType\":\"{0}\",", txnType); returnMsg.AppendFormat("\"TxnChannel\":\"{0}\",", item.TxnChannel); returnMsg.AppendFormat("\"MerchantName\":\"{0}\",", item.MerchantName); returnMsg.AppendFormat("\"TxnDscpt\":\"{0}\",", item.TxnDscpt); returnMsg.AppendFormat("\"CancelFlag\":\"{0}\",", flag); if (_recharge_redcord != null) { returnMsg.AppendFormat("\"OrderSeq\":\"{0}\",", _recharge_redcord.OrderSeq); } returnMsg.AppendFormat("\"TxnTime\":\"{0}\"", item.TxnTime); returnMsg.Append("},"); } returnMsg.Insert(0, "{\"errcode\":\"0\",\"errmsg\":\"\",\"txninfo\":["); returnMsg = returnMsg.Remove(returnMsg.Length - 1, 1); returnMsg.Append("]}"); } else { returnMsg.Append("{\"errcode\":\"-2012\",\"errmsg\":\"NoData\"}"); } } catch (Exception ex) { returnMsg.Append("{\"errcode\":\"-2013\",\"errmsg\":\"异常:" + ex.Message + "\"}"); } return(returnMsg.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { String custid = Request["hiddenCustID"]; String spid = Request["hiddenSPID"]; String InvoiceType = Request["InvoiceType"]; String InvoiceTitle = Request["InvoiceTitle"]; String InvoiceContent = Request["InvoiceContent"]; String ContactPerson = Request["ContactPerson"]; String ContactPhone = Request["ContactPhone"]; String Address = Request["Address"]; String Zip = Request["Zip"]; String Mem = Request["Mem"]; String NeedInvoice = Request["NeedInvoice"]; long balance = Convert.ToInt64(Convert.ToDouble(Request["TranAmount"]) * 100); DateTime reqTime = DateTime.Now; //查询账户信息 BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO(); BesttoneAccount account_entity = _besttoneAccount_dao.QueryByCustID(custid); if (account_entity == null) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "账户信息异常", this.Context); return; } #region 账户充值金额上限校验 long OnceRechargeLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne; //单笔充值金额上限 long RechargeAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay; //账户单日充值额度上限 long CurrentAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited; //账户余额上限 if (OnceRechargeLimit > 0) { //检测用户单笔充值金额是否超限(10000元) if (balance > OnceRechargeLimit) { result = 100003; ErrMsg = String.Format("单笔充值金额最多不能超过{0}元", BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit)); CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context); return; } } if (RechargeAmountLimit > 0) { //检测用户当日充值是否超限(当日充值金额不能超过50000元) long hadRechargeAmount = _rechargeOrder_dao.QueryCurrentRechargeAmount(account_entity.BestPayAccount); if ((hadRechargeAmount + balance) > RechargeAmountLimit) { result = 100001; ErrMsg = String.Format("您今日累计充值金额:{0}元,本次充值将超过您的当日累计充值限额:{1}元,请改日再进行充值操作!", BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount), BesttoneAccountHelper.ConvertAmountToYuan(RechargeAmountLimit)); CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context); return; } } if (CurrentAmountLimit > 0) { long accountBalance = 0; //检测用户帐户余额(个人账户余额不能超过100000元) result = BesttoneAccountHelper.QueryAccountBalance(account_entity.BestPayAccount, out accountBalance, out ErrMsg); if (result != 0) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "账户信息异常", this.Context); return; } if ((accountBalance + balance) > CurrentAmountLimit) { result = 100002; ErrMsg = String.Format("您的账户余额为:{0}元,本次充值将超过您的账户余额上限:{1}元,请消费后再进行充值操作!", BesttoneAccountHelper.ConvertAmountToYuan(accountBalance), BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit)); CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context); return; } } #endregion bool Result = false; #region 生成订单信息 /***************************************************************************/ String orderSeq = BesttoneAccountHelper.CreateOrderSeq(); //订单号 String transactionID = BesttoneAccountHelper.CreateTransactionID(); //流水号 // 在发起网银扣款请求,主表状态为1,扣款子表状态为0 //初始化充值订单 //2013-04-13 add -start if (String.IsNullOrEmpty(NeedInvoice)) { NeedInvoice = "0"; } //2013-04-13 add -end RechargeOrder _recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", balance, balance, 0, "网银充值", custid, account_entity.BestPayAccount, "0", spid, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", "", NeedInvoice); //2013-04-13 add NeedInvoice 字段 //初始化网银扣款流水记录 BankRechargeRecord _bankRecharge_record = new BankRechargeRecord(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", balance, balance, 0, "网银充值", account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", ""); Result = _rechargeOrder_dao.Insert(_recharge_order); if (!Result) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败1", this.Context); return; } //如果需要开发票 -- 插入发票表 2013-04-14 add-start if ("1".Equals(NeedInvoice)) { System.Text.StringBuilder datalog = new System.Text.StringBuilder(); //Result = _rechargeOrder_dao.InsertInvoice(orderSeq, InvoiceType, "", InvoiceTitle, ContactPerson, ContactPhone, Address, Zip, Mem, out datalog); if ("0".Equals("InvoiceType")) { InvoiceTitle = "个人"; } if (String.IsNullOrEmpty(InvoiceTitle)) { InvoiceTitle = "个人"; } if (String.IsNullOrEmpty(InvoiceContent)) { InvoiceContent = "日用品"; } Result = _rechargeOrder_dao.InsertInvoice(orderSeq, InvoiceType, InvoiceContent, InvoiceTitle, ContactPerson, ContactPhone, Address, Zip, Mem, "9", out datalog); // "9" 代表需要开票 if (!Result) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败-发票生成失败", this.Context); return; } } //2013-04-14 add-end Result = _bankRechargeRecord_dao.Insert(_bankRecharge_record); if (!Result) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败2", this.Context); return; } /***************************************************************************/ #endregion this._ORDERSEQ = orderSeq; this._ORDERREQTRANSEQ = transactionID; this._ORDERDATE = reqTime.ToString("yyyyMMddHHmmss"); this._ORDERAMOUNT = balance.ToString(); this._PRODUCTAMOUNT = balance.ToString(); //MAC签名 String mac = String.Format("MERCHANTID={0}&ORDERSEQ={1}&ORDERDATE={2}&ORDERAMOUNT={3}", this.MERCHANTID, this._ORDERSEQ, this._ORDERDATE, this._ORDERAMOUNT); mac = BesttoneAccountHelper.MACSign(mac); this._MAC = mac; } catch (Exception ex) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败", this.Context); return; } } }
protected void register_Click(object sender, EventArgs e) { StringBuilder strLog = new StringBuilder(); try { logger.Info("RegisterAllInOne-注册来源:" + HttpContext.Current.Request.RawUrl); Response.AddHeader("P3P", "CP=CAO PSA OUR"); strLog.AppendFormat("----------------------注册事件开始:------------------\r\n"); strLog.AppendFormat("SPID:{0}\r\n", SPID); strLog.AppendFormat("ReturnUrl:{0}\r\n", ReturnUrl); PassWord = Request.Form["password"].ToString().Trim(); strLog.AppendFormat("PassWord:{0}\r\n", PassWord); Mobile = Request.Form["mobile"].ToString().Trim(); strLog.AppendFormat("mobile:{0}\r\n", Mobile); CheckPhoneCode = Request.Form["checkCode"].ToString().Trim(); strLog.AppendFormat("checkCode:{0}\r\n", CheckPhoneCode); Email = Request.Form["email"].ToString().Trim(); UserName = Request.Form["userName"].ToString().Trim(); strLog.AppendFormat("ViewState[phonestate]:{0}\r\n", ViewState["phonestate"]); strLog.AppendFormat("Request.Form[phonestate]:{0}\r\n", Request.Form["phonestate"]); if (ViewState["phonestate"] == null) { ViewState["phonestate"] = Request.Form["phonestate"].ToString(); string a = (string)ViewState["phonestate"]; } if (((string)ViewState["phonestate"]).Equals("0")) { strLog.AppendFormat("phonestate==0\r\n"); //判断手机验证码 string needCheckCode = "0"; //ConfigurationManager.AppSettings["needCheckCode"]; strLog.AppendFormat("判断手机验证码\r\n"); //strLog.AppendFormat("needCheckCode:{0}\r\n}", needCheckCode); if ("0".Equals(needCheckCode)) { //strLog.AppendFormat("needCheckCode==0"); Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg); if (Result != 0) { strLog.AppendFormat("手机验证码验证错误\r\n"); hintCode.InnerHtml = "手机验证码错误,请重新输入"; // 这里如何控制样式 return; } strLog.AppendFormat("手机验证码验证无误\r\n"); } //strLog.AppendFormat("does not needCheckCode:{0}\r\n}", needCheckCode); } //strLog.AppendFormat("phonestate!=0 \r\n"); strLog.AppendFormat("-----------------quickUserRegistryWeb begin------------------\r\n"); Result = UserRegistry.quickUserRegistryWebV3(SPID, PassWord, Mobile, (string)ViewState["phonestate"], UserName, Email, out CustID, out ErrMsg); if (Result != 0) { strLog.AppendFormat("注册失败!\r\n"); CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context); return; } strLog.AppendFormat("注册成功!\r\n"); //短信通知 // string VoicePwdSPID = System.Configuration.ConfigurationManager.AppSettings["VoicePwd_SPID"]; // int SIP1 = VoicePwdSPID.IndexOf(SPID); String SMS_Message = String.Empty; // if (SIP1 >= 0) // { SMS_Message = "恭喜您成为号码百事通会员!请妥善保管您的密码;如需帮助请联系:4008-118114。"; //通知短信网关 //CommonBizRules.SendMessageV3(Mobile, SMS_Message, SPID); //2013-11-19 注释掉 // } strLog.AppendFormat("检查邮箱是否需要发送\r\n"); if (!String.IsNullOrEmpty(Email)) { SendEmail(CustID, Email); } strLog.AppendFormat("写Cookie\r\n"); String TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:ta:ss"); SPInfoManager spInfo = new SPInfoManager(); Object SPData = spInfo.GetSPData(this.Context, "SPData"); String key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData); String Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key); String temp = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key); String RegistryResponseValue = HttpUtility.UrlEncode(temp); //给用户写cookie UserToken UT = new UserToken(); String RealName = Mobile; String NickName = Mobile; string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg); string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"]; PageUtility.SetCookie(UserTokenValue, CookieName, this.Page); //通知积分平台 //strLog.AppendFormat("通知积分平台,CustID:{0}\r\n", CustID); CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg); strLog.AppendFormat("写入数据库日志\r\n"); //记登录日志 CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg); strLog.AppendFormat("-----------------quickUserRegistryWeb end------------------\r\n"); strLog.AppendFormat("是否开户\r\n"); strLog.AppendFormat("--------------------openBestToneAccount begin------------------------\r\n"); String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim(); //strLog.AppendFormat("hid_openAccount:{0}\r\n", hid_openAccount); if ("1".Equals(hid_openAccount)) { strLog.AppendFormat("hid_openAccount==1 需要开户\r\n"); // 开户要做的事情 需要前面注册获得的custID string BindedBestpayAccount = ""; string CreateTime = ""; strLog.AppendFormat("先查看该CustID:{0}头上是否有账户\r\n", CustID); int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg); //strLog.AppendFormat("查看结果:IsBesttoneAccountBindV5Result:{0},BindedBestpayAccount:{1},CreateTime:{2},ErrMsg:{3}\r\n", IsBesttoneAccountBindV5Result, BindedBestpayAccount, CreateTime, ErrMsg); if (IsBesttoneAccountBindV5Result == 0) { //strLog.AppendFormat("IsBesttoneAccountBindV5Result==0,该CustID:{0}头上有账户BindedBestpayAccount:{1}\r\n", CustID, BindedBestpayAccount); Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!"); } strLog.AppendFormat("该CustID:{0}头上无绑定账户\r\n", CustID); String TransactionID = BesttoneAccountHelper.CreateTransactionID(); AccountItem ai = new AccountItem(); string ResponseCode = ""; BestToneAccount = Request.Form["mobile"].ToString().Trim(); //strLog.AppendFormat("开户账号:{0}\r\n", BestToneAccount); realName = Request.Form["realName"].ToString().Trim(); //strLog.AppendFormat("realName:{0}\r\n", realName); certnum = Request.Form["certnum"].ToString().Trim(); //strLog.AppendFormat("certnum:{0}\r\n", certnum); strLog.AppendFormat("去翼支付查看该账号是否已经存在\r\n"); int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg); //strLog.AppendFormat("查看结果 QueryBesttoneAccountResult:{0},ResponseCode:{1},ErrMsg:{2}\r\n", QueryBesttoneAccountResult, ResponseCode, ErrMsg); if (QueryBesttoneAccountResult == 0) { if ("200010".Equals(ResponseCode)) // 未开户 { strLog.AppendFormat("200010-未开户\r\n"); strLog.AppendFormat("准备开户\r\n"); //strLog.AppendFormat("开户前日志参数:SPID:{0},TransactionID:{1},CustID:{2},BestToneAccount:{3}\r\n", SPID, TransactionID, BestToneAccount); UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); //strLog.AppendFormat("日志结果 ErrMsg:{0} \r\n", ErrMsg); strLog.AppendFormat("开户...\r\n"); Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg); //strLog.AppendFormat("开户结果:Result:{0},ErrMsg:{1},TransactionID:{2}\r\n", Result, ErrMsg, TransactionID); if (Result == 0) { //strLog.AppendFormat("开户成功\r\n,准备去将账户{0}绑定到{1}上\r\n", BestToneAccount, CustID); int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg); //strLog.AppendFormat("绑定结果:BindResult:{0},ErrMsg:{1}上\r\n", BindResult, ErrMsg); if (BindResult == 0) { strLog.AppendFormat("开户后日志\r\n"); UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg); //strLog.AppendFormat("开户后日志结果:ErrMsg:{0}\r\n", ErrMsg); Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true); } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { // 账户已存在 strLog.AppendFormat("账户已经存在\r\n"); strLog.AppendFormat("仅仅做绑定\r\n"); UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg); //strLog.AppendFormat("绑定结果:ErrMsg:{0}\r\n", ErrMsg); if (BindResult == 0) { UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg); Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true); } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } //不需要开户 //这里应该先到一个结果页面,并将ReturnUrl传给结果页面,结果页面倒计时3秒后自动跳转到ReturnUrl,根据注册和开户跳转到不同的结果页面 if (ReturnUrl.IndexOf("?") > 0) { Response.Redirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, false); } else { Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, false); } } catch (Exception ex) { strLog.AppendFormat(ex.ToString()); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 卡充值 /// </summary> protected String AccountRechargeByCard(out StringBuilder strLog) { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; strLog = new StringBuilder(); strLog.AppendFormat("【消费卡充值,DateTime:{0}】\r\n[参数]:", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //获取参数 String spid = Request["SPID"]; String custid = Request["CustID"]; String cardNo = Request["CardNo"]; String cardPwd = Request["CardPassword"]; String cardType = Request["CardType"]; strLog.AppendFormat("SPID:{0},CustID:{1},CardNo:{2},CardPwd:{3},CardType:{4}\r\n", spid, custid, cardNo, cardPwd, cardType); //String CheckCardErrMsg = ""; //Int32 CheckCardResult = BesttoneAccountHelper.VerifyCardNo(cardNo, out CheckCardErrMsg); //if(CheckCardResult!=0) // return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + CheckCardResult + "\",\"info\":\"" + CheckCardErrMsg + "}]"; long accountBalance = 0; //账户余额 long cardBalance = 0; //卡余额 String accountType = BesttoneAccountHelper.ConvertAccountType(cardType); //转换卡类型 /*********************************************查询账户信息*****************************************************/ BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO(); BesttoneAccount account_entity = _besttoneAccount_dao.QueryByCustID(custid); #region 卡余额查询 //查询卡余额 Result = BesttoneAccountHelper.QueryCardBalance(cardNo, accountType, out cardBalance, out ErrMsg); strLog.AppendFormat("[查询卡余额]:Result:{0},Balance:{1}\r\n", Result, cardBalance); //查询失败 if (Result != 0) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"查询余额失败\"}]"); } //卡余额为0 if (cardBalance == 0) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"200020\",\"info\":\"卡内余额为0\"}]"); } #endregion #region 账户充值金额上限校验 long OnceRechargeLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne; //单笔充值金额上限 long RechargeAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay; //账户单日充值额度上限 long CurrentAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited; //账户余额上限 if (OnceRechargeLimit > 0) { //检测用户单笔充值金额是否超限(10000元) if (cardBalance > OnceRechargeLimit) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100003\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit) + "\",\"info\":\"卡内余额为0\"}]"); } } if (RechargeAmountLimit > 0) { //检测用户当日充值是否超限(当日充值金额不能超过50000元) long hadRechargeAmount = _rechargeOrder_dao.QueryCurrentRechargeAmount(account_entity.BestPayAccount); if ((hadRechargeAmount + cardBalance) > RechargeAmountLimit) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100001\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(RechargeAmountLimit) + "\",\"info\":\"卡内余额为0\"}]"); } } if (CurrentAmountLimit > 0) { //检测用户帐户余额(个人账户余额不能超过100000元) Result = BesttoneAccountHelper.QueryAccountBalance(account_entity.BestPayAccount, out accountBalance, out ErrMsg); if (Result != 0) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"账户信息查询失败\"}]"); } if ((accountBalance + cardBalance) > CurrentAmountLimit) { return("[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100002\",\"accountbalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\",\"CurrentAmountLimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit) + "\",\"info\":\"卡内余额为0\"}]"); } accountBalance = 0; } #endregion #region 卡扣款 String transactionID = BesttoneAccountHelper.CreateTransactionID(); String orderSeq = BesttoneAccountHelper.CreateOrderSeq(); DateTime reqTime = DateTime.Now; RechargeOrder _recharge_order; //充值订单 CardRechargeRecord cardrecharge_entity; //卡扣款流水记录 //初始化充值订单 _recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, cardBalance, 0, "消费卡向账户充值扣款", custid, account_entity.BestPayAccount, cardType, spid, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", "", "0"); //2013-04-13 add 最后一个字段 0 代表是否需要开票 //初始化充值订单—测试 //_recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", 1, 1, 0, "消费卡向账户充值扣款", // custid, account_entity.BestPayAccount, cardType, spid, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", ""); //初始化卡扣款流水 cardrecharge_entity = new CardRechargeRecord(transactionID, orderSeq, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, "消费卡向账户充值扣款", cardNo, cardPwd, cardType, account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", ""); //初始化卡扣款流水—测试 //cardrecharge_entity = new CardRechargeRecord(transactionID, orderSeq, reqTime.ToString("yyyyMMdd"), "RMB", 1, "消费卡向账户充值扣款", cardNo, cardPwd, cardType, // account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", ""); strLog.AppendFormat("[订单信息]:TransactionID:{0},OrderSeq:{1},ReqTime:{2}\r\n", transactionID, orderSeq, reqTime.ToString("yyyy-MM-dd HH:mm:ss")); /***********************************************************开始扣款*******************************************************/ String uptranSeq = String.Empty; //交易流水号,支付平台返回的,后期对账用 Result = BesttoneAccountHelper.CardDeductionBalance(transactionID, orderSeq, cardNo, cardPwd, cardType, cardBalance, reqTime, "", out uptranSeq, out ErrMsg); //扣款—测试 //Result = BesttoneAccountHelper.CardDeductionBalance(transactionID, orderSeq, cardNo, cardPwd, cardType, 1, reqTime, "", out uptranSeq, out ErrMsg); strLog.AppendFormat("[卡扣款]:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg); _recharge_order.UptranSeq = uptranSeq; cardrecharge_entity.UptranSeq = uptranSeq; if (Result != 0) { //修改订单信息 _recharge_order.Status = 4; // 这里要对调网关发生异常做分别处理 ,定位6 if (Result == -3024) { _recharge_order.Status = 6; } _recharge_order.PayTime = DateTime.Now; _recharge_order.ReturnCode = Result.ToString(); _recharge_order.ReturnDesc = ErrMsg; _rechargeOrder_dao.Insert(_recharge_order); //修改卡扣款记录信息 //cardrecharge_entity.Status = 2; //为统一rechargeorder 和 cardrechargerecord 的状态值,这里做修改 2013-05-15 cardrecharge_entity.Status = 4; if (Result == -3024) { cardrecharge_entity.Status = 6; } //以上和rechargeorder 的状态处理方式统一 cardrecharge_entity.PayTime = DateTime.Now; cardrecharge_entity.ReturnCode = Result.ToString(); cardrecharge_entity.ReturnDesc = ErrMsg; _cardRechargeRecord_dao.Insert(cardrecharge_entity); return("[{\"result\":\"false\",\"step\":\"deduction\",\"errorcode\":\"" + Result + "\",\"info\":\"卡扣款失败\"}]"); } else { //修改订单信息 _recharge_order.Status = 2; _recharge_order.PayTime = DateTime.Now; _recharge_order.ReturnCode = "0000"; _recharge_order.ReturnDesc = "已扣款待充值"; // 原:扣款成功 _rechargeOrder_dao.Insert(_recharge_order); //修改卡充值记录信息 //cardrecharge_entity.Status = 1; // 这里为和 rechargeorder 状态统一 ,修改为2 cardrecharge_entity.Status = 2; cardrecharge_entity.PayTime = DateTime.Now; cardrecharge_entity.ReturnCode = "0000"; cardrecharge_entity.ReturnDesc = "已扣款待充值"; // 原:扣款成功 _cardRechargeRecord_dao.Insert(cardrecharge_entity); } #endregion #region 充值 transactionID = BesttoneAccountHelper.CreateTransactionID(); //充值流水记录 DateTime rechargeTime = DateTime.Now; //充值请求时间 String returnMsg = String.Empty; bool resultBoolean = false; //初始化充值流水类 AccountRechargeRecord rechargeRecord_entity = new AccountRechargeRecord(transactionID, rechargeTime.ToString("yyyyMMdd"), orderSeq, cardBalance, cardType, "消费卡充值", rechargeTime, new DateTime(1900, 1, 1), 0, "", ""); try { #region 开始充值 //调用接口给账户充值 Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, cardBalance, rechargeTime, out accountBalance, out ErrMsg); //调用接口给账户充值—测试 //Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, 1, rechargeTime, out accountBalance, out ErrMsg); strLog.AppendFormat("[账户充值]:TransactionID:{0},Result:{1},ErrMsg:{2}\r\n", transactionID, Result, ErrMsg); if (Result == 0) { //修改订单信息 _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq); _recharge_order.Status = 3; _recharge_order.RechargeCount = 1; _recharge_order.CompleteTime = DateTime.Now; _recharge_order.ReturnCode = "0000"; _recharge_order.ReturnDesc = "已充值"; // 原:充值成功 _recharge_order.RechargeTransactionID = transactionID; // 回填充值流水号 resultBoolean = _rechargeOrder_dao.Update(_recharge_order); //修改充值流水记录信息 rechargeRecord_entity.Status = 3; // 原: 1 ,为和总表rechargeorder 统一改为3 rechargeRecord_entity.CompleteTime = DateTime.Now; rechargeRecord_entity.ReturnCode = "0000"; rechargeRecord_entity.ReturnDesc = "已充值"; // 原:充值成功 strLog.AppendFormat("[更新订单状态]ResultBoolean:{0}\r\n", resultBoolean); returnMsg = "[{\"result\":\"true\",\"info\":\"账户充值成功\",\"deductionBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"accountBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\"}]"; } else { //修改订单信息 _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq); _recharge_order.RechargeCount = 1; _recharge_order.Status = 5; // 原:没有这句 if (Result == -3025) { _recharge_order.Status = 7; //原:没有这句 } _recharge_order.ReturnCode = Result.ToString(); _recharge_order.ReturnDesc = ErrMsg; _recharge_order.RechargeTransactionID = transactionID; // 回填充值流水号 resultBoolean = _rechargeOrder_dao.Update(_recharge_order); //修改充值流水记录信息 rechargeRecord_entity.Status = 5; // 5 代表充值失败 原:2 if (Result == -3025) { rechargeRecord_entity.Status = 7;// 充值异常 } rechargeRecord_entity.CompleteTime = DateTime.Now; rechargeRecord_entity.ReturnCode = Result.ToString(); rechargeRecord_entity.ReturnDesc = ErrMsg; returnMsg = "[{\"result\":\"false\",\"step\":\"recharge\",\"errorcode\":\"" + Result + "\",\"info\":\"账户充值失败\"}]"; } #endregion } catch (Exception ex) { rechargeRecord_entity.ReturnDesc += ex.Message; throw ex; } finally { _accountRechargeRecord_dao.Insert(rechargeRecord_entity); } #endregion return(returnMsg); }
protected void register_Click(object sender, EventArgs e) { StringBuilder strLog = new StringBuilder(); try { ParseSPTokenRequest(); //CreateSPTokenRequest(); Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; realName = Request["realName"]; //contactMail = Request["contactMail"]; sex = Request["sex"]; certnum = Request["certnum"]; checkCode = Request["checkCode"]; CustID = this.myCustID.Value; strLog.AppendFormat("开户页面手机验证码:{0}", checkCode); //判断手机验证码 if (checkCode != null && !"".Equals(checkCode)) { Result = PhoneBO.SelSendSMSMassage("", this.mobile.Text, checkCode, out ErrMsg); if (Result != 0) { hintCode.InnerHtml = "手机验证码错误,请重新输入"; // 这里如何控制样式 return; } } string BindedBestpayAccount = ""; string CreateTime = ""; int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(this.myCustID.Value, out BindedBestpayAccount, out CreateTime, out ErrMsg); if (IsBesttoneAccountBindV5Result == 0) { Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!"); } TransactionID = BesttoneAccountHelper.CreateTransactionID(); AccountItem ai = new AccountItem(); string ResponseCode = ""; int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(this.mobile.Text, out ai, out ResponseCode, out ErrMsg); strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text); if (QueryBesttoneAccountResult == 0) { if ("200010".Equals(ResponseCode)) // 200010 -> 客户不存在 { //todo 发起开户请求日志 UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg); strLog.AppendFormat("BeforeCreateBesttoneAccount:ErrMsg:{0}", ErrMsg); //String realName,String contactTel,String sex,String certtype,String certnum, Result = BesttoneAccountHelper.RegisterBesttoneAccount(this.mobile.Text, realName, this.mobile.Text, "", sex, "1", certnum, TransactionID, out ErrMsg); if (Result == 0) { strLog.AppendFormat("开户结果:{0},{1},{2}", Result, ErrMsg, this.myCustID.Value); // todo 建立绑定关系,插入绑定关系表 int ret = 0; ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg); strLog.AppendFormat("CreateBesttoneAccount:ErrMsg:{0}", ErrMsg); if (ret == 0) { //todo 开户完成 建立绑定关系 日志 UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg); strLog.AppendFormat("AfterCreateBesttoneAccount:ErrMsg:{0}", ErrMsg); strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl); int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg); strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg); strLog.AppendFormat("SPTokenRequest={0}", SPTokenRequest); strLog.AppendFormat("Redirect to Url:{0}", "OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0"); Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0"); } else { strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { strLog.AppendFormat("开户结果:{0},{1}", Result, ErrMsg); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else // 账户已存在 { // todo 建立绑定关系,插入绑定关系表 UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg); strLog.AppendFormat("OnlyBindingBesttoneAccount:ErrMsg:{0}", ErrMsg); int ret = 0; ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg); if (ret == 0) { int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg); strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg); strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl); strLog.AppendFormat(String.Format("SPTokenRequest={0}", SPTokenRequest)); Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0"); //Response.Redirect(this.myReturnUrl.Value); } else { strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } } else { strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text); Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 获取近三个月交易明细 /// </summary> protected String GetThreeMonthsHistoryDetails() { Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code; String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg; StringBuilder returnMsg = new StringBuilder(); DateTime startDate = new DateTime(DateTime.Now.AddMonths(-2).Year, DateTime.Now.AddMonths(-2).Month, 1); DateTime endDate = DateTime.Now; try { String bestPayAccount = Request["BestPayAccount"]; List <TxnItem> list = new List <TxnItem>(); IList <TxnItem> list1, list2; Result = BesttoneAccountHelper.QueryAllTxnCurrentDay(bestPayAccount, out list1, out ErrMsg); Result = BesttoneAccountHelper.QueryAllTxnHistory(startDate, endDate, bestPayAccount, 10000, 1, out list2, out ErrMsg); if (list1 != null && list1.Count > 0) { foreach (TxnItem item in list1) { list.Add(item); } } if (list2 != null && list2.Count > 0) { foreach (TxnItem item in list2) { list.Add(item); } } //测试数据 //list = CreateTestList(); if (list != null && list.Count > 0) { list.Sort(); foreach (TxnItem item in list) { //如果是交易类型是“退货退还手续费”记录,则过滤掉不显示 if (item.TxnType == "261020") { continue; } String sign = "+"; String txnType = BesttoneAccountHelper.ConvertTxnType(item.TxnType); String flag = item.CancelFlag == "1" ? "已撤销" : "成功"; if (item.TxnType == "131090") { sign = "-"; } AccountRechargeRecord _recharge_redcord = _accountRechargeRecord_dao.QueryByTransactionID(item.AcceptSeqNO); returnMsg.Append("{"); returnMsg.AppendFormat("\"AcceptSeqNO\":\"{0}\",", item.AcceptSeqNO); returnMsg.AppendFormat("\"AcceptDate\":\"{0}\",", item.AcceptDate); returnMsg.AppendFormat("\"AcceptTime\":\"{0}\",", item.AcceptTime); returnMsg.AppendFormat("\"TxnAmount\":\"{0}\",", sign + BesttoneAccountHelper.ConvertAmountToYuan(item.TxnAmount)); returnMsg.AppendFormat("\"TxnType\":\"{0}\",", txnType); returnMsg.AppendFormat("\"TxnChannel\":\"{0}\",", item.TxnChannel); returnMsg.AppendFormat("\"MerchantName\":\"{0}\",", item.MerchantName); returnMsg.AppendFormat("\"TxnDscpt\":\"{0}\",", item.TxnDscpt); returnMsg.AppendFormat("\"CancelFlag\":\"{0}\",", flag); if (_recharge_redcord != null) { returnMsg.AppendFormat("\"OrderSeq\":\"{0}\",", _recharge_redcord.OrderSeq); } returnMsg.AppendFormat("\"TxnTime\":\"{0}\"", item.TxnTime); returnMsg.Append("},"); } returnMsg.Insert(0, "{\"result\":\"true\",\"txninfo\":["); returnMsg = returnMsg.Remove(returnMsg.Length - 1, 1); returnMsg.Append("]}"); } else { returnMsg.Append("{\"result\":\"NoData\"}"); } } catch (Exception ex) { returnMsg.Append("{\"result\":\"false\",\"info\":\"异常:" + ex.Message + "\"}"); } return(returnMsg.ToString()); }
protected void Page_Load(object sender, EventArgs e) { StringBuilder strLog = new StringBuilder(); strLog.AppendFormat("【网银充值,DateTime:{0}】\r\n", DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); if (!IsPostBack) { try { //客户ID,账户号,订单号 String CustID, BestPayAccount, OrderSeq; //充值金额,账户余额 long RechargeBalance, Balance; #region 获取支付平台post过来的一些变量 //获取支付平台post过来的一些变量 String uptranSeq = Request.Form["UPTRANSEQ"]; //支付平台交易流水号 String tranDate = Request.Form["TRANDATE"]; //支付平台交易日期 String retnCode = Request.Form["RETNCODE"]; //处理结果码 String retnInfo = Request.Form["RETNINFO"]; //处理结果解释码 String orderReqtranSeq = Request.Form["ORDERREQTRANSEQ"]; //订单请求交易流水号 String orderSeq = Request.Form["ORDERSEQ"]; //订单号 String orderAmount = Request.Form["ORDERAMOUNT"]; //订单总金额 String productAmount = Request.Form["PRODUCTAMOUNT"]; //产品金额 String attachAmount = Request.Form["ATTACHAMOUNT"]; //附加金额 String curType = Request.Form["CURTYPE"]; //币种 String encodeType = Request.Form["ENCODETYPE"]; //加密方式 String attach = Request.Form["ATTACH"]; //SP附加信息 String sign = Request.Form["SIGN"]; //数字签名 strLog.AppendFormat("[网银返回参数]:uptranSeq:{0},tranDate:{1},retnCode:{2},retnInfo:{3},orderReqtranSeq:{4},orderSeq:{5},orderAmount:{6},productAmount:{7},attachAmount:{8},curType:{9},attach:{10},sign:{11},", uptranSeq, tranDate, retnCode, retnInfo, orderReqtranSeq, orderSeq, orderAmount, productAmount, attachAmount, curType, attach, sign); if (retnCode != "0000") { return; } //验证签名:16进制转换(MD5加密) String newSign = String.Format("UPTRANSEQ={0}&MERCHANTID={1}&ORDERID={2}&PAYMENT={3}&RETNCODE={4}&RETNINFO={5}&PAYDATE={6}&KEY={7}", uptranSeq, BesttoneAccountConstDefinition.DefaultInstance.MERCHANTID, orderSeq, orderAmount, retnCode, retnInfo, tranDate, BesttoneAccountConstDefinition.DefaultInstance.MERCHANTID_KEY); String md5EncodingSign = BesttoneAccountHelper.MACSign(newSign); strLog.AppendFormat("newSign:{0},md5EncodingSign:{1}\r\n", newSign, md5EncodingSign); if (!md5EncodingSign.Equals(sign)) { strLog.Append("[签名验证]:签名验证有误"); return; } String responseXml = String.Format("UPTRANSEQ_{0}", uptranSeq); strLog.AppendFormat("[返回给网银参数]:ResponseXml:{0}\r\n", responseXml); #endregion #region 更新银行扣款订单状态 //查询订单,检查订单状态 RechargeOrder _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq); BankRechargeRecord _bankRecharge_record = _bankRechargeRecord_dao.QueryByOrderTransacntionID(orderReqtranSeq); if (_recharge_order == null) { return; } if (_bankRecharge_record == null) { return; } CustID = _recharge_order.CustID; BestPayAccount = _recharge_order.TargetAccount; OrderSeq = _recharge_order.OrderSeq; RechargeBalance = _recharge_order.OrderAmount; strLog.AppendFormat("[订单信息]:CustID:{0},BestPayAccount:{1},OrderSeq:{2},RechargeBalance:{3},订单状态:{4}\r\n", CustID, BestPayAccount, OrderSeq, RechargeBalance, _recharge_order.Status); //检查订单状态 6 扣款异常 主表 if (_recharge_order.Status == 6) { return; } else if (_recharge_order.Status == 2 || _recharge_order.Status == 3 || _recharge_order.Status == 5 || _recharge_order.Status == 9) { Response.Write(responseXml.ToString()); // 2 扣款成功 3 已充成功 5 充值失败 9 已对账 } // Response.Write 后,不会再往下执行 // 0 ,1, 4, 7 往下做 先把主表状态改为2,然后将扣款子表状态改为1 意味着扣款成功 Boolean result = false; //修改订单状态 _recharge_order.Status = 2; _recharge_order.PayTime = DateTime.Now; _recharge_order.UptranSeq = uptranSeq; result = _rechargeOrder_dao.Update(_recharge_order); strLog.AppendFormat("[修改订单结果]:{0}\r\n", result); if (!result) { return; } //修改扣款记录状态 _bankRecharge_record.UptranSeq = uptranSeq; _bankRecharge_record.Sign = sign; _bankRecharge_record.TranDate = tranDate; _bankRecharge_record.ReturnCode = retnCode; _bankRecharge_record.ReturnDesc = retnInfo; _bankRecharge_record.PayTime = DateTime.Now; _bankRecharge_record.Status = 1; result = _bankRechargeRecord_dao.Update(_bankRecharge_record); if (!result) { return; } #endregion #region 向账户进行充值 //生成一条充值流水号记录 DateTime rechargeTime = DateTime.Now; String transactionid = BesttoneAccountHelper.CreateTransactionID(); AccountRechargeRecord rechargeRecord_entity = new AccountRechargeRecord(); rechargeRecord_entity.RechargeTransactionID = transactionid; rechargeRecord_entity.RechargeDate = rechargeTime.ToString("yyyyMMdd"); rechargeRecord_entity.OrderSeq = OrderSeq; rechargeRecord_entity.OrderAmount = RechargeBalance; rechargeRecord_entity.RechargeType = "0"; rechargeRecord_entity.OrderDesc = "网银充值"; rechargeRecord_entity.ReqTime = rechargeTime; rechargeRecord_entity.CompleteTime = new DateTime(1900, 1, 1); rechargeRecord_entity.Status = 0; rechargeRecord_entity.ReturnCode = ""; rechargeRecord_entity.ReturnDesc = ""; strLog.AppendFormat("[开始给账户充值]:transactionid:{0},", transactionid); try { //开始调用接口充值 Result = BesttoneAccountHelper.AccountRecharge(transactionid, BestPayAccount, RechargeBalance, rechargeTime, out Balance, out ErrMsg); if (Result == 0) { strLog.Append("充值状态:充值成功\r\n"); //充值成功,则更新订单状态 _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(OrderSeq); _recharge_order.CompleteTime = DateTime.Now; _recharge_order.Status = 3; _recharge_order.RechargeCount = _recharge_order.RechargeCount + 1; _recharge_order.ReturnCode = "0000"; _recharge_order.ReturnDesc = "充值成功"; _rechargeOrder_dao.Update(_recharge_order); //如果需要开发票 -- 插入发票表 2013-04-14 add-start System.Text.StringBuilder datalog = new System.Text.StringBuilder(); _rechargeOrder_dao.UpdateInvoice(orderSeq, "0", out datalog); //将发票状态改为申请中. strLog.Append("更新发票状态:" + datalog.ToString()); //2013-04-14 add-end //更新流水号状态 rechargeRecord_entity.Status = 1; rechargeRecord_entity.CompleteTime = DateTime.Now; rechargeRecord_entity.ReturnCode = "0000"; rechargeRecord_entity.ReturnDesc = "充值成功"; } else { strLog.Append("充值状态:充值失败\r\n"); //充值失败,则更新订单状态 _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(OrderSeq); _recharge_order.RechargeCount = _recharge_order.RechargeCount + 1; _recharge_order.ReturnCode = Result.ToString(); _recharge_order.ReturnDesc = ErrMsg; _rechargeOrder_dao.Update(_recharge_order); //更新流水号状态 rechargeRecord_entity.Status = 2; rechargeRecord_entity.CompleteTime = DateTime.Now; rechargeRecord_entity.ReturnCode = Result.ToString(); rechargeRecord_entity.ReturnDesc = ErrMsg; } } catch (Exception ex) { strLog.AppendFormat("充值异常1:{0}\r\n", ex.Message); } finally { //插入充值流水记录 _accountRechargeRecord_dao.Insert(rechargeRecord_entity); Response.Write(responseXml.ToString()); } #endregion } catch (Exception ex) { strLog.AppendFormat("异常2:{0}\r\n", ex.Message); } finally { log(strLog.ToString()); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { StringBuilder strLog = new StringBuilder(); String Url = ""; try { PassWord = Request.Form["password"].ToString().Trim(); Mobile = Request.Form["mobile"].ToString().Trim(); CheckPhoneCode = Request.Form["checkCode"].ToString().Trim(); strLog.AppendFormat("接收到password:{0},Mobile:{1},CheckPhoneCode:{2}\r\n", PassWord, Mobile, CheckPhoneCode); string UserName = ""; string Email = ""; if (ViewState["phonestate"] == null) { strLog.AppendFormat("phonestate=null\r\n"); ViewState["phonestate"] = Request.Form["phonestate"].ToString(); string a = (string)ViewState["phonestate"]; } if (((string)ViewState["phonestate"]).Equals("0")) { Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg); if (Result != 0) { strLog.AppendFormat("手机验证码校验未通过!\r\n"); return; } } strLog.AppendFormat("手机验证码校验通过!\r\n"); Result = UserRegistry.quickUserRegistryWebV4(SPID, PassWord, Mobile, (string)ViewState["phonestate"], UserName, Email, Device, out CustID, out ErrMsg); if (Result != 0) { strLog.AppendFormat("注册失败!\r\n"); return; } strLog.AppendFormat("注册成功!CustID:{0}\r\n", CustID); String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim(); if ("1".Equals(hid_openAccount)) { strLog.AppendFormat("开户过程\r\n"); string BindedBestpayAccount = ""; string CreateTime = ""; int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg); if (IsBesttoneAccountBindV5Result == 0) { Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!"); } String TransactionID = BesttoneAccountHelper.CreateTransactionID(); AccountItem ai = new AccountItem(); string ResponseCode = ""; string BestToneAccount = Request.Form["mobile"].ToString().Trim(); realName = Request.Form["realName"].ToString().Trim(); certnum = Request.Form["certnum"].ToString().Trim(); int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg); if (QueryBesttoneAccountResult == 0) { if ("200010".Equals(ResponseCode)) // 未开户 { strLog.AppendFormat("该号码未开过户:\r\n"); UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg); if (Result == 0) { strLog.AppendFormat("开户成功:\r\n"); int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg); if (BindResult == 0) { UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg); // //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true); } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } else { UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg); if (BindResult == 0) { UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg); int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg); //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true); } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } } else { Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg); } } if (ReturnUrl.IndexOf("?") > 0) { Url = ReturnUrl + "&CustID=" + CustID + "&welcomeName=" + Mobile; } else { Url = ReturnUrl + "?CustID=" + CustID + "&welcomeName=" + Mobile; } Response.Redirect(Url, true); } catch (Exception ex) { strLog.AppendFormat(ex.ToString()); } finally { log(strLog.ToString()); } }