예제 #1
0
        private bool ValidFeedbackSign(FeedBackNotify notify)
        {
            PayDictionary payDictionary = new PayDictionary();

            payDictionary.Add("appid", this._payAccount.AppId);
            payDictionary.Add("timestamp", notify.TimeStamp);
            payDictionary.Add("openid", notify.OpenId);
            return(notify.AppSignature == SignHelper.SignPay(payDictionary, ""));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NotifyClient client;

            base.Response.Write("success");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.EnableSP)
            {
                client = new NotifyClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                client = new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            FeedBackNotify feedBackNotify = client.GetFeedBackNotify(base.Request.InputStream);

            if (feedBackNotify != null)
            {
                string msgType = feedBackNotify.MsgType;
                if (msgType != null)
                {
                    if (!(msgType == "request"))
                    {
                        if (msgType == "confirm")
                        {
                            feedBackNotify.MsgType = "已完成";
                        }
                    }
                    else
                    {
                        feedBackNotify.MsgType = "未处理";
                    }
                }
                if (VShopHelper.GetFeedBack(feedBackNotify.FeedBackId) != null)
                {
                    VShopHelper.UpdateFeedBackMsgType(feedBackNotify.FeedBackId, feedBackNotify.MsgType);
                }
                else
                {
                    FeedBackInfo info = new FeedBackInfo
                    {
                        AppId      = feedBackNotify.AppId,
                        ExtInfo    = feedBackNotify.ExtInfo,
                        FeedBackId = feedBackNotify.FeedBackId,
                        MsgType    = feedBackNotify.MsgType,
                        OpenId     = feedBackNotify.OpenId,
                        Reason     = feedBackNotify.Reason,
                        Solution   = feedBackNotify.Solution,
                        TransId    = feedBackNotify.TransId
                    };
                    VShopHelper.SaveFeedBack(info);
                }
            }
        }
예제 #3
0
 public FeedBackNotify GetFeedBackNotify(string xml)
 {
     if (!string.IsNullOrEmpty(xml))
     {
         FeedBackNotify notifyObject = Utils.GetNotifyObject <FeedBackNotify>(xml);
         if ((notifyObject != null) && this.ValidFeedbackSign(notifyObject))
         {
             return(notifyObject);
         }
     }
     return(null);
 }
예제 #4
0
        public FeedBackNotify GetFeedBackNotify(string xml)
        {
            FeedBackNotify result;

            if (string.IsNullOrEmpty(xml))
            {
                result = null;
            }
            else
            {
                FeedBackNotify notifyObject = Utils.GetNotifyObject <FeedBackNotify>(xml);
                if (notifyObject == null || !this.ValidFeedbackSign(notifyObject))
                {
                    result = null;
                }
                else
                {
                    result = notifyObject;
                }
            }
            return(result);
        }