public void RespondToBestOffer()
        {
            Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test");
            //
            RespondToBestOfferCall api = new RespondToBestOfferCall(this.apiContext);
            // Make API call.
            ApiException gotException = null;

            try
            {
                api.Action          = BestOfferActionCodeType.Accept;
                api.BestOfferIDList = new StringCollection();
                api.BestOfferIDList.Add("0");
                api.ItemID         = TestData.NewItem.ItemID;
                api.SellerResponse = "Hello SDK user!";
                api.Execute();
            }
            catch (ApiException ex)
            {
                gotException = ex;
            }
            Assert.IsNotNull(gotException);
        }
Пример #2
0
        private void BtnRespondToBestOffer_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (TxtBestOfferID.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Please input best offer id!");
                    return;
                }

                if (TxtItemID.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Please input item id!");
                    return;
                }


                TxtStatus.Text = "";
                RespondToBestOfferCall apicall = new RespondToBestOfferCall(Context);

                StringCollection BestOfferIDList = new StringCollection();
                BestOfferIDList.Add(TxtBestOfferID.Text);
                string cboActionChoice = CboAction.SelectedItem.ToString();
                if (cboActionChoice == "Counter")
                {
                    if (txtCounterOfferPrice.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Please counter offer price!");
                        return;
                    }

                    if (txtCounterOfferQuantity.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Please input counter offer quanity!");
                        return;
                    }

                    AmountType CounterOfferPrice = new AmountType();
                    CounterOfferPrice.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                    CounterOfferPrice.Value      = Convert.ToDouble(txtCounterOfferPrice.Text);
                    int quantity = Convert.ToInt32(txtCounterOfferQuantity.Text);
                    apicall.RespondToBestOffer(TxtItemID.Text,
                                               BestOfferIDList,
                                               (BestOfferActionCodeType)Enum.Parse(typeof(BestOfferActionCodeType),
                                                                                   CboAction.SelectedItem.ToString()),
                                               TxtSellerResponse.Text,
                                               CounterOfferPrice,
                                               quantity);
                }
                else
                {
                    apicall.RespondToBestOffer(TxtItemID.Text,
                                               BestOfferIDList,
                                               (BestOfferActionCodeType)Enum.Parse(typeof(BestOfferActionCodeType),
                                                                                   CboAction.SelectedItem.ToString()),
                                               TxtSellerResponse.Text);
                }
                TxtStatus.Text = apicall.ApiResponse.Ack.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }