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); } } }
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); } }