public bool PurchaseProduct(string productId, string endUserIp) { var placeOfferCall = new PlaceOfferCall(this.ApiContext); placeOfferCall.ApiRequest.EndUserIP = endUserIp; try { var sellingStatus = placeOfferCall.PlaceOffer(new OfferType() { Action = BidActionCodeType.Purchase, MaxBid = new AmountType() { Value = 124 }, Quantity = 1, }, productId); } catch { return false; } return true; }
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; } }