-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from krystianbajno/master
Refunds support
- Loading branch information
Showing
13 changed files
with
415 additions
and
19 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
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,71 @@ | ||
<?php | ||
|
||
namespace Evilnet\Dotpay\DotpayApi\Requests; | ||
|
||
use Evilnet\Dotpay\DotpayApi\Contracts\IRequest; | ||
use Evilnet\Dotpay\Exceptions\RequestIntegrityException; | ||
|
||
/** | ||
* Class CreateRefund | ||
* @package Evilnet\Dotpay\DotpayApi\Requests | ||
*/ | ||
class CreateRefund extends AbstractRequest implements IRequest | ||
{ | ||
/** | ||
* @var | ||
*/ | ||
protected $amount; | ||
|
||
/** | ||
* @var | ||
*/ | ||
protected $description; | ||
|
||
/** | ||
* @var | ||
*/ | ||
protected $control; | ||
|
||
/** | ||
* @var | ||
*/ | ||
protected $operation_number; | ||
|
||
/** | ||
* CreateRefund constructor. | ||
* @param $operation_number | ||
* @param $data | ||
* @throws RequestIntegrityException | ||
*/ | ||
public function __construct($operation_number, $data) | ||
{ | ||
if(!$operation_number){ | ||
throw new RequestIntegrityException("Operation number is not set"); | ||
} | ||
|
||
$this->operation_number = $operation_number; | ||
|
||
foreach ($data as $key => $value) { | ||
if(!$value || is_numeric($value) && $value <= 0){ | ||
throw new RequestIntegrityException(); | ||
} | ||
$this->$key = $value; | ||
} | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function method() | ||
{ | ||
return 'POST'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function path() | ||
{ | ||
return 'api/v1/payments/'.$this->operation_number.'/refund/'; | ||
} | ||
} |
Oops, something went wrong.