Example #1
0
        public static void PlaceOffer(ApiContext apiContext, string ItemID, double AValue)
        {
            PlaceOfferCall apiCall = new PlaceOfferCall(apiContext);

            apiCall.Offer = new OfferType()
            {
                Action   = BidActionCodeType.Purchase,
                Quantity = 1,
                MaxBid   = new AmountType()
                {
                    currencyID = CurrencyCodeType.USD, Value = AValue
                }
            };
            apiCall.AbstractRequest.EndUserIP = "71.234.110.72";
            apiCall.ItemID = ItemID;
            apiCall.Execute();
            if (apiCall.HasError)
            {
                throw new Exception("Error in PlaceOffer");
            }
        }
        public void PlaceOfferFull()
        {
            string originalToken = this.apiContext.ApiCredential.eBayToken;

            try
            {
                Assert.IsNotNull(TestData.ChineseAuctionItem, "ChineseAuctionItem is null");
                ItemType item = TestData.ChineseAuctionItem;
                //change user
                this.apiContext.ApiCredential.eBayToken = TestData.BuyerToken;

                PlaceOfferCall api = new PlaceOfferCall(this.apiContext);
                api.ItemID = TestData.ChineseAuctionItem.ItemID;

                OfferType offer = new OfferType();
                offer.Action   = BidActionCodeType.Bid;
                offer.Quantity = 1;
                AmountType at = new AmountType();
                at.Value                      = 1;
                offer.ConvertedPrice          = at;
                at.Value                      = 2;
                offer.MaxBid                  = at;
                api.Offer                     = offer;
                api.AbstractRequest.EndUserIP = "10.249.72.135";

                api.Execute();

                //check whether the call is success.
                Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!");
            }
            finally
            {
                //reset token
                this.apiContext.ApiCredential.eBayToken = originalToken;
            }
        }