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(Payment): support get/update/delete payment by key
Closes #349
- Loading branch information
Jens Schulze
committed
Oct 4, 2017
1 parent
e68aaf0
commit da32ce6
Showing
5 changed files
with
175 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\Payments; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\Type\Type; | ||
use Commercetools\Core\Request\AbstractByKeyGetRequest; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\Payment\Payment; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\Payments | ||
* @link https://dev.commercetools.com/http-api-projects-payments.html#get-payment-by-key | ||
* @method Payment mapResponse(ApiResponseInterface $response) | ||
* @method Payment mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class PaymentByKeyGetRequest extends AbstractByKeyGetRequest | ||
{ | ||
protected $resultClass = Payment::class; | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
*/ | ||
public function __construct($key, Context $context = null) | ||
{ | ||
parent::__construct(PaymentsEndpoint::endpoint(), $key, $context); | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param Context $context | ||
* @return static | ||
*/ | ||
public static function ofKey($key, Context $context = null) | ||
{ | ||
return new static($key, $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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\Payments; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractDeleteByKeyRequest; | ||
use Commercetools\Core\Model\Type\Type; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\Payment\Payment; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\Payments | ||
* @link https://dev.commercetools.com/http-api-projects-payments.html#delete-payment-by-key | ||
* @method Payment mapResponse(ApiResponseInterface $response) | ||
* @method Payment mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class PaymentDeleteByKeyRequest extends AbstractDeleteByKeyRequest | ||
{ | ||
protected $resultClass = Payment::class; | ||
|
||
/** | ||
* @param string $id | ||
* @param int $version | ||
* @param Context $context | ||
*/ | ||
public function __construct($id, $version, Context $context = null) | ||
{ | ||
parent::__construct(PaymentsEndpoint::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); | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\Payments; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractUpdateByKeyRequest; | ||
use Commercetools\Core\Request\AbstractUpdateRequest; | ||
use Commercetools\Core\Model\Payment\Payment; | ||
use Commercetools\Core\Response\ApiResponseInterface; | ||
use Commercetools\Core\Model\MapperInterface; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\Payments | ||
* @link https://dev.commercetools.com/http-api-projects-payments.html#update-payment-by-key | ||
* @method Payment mapResponse(ApiResponseInterface $response) | ||
* @method Payment mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) | ||
*/ | ||
class PaymentUpdateByKeyRequest extends AbstractUpdateByKeyRequest | ||
{ | ||
protected $resultClass = Payment::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(PaymentsEndpoint::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
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