| 1 |
<?php |
| 2 |
namespace Payplug; |
| 3 |
|
| 4 |
/** |
| 5 |
* The Refund DAO simplifies the access to most useful methods |
| 6 |
**/ |
| 7 |
class Refund { |
| 8 |
/** |
| 9 |
* Creates a refund on a payment. |
| 10 |
* |
| 11 |
* @param string|Payment $payment the payment id or the payment object |
| 12 |
* @param array $data API data for refund |
| 13 |
* @param Payplug $payplug the client configuration |
| 14 |
* |
| 15 |
* @return null|Refund the refund object |
| 16 |
* @throws Exception\ConfigurationNotSetException |
| 17 |
*/ |
| 18 |
public static function create($payment, array $data = null, Payplug $payplug = null) |
| 19 |
{ |
| 20 |
return Resource\Refund::create($payment, $data, $payplug); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Retrieves a refund object on a payment. |
| 25 |
* |
| 26 |
* @param string|Payment $payment the payment id or the payment object |
| 27 |
* @param string $refundId the refund id |
| 28 |
* @param Payplug $payplug the client configuration |
| 29 |
* |
| 30 |
* @return null|Resource\APIResource|Refund the refund object |
| 31 |
* |
| 32 |
* @throws Exception\ConfigurationNotSetException |
| 33 |
*/ |
| 34 |
public static function retrieve($payment, $refundId, Payplug $payplug = null) |
| 35 |
{ |
| 36 |
return Resource\Refund::retrieve($payment, $refundId, $payplug); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Lists the last refunds of a payment. |
| 41 |
* |
| 42 |
* @param string|Payment $payment the payment id or the payment object |
| 43 |
* @param Payplug $payplug the client configuration |
| 44 |
* |
| 45 |
* @return null|Refund[] an array containing the refunds on success. |
| 46 |
* |
| 47 |
* @throws Exception\ConfigurationNotSetException |
| 48 |
* @throws Exception\UnexpectedAPIResponseException |
| 49 |
*/ |
| 50 |
public static function listRefunds($payment, Payplug $payplug = null) |
| 51 |
{ |
| 52 |
return Resource\Refund::listRefunds($payment, $payplug); |
| 53 |
} |
| 54 |
} |