-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added amount to be captured for /payment-requests/{paymentRequestId}/…
…capture endpoint
- Loading branch information
1 parent
185a822
commit 342bcfd
Showing
3 changed files
with
50 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Paysera\Client\CheckoutClient\Entity; | ||
|
||
use Evp\Component\Money\Money; | ||
use Paysera\Component\RestClientCommon\Entity\Entity; | ||
|
||
class CaptureParameters extends Entity | ||
{ | ||
public function __construct(array $data = []) | ||
{ | ||
parent::__construct($data); | ||
} | ||
|
||
/** | ||
* @return Money|null | ||
*/ | ||
public function getCaptureAmount() | ||
{ | ||
return $this->get('capture_amount') !== null | ||
? new Money($this->get('capture_amount')['amount'], $this->get('capture_amount')['currency']) | ||
: null | ||
; | ||
} | ||
|
||
/** | ||
* @param Money|null $captureAmount | ||
* | ||
* @return self | ||
*/ | ||
public function setCaptureAmount(Money $captureAmount = null) | ||
{ | ||
if ($captureAmount === null) { | ||
$this->set('capture_amount', null); | ||
} else { | ||
$this->set('capture_amount', [ | ||
'amount' => $captureAmount->getAmount(), | ||
'currency' => $captureAmount->getCurrency() | ||
]); | ||
} | ||
|
||
return $this; | ||
} | ||
} |