Exemple #1
0
        public NotifyData GetNotifyData(AliPayChannel pChannel)
        {
            var str = string.Empty;

            if (this.SecID == "0001")
            {
                str = RSAFromPkcs8.DecryptData(NotifyDataStr, pChannel.RSA_PrivateKey, AliPayConfig.InputCharset);
            }
            else
            {
                str = HttpUtility.UrlDecode(NotifyDataStr);
            }
            if (!string.IsNullOrEmpty(str))
            {
                try
                {
                    Log.Loggers.Debug(new Log.DebugLogInfo()
                    {
                        Message = "阿里PAY支付通知的业务数据:" + str
                    });
                    Dictionary <string, string> tempDic = new Dictionary <string, string>();
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(str);
                    foreach (XmlElement item in doc.DocumentElement.ChildNodes)
                    {
                        tempDic[item.Name] = item.InnerText;
                    }
                    NotifyData data = new NotifyData();
                    data.Load(tempDic);
                    return(data);
                }
                catch (Exception ex)
                {
                    Log.Loggers.Exception(new Log.ExceptionLogInfo(ex)
                    {
                        ErrorMessage = str + ex.Message
                    });
                }
            }
            return(null);
        }