Beispiel #1
0
        /// <summary>
        /// ebay_items의 _id 상품에 대하여 판매 중지 요청
        /// </summary>
        /// <param name="id">ebay_items 컬렉션의 id 임. eBay 의 실제 상품 번호 아님!</param>
        /// <returns>
        ///		성공시 Success = true, Message = null
        ///		실패시 Success = false, Messsage = 실패사유
        /// </returns>
        public eBayItemResultBase RequestStopListing(string id)
        {
            eBayItemsData info = new eBayItemDac().View(Query.EQ("_id", ObjectId.Parse(id)));
            if (String.IsNullOrWhiteSpace(info.itemno))
            {
                return new eBayItemResultBase
                {
                    Success = false,
                    Message = "eBay 상품번호가 없어 판매중지요청을 할 수 없습니다."
                };
            }

            if (string.IsNullOrWhiteSpace(info.ebay_acnt))
            {
                return new eBayItemResultBase
                {
                    Success = false,
                    Message = "eBay 계정이 존재하지 않거나 유효한 eBay 계정이 아닙니다."
                };
            }

            //TODO valid한 SiteID인지도 체크 해야되! 근데 valid한 SiteID가 뭔지를 몰라 ㅋㅋㅋㅋㅋ
            var ebayToken = new CommonBiz().GeteBayTokenId(info.ebay_acnt);

            if (String.IsNullOrWhiteSpace(ebayToken))
            {
                return new eBayItemResultBase
                {
                    Success = false,
                    Message = "eBay 계정이 존재하지 않거나 유효한 eBay 계정이 아닙니다."
                };
            }

            var request = new CloseItemRequest
            {
                EbayTokenID = ebayToken,
                ItemID = info.itemno,
                SiteID = info.site
            };

            var response = new ItemService(apiUrl).CloseItem(request);
            if (response.Ack.Equals(AckType.Failure))
            {
                return new eBayItemResultBase
                {
                    Success = false,
                    Message = (from messages in response.Response.Messages
                              select messages[AckType.Failure.ToString()]).ToArray().ToString()
                };
            }

            //TODO 해당 eBay item 판매중지상태로 update
            SaveItemStatus(new ObjectId(id), eBayItemStat.Stop);

            //clone 상품 팔자주문 내리기
            new ItemOrderBiz().DeleteOrder(info.gep_info.src_no, info.gep_info.src_seller.sid, info.gep_info.src_seller.sid);

            return new eBayItemResultBase
            {
                Success = true
            };
        }
Beispiel #2
0
 public CloseItemResponse CloseItem(CloseItemRequest Request)
 {
     return GetClient().CloseItem(Request);
 }
 public void send_CloseItem(CloseItemRequest Request)
 {
     oprot_.WriteMessageBegin(new TMessage("CloseItem", TMessageType.Call, seqid_));
     CloseItem_args args = new CloseItem_args();
     args.Request = Request;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) {
     break;
       }
       switch (field.ID)
       {
     case 1:
       if (field.Type == TType.Struct) {
     Request = new CloseItemRequest();
     Request.Read(iprot);
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
 public CloseItemResponse CloseItem(CloseItemRequest Request)
 {
     send_CloseItem(Request);
     return recv_CloseItem();
 }