示例#1
0
        public static string RefreshToken(AccountType account)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("grant_type", "refresh_token");
            dic.Add("client_id", Config.AliAppKey);
            dic.Add("client_secret", Config.AliAppSecret);
            dic.Add("refresh_token", account.ApiToken);
            dic.Add("_aop_signature", SMTConfig.Sign(SMTConfig.UrlRefreshToken, dic));
            string c     = PostWebRequest(SMTConfig.IP + SMTConfig.UrlRefreshToken + "/" + Config.AliAppKey, SMTConfig.GetParamUrl(dic));
            JToken token = (JToken)Newtonsoft.Json.JsonConvert.DeserializeObject(c);

            return(token["access_token"].ToString().Replace("\"", ""));
        }
示例#2
0
        public static string GetAuthUrl()
        {
            string url =
                "http://gw.api.alibaba.com/auth/authorize.htm?";
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("client_id", Config.AliAppKey);
            dic.Add("site", "aliexpress");
            dic.Add("redirect_uri", "http://127.0.0.1/");
            dic.Add("state", "sss");
            dic.Add("_aop_signature", SMTConfig.Sign("", dic, false));
            // System.Diagnostics.Process.Start(url + SMTConfig.GetParamUrl(dic));

            return(url + SMTConfig.GetParamUrl(dic));
        }
示例#3
0
        public static OrderMsgType[] findOrderMsgByOrderId(string token, string OId)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add(SMTConfig.fieldAccessToken, token);
            dic.Add("orderId", OId);
            string c = PostWebRequest(SMTConfig.IP + SMTConfig.Url + SMTConfig.ApiqueryOrderMsgListByOrderId + "/" + Config.AliAppKey, SMTConfig.GetParamUrl(dic));

            return(Newtonsoft.Json.JsonConvert.DeserializeObject <OrderMsgType[]>(c));
        }
示例#4
0
        public static AliOrderListType findOrderListQuery(string token, int pageIndex)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add(SMTConfig.fieldAccessToken, token);
            dic.Add("orderStatus", "WAIT_SELLER_SEND_GOODS");
            dic.Add("pageSize", "50");
            dic.Add("page", pageIndex.ToString());
            string c = PostWebRequest(SMTConfig.IP + SMTConfig.Url + SMTConfig.ApifindOrderListQuery + "/" + Config.AliAppKey, SMTConfig.GetParamUrl(dic));

            return(JsonConvert.DeserializeObject <AliOrderListType>(c));
        }
示例#5
0
        public static string GetToken(string code)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("grant_type", "authorization_code");
            dic.Add("client_id", Config.AliAppKey);
            dic.Add("client_secret", Config.AliAppSecret);
            dic.Add("redirect_uri", "http://127.0.0.1/");
            dic.Add("code", code);
            dic.Add("need_refresh_token", "true");
            string c     = PostWebRequest(SMTConfig.IP + SMTConfig.UrlGetToken + "/" + Config.AliAppKey, SMTConfig.GetParamUrl(dic));
            JToken token = (JToken)Newtonsoft.Json.JsonConvert.DeserializeObject(c);

            return(token["refresh_token"].ToString().Replace("\"", ""));
        }
示例#6
0
        public static string sellerShipment(string token, string orderExNo, string trackCode, string serviceName, bool isALL = false)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add(SMTConfig.fieldAccessToken, token);
            dic.Add("serviceName", serviceName);
            dic.Add("logisticsNo", trackCode);
            if (isALL)
            {
                dic.Add("sendType", "all");
            }
            else
            {
                dic.Add("sendType", "part");
            }
            dic.Add("outRef", orderExNo);
            string c = PostWebRequest(SMTConfig.IP + SMTConfig.Url + "sellerShipment/" + Config.AliAppKey, SMTConfig.GetParamUrl(dic));

            return(c);
        }