示例#1
0
        /// <summary>
        /// 获取所有商品
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#list-all-product
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="posStart">起始位置,数字</param>
        /// <param name="numLimit">要获取的商品数量,数字 </param>
        /// <param name="sinceDate">自此时间之后</param>
        /// <param name="showRejected">为true 则wish审核未通过的商品也一起列出</param>
        /// <param name="sessionType">prod 正式环境 ,sandbox 沙盒环境 </param>
        /// <returns></returns>
        public static ProductList ProductAllRetrieve(string clientId, string accessToken, int?posStart = null, int?numLimit = null, string sinceDate = null, bool?showRejected = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/multi-get",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);
                var data = new
                {
                    ///optional An offset into the list of returned items.
                    ///Use 0 to start at the beginning. The API will return the requested number of items starting at this offset. Default to 0 if not supplied
                    start = posStart,

                    ///optional A limit on the number of products that can be returned. Limit can range from 1 to 250 items and the default is 50
                    limit = numLimit,

                    ///optional A date string in the format YYYY-MM-DD.
                    ///If a date is provided, only products updated since the given date will be fetched. Default is to fetch all.
                    since = sinceDate,

                    ///optional If specified to 'true', this API will return all products including those inappropriate products that were rejected during review.
                    show_rejected = showRejected
                };
                var result = CommonJsonSend.Send <ProductList>(token, url, data, CommonJsonSendType.GET);
                return result;
            }, clientId, accessToken, sessionType));
        }
示例#2
0
        /// <summary>
        /// 修改还未标记发货订单的收货信息
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#change-shipping
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="orderId"></param>
        /// <param name="streetAddress1"></param>
        /// <param name="city"></param>
        /// <param name="zipCode"></param>
        /// <param name="country"></param>
        /// <param name="streetAddress2">可选 地址2</param>
        /// <param name="state">可选 州代码 </param>
        /// <param name="phoneNumber">可选 联系电话</param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static OrderResultBase OrderNotShippedModifyShippingInformation(string clientId, string accessToken, string orderId, string streetAddress1, string city, string zipCode, string country, string streetAddress2 = null, string state = null, string phoneNumber = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/order/change-shipping",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = orderId,
                    street_address1 = streetAddress1,
                    city = city,
                    zipcode = zipCode,
                    country = country,
                    street_address2 = streetAddress2,
                    state = state,
                    phone_number = phoneNumber
                };

                var result = CommonJsonSend.Send <OrderResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#3
0
 /// <summary>
 /// 订单列表查看(卖家视角)
 /// </summary>
 /// <param name="requestPolicy"></param>
 /// <param name="reqModelOrderListOnSellerView"></param>
 /// <param name="timeOut"></param>
 /// <returns></returns>
 public static Com.Alibaba.Trade.Entities.OrderListForSellerContainer OrderListOnSellerViewRetrieve(
     Com.Alibaba.Entities.Request.RequestPolicy requestPolicy,
     Com.Alibaba.Trade.Entities.Request.ReqModelOrderListForSeller reqModelOrderListOnSellerView,
     int timeOut = Config.TIME_OUT)
 {
     return(ApiHandlerWrapper.TryCommonApi(reqPoli =>
     {
         var result = CommonJsonSend.Send <Com.Alibaba.Trade.Entities.OrderListForSellerContainer>(requestPolicy, reqModelOrderListOnSellerView, timeOut: timeOut);
         return result;
     }, requestPolicy: requestPolicy));
 }
示例#4
0
        /// <summary>
        /// 获得某商品到某国家的运费
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#get-shipping
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="productShippingPriceSingle"> id,parent_sku 必写其一;country 两位国家代码 </param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static ProductShippingPriceSingle ProductShippingPriceRetrieveSingle(string clientId, string accessToken, Wl.Wish.Entities.Request.ProductShippingPriceSingle productShippingPriceSingle, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/get-shipping",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <ProductShippingPriceSingle>(token, url, productShippingPriceSingle, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#5
0
        /// <summary>
        /// 获取公告
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#fetch-bd-announcements
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static AnnouncementList AnnouncementRetrieve(string clientId, string accessToken, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/fetch-bd-announcement",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <AnnouncementList>(token, url, null, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#6
0
        /// <summary>
        /// 获取系统更改通知
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#fetch-system-updates-noti
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static SystemUpdateNotification SystemUpdateNotificationRetrieve(string clientId, string accessToken, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/fetch-sys-updates-noti",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <SystemUpdateNotification>(token, url, null, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#7
0
        /// <summary>
        /// 获取违规通知次数
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#get-infraction-count
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static CountInfractionsResult InfractionCountRetrieve(string clientId, string accessToken, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/count/infractions",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <CountInfractionsResult>(token, url, null, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#8
0
        /// <summary>
        /// 添加一个商品规格
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#create-product-variation
        ///
        /// variant参数 =>
        /// parent_sku,
        /// sku,
        /// inventory,
        /// price,
        /// shipping,
        /// color 可空,
        /// size 可空,
        /// msrp 可空,
        /// shipping_time 可空,
        /// main_image 可空
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="variant"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static VariantResult ProductVariantCreate(string clientId, string accessToken, Wl.Wish.Entities.Request.Variant variant, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/variant/add",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <VariantResult>(token, url, variant, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#9
0
        /// <summary>
        /// 获取未查看通知的条数
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#noti-count
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static NotificationResultBase NotificationUnviewedCountRetrieve(string clientId, string accessToken, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/noti/get-unviewed-count",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = CommonJsonSend.Send <NotificationResultBase>(token, url, null, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="requestPolicy"></param>
        /// <param name="reqModelOrderDetailOnSellerView"></param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static Dictionary <string, object> OrderDetailOnSellerViewRetrieveRowString(
            Com.Alibaba.Entities.Request.RequestPolicy requestPolicy,
            Com.Alibaba.Trade.Entities.Request.ReqModelOrderDetailForSeller reqModelOrderDetailOnSellerView,
            int timeOut = Config.TIME_OUT)
        {
            var retObject = ApiHandlerWrapper.TryCommonApi(reqPoli =>
            {
                var result = CommonJsonSend.Send <Com.Alibaba.Entities.Response.EntityBase>(requestPolicy, reqModelOrderDetailOnSellerView, timeOut: timeOut);
                return(result);
            }, requestPolicy: requestPolicy);

            dynamic coreObject = retObject.ReturnObject;

            var retDict = new Dictionary <string, object>(coreObject._dictionary);

            return(retDict);
        }
示例#11
0
        /// <summary>
        /// 禁用一个商品规格
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#disable-product-variation
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sku"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static VariantResultBase ProductVariantDisable(string clientId, string accessToken, string sku, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/variant/disable",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    sku = sku
                };

                var result = CommonJsonSend.Send <VariantResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#12
0
        /// <summary>
        /// 获得多个商品的所有运费设置
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#get-products-shipping
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="productIds"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static ProductShippingPriceMultipleOfMany ProductShippingPriceRetrieveMultipleOfMany(string clientId, string accessToken, string productIds = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/get-products-shipping",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    ids = productIds
                };

                var result = CommonJsonSend.Send <ProductShippingPriceMultipleOfMany>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#13
0
        /// <summary>
        /// 标记通知为已读
        /// 参数中的noti_id 在
        /// https://www.merchant.wish.com/documentation/api/v2#noti-mark
        /// 中示例为id
        /// 但是在
        /// https://www.merchant.wish.com/documentation/api/explorer/noti/mark-as-viewed
        /// 中为noti_id
        /// 此处对参数存疑问
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="notificationId"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static NotificationResultBase NotificationMarkViewed(string clientId, string accessToken, string notificationId, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/noti/mark-as-viewed",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    noti_id = notificationId
                };

                var result = CommonJsonSend.Send <NotificationResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#14
0
        /// <summary>
        /// 取消商品下载任务
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#product-cancel-download-job
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="jobId"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static ProductDownloadTask ProductDownloadTaskCancel(string clientId, string accessToken, string jobId, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/cancel-download-job",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    job_id = jobId
                };

                var result = CommonJsonSend.Send <ProductDownloadTask>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#15
0
        /// <summary>
        /// 获取一个Ticket
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#get-ticket
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="ticketId"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static TicketResult TicketRetrieve(string clientId, string accessToken, string ticketId, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/ticket",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = ticketId
                };

                var result = CommonJsonSend.Send <TicketResult>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#16
0
        /// <summary>
        /// 获取未查看的通知消息
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#noti-fetch
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="startNumber"></param>
        /// <param name="limitNumber"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static NotificationList NotificationUnviewedRetrieve(string clientId, string accessToken, int startNumber = 0, int limitNumber = 50, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/noti/fetch-unviewed",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    start = startNumber,
                    limit = limitNumber
                };

                var result = CommonJsonSend.Send <NotificationList>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#17
0
        /// <summary>
        /// 移除商品的图片,只保留主图(通过 product_id或 parent_sku )
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#product-remove-extra-images
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="productId"></param>
        /// <param name="parentSku"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static ProductResultBase ProductExtraPhotoRemove(string clientId, string accessToken, string productId, string parentSku, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/remove-extra-images",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = productId,
                    parent_sku = parentSku
                };

                var result = CommonJsonSend.Send <ProductResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#18
0
        /// <summary>
        /// 开始批量下载商品的任务
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#product-create-download-job
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sinceDate"></param>
        /// <param name="limitNum"></param>
        /// <param name="sortString"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static ProductDownloadTask ProductDownloadTaskStart(string clientId, string accessToken, string sinceDate, int?limitNum, string sortString, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/create-download-job",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    since = sinceDate,
                    limit = limitNum
                };

                var result = CommonJsonSend.Send <ProductDownloadTask>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#19
0
        /// <summary>
        /// 获取所有商品规格数据
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#list-all-product-variation
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="start">起始</param>
        /// <param name="limit">限制</param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static VariantList ProductVariantListAll(string clientId, string accessToken, int start = 0, int limit = 50, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/variant/multi-get",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    start = start,
                    limit = limit
                };

                var result = CommonJsonSend.Send <VariantList>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#20
0
        /// <summary>
        /// 获取所有等待回复的Ticket
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#list-tickets
        ///
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="startNumber"></param>
        /// <param name="limitNumber"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static TicketList TicketRetrieveAll(string clientId, string accessToken, int startNumber = 0, int limitNumber = 50, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/ticket/get-action-required",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    start = startNumber,
                    limit = limitNumber
                };

                var result = CommonJsonSend.Send <TicketList>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#21
0
        /// <summary>
        /// 重新开启一个Ticket
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#reopen-ticket
        ///
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="ticketId"></param>
        /// <param name="reasonToReOpen">重新开启的原因</param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static TicketResultBase TicketReOpen(string clientId, string accessToken, string ticketId, string reasonToReOpen, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/ticket/re-open",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = ticketId,
                    reply = reasonToReOpen
                };

                var result = CommonJsonSend.Send <TicketResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#22
0
        /// <summary>
        /// 订单取消/退款
        /// ReasonCode 见 https://www.merchant.wish.com/documentation/api/v2#cancel-an-order
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#cancel-an-order
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="orderId"></param>
        /// <param name="reasonCode"></param>
        /// <param name="reasonNote"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static OrderResultBase OrderRefundOrCancel(string clientId, string accessToken, string orderId, Wl.Wish.Entities.ResonCodeOfRefundOrCancel reasonCode = Wish.Entities.ResonCodeOfRefundOrCancel.Other, string reasonNote = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/order/refund",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = orderId,
                    reason_code = (int)reasonCode,
                    reason_note = reasonNote
                };

                var result = CommonJsonSend.Send <OrderResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#23
0
        /// <summary>
        /// 修改已发货订单的跟踪信息
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#update-tracking
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="orderId"></param>
        /// <param name="trackingProvider"></param>
        /// <param name="trackingNumber"></param>
        /// <param name="shipNote"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static OrderResultBase OrderShippedModifyTracking(string clientId, string accessToken, string orderId, string trackingProvider, string trackingNumber = null, string shipNote = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/order/modify-tracking",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    id = orderId,
                    tracking_provider = trackingProvider,
                    tracking_number = trackingNumber,
                    ship_note = shipNote
                };

                var result = CommonJsonSend.Send <OrderResultBase>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#24
0
        /// <summary>
        /// 开始一个订单下载的任务
        ///
        /// 原始文档
        ///
        /// https://www.merchant.wish.com/documentation/api/v2#order-create-download-job
        ///
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="startDate">开始日期,形如 2017-01-01</param>
        /// <param name="endDate">结束日期,形如 2017-04-01</param>
        /// <param name="limitNumber"></param>
        /// <param name="sortNotation">排序方式 asc,desc</param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static OrderDownloadTask OrderDownload(string clientId, string accessToken, string startDate = null, string endDate = null, int?limitNumber = null, string sortNotation = "desc", SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/order/create-download-job",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    start = startDate,
                    end = endDate,
                    limit = limitNumber,
                    sort = sortNotation
                };

                var result = CommonJsonSend.Send <OrderDownloadTask>(token, url, data, CommonJsonSendType.POST);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#25
0
        /// <summary>
        /// 获取最近有变更的订单
        ///
        /// 原始文档
        /// https://www.merchant.wish.com/documentation/api/v2#list-all-orders
        ///
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="start"></param>
        /// <param name="limit"></param>
        /// <param name="since"></param>
        /// <param name="wish_express_only"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static OrderList OrdersRecentlyChangesRetrieve(string clientId, string accessToken, int start = 0, int limit = 50, string since = null, bool?wish_express_only = null, SessionType sessionType = SessionType.Prod)
        {
            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var url =
                    string.Format("{0}/api/v2/order/multi-get",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var data = new
                {
                    start = start,
                    limit = limit,
                    since = since,
                    wish_express_only = wish_express_only
                };

                var result = CommonJsonSend.Send <OrderList>(token, url, data, CommonJsonSendType.GET);

                return result;
            }, clientId, accessToken, sessionType));
        }
示例#26
0
        /// <summary>
        /// 订单列表查看(卖家视角)
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="clientSecret"></param>
        /// <param name="accessToken"></param>
        /// <param name="reqModelOrderListOnSellerView"></param>
        /// <param name="apiRoot"></param>
        /// <param name="apiVersion"></param>
        /// <param name="apiNamespace"></param>
        /// <param name="apiName"></param>
        /// <param name="protocol"></param>
        /// <param name="sessionType"></param>
        /// <param name="requestSchema"></param>
        /// <param name="validateSignature"></param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static Com.Alibaba.Trade.Entities.OrderListForSellerContainer OrderListOnSellerViewRetrieve(
            string clientId,
            string clientSecret,
            string accessToken,
            Com.Alibaba.Trade.Entities.Request.ReqModelOrderListForSeller reqModelOrderListOnSellerView,
            string apiRoot                = "openapi",
            string apiVersion             = "1",
            string apiNamespace           = "com.alibaba.trade",
            string apiName                = "alibaba.trade.getSellerOrderList",
            Com.Alibaba.Protocol protocol = Com.Alibaba.Protocol.param2,
            SessionType sessionType       = SessionType.Prod,
            UriSchema requestSchema       = UriSchema.https,
            bool validateSignature        = true,
            int timeOut = Config.TIME_OUT)
        {
            var requestPolicy = new Com.Alibaba.Entities.Request.RequestPolicy
            {
                ClientId          = clientId,
                ClientSecret      = clientSecret,
                AccessToken       = accessToken,
                ApiRoot           = apiRoot,
                ApiVersion        = apiVersion,
                ApiNamespace      = apiNamespace,
                ApiName           = apiName,
                Protocol          = protocol,
                SessionType       = sessionType,
                RequestSchema     = requestSchema,
                ValidateSignature = validateSignature
            };

            return(ApiHandlerWrapper.TryCommonApi(token =>
            {
                var result = CommonJsonSend.Send <Com.Alibaba.Trade.Entities.OrderListForSellerContainer>(requestPolicy, reqModelOrderListOnSellerView, timeOut: timeOut);
                return result;
            }, requestPolicy: requestPolicy));
        }