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(ShippingMethod): support shipping method by key functionality
Closes #329
- Loading branch information
Jens Schulze
committed
Aug 9, 2017
1 parent
f7291ae
commit 3ba9596
Showing
7 changed files
with
160 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
42 changes: 42 additions & 0 deletions
42
src/Core/Request/ShippingMethods/ShippingMethodByKeyGetRequest.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,42 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\ShippingMethods; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\ShippingMethod\ShippingMethod; | ||
use Commercetools\Core\Request\AbstractByKeyGetRequest; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ShippingMethods | ||
* @link https://dev.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethod-by-key | ||
* @method ShippingMethod mapResponse(ApiResponseInterface $response) | ||
* @method ShippingMethod mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class ShippingMethodByKeyGetRequest extends AbstractByKeyGetRequest | ||
{ | ||
protected $resultClass = ShippingMethod::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, Context $context = null) | ||
{ | ||
parent::__construct(ShippingMethodsEndpoint::endpoint(), $key, $context); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
* @return static | ||
*/ | ||
public static function ofKey($key, Context $context = null) | ||
{ | ||
return new static($key, $context); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Core/Request/ShippingMethods/ShippingMethodDeleteByKeyRequest.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\ShippingMethods; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\ShippingMethod\ShippingMethod; | ||
use Commercetools\Core\Request\AbstractDeleteByKeyRequest; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ShippingMethods | ||
* @link http://dev.commercetools.com/http-api-projects-shippingMethods.html#delete-shippingmethod-by-key | ||
* @method ShippingMethod mapResponse(ApiResponseInterface $response) | ||
* @method ShippingMethod mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class ShippingMethodDeleteByKeyRequest extends AbstractDeleteByKeyRequest | ||
{ | ||
protected $resultClass = ShippingMethod::class; | ||
|
||
/** | ||
* @param string $id | ||
* @param int $version | ||
* @param Context $context | ||
*/ | ||
public function __construct($id, $version, Context $context = null) | ||
{ | ||
parent::__construct(ShippingMethodsEndpoint::endpoint(), $id, $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/ShippingMethods/ShippingMethodUpdateByKeyRequest.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\ShippingMethods; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\ShippingMethod\ShippingMethod; | ||
use Commercetools\Core\Request\AbstractUpdateByKeyRequest; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ShippingMethods | ||
* @link http://dev.commercetools.com/http-api-projects-shippingMethods.html#update-shippingmethod-by-key | ||
* @method ShippingMethod mapResponse(ApiResponseInterface $response) | ||
* @method ShippingMethod mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class ShippingMethodUpdateByKeyRequest extends AbstractUpdateByKeyRequest | ||
{ | ||
protected $resultClass = ShippingMethod::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param string $version | ||
* @param array $actions | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, $version, array $actions = [], Context $context = null) | ||
{ | ||
parent::__construct(ShippingMethodsEndpoint::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 |
---|---|---|
|
@@ -800,6 +800,7 @@ shippingMethod: | |
- taxCategory | ||
- zoneRates | ||
- isDefault | ||
- key | ||
|
||
zoneRate: | ||
domain: shippingMethod | ||
|
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