| 1 |
<?php |
| 2 |
|
| 3 |
// File generated from our OpenAPI spec |
| 4 |
|
| 5 |
namespace Stripe\Service; |
| 6 |
|
| 7 |
class RefundService extends \Stripe\Service\AbstractService |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Returns a list of all refunds you’ve previously created. The refunds are |
| 11 |
* returned in sorted order, with the most recent refunds appearing first. For |
| 12 |
* convenience, the 10 most recent refunds are always available by default on the |
| 13 |
* charge object. |
| 14 |
* |
| 15 |
* @param null|array $params |
| 16 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 17 |
* |
| 18 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 19 |
* |
| 20 |
* @return \Stripe\Collection<\Stripe\Refund> |
| 21 |
*/ |
| 22 |
public function all($params = null, $opts = null) |
| 23 |
{ |
| 24 |
return $this->requestCollection('get', '/v1/refunds', $params, $opts); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Cancels a refund with a status of <code>requires_action</code>. |
| 29 |
* |
| 30 |
* Refunds in other states cannot be canceled, and only refunds for payment methods |
| 31 |
* that require customer action will enter the <code>requires_action</code> state. |
| 32 |
* |
| 33 |
* @param string $id |
| 34 |
* @param null|array $params |
| 35 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 36 |
* |
| 37 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 38 |
* |
| 39 |
* @return \Stripe\Refund |
| 40 |
*/ |
| 41 |
public function cancel($id, $params = null, $opts = null) |
| 42 |
{ |
| 43 |
return $this->request('post', $this->buildPath('/v1/refunds/%s/cancel', $id), $params, $opts); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Create a refund. |
| 48 |
* |
| 49 |
* @param null|array $params |
| 50 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 51 |
* |
| 52 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 53 |
* |
| 54 |
* @return \Stripe\Refund |
| 55 |
*/ |
| 56 |
public function create($params = null, $opts = null) |
| 57 |
{ |
| 58 |
return $this->request('post', '/v1/refunds', $params, $opts); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Retrieves the details of an existing refund. |
| 63 |
* |
| 64 |
* @param string $id |
| 65 |
* @param null|array $params |
| 66 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 67 |
* |
| 68 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 69 |
* |
| 70 |
* @return \Stripe\Refund |
| 71 |
*/ |
| 72 |
public function retrieve($id, $params = null, $opts = null) |
| 73 |
{ |
| 74 |
return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Updates the specified refund by setting the values of the parameters passed. Any |
| 79 |
* parameters not provided will be left unchanged. |
| 80 |
* |
| 81 |
* This request only accepts <code>metadata</code> as an argument. |
| 82 |
* |
| 83 |
* @param string $id |
| 84 |
* @param null|array $params |
| 85 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 86 |
* |
| 87 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 88 |
* |
| 89 |
* @return \Stripe\Refund |
| 90 |
*/ |
| 91 |
public function update($id, $params = null, $opts = null) |
| 92 |
{ |
| 93 |
return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); |
| 94 |
} |
| 95 |
} |
| 96 |
|