protected void Page_Load(object sender, EventArgs e) { // 设置 Response编码格式为GB2312 Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); p2_Order = Request.Form["p2_Order"]; p3_Amt = Request.Form["p3_Amt"]; p4_verifyAmt = Request.Form["p4_verifyAmt"]; p5_Pid = Request.Form["p5_Pid"]; p6_Pcat = Request.Form["p6_Pcat"]; p7_Pdesc = Request.Form["p7_Pdesc"]; p8_Url = Request.Form["p8_Url"]; pa_MP = Request.Form["pa_MP"]; pa7_cardAmt = Request.Form["pa7_cardAmt"]; pa8_cardNo = Request.Form["pa8_cardNo"]; pa9_cardPwd = Request.Form["pa9_cardPwd"]; pd_FrpId = Request.Form["pd_FrpId"]; pr_NeedResponse = "1"; pz_userId = Request.Form["pz_userId"]; pz1_userRegTime = Request.Form["pz1_userRegTime"]; try { //非银行卡 正式使用 SZXResult result = SZX.AnnulCard(p2_Order, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime); if (result.R1_Code == "1") { Response.Write("非银行卡支付请求提交成功"); Response.Write("<br>商户订单号:" + result.R6_Order); Response.Write("<br><br>" + result.ReqResult); } else { Response.Write("非银行卡支付请求提交失败 [" + result.R1_Code + "]" + result.Rq_ReturnMsg); if (result.R1_Code == "11") { Response.Write("-订单号重复"); } else if (result.R1_Code == "7") { Response.Write("-卡密无效"); } else if (result.R1_Code == "61") { Response.Write("-账户未开通"); } Response.Write("<br><br>" + result.ReqUrl); Response.Write("<br><br>" + result.ReqResult); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
/// <summary> /// /// </summary> /// <param name="order"></param> /// <returns></returns> public string GetPayUrl(string _orderid, string _cardno, string _cardpwd, int _typeId, int cardvalue, out string errmsg) { errmsg = string.Empty; string puserid = this.SuppAccount; string puserkey = this.SuppKey; HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("gb2312"); p2_Order = _orderid; p3_Amt = decimal.Parse(cardvalue.ToString()).ToString("0.00"); p4_verifyAmt = "false"; p5_Pid = "product"; p6_Pcat = "producttype"; p7_Pdesc = "productdesc"; p8_Url = this.SiteDomain + "/notify/YeePay_Card_Return.aspx"; pa_MP = ""; pa7_cardAmt = decimal.Parse(cardvalue.ToString()).ToString("0.00"); pa8_cardNo = _cardno; pa9_cardPwd = _cardpwd; pd_FrpId = CardTypeNo(_typeId); pr_NeedResponse = "1"; pz_userId = puserid; pz1_userRegTime = ""; try { SZXResult result = SZX.AnnulCard(SuppKey, SuppAccount, p2_Order, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime); if (result.R1_Code == "1") { return("0");//success } if (result.R1_Code == "11") { errmsg = "订单号重复"; return("-1");//订单号重复 } if (result.R1_Code == "7") { errmsg = "卡密无效"; return("-1");//卡密无效 } if (result.R1_Code == "61") { errmsg = "卡密无效"; return("-1");//卡密无效 } errmsg = "未知错误,错误编码:" + result.R1_Code; return("-1");// ("未知错误,错误编码:" + result.R1_Code); } catch (Exception ex) { ExceptionHandler.HandleException(ex); return("-1"); } }
/// <summary> /// /// </summary> /// <param name="o"></param> /// <returns></returns> public CardSynchCallBack CardSend(CardOrderSummitArgs o) { var callBack = new CardSynchCallBack(); HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("gb2312"); p2_Order = o.SysOrderNo; p3_Amt = decimal.Parse(o.FaceValue.ToString(CultureInfo.InvariantCulture)).ToString("0.00"); p4_verifyAmt = "false"; p5_Pid = "product"; p6_Pcat = "producttype"; p7_Pdesc = "productdesc"; p8_Url = NotifyUrl; pa_MP = ""; pa7_cardAmt = decimal.Parse(o.FaceValue.ToString(CultureInfo.InvariantCulture)).ToString("0.00"); pa8_cardNo = o.CardNo; pa9_cardPwd = o.CardPass; pd_FrpId = CardTypeNo(o.CardTypeId); pr_NeedResponse = "1"; pz_userId = SuppAccount; pz1_userRegTime = ""; try { SZXResult result = SZX.AnnulCard(SuppKey, SuppAccount, p2_Order, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime); callBack.Success = 1; callBack.SuppErrorCode = result.R1_Code; callBack.SuppErrorMsg = result.Rq_ReturnMsg; if (result.R1_Code == "1") { callBack.SummitStatus = 1; } } catch (Exception ex) { ExceptionHandler.HandleException(ex); callBack.Success = 0; } return(callBack); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SZX.logURL(Request.RawUrl); // 校验返回数据包 SZXCallbackResult result = SZX.VerifyCallback(Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("r0_Cmd"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("r1_Code"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p1_MerId"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p2_Order"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p3_Amt"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p4_FrpId"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p5_CardNo"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p6_confirmAmount"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p7_realAmount"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p8_cardStatus"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("p9_MP"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("pb_BalanceAmt"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("pc_BalanceAct"), Game.Web.Pay.YbBuy.FormatQueryString.GetQueryString("hmac")); if (string.IsNullOrEmpty(result.ErrMsg)) { // 使用应答机制时 必须回写success Response.Write("SUCCESS"); //在接收到支付结果通知后,判断是否进行过业务逻辑处理,不要重复进行业务逻辑处理 Logic(result); } else { HmacError(result); } } }
protected void Page_Load(object sender, EventArgs e) { Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); if (!string.IsNullOrEmpty(FormatQueryString.GetQueryString("p1_MerId")) && !string.IsNullOrEmpty(FormatQueryString.GetQueryString("pz1_userRegTime"))) { #region 这是我的获取第三方接入过来的提交参数 origin_p1_MerId = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p1_MerId"), System.Text.Encoding.GetEncoding("gb2312")); origin_p2_Order = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p2_Order"), System.Text.Encoding.GetEncoding("gb2312")); p3_Amt = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p3_Amt"), System.Text.Encoding.GetEncoding("gb2312")); p4_verifyAmt = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p4_verifyAmt"), System.Text.Encoding.GetEncoding("gb2312")); p5_Pid = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p5_Pid"), System.Text.Encoding.GetEncoding("gb2312")); p6_Pcat = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p6_Pcat"), System.Text.Encoding.GetEncoding("gb2312")); p7_Pdesc = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p7_Pdesc"), System.Text.Encoding.GetEncoding("gb2312")); origin_p8_Url = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("p8_Url"), System.Text.Encoding.GetEncoding("gb2312")); pa_MP = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pa_MP"), System.Text.Encoding.GetEncoding("gb2312")); pa7_cardAmt = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pa7_cardAmt"), System.Text.Encoding.GetEncoding("gb2312")); pa8_cardNo = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pa8_cardNo"), System.Text.Encoding.GetEncoding("gb2312")); pa9_cardPwd = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pa9_cardPwd"), System.Text.Encoding.GetEncoding("gb2312")); pd_FrpId = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pd_FrpId"), System.Text.Encoding.GetEncoding("gb2312")); pr_NeedResponse = "1"; pz_userId = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pz_userId"), System.Text.Encoding.GetEncoding("gb2312")); pz1_userRegTime = System.Web.HttpUtility.UrlDecode(FormatQueryString.GetQueryString("pz1_userRegTime"), System.Text.Encoding.GetEncoding("gb2312")); origin_hmac = FormatQueryString.GetQueryString("hmac"); #endregion #region 这是我修改提交的参数 p1_MerId = ConfigurationManager.AppSettings["p1_MerId"].ToString(); p8_Url = ConfigurationManager.AppSettings["p8_Url"].ToString(); p2_Order = "789" + origin_p2_Order; #endregion #region 业务逻辑的处理 #endregion SZXResult result = SZX.AnnulCard(p2_Order, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime); #region 提交的返回值处理 //得到的返回的数值 string call_hmac = result.Hmac; string call_r0_cmd = result.R0_Cmd; string call_r1_code = result.R1_Code; string call_r6_order = result.R6_Order; string call_rq_returnmsg = result.Rq_ReturnMsg; string call_req_result = result.ReqResult; string real_call_req_result = ""; if (result.R1_Code.Equals("1")) { real_call_req_result = getReturnValue(call_r1_code, origin_p2_Order, call_rq_returnmsg, origin_hmac); } else { real_call_req_result = getReturnValue(call_r1_code, origin_p2_Order, call_rq_returnmsg, call_hmac); } Response.Write(real_call_req_result); #endregion //p1_MerId = FormatQueryString.GetQueryString("p1_MerId"); //p2_Order = FormatQueryString.GetQueryString("p2_Order"); //p3_Amt = FormatQueryString.GetQueryString("p3_Amt"); //p4_verifyAmt = FormatQueryString.GetQueryString("p4_verifyAmt"); //p5_Pid = FormatQueryString.GetQueryString("p5_Pid"); //p6_Pcat = FormatQueryString.GetQueryString("p6_Pcat"); //p7_Pdesc = FormatQueryString.GetQueryString("p7_Pdesc"); //p8_Url = FormatQueryString.GetQueryString("p8_Url"); //pa_MP = FormatQueryString.GetQueryString("pa_MP"); //pa7_cardAmt = FormatQueryString.GetQueryString("pa7_cardAmt"); //pa8_cardNo = FormatQueryString.GetQueryString("pa8_cardNo"); //pa9_cardPwd = FormatQueryString.GetQueryString("pa9_cardPwd"); //pd_FrpId = FormatQueryString.GetQueryString("pd_FrpId"); //pr_NeedResponse="1"; //pz_userId = FormatQueryString.GetQueryString("pz_userId"); //pz1_userRegTime = FormatQueryString.GetQueryString("pz1_userRegTime"); } }
protected void Page_Load(object sender, EventArgs e) { // 设置 Response编码格式为GB2312 Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); if (!string.IsNullOrEmpty(Request.Form["Cuserspay"]) && !string.IsNullOrEmpty(Request.Form["inputMoney"])) { string pay_username = Request.Form["Cuserspay"]; string PayMoney = Request.Form["inputMoney"]; string payBank = Request.Form["CpayBank"]; string rtypeBank = Request.Form["yx_bank"]; string payTel = string.IsNullOrEmpty(Request.Form["txt_telphone"]) == true? "" : Request.Form["txt_telphone"]; if (rtypeBank != "BANKSEL") { payBank = rtypeBank; } p3_Amt = Convert.ToString(decimal.Parse(PayMoney)); p4_verifyAmt = "false"; p5_Pid = "金币"; p6_Pcat = "1"; p7_Pdesc = "1"; p8_Url = ConfigurationManager.AppSettings["CallBackC"].ToString(); pa_MP = pay_username; pa7_cardAmt = Request.Form["inputMoney"]; pa8_cardNo = Request.Form["pa8_cardNo"]; pa9_cardPwd = Request["pa9_cardPwd"]; pd_FrpId = payBank; pr_NeedResponse = "1"; pz_userId = Convert.ToString(DateTime.Now.ToString("yyyyMMddhhmmss")); pz1_userRegTime = DateTime.Now.ToString(); p2_Order = "CYC" + DateTime.Now.ToString("yyyyMMddhhmmss"); //非银行卡专业版正式使用 try { int payType = 0; switch (payBank) { case "JUNNET": payType = 2; break; case "SNDACARD": payType = 3; break; case "SZX": payType = 4; break; case "ZHENGTU": payType = 5; break; case "QQCARD": payType = 6; break; case "UNICOM": payType = 7; break; case "JIUYOU": payType = 8; break; case "NETEASE": payType = 9; break; case "WANMEI": payType = 10; break; case "SOHU": payType = 11; break; case "TELECOM": payType = 12; break; case "TIANXIA": payType = 13; break; case "TIANHONG": payType = 14; break; case "YPCARD": payType = 16; break; case "ZONGYOU": payType = 17; break; } DataSet ds = new DataSet(); int uid = accountsFacade.GetAccountsId(pay_username); OnLineOrder onlineOrder = new OnLineOrder(); onlineOrder.Accounts = pay_username; onlineOrder.UserID = uid; onlineOrder.OrderAmount = decimal.Parse(PayMoney); onlineOrder.OrderID = p2_Order; onlineOrder.OrderStatus = 0; onlineOrder.ShareID = payType; onlineOrder.CardTotal = 1; onlineOrder.CardTypeID = payType;//卡类充值 onlineOrder.TelPhone = payTel; onlineOrder.IPAddress = GameRequest.GetUserIP(); Message msg = treasureFacade.RequestOrder(onlineOrder); if (!msg.Success) { Response.Redirect("/Tips.aspx?msg=" + msg.Content); } else { //非银行卡专业版正式使用 SZXResult result = SZX.AnnulCard(onlineOrder.OrderID, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime); if (result.R1_Code == "1") { Response.Redirect("/WiteNetCard.html?OID=" + onlineOrder.OrderID); } else { Response.Redirect("/WiteNetCard.html?OID=" + onlineOrder.OrderID); } } } catch (Exception ex) { Response.Write(ex.ToString()); } } }
public SZXResult AnnulCard(string p2_Order, string p3_Amt, string p4_verifyAmt, string p5_Pid, string p6_Pcat, string p7_Pdesc, string p8_Url, string pa_MP, string pa7_cardAmt, string pa8_cardNo, string pa9_cardPwd, string pd_FrpId, string pr_NeedResponse, string pz_userId, string pz1_userRegTime) { return(SZX.AnnulCard(p2_Order, p3_Amt, p4_verifyAmt, p5_Pid, p6_Pcat, p7_Pdesc, p8_Url, pa_MP, pa7_cardAmt, pa8_cardNo, pa9_cardPwd, pd_FrpId, pr_NeedResponse, pz_userId, pz1_userRegTime)); }
public SZXCallbackResult VerifyCallback(string r0_Cmd, string r1_Code, string p1_MerId, string p2_Order, string p3_Amt, string p4_FrpId, string p5_CardNo, string p6_confirmAmount, string p7_realAmount, string p8_cardStatus, string p9_MP, string pb_BalanceAmt, string pc_BalanceAct, string hmac) { return(SZX.VerifyCallback(r0_Cmd, r1_Code, p1_MerId, p2_Order, p3_Amt, p4_FrpId, p5_CardNo, p6_confirmAmount, p7_realAmount, p8_cardStatus, p9_MP, pb_BalanceAmt, pc_BalanceAct, hmac)); }
public void Return(HttpContext context) { //SZX.logURL(context.Request.RawUrl); // 校验返回数据包 SZXCallbackResult result = SZX.VerifyCallback(SuppKey , FormatQueryString.GetQueryString("r0_Cmd") , FormatQueryString.GetQueryString("r1_Code") , FormatQueryString.GetQueryString("p1_MerId") , FormatQueryString.GetQueryString("p2_Order") , FormatQueryString.GetQueryString("p3_Amt") , FormatQueryString.GetQueryString("p4_FrpId") , FormatQueryString.GetQueryString("p5_CardNo") , FormatQueryString.GetQueryString("p6_confirmAmount") , FormatQueryString.GetQueryString("p7_realAmount") , FormatQueryString.GetQueryString("p8_cardStatus") , FormatQueryString.GetQueryString("p9_MP") , FormatQueryString.GetQueryString("pb_BalanceAmt") , FormatQueryString.GetQueryString("pc_BalanceAct") , FormatQueryString.GetQueryString("hmac")); if (string.IsNullOrEmpty(result.ErrMsg)) { //使用应答机制时 必须回写success string viewMsg = ""; string msg = GetMsgInfo(result.P8_cardStatus); string opstate = "-1"; /*成功还是失败*/ int status = (result.R1_Code == "1") ? 2 : 4; if (status == 2) { opstate = "0"; viewMsg = "支付成功"; } else { viewMsg = msg; } var response = new CardOrderSupplierResponse() { SupplierId = SuppId, SuppTransNo = "", SysOrderNo = result.P2_Order, OrderAmt = decimal.Parse(result.P3_Amt), SuppAmt = 0M, OrderStatus = status, SuppErrorCode = result.P8_cardStatus, Opstate = opstate, SuppErrorMsg = result.ErrMsg, ViewMsg = viewMsg, Method = 1 }; OrderCardUtils.SuppNotify(response, Succflag); } else { context.Response.Write("交易签名无效!"); context.Response.Write("<BR>YeePay-HMAC:" + result.Hmac); context.Response.Write("<BR>LocalHost:" + result.ErrMsg); } }