Ebay PHP SDK Trading — Укажите время доставки

Я работаю над проектом, связанным с использованием Ebay-PHP-SDK.
Я пытаюсь создать список и указать время доставки для доставки.
Вот хороший пример, который демонстрирует, как создать список товаров.
Можно ли указать время доставки товара? Или это зависит от службы доставки, которую я указываю, и я не могу изменить ее?
Я не мог найти то, что я искал внутри InternationalShippingServiceOptionsType учебный класс.

<?php
require __DIR__.'/../vendor/autoload.php';

$config = require __DIR__.'/../configuration.php';

use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;

$siteId = Constants\SiteIds::US;

$service = new Services\TradingService([
'credentials' => $config['sandbox']['credentials'],
'sandbox'     => true,
'siteId'      => $siteId
]);

$request = new Types\AddItemRequestType();

$request->RequesterCredentials = new Types\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $config['sandbox']['authToken'];

$item = new Types\ItemType();

$item->ListingType = Enums\ListingTypeCodeType::C_CHINESE;
$item->Quantity = 1;

$item->ListingDuration = Enums\ListingDurationCodeType::C_DAYS_7;

$item->StartPrice = new Types\AmountType(['value' => 8.99]);

$item->ReservePrice = new Types\AmountType(['value' => 10.99]);

$item->BuyItNowPrice = new Types\AmountType(['value' => 15.99, 'currencyID' => 'USD']);

$item->Title = 'Bits & Bobs';
$item->Description = '<h1>Bits & Bobs</h1><p>Just some &lt;stuff&gt; I found.</p>';
$item->Country = 'US';
$item->Location = 'Beverly Hills';
$item->PostalCode = '90210';

$item->Currency = 'USD';

$item->PictureDetails = new Types\PictureDetailsType();
$item->PictureDetails->GalleryType = Enums\GalleryTypeCodeType::C_GALLERY;
$item->PictureDetails->PictureURL = ['http://lorempixel.com/1500/1024/abstract'];

$item->PrimaryCategory = new Types\CategoryType();
$item->PrimaryCategory->CategoryID = '29792';

$item->ConditionID = 1000;

$item->PaymentMethods = [
'VisaMC',
'PayPal'
];
$item->PayPalEmailAddress = 'example@example.com';
$item->DispatchTimeMax = 3;

$item->ShippingDetails = new Types\ShippingDetailsType();
$item->ShippingDetails->ShippingType = Enums\ShippingTypeCodeType::C_FLAT;

$shippingService = new Types\ShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 1;
$shippingService->ShippingService = 'Other';
$shippingService->ShippingServiceCost = new Types\AmountType(['value' => 2.00]);
$item->ShippingDetails->ShippingServiceOptions[] = $shippingService;

$shippingService = new Types\ShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 2;
$shippingService->ShippingService = 'USPSParcel';
$shippingService->ShippingServiceCost = new Types\AmountType(['value' => 3.00]);
$item->ShippingDetails->ShippingServiceOptions[] = $shippingService;

$shippingService = new Types\InternationalShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 1;
$shippingService->ShippingService = 'USPSFirstClassMailInternational';
$shippingService->ShippingServiceCost = new Types\AmountType(['value' => 4.00]);
$shippingService->ShipToLocation = ['WorldWide'];
$item->ShippingDetails->InternationalShippingServiceOption[] = $shippingService;

$shippingService = new Types\InternationalShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 2;
$shippingService->ShippingService = 'USPSPriorityMailInternational';
$shippingService->ShippingServiceCost = new Types\AmountType(['value' => 5.00]);
$shippingService->ShipToLocation = [
'Americas',
'CA',
'AU',
'Europe',
'JP'
];
$item->ShippingDetails->InternationalShippingServiceOption[] = $shippingService;

$item->ReturnPolicy = new Types\ReturnPolicyType();
$item->ReturnPolicy->ReturnsAcceptedOption = 'ReturnsAccepted';
$item->ReturnPolicy->RefundOption = 'MoneyBack';
$item->ReturnPolicy->ReturnsWithinOption = 'Days_14';
$item->ReturnPolicy->ShippingCostPaidByOption = 'Buyer';

$request->Item = $item;

$response = $service->addItem($request);

if (isset($response->Errors)) {
foreach ($response->Errors as $error) {
printf(
"%s: %s\n%s\n\n",
$error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
$error->ShortMessage,
$error->LongMessage
);
}
}
if ($response->Ack !== 'Failure') {
printf(
"The item was listed to the eBay Sandbox with the Item number %s\n",
$response->ItemID
);
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector