Вызов eBay API AddItem возвращает Внутренняя доставка требуется, если указана ошибка AutoPay

Я новичок в API eBay и пытаюсь сделать AddItem вызов. Однако я продолжаю получать сообщение об ошибке:

Требуется внутренняя доставка, если указана функция AutoPay.

Я скопировал код построчно из примера кода SDK, и он отлично компилируется и работает, поэтому я чувствую, что со стороны eBay могли быть какие-то изменения.

Вот часть моего кода:

static ItemType BuildItem()
    {
        ItemType item = new ItemType();

        item.AutoPaySpecified = false;

        item.Title = "Test Item";
        item.Description = "eBay SDK sample test item";

        item.ListingType = ListingTypeCodeType.Chinese;
        item.Currency = CurrencyCodeType.USD;
        item.StartPrice = new AmountType();
        item.StartPrice.Value = 20;
        item.StartPrice.currencyID = CurrencyCodeType.USD;

        item.ListingDuration = "Days_3";

        item.Location = "San Jose";
        item.Country = CountryCodeType.US;

        CategoryType category = new CategoryType();
        category.CategoryID = "11104";
        item.PrimaryCategory = category;

        item.Quantity = 1;
        item.ConditionID = 1000;
        item.ItemSpecifics = buildItemSpecifics();

        item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
        item.PaymentMethods.AddRange(
            new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
            );
        item.PayPalEmailAddress = "[email protected]";

        item.DispatchTimeMax = 1;
        item.ShippingDetails = BuildShippingDetails();

        item.ReturnPolicy = new ReturnPolicyType();
        item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

        AmountType amount = new AmountType();
        amount.Value = 2.8;
        amount.currencyID = CurrencyCodeType.USD;
        item.StartPrice = amount;

        return item;
    }

    static NameValueListTypeCollection buildItemSpecifics()
    {
        NameValueListTypeCollection nvCollection = new NameValueListTypeCollection();

        NameValueListType nv1 = new NameValueListType();
        nv1.Name = "Platform";
        StringCollection nv1Col = new StringCollection();
        String[] strArr1 = new string[] { "Microsoft Xbox 360" };
        nv1Col.AddRange(strArr1);
        nv1.Value = nv1Col;
        NameValueListType nv2 = new NameValueListType();
        nv2.Name = "Genre";
        StringCollection nv2Col = new StringCollection();
        String[] strArr2 = new string[] { "Simulation" };
        nv2Col.AddRange(strArr2);
        nv2.Value = nv2Col;
        nvCollection.Add(nv1);
        nvCollection.Add(nv2);

        return nvCollection;
    }

    static ShippingDetailsType BuildShippingDetails()
    {
        ShippingDetailsType sd = new ShippingDetailsType();

        sd.ApplyShippingDiscount = true;
        AmountType amount = new AmountType();
        amount.Value = 2.8;
        amount.currencyID = CurrencyCodeType.USD;
        sd.PaymentInstructions = "eBay .Net SDK test instructions";

        // shipping type and shipping service options
        sd.ShippingType = ShippingTypeCodeType.Flat;
        ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();
        shippingOptions.ShippingService = ShippingServiceCodeType.ShippingMethodStandard.ToString();
        amount = new AmountType();
        amount.Value = 1;
        amount.currencyID = CurrencyCodeType.USD;
        shippingOptions.ShippingServiceAdditionalCost = amount;
        shippingOptions.ShippingServicePriority = 1;
        amount = new AmountType();
        amount.Value = 1.0;
        amount.currencyID = CurrencyCodeType.USD;
        shippingOptions.ShippingInsuranceCost = amount;

        sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
            new ShippingServiceOptionsType[] { shippingOptions }
            );

        return sd;
    }

Я пытался установить item.AutoPay = false; и item.AutoPaySpecified = false; - ни один из них, похоже, ничего не делает. Я искал в документах какие-либо ссылки на что-то о внутренней доставке, но ничего не нашел.

Кто-нибудь знает, почему это может происходить?


person eckza    schedule 17.07.2012    source источник


Ответы (1)


В поле shippingOptions отсутствует ShippingServiceCost, попробуйте изменить строку:

shippingOptions.ShippingServiceAdditionalCost = amount;

to

shippingOptions.ShippingServiceCost = amount;

или добавьте назначение в ShippingServiceCost.

«Требуется внутренняя доставка, если указан AutoPay», по-видимому, означает, что какое-то условное (т.е. зависящее от типа доставки) поле отсутствует в вариантах доставки. Я столкнулся с той же ошибкой при попытке добавить все необходимые поля для расчетной доставки — без всех полей eBay интерпретирует это как фиксированную доставку, в которой отсутствует поле ShippingServiceCost.

person jordoh    schedule 22.08.2012