-
Notifications
You must be signed in to change notification settings - Fork 176
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 #121 from fraterblack/master
Implemented RestRefundCaptureRequest to refund captured payments. And RestVoidRequest to void a previously authorized payments
- Loading branch information
Showing
4 changed files
with
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* PayPal REST Refund Captured Payment Request | ||
*/ | ||
|
||
namespace Omnipay\PayPal\Message; | ||
|
||
/** | ||
* PayPal REST Refund Captured Payment Request | ||
* | ||
* Use this call to refund a captured payment. | ||
* | ||
* @link https://developer.paypal.com/docs/api/#refund-a-captured-payment | ||
* @see RestAuthorizeRequest | ||
* @see RestCaptureRequest | ||
*/ | ||
class RestRefundCaptureRequest extends AbstractRestRequest | ||
{ | ||
public function getData() | ||
{ | ||
$this->validate('transactionReference'); | ||
|
||
return array( | ||
'amount' => array( | ||
'currency' => $this->getCurrency(), | ||
'total' => $this->getAmount(), | ||
), | ||
'description' => $this->getDescription(), | ||
); | ||
} | ||
|
||
public function getEndpoint() | ||
{ | ||
return parent::getEndpoint() . '/payments/capture/' . $this->getTransactionReference() . '/refund'; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
/** | ||
* PayPal REST Void an authorization | ||
*/ | ||
|
||
namespace Omnipay\PayPal\Message; | ||
|
||
/** | ||
* PayPal REST Void an authorization | ||
* | ||
* Use this call to void a previously authorized payment. | ||
* Note: A fully captured authorization cannot be voided. | ||
* | ||
* @link https://developer.paypal.com/docs/api/#void-an-authorization | ||
* @see RestAuthorizeRequest | ||
*/ | ||
class RestVoidRequest extends AbstractRestRequest | ||
{ | ||
public function getData() | ||
{ | ||
$this->validate('transactionReference'); | ||
} | ||
|
||
public function getEndpoint() | ||
{ | ||
return parent::getEndpoint() . '/payments/authorization/' . $this->getTransactionReference() . '/void'; | ||
} | ||
} |
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