Пример #1
0
        public override Task <NotifyReturn> Notify(HttpRequest request)
        {
            NotifyReturn notifyReturn = new NotifyReturn();
            var          body         = request.Body;
            string       content      = string.Empty;

            using (StreamReader dRead = new StreamReader(body, Encoding.UTF8))
            {
                content = dRead.ReadToEnd();
            }
            hyNotify j           = JsonConvert.DeserializeObject <hyNotify>(content);
            string   P_UserId    = j.P_UserId;
            string   P_OrderId   = j.P_OrderId;
            string   P_FaceValue = j.P_FaceValue;
            string   P_Notic     = j.P_Notic;
            string   P_Return    = j.P_Return;
            string   P_ErrCode   = j.P_ErrCode;
            string   P_SuccTime  = j.P_SuccTime;
            string   P_PostKey   = j.P_PostKey;

            string signstr = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", P_UserId, P_OrderId, P_FaceValue, P_Notic, P_Return, P_ErrCode, P_SuccTime, this.MchKey2);

            string _sign = PayHelper.MD5Hash2(signstr);

            if (P_Return == "1" && _sign.ToLower() == P_PostKey.ToLower())
            {
                notifyReturn.MchID   = this.MchID;
                notifyReturn.IsCheck = true;
            }
            else
            {
                notifyReturn.MchID   = this.MchID;
                notifyReturn.IsCheck = false;
            }
            return(new Task <NotifyReturn>(() => notifyReturn));
        }
Пример #2
0
        public override Task <NotifyReturn> Notify(HttpRequest request)
        {
            NotifyReturn notifyReturn = new NotifyReturn();
            var          body         = request.Body;
            string       content      = string.Empty;

            using (StreamReader dRead = new StreamReader(body, Encoding.UTF8))
            {
                content = dRead.ReadToEnd();
            }
            hyNotify j            = JsonConvert.DeserializeObject <hyNotify>(content);
            string   krid         = j.krid;
            string   money        = j.money;
            string   order_sn     = j.order_sn;
            string   out_order_sn = j.out_order_sn;
            string   status       = j.status;
            data     data         = j.data;
            string   kts          = j.kts;
            string   sign         = j.sign;
            string   signstr      = string.Format("krid={0}&money={1}&order_sn={2}&out_order_sn={3}&status={4}&kts={5}", krid, money, order_sn, out_order_sn, status, kts);

            string _sign = PayHelper.Md5Hash4(signstr);

            _sign = PayHelper.Md5Hash4(_sign + this.MchKey);
            if (status == "success" && _sign.ToLower() == sign.ToLower())
            {
                notifyReturn.MchID   = this.MchID;
                notifyReturn.IsCheck = true;
            }
            else
            {
                notifyReturn.MchID   = this.MchID;
                notifyReturn.IsCheck = false;
            }
            return(new Task <NotifyReturn>(() => notifyReturn));
        }