Ejemplo n.º 1
0
        /// <summary>
        /// 订单反查
        /// 返回值为京东的订单号
        /// </summary>
        /// <param name="nopOrderId">Nop订单编号</param>
        /// <returns></returns>
        public JDOrderIdOut SearchJDOrderByNopOrderId(int paymentCompanyId, string nopOrderId)
        {
            (paymentCompanyId == default(int)).TrueThrow("paymentCompanyId不能为空");
            nopOrderId.NullOrEmptyCheck("nopOrderId");

            var jdOrderId = new JDOrderIdOut();

            var token = GetJdToken(paymentCompanyId);

            token.NullCheck("token");

            string str = CallApi("https://bizapi.jd.com/api/order/selectJdOrderIdByThirdOrder",
                                 $"token={token.Access_Token}&thirdOrder={nopOrderId}");

            JDStringlResult json = JsonConvert.DeserializeObject <JDStringlResult>(str);

            if (json != null && json.success)
            {
                jdOrderId.Success       = json.success;
                jdOrderId.ResultCode    = json.resultCode;
                jdOrderId.ResultMessage = json.resultMessage;
                jdOrderId.JDOrderId     = json.result;
            }
            else
            {
                _log.InsertLog(LogLevel.Error, "京东-订单反查异常", str);
            }

            return(jdOrderId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建售后服务单
        /// 需要该配送单已经妥投。
        /// 需要先调用10.3接口校验订单中某商品是否可以提交售后服务
        /// 需要先调用10.4接口查询支持的服务类型
        /// 需要先调用10.5接口查询支持的商品返回京东方式
        /// </summary>
        /// <returns></returns>
        public JDBoolOut AS_CreateAfterSaleOrder(JDAfterSaleIn afterOrder)
        {
            afterOrder.NullCheck("afterOrder");
            afterOrder.Check();

            var result = new JDBoolOut();

            var token = GetJdToken(afterOrder.PaymentCompanyId);

            token.NullCheck("token");

            string _params = JsonConvert.SerializeObject(afterOrder);

            string str = CallApi("https://bizapi.jd.com/api/afterSale/createAfsApply",
                                 $"token={token.Access_Token}&param={_params}");

            JDStringlResult json =
                JsonConvert.DeserializeObject <JDStringlResult>(str);

            if (json != null)
            {
                result.Success       = json.success;
                result.ResultCode    = json.resultCode;
                result.ResultMessage = json.resultMessage;
                //success为服务单保存状态
                result.Data = json.success;
            }
            else
            {
                _log.InsertLog(LogLevel.Error, "京东-创建服务单异常", str);
            }

            return(result);
        }