This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TaxCategory): support setKey for tax categories
Closes #339
- Loading branch information
Jens Schulze
committed
Sep 11, 2017
1 parent
67a1246
commit 6c41b97
Showing
9 changed files
with
260 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/Core/Request/TaxCategories/Command/TaxCategorySetKeyAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\TaxCategories\Command; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractAction; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\TaxCategories\Command | ||
* @link http://dev.commercetools.com/http-api-projects-taxCategories.html#set-key | ||
* @method string getKey() | ||
* @method TaxCategorySetKeyAction setKey(string $key = null) | ||
* @method string getAction() | ||
* @method TaxCategorySetKeyAction setAction(string $action = null) | ||
*/ | ||
class TaxCategorySetKeyAction extends AbstractAction | ||
{ | ||
public function fieldDefinitions() | ||
{ | ||
return [ | ||
'action' => [static::TYPE => 'string'], | ||
'key' => [static::TYPE => 'string'] | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @param Context|callable $context | ||
*/ | ||
public function __construct(array $data = [], $context = null) | ||
{ | ||
parent::__construct($data, $context); | ||
$this->setAction('setKey'); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param Context|callable $context | ||
* @return TaxCategorySetKeyAction | ||
*/ | ||
public static function ofKey($key, $context = null) | ||
{ | ||
return static::of($context)->setKey($key); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/Core/Request/TaxCategories/TaxCategoryByKeyGetRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\TaxCategories; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\TaxCategory\TaxCategory; | ||
use Commercetools\Core\Request\AbstractByKeyGetRequest; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\TaxCategories | ||
* @method TaxCategory mapResponse(ApiResponseInterface $response) | ||
* @method TaxCategory mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class TaxCategoryByKeyGetRequest extends AbstractByKeyGetRequest | ||
{ | ||
protected $resultClass = TaxCategory::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, Context $context = null) | ||
{ | ||
parent::__construct(TaxCategoriesEndpoint::endpoint(), $key, $context); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
* @return TaxCategoryByKeyGetRequest | ||
*/ | ||
public static function ofKey($key, Context $context = null) | ||
{ | ||
return new static($key, $context); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Core/Request/TaxCategories/TaxCategoryDeleteByKeyRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\TaxCategories; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractDeleteByKeyRequest; | ||
use Commercetools\Core\Model\TaxCategory\TaxCategory; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\TaxCategories | ||
* @link http://dev.commercetools.com/http-api-projects-taxCategories.html#delete-taxcategory | ||
* @method TaxCategory mapResponse(ApiResponseInterface $response) | ||
* @method TaxCategory mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class TaxCategoryDeleteByKeyRequest extends AbstractDeleteByKeyRequest | ||
{ | ||
protected $resultClass = TaxCategory::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param int $version | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, $version, Context $context = null) | ||
{ | ||
parent::__construct(TaxCategoriesEndpoint::endpoint(), $key, $version, $context); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param int $version | ||
* @param Context $context | ||
* @return static | ||
*/ | ||
public static function ofKeyAndVersion($key, $version, Context $context = null) | ||
{ | ||
return new static($key, $version, $context); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Core/Request/TaxCategories/TaxCategoryUpdateByKeyRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\TaxCategories; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractUpdateByKeyRequest; | ||
use Commercetools\Core\Model\TaxCategory\TaxCategory; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\TaxCategories | ||
* @link http://dev.commercetools.com/http-api-projects-taxCategories.html#update-taxcategory | ||
* @method TaxCategory mapResponse(ApiResponseInterface $response) | ||
* @method TaxCategory mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class TaxCategoryUpdateByKeyRequest extends AbstractUpdateByKeyRequest | ||
{ | ||
protected $resultClass = TaxCategory::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param int $version | ||
* @param array $actions | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, $version, array $actions = [], Context $context = null) | ||
{ | ||
parent::__construct(TaxCategoriesEndpoint::endpoint(), $key, $version, $actions, $context); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param int $version | ||
* @param Context $context | ||
* @return static | ||
*/ | ||
public static function ofKeyAndVersion($key, $version, Context $context = null) | ||
{ | ||
return new static($key, $version, [], $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -665,6 +665,7 @@ taxCategory: | |
- name | ||
- description | ||
- rates | ||
- key | ||
|
||
taxRate: | ||
domain: taxCategory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters