コード例 #1
0
        /*
         *  Convert object to request params
         */
        protected SortedDictionary <string, string> convertToRequestParam()
        {
            if (config == null)
            {
                throw new YuanpayException("missing config information.");
            }

            //Ignore param list
            List <string> ignores = new List <string>();

            ignores.Add("config");

            //Compute map
            SortedDictionary <string, string> map = ReflectUtils.Obj2map(this, ignores);

            map = config.basicParamSetting(map);

            if (string.IsNullOrEmpty(config.token))
            {
                throw new YuanpayException("missing token");
            }

            //Encrpt params along with token
            string str = MapUrlUtils.getUrlParamsByMap(map);

            str = str + "&" + MD5Utils.cryptHash((config.token + "").Trim());
            string verifySign = MD5Utils.cryptHash(str);

            map.Add("verifySign", verifySign);

            return(map);
        }