コード例 #1
0
        /// <summary>
        /// GetFindOrderListQueryUrl
        /// </summary>
        /// <param name="appKey"></param>
        /// <param name="appSecret"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="accessToken"></param>
        /// <param name="createDateStart"></param>
        /// <param name="createDateEnd"></param>
        /// <param name="orderStatus"></param>
        /// <returns></returns>
        private string GetFindOrderListQueryUrl(string appKey, string appSecret, int page, int pageSize, string accessToken, string createDateStart = null, string createDateEnd = null, string orderStatus = null)
        {
            var partUrl = $"http://gw.api.alibaba.com:80/openapi/param2/1/aliexpress.open/api.findOrderListQuery/{appKey}";
            var dic     = new Dictionary <string, string>
            {
                { "page", page.ToString() },
                { "pageSize", pageSize.ToString() },
                { "access_token", accessToken }
            };

            if (!string.IsNullOrEmpty(createDateStart))
            {
                dic.Add("createDateStart", createDateStart);
            }
            if (!string.IsNullOrEmpty(createDateEnd))
            {
                dic.Add("createDateEnd", createDateEnd);
            }
            if (!string.IsNullOrEmpty(orderStatus))
            {
                dic.Add("orderStatus", orderStatus);
            }

            var sign = SignatureHandler.APISign(Regex.Match(partUrl, "(?<=openapi/).*$").Value, dic, appSecret);

            dic.Add("_aop_signature", sign);
            var url = GetUrlByDic(partUrl, dic);

            return(url);
        }
コード例 #2
0
        /// <summary>
        /// GetAuthUrl
        /// </summary>
        /// <param name="appKey"></param>
        /// <param name="appSecret"></param>
        /// <param name="redirectUri"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        private string GetAuthUrl(string appKey, string appSecret, string redirectUri, string state = "test")
        {
            Dictionary <string, string> dic = new Dictionary <string, string>
            {
                { "client_id", appKey },
                { "site", "aliexpress" },
                { "redirect_uri", redirectUri },
                { "state", state },
            };
            var sign = SignatureHandler.Sign(dic, appSecret);

            dic.Add("_aop_signature", sign);
            var authUrl = GetUrlByDic("http://authhz.alibaba.com/auth/authorize.htm", dic);

            return(authUrl);
        }