diff --git a/CHANGELOG.md b/CHANGELOG.md index 59839c8af4..a9f8cac788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 13.1.0 - 2017-09-24 + +### + +* Added withdrawOffer to Inventory service. + ## 13.0.3 - 2017-09-07 ## Fixes diff --git a/src/Inventory/Services/InventoryService.php b/src/Inventory/Services/InventoryService.php index 916cda5965..9d9983571d 100644 --- a/src/Inventory/Services/InventoryService.php +++ b/src/Inventory/Services/InventoryService.php @@ -260,6 +260,17 @@ class InventoryService extends \DTS\eBaySDK\Inventory\Services\InventoryBaseServ ] ] ], + 'WithdrawOffer' => [ + 'method' => 'POST', + 'resource' => 'offer/{offerId}/withdraw', + 'responseClass' => '\DTS\eBaySDK\Inventory\Types\WithdrawOfferRestResponse', + 'params' => [ + 'offerId' => [ + 'valid' => ['string'], + 'required' => true + ] + ] + ], 'UpdateOffer' => [ 'method' => 'PUT', 'resource' => 'offer/{offerId}', @@ -710,6 +721,24 @@ public function publishOfferAsync(\DTS\eBaySDK\Inventory\Types\PublishOfferRestR return $this->callOperationAsync('PublishOffer', $request); } + /** + * @param \DTS\eBaySDK\Inventory\Types\WithdrawOfferRestRequest $request + * @return \DTS\eBaySDK\Inventory\Types\WithdrawOfferRestResponse + */ + public function withdrawOffer(\DTS\eBaySDK\Inventory\Types\WithdrawOfferRestRequest $request) + { + return $this->withdrawOfferAsync($request)->wait(); + } + + /** + * @param \DTS\eBaySDK\Inventory\Types\WithdrawOfferRestRequest $request + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function withdrawOfferAsync(\DTS\eBaySDK\Inventory\Types\WithdrawOfferRestRequest $request) + { + return $this->callOperationAsync('WithdrawOffer', $request); + } + /** * @param \DTS\eBaySDK\Inventory\Types\UpdateOfferRestRequest $request * @return \DTS\eBaySDK\Inventory\Types\UpdateOfferRestResponse diff --git a/src/Inventory/Types/WithdrawOfferRestRequest.php b/src/Inventory/Types/WithdrawOfferRestRequest.php new file mode 100644 index 0000000000..3df2ab41ee --- /dev/null +++ b/src/Inventory/Types/WithdrawOfferRestRequest.php @@ -0,0 +1,46 @@ + [ + 'type' => 'string', + 'repeatable' => false, + 'attribute' => false, + 'elementName' => 'offerId' + ] + ]; + + /** + * @param array $values Optional properties and values to assign to the object. + */ + public function __construct(array $values = []) + { + list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values); + + parent::__construct($parentValues); + + if (!array_key_exists(__CLASS__, self::$properties)) { + self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes); + } + + $this->setValues(__CLASS__, $childValues); + } +} diff --git a/src/Inventory/Types/WithdrawOfferRestResponse.php b/src/Inventory/Types/WithdrawOfferRestResponse.php new file mode 100644 index 0000000000..6dc9dccb7d --- /dev/null +++ b/src/Inventory/Types/WithdrawOfferRestResponse.php @@ -0,0 +1,65 @@ + [ + 'type' => 'DTS\eBaySDK\Inventory\Types\ErrorDetailV3', + 'repeatable' => true, + 'attribute' => false, + 'elementName' => 'errors' + ], + 'warnings' => [ + 'type' => 'DTS\eBaySDK\Inventory\Types\ErrorDetailV3', + 'repeatable' => true, + 'attribute' => false, + 'elementName' => 'warnings' + ] + ]; + + /** + * @param array $values Optional properties and values to assign to the object. + * @param int $statusCode Status code + * @param array $headers HTTP Response headers. + */ + public function __construct(array $values = [], $statusCode = 200, array $headers = []) + { + list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values); + + parent::__construct($parentValues); + + if (!array_key_exists(__CLASS__, self::$properties)) { + self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes); + } + + $this->setValues(__CLASS__, $childValues); + + $this->statusCode = (int)$statusCode; + + $this->setHeaders($headers); + } +} diff --git a/src/Inventory/Types/WithdrawResponse.php b/src/Inventory/Types/WithdrawResponse.php new file mode 100644 index 0000000000..15d6c28018 --- /dev/null +++ b/src/Inventory/Types/WithdrawResponse.php @@ -0,0 +1,46 @@ + [ + 'type' => 'string', + 'repeatable' => false, + 'attribute' => false, + 'elementName' => 'listingId' + ] + ]; + + /** + * @param array $values Optional properties and values to assign to the object. + */ + public function __construct(array $values = []) + { + list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values); + + parent::__construct($parentValues); + + if (!array_key_exists(__CLASS__, self::$properties)) { + self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes); + } + + $this->setValues(__CLASS__, $childValues); + } +} diff --git a/src/Sdk.php b/src/Sdk.php index 01a3d47b36..51aa35418d 100644 --- a/src/Sdk.php +++ b/src/Sdk.php @@ -30,7 +30,7 @@ */ class Sdk { - const VERSION = '13.0.3'; + const VERSION = '13.1.0'; /** * @var bool Controls if the SDK should enforce strict types diff --git a/test/Inventory/Types/WithdrawOfferRestRequestTest.php b/test/Inventory/Types/WithdrawOfferRestRequestTest.php new file mode 100644 index 0000000000..ff3815a85a --- /dev/null +++ b/test/Inventory/Types/WithdrawOfferRestRequestTest.php @@ -0,0 +1,33 @@ +obj = new WithdrawOfferRestRequest(); + } + + public function testCanBeCreated() + { + $this->assertInstanceOf('\DTS\eBaySDK\Inventory\Types\WithdrawOfferRestRequest', $this->obj); + } + + public function testExtendsBaseType() + { + $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj); + } +} diff --git a/test/Inventory/Types/WithdrawOfferRestResponseTest.php b/test/Inventory/Types/WithdrawOfferRestResponseTest.php new file mode 100644 index 0000000000..1ae89901a0 --- /dev/null +++ b/test/Inventory/Types/WithdrawOfferRestResponseTest.php @@ -0,0 +1,33 @@ +obj = new WithdrawOfferRestResponse(); + } + + public function testCanBeCreated() + { + $this->assertInstanceOf('\DTS\eBaySDK\Inventory\Types\WithdrawOfferRestResponse', $this->obj); + } + + public function testExtendsWithdrawResponse() + { + $this->assertInstanceOf('\DTS\eBaySDK\Inventory\Types\WithdrawResponse', $this->obj); + } +} diff --git a/test/Inventory/Types/WithdrawResponseTest.php b/test/Inventory/Types/WithdrawResponseTest.php new file mode 100644 index 0000000000..a94d0bb900 --- /dev/null +++ b/test/Inventory/Types/WithdrawResponseTest.php @@ -0,0 +1,33 @@ +obj = new WithdrawResponse(); + } + + public function testCanBeCreated() + { + $this->assertInstanceOf('\DTS\eBaySDK\Inventory\Types\WithdrawResponse', $this->obj); + } + + public function testExtendsBaseType() + { + $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj); + } +}