Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Help with ReviseInventoryStatusRequestType. #9

Closed
acubino opened this issue May 11, 2015 · 1 comment
Closed

Help with ReviseInventoryStatusRequestType. #9

acubino opened this issue May 11, 2015 · 1 comment

Comments

@acubino
Copy link

acubino commented May 11, 2015

Hi.

I was trying to update the qty of the item that previusly listed using the example. But i'm managed some bad.

My code

$request = new Types\ReviseInventoryStatusRequestType();

$request->RequesterCredentials = new Types\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $this->config[$entorno]['userToken'];

$inventory = new Types\InventoryStatusType();

$inventory->ItemID = "281689406834";
$inventory->SKU = "MO-10240";
$inventory->Quantity = 100;
$inventory->StartPrice = new Types\AmountType(array('value' => (float)4.95));

$request->InventoryStatus = $inventory;

$response = $this->service->ReviseInventoryStatus($request);

The error I get from SDK is.

( ! ) Fatal error: Uncaught exception 'DTS\eBaySDK\Exceptions\InvalidPropertyTypeException' with message 'Invalid property type: DTS\eBaySDK\Trading\Types\ReviseInventoryStatusRequestType::InventoryStatus expected <DTS\eBaySDK\Types\UnboundType>, got <DTS\eBaySDK\Trading\Types\InventoryStatusType>' in /var/www/ebay-sdk-trading-master/ebay-sdk-examples-master/vendor/dts/ebay-sdk/src/DTS/eBaySDK/Types/BaseType.php on line 334

( ! ) DTS\eBaySDK\Exceptions\InvalidPropertyTypeException: Invalid property type: DTS\eBaySDK\Trading\Types\ReviseInventoryStatusRequestType::InventoryStatus expected <DTS\eBaySDK\Types\UnboundType>, got <DTS\eBaySDK\Trading\Types\InventoryStatusType> in /var/www/ebay-sdk-trading-master/ebay-sdk-examples-master/vendor/dts/ebay-sdk/src/DTS/eBaySDK/Types/BaseType.php on line 334

Can you help me?. Thx.

@davidtsadler
Copy link
Owner

$request->InventoryStatus is a repeatable field in the API which basically means that you can provide more than one value. This is handled in the SDK by using array properties. To stop the error you just need to assign a value using the square bracket syntax.

$request->InventoryStatus[] = $inventory;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants