public void AddMemberMessageRTQ()
        {
            AddMemberMessageRTQCall api = new AddMemberMessageRTQCall(apiContext);

            MemberMessageType memberMsg = new MemberMessageType();
            memberMsg.Subject = "SDK Sanity Test ASQ";
            memberMsg.Body = "SDK sanity test body";
            memberMsg.DisplayToPublic = false; memberMsg.DisplayToPublicSpecified = true;
            memberMsg.EmailCopyToSender = false; memberMsg.EmailCopyToSenderSpecified = true;
            memberMsg.HideSendersEmailAddress = true; memberMsg.HideSendersEmailAddressSpecified = true;
            memberMsg.MessageType = MessageTypeCodeType.ContactEbayMember;
            memberMsg.QuestionType = QuestionTypeCodeType.General;
            memberMsg.RecipientID = new StringCollection();
            memberMsg.ParentMessageID = "1234";
            memberMsg.RecipientID.Add(TestData.ApiUserID);
            // Make API call.
            ApiException gotException = null;
            // Negative test.
            try {
            api.AddMemberMessageRTQ("1111111111", memberMsg);
            } catch (ApiException ex) {
                gotException = ex;
            }
            Assert.IsNotNull(gotException);
        }
示例#2
0
        //
        // AddMemberMessageRTQ
        // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/AddMemberMessageRTQ.html
        public static bool ReplyBuyerMessage(AccountType account, String itemId, 
            String externalMessageId, String buyerId, String body)
        {
            if (account == null || account.SellerApiContext == null)
                return false;

            if (itemId == null)
                return false;

            if (body == null || body.Trim().Length == 0)
                return false;

            AddMemberMessageRTQCall apiCall = new AddMemberMessageRTQCall(account.SellerApiContext);
            apiCall.ItemID = itemId;
            apiCall.MemberMessage = new eBay.Service.Core.Soap.MemberMessageType();
            apiCall.MemberMessage.Body = body;
            apiCall.MemberMessage.DisplayToPublic = false;
            apiCall.MemberMessage.EmailCopyToSender = true;
            apiCall.MemberMessage.ParentMessageID = externalMessageId;

            StringCollection recipientIds = new StringCollection();
            recipientIds.Add(buyerId);
            apiCall.MemberMessage.RecipientID = recipientIds;
            apiCall.MemberMessage.Subject = "";

            bool result = false;
            try
            {
                apiCall.AddMemberMessageRTQ(apiCall.ItemID, apiCall.MemberMessage);
                result = true;
            }
            catch (System.Exception ex)
            {
                Logger.WriteSystemUserLog(string.Format("Error when sending message to buyer, msg={0}", ex.Message));
            }

            return result;
        }
示例#3
0
        public void UploadEmailByAPI(SaleAccountType account)
        {
            ApiContext context = AppSettingHelper.GetGenericApiContext("US");
            context.ApiCredential.eBayToken = account.ApiToken;
            List<EmailRepliedType> result = EmailRepliedType.find("IsToEbay = 0 AND SaleAccount = '"+account.UserName+"'").list();

            AddMemberMessageRTQCall addMsgApicall = new AddMemberMessageRTQCall(context);
            ReviseMyMessagesCall revMsgApicall = new ReviseMyMessagesCall(context);

            foreach (EmailRepliedType er in result)
            {
                MemberMessageType mm = new MemberMessageType();
                mm.MessageID = er.MessageID;
                mm.Body = er.Body;
                mm.Subject = er.Subject;
                mm.SenderID = er.BuyerAccount;
                mm.SenderEmail = er.BuyerEmail;
                mm.ParentMessageID = er.MessageID;

                addMsgApicall.AddMemberMessageRTQ(er.ItemID, mm);
                revMsgApicall.ReviseMyMessages(true, false, new StringCollection(new string[] { mm.MessageID }));

                er.IsToEbay = true;
                er.ToEbayOn = DateTime.Now;
                er.RepliedSpaceHour = (er.ToEbayOn - er.ReceiveOn).TotalHours;
                er.update();
            }
        }
        public static void Upload(AccountType account, ISession NSession)
        {
            ApiContext context = AppSettingHelper.GetGenericApiContext("US");
            context.ApiCredential.eBayToken = account.ApiToken;
            AddMemberMessageRTQCall addMsgApicall = new AddMemberMessageRTQCall(context);
            ReviseMyMessagesCall revMsgApicall = new ReviseMyMessagesCall(context);
            IList<EbayMessageReType> list = NSession.CreateQuery("from EbayMessageReType where IsUpload<>'1'").List<EbayMessageReType>();
            if (list.Count != 0)
            {
                foreach (var item in list)
                {
                    MemberMessageType mm = new MemberMessageType();
                    mm.SenderID = item.SenderID;
                    mm.SenderEmail = item.SenderEmail;
                    mm.MessageID = item.EbayId;
                    mm.Body = item.BodyRe;
                    mm.ParentMessageID = item.EbayId;

                    addMsgApicall.AddMemberMessageRTQ(item.ItemId, mm);
                    revMsgApicall.ReviseMyMessages(true, false, new StringCollection(new string[] { mm.MessageID }));

                    item.IsUpload = 1;
                }
            }
        }