Exemplo n.º 1
0
        public static ResultModel <SubaccountAuthResult> GetSubaccountAuthInfo()
        {
            //string encodedUrl = "%5B%22%E6%B7%B1%E5%9C%B3%E5%82%B2%E5%9F%BA2018%3Axs057%22%5D";
            //string decodedUrl = HttpUtility.UrlDecode(encodedUrl);
            //encodedUrl = HttpUtility.UrlEncode(decodedUrl);
            ResultModel <SubaccountAuthResult> resultModel = new ResultModel <SubaccountAuthResult>()
            {
                Success = true
            };
            GetSubaccountAuthInfoParam subaccountAuth = new GetSubaccountAuthInfoParam();

            subaccountAuth.SubUserIdentityList = new List <string>()
            {
                "深圳傲基2018:ao504"
            };
            subaccountAuth.GetRequestUrl();
            string url = subaccountAuth.URL;
            // string postData =  CreateParameterStr(subaccountAuth.m_DictParameters);
            string            postData       = string.Join("&", subaccountAuth.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                SubaccountAuthResult subaccountAuthResult = JsonConvert.DeserializeObject <SubaccountAuthResult>(responseResult.Result);
                resultModel.Result = subaccountAuthResult;
            }
            else
            {
                resultModel.Success = false;
            }
            return(resultModel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建订单预览
        /// </summary>
        public static void CreateOrderPreview()
        {
            CreateOrderPreviewParam createOrderPreviewParam = new CreateOrderPreviewParam();

            //  createOrderPreviewParam.invoiceParam = GetInvoiceParam();
            createOrderPreviewParam.addressParam   = GetAddressParam();
            createOrderPreviewParam.cargoParamList = GetCargoParamList();
            createOrderPreviewParam.GetRequestUrl();
            string            url            = "https://gw.open.1688.com/openapi/param2/1/com.alibaba.trade/alibaba.createOrder.preview/6368408";// createOrderPreviewParam.URL;
            string            postData       = string.Join("&", createOrderPreviewParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        CreateOrderPreviewResponse productResponse = JsonConvert.DeserializeObject <CreateOrderPreviewResponse>(responseResult.Result);
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取消子账号授权
        /// </summary>
        /// <param name="appAccount"></param>
        /// <param name="accountList"></param>
        /// <returns></returns>
        public static ResultModel <SubaccountAuthCancelResponse> SubaccountAuthCancel(List <string> accountList)
        {
            ResultModel <SubaccountAuthCancelResponse> resultModel = new ResultModel <SubaccountAuthCancelResponse>()
            {
                Success = true
            };
            SubaccountAuthCancelParam subaccountAuthCancel = new SubaccountAuthCancelParam();

            //获取子账号列表
            subaccountAuthCancel.SubUserIdentityList = accountList;
            subaccountAuthCancel.GetRequestUrl();
            string            url            = subaccountAuthCancel.URL;
            string            postData       = string.Join("&", subaccountAuthCancel.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData, subaccountAuthCancel.RequestType);

            if (responseResult.Success)
            {
                SubaccountAuthCancelResponse subaccountAuthResult = JsonConvert.DeserializeObject <SubaccountAuthCancelResponse>(responseResult.Result);
                resultModel.Result = subaccountAuthResult;
            }
            else
            {
                resultModel.Success = false;
            }
            return(resultModel);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 取消订单
        /// </summary>
        public static void CancelOrder()
        {
            CancelOrderParam cancelOrderParam = new CancelOrderParam();

            cancelOrderParam.tradeID      = 214498786581086919;//213485383312086919 214228696119086919
            cancelOrderParam.remark       = "测试";
            cancelOrderParam.cancelReason = "buyerCancel";
            cancelOrderParam.RequestType  = "CancelOrder";
            cancelOrderParam.GetRequestUrl();
            string            url            = cancelOrderParam.URL;
            string            postData       = string.Join("&", cancelOrderParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 下载订单
        /// </summary>
        public static void UpLoadOrder()
        {
            GetOrderParam getOrderParam = new GetOrderParam();

            getOrderParam.orderId       = 229560749877086919;                                                                           //209934924621086919,213485383312086919
            getOrderParam.includeFields = "GuaranteesTerms,NativeLogistics,RateDetail,OrderInvoice,OrderBizInfo,baseInfo,productItems"; //
            getOrderParam.GetRequestUrl();
            HttpClientRequest httpClient     = new HttpClientRequest();
            string            postData       = string.Join("&", getOrderParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            ResponseResult    responseResult = httpClient.RequesResult(getOrderParam.URL, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        GetOrdersResponse ordersResponse = JsonConvert.DeserializeObject <GetOrdersResponse>(responseResult.Result);
                        if (ordersResponse != null)
                        {
                        }
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 下载产品
        /// </summary>
        public static void LoadProduct()
        {
            GetProductParam getProductParam = new GetProductParam();

            getProductParam.productId = 547363119296;// 576620941437 565461451556  561577651929 554833936110
            getProductParam.GetRequestUrl();
            string            url            = getProductParam.URL;
            string            postData       = string.Join("&", getProductParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        GetProductResponse productResponse = JsonConvert.DeserializeObject <GetProductResponse>(responseResult.Result);
                        string             productId       = productResponse.productInfo.productID.ToString();
                        string             staus           = productResponse.productInfo.status;
                        string             subject         = productResponse.productInfo.subject;
                        string             categoryName    = productResponse.productInfo.categoryName;
                        List <SkuInfos>    skuInfosList    = new List <SkuInfos>();
                        List <SkuInfos>    list            = productResponse.productInfo.skuInfos;
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 刷新token
        /// </summary>
        public static void RefeshToken()
        {
            RefreshTokenParam refreshTokenParam = new RefreshTokenParam();

            refreshTokenParam.GetRequestUrl();
            string            url            = refreshTokenParam.URL;
            string            postData       = string.Join("&", refreshTokenParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 8
0
        public static void GetMessage()
        {
            HttpClientRequest httpClientRequest = new HttpClientRequest();
            string            url         = "http://*****:*****@"message={ 'data':{'sellerMemberId':'b2b-1676547900b7bb3','orderId':167539019420540000,'buyerMemberId':'b2b-665170100','currentStatus': 'waitbuyerpay'},'gmtBorn':1527556000,'msgId':70299002,'type':'PRODUCT_PRODUCT_EXPIRE','userInfo':'CBU_MemberId'}&_aop_signature=65F2AA13AE9C9C9DFE8682EFB90B32F37CB01BE1";

            httpClientRequest.RequesResult(url, postDataStr);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取收货地址
        /// </summary>
        public static ResultModel <ReceiveAddressItems> GetReceiveAddress()
        {
            ResultModel <ReceiveAddressItems> resultModel = new ResultModel <ReceiveAddressItems>();
            ReceiveAddressParam receiveAddressParam       = new ReceiveAddressParam();

            receiveAddressParam.GetRequestUrl();
            string            url            = receiveAddressParam.URL;
            string            postData       = string.Join("&", receiveAddressParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        //进行序列化
                        if (!string.IsNullOrEmpty(responseResult.Result))
                        {
                            try
                            {
                                ReceiveAddressResponse productResponse = JsonConvert.DeserializeObject <ReceiveAddressResponse>(responseResult.Result);
                                resultModel.Code         = productResponse.code;
                                resultModel.ErrorCode    = productResponse.errorCode;
                                resultModel.ErrorMessage = productResponse.errorMessage;
                                if (!string.IsNullOrEmpty(productResponse.message))
                                {
                                    resultModel.Message = productResponse.message;
                                }
                                resultModel.Success = productResponse.success;
                                resultModel.Result  = productResponse.result;
                            }
                            catch (Exception ex)
                            {
                                string meg = ex.Message;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
            return(resultModel);
        }
Exemplo n.º 10
0
        public static ResultModel <SubaccountAuthResponse> GetSubaccountAuth()
        {
            ResultModel <SubaccountAuthResponse> resultModel             = new ResultModel <SubaccountAuthResponse>();
            List <SubaccountAuthResponse>        subaccountAuthResponses = new List <SubaccountAuthResponse>();
            SubaccountAuthParam subaccountAuth = new SubaccountAuthParam();

            subaccountAuth.SubUserIdentityList = new List <string>()
            {
                "深圳傲基2018:b0204", "深圳傲基2018:xs058", "深圳傲基2018:xs0581"
            };
            subaccountAuth.GetRequestUrl();
            string            url            = subaccountAuth.URL;
            string            postData       = string.Join("&", subaccountAuth.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                JObject resultObject = JObject.Parse(responseResult.Result);
                JToken  result       = resultObject as JToken;
                if (result["returnValue"].ToString() != "[]")
                {
                    JObject jObj = JObject.Parse(result["returnValue"].ToString());
                    foreach (var item in subaccountAuth.SubUserIdentityList)
                    {
                        if (jObj.SelectToken(item) != null)
                        {
                            SubaccountAuthResponse subaccountAuthResponse = new SubaccountAuthResponse();
                            subaccountAuthResponse.accessToken        = jObj.SelectToken(item)["accessToken"].ToString();
                            subaccountAuthResponse.aliId              = jObj.SelectToken(item)["aliId"].ToString();
                            subaccountAuthResponse.memberId           = jObj.SelectToken(item)["memberId"].ToString();
                            subaccountAuthResponse.resourceOwnerId    = jObj.SelectToken(item)["resourceOwnerId"].ToString();
                            subaccountAuthResponse.accessTokenTimeout = jObj.SelectToken(item)["accessTokenTimeout"].ToString();
                            subaccountAuthResponses.Add(subaccountAuthResponse);
                        }
                    }
                }
                resultModel.ResultList = subaccountAuthResponses;
            }
            else
            {
                resultModel.Success = false;
            }
            return(resultModel);
        }
Exemplo n.º 11
0
        public static ResultModel <SubAccountResponse> GetSubAccounts()
        {
            ResultModel <SubAccountResponse> resultModel = new ResultModel <SubAccountResponse>();
            GetSubAccountsParam subAccountsParam         = new GetSubAccountsParam("ljy");

            subAccountsParam.GetRequestUrl();
            string            url            = subAccountsParam.URL;
            string            postData       = string.Join("&", subAccountsParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        //进行序列化
                        if (!string.IsNullOrEmpty(responseResult.Result))
                        {
                            try
                            {
                                SubAccountResponse subAccountResponse = JsonConvert.DeserializeObject <SubAccountResponse>(responseResult.Result);
                                if (subAccountResponse != null)
                                {
                                    resultModel.Success = subAccountResponse.success;
                                    resultModel.Result  = subAccountResponse;
                                }
                            }
                            catch (Exception ex)
                            {
                                string meg = ex.Message;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
            return(resultModel);
        }
Exemplo n.º 12
0
        public static ResultModel <SyncProductPushedResponse> SyncProductsPushed()
        {
            ResultModel <SyncProductPushedResponse> resultModel = new ResultModel <SyncProductPushedResponse>();
            SyncProductsPushedParam syncProductsPushed          = new SyncProductsPushedParam();

            syncProductsPushed.ProductIdList = new List <string>()
            {
                "571417124858"
            };                                                                       //531166632724 ,45516189923,45420491343,554833936110,565461451556,561577651929,569211240067,524889799249
            syncProductsPushed.GetRequestUrl();
            string            url            = syncProductsPushed.URL;
            string            postData       = string.Join("&", syncProductsPushed.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));
            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                SyncProductPushedResponse productResponse = JsonConvert.DeserializeObject <SyncProductPushedResponse>(responseResult.Result);
                resultModel.Result = productResponse;
            }
            return(resultModel);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 创建订单
        /// </summary>
        public static void CreateOrder()
        {
            CreateOrderParam createOrderParam = new CreateOrderParam("ljy");

            // createOrderParam.invoiceParam = GetInvoiceParam();
            createOrderParam.addressParam   = GetAddressParam();
            createOrderParam.cargoParamList = GetCargoParamList();
            createOrderParam.tradeType      = "fxassure";
            createOrderParam.message        = "请帮我打印(手写也可)以下信息两份,一份放货里面(每箱装的实物清单),一份贴外箱上(如果两款产品以上的务必做区分,拒收混装)  1.外箱上面写上实际重量;  2.采购员:朱锦兰  电话:18123759489  3.产品编号:98528 (中性)私密比基尼剃刀模版+ 剃毛刀 数量:20;  4.订单编号:PO18100400429  5.快递单地址后面请填下:PO18100400429";
            createOrderParam.GetRequestUrl();
            string url      = createOrderParam.URL;
            string postData = CreateParameterStr(createOrderParam.m_DictParameters);


            //     string.Join("&", createOrderParam.m_DictParameters.Select(zw => zw.Key + "=" + zw.Value));


            HttpClientRequest httpClient     = new HttpClientRequest();
            ResponseResult    responseResult = httpClient.RequesResult(url, postData);

            if (responseResult.Success)
            {
                //进行序列化
                if (!string.IsNullOrEmpty(responseResult.Result))
                {
                    try
                    {
                        GetOrdersResponse ordersResponse = JsonConvert.DeserializeObject <GetOrdersResponse>(responseResult.Result);
                    }
                    catch (Exception ex)
                    {
                        string meg = ex.Message;
                    }
                }
            }
        }