/// <summary> /// IsValidation /// </summary> private void IsValidation() { try { //GateId =U2 //MerPriv = //TrxId =2013062589057816 //OrdId =30201020130625000010 //RetType =2 //OrdAmt =1.00 //Pid = //ChkValue =9188B176EE0CEC769E077BC63ACE7ADBDAD0FA273A5C81DF9E14C67789F93FACFBF062F22A9EECCA4208CBCEDC4084505C4565E32BA20C9670FC83C775804520AC8C317A2B59BF1FE173F7AC58A80286A54DBA3A2B6C8CFC8559A8530D6E2A55CDF1286A6EE1169712C90212526EA8A0E954B0D3488A8BEEC025DB4AA702F6BD //CmdId =Buy //DivDetails =Agent:00000458605930201020:1.00 //CurCode =RMB //RespCode =000000 //MerId =871997 String GateId, MerPriv, TrxId, OrdId, RetType, OrdAmt, Pid, ChkValue, CmdId, DivDetails, CurCode, RespCode, MerId; GateId = Request.Form["GateId"]; MerPriv = Request.Form["MerPriv"]; TrxId = Request.Form["TrxId"]; OrdId = Request.Form["OrdId"]; RetType = Request.Form["RetType"]; OrdAmt = Request.Form["OrdAmt"]; Pid = Request.Form["Pid"]; ChkValue = Request.Form["ChkValue"]; CmdId = Request.Form["CmdId"]; DivDetails = Request.Form["DivDetails"]; CurCode = Request.Form["CurCode"]; RespCode = Request.Form["RespCode"]; MerId = Request.Form["MerId"]; string SignData = ""; #region 验证签名使用 PbProject.Logic.Pay.ChinaPnr _ChinaPnr = new PbProject.Logic.Pay.ChinaPnr(); String MsgData; MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId; //参数顺序不能错 CHINAPNRLib.NetpayClient SignObject = new CHINAPNRLib.NetpayClientClass(); SignData = SignObject.VeriSignMsg0(_ChinaPnr._PgKeyUrl, MsgData, MsgData.Length, ChkValue); //请将此处改成你的私钥文件所在路径 #endregion if (SignData == "0") { if (RespCode == "000000") { #region 交易成功 if (CmdId == "Buy") { new PbProject.Logic.Pay.Bill().CreateLogMoneyDetail("", TrxId, OrdAmt, 12, OrdId.Substring(0, 8), "POS充值", "POS充值"); } #endregion } else { //交易失败 OnErrorNew("交易失败 OrdId=" + OrdId, false); } Response.Write("RECV_ORD_ID_" + OrdId); } else { //验签失败 OnErrorNew("验签失败", false); } } catch (Exception ex) { } }
/// <summary> /// Validation /// </summary> private string Validation() { string val = ""; try { String CmdId, MerId, RespCode, TrxId, OrdAmt, CurCode, Pid, OrdId, MerPriv, RetType, DivDetails, GateId, ChkValue; CmdId = Request.Form["CmdId"]; //消息类型 MerId = Request.Form["MerId"]; //商户号 RespCode = Request.Form["RespCode"]; //应答返回码 TrxId = Request.Form["TrxId"]; //钱管家交易唯一标识 OrdAmt = Request.Form["OrdAmt"]; //金额 CurCode = Request.Form["CurCode"]; //币种 Pid = Request.Form["Pid"]; //商品编号 OrdId = Request.Form["OrdId"]; //订单号 MerPriv = Request.Form["MerPriv"]; //商户私有域 RetType = Request.Form["RetType"]; //返回类型 DivDetails = Request.Form["DivDetails"]; //分账明细 GateId = Request.Form["GateId"]; //银行ID ChkValue = Request.Form["ChkValue"]; //签名信息 PbProject.Logic.Pay.ChinaPnr _ChinaPnr = new PbProject.Logic.Pay.ChinaPnr(); //验证签名 String MsgData, SignData; MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId; CHINAPNRLib.NetpayClient SignObject = new CHINAPNRLib.NetpayClientClass(); SignData = SignObject.VeriSignMsg0(_ChinaPnr._PgKeyUrl, MsgData, MsgData.Length, ChkValue); //请将此处改成你的私钥文件所在路径 if (SignData == "0") { if (RespCode == "000000") { #region 交易成功 if (CmdId == "Buy") { #region 支付 #endregion } else if (CmdId == "Refund") { #region 退款 #endregion } #endregion val = "Sucess.aspx?PayType=3&ReturnType=1&OrderId=" + OrdId + "&Price=" + OrdAmt + "&OnLineNo=" + OrdId; } else { //交易失败 OnErrorNew("交易失败", false); } } else { OnErrorNew("验证失败", false); } } catch (Exception ex) { OnErrorNew("catch:" + ex, false); } return(val); }