1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Contracts\Resources\TransferReversal as TransferReversalContract; |
4
|
|
|
use Arcanedev\Stripe\Exceptions\InvalidRequestException; |
5
|
|
|
use Arcanedev\Stripe\StripeResource; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class TransferReversal |
9
|
|
|
* |
10
|
|
|
* @package Arcanedev\Stripe\Resources |
11
|
|
|
* @author ARCANEDEV <[email protected]> |
12
|
|
|
* @link https://stripe.com/docs/api/php#transfer_reversal_object |
13
|
|
|
* |
14
|
|
|
* @property string id |
15
|
|
|
* @property string object // 'transfer_reversal' |
16
|
|
|
* @property int amount |
17
|
|
|
* @property string balance_transaction |
18
|
|
|
* @property int created // timestamp |
19
|
|
|
* @property string currency |
20
|
|
|
* @property \Arcanedev\Stripe\AttachedObject metadata |
21
|
|
|
* @property string transfer |
22
|
|
|
*/ |
23
|
|
|
class TransferReversal extends StripeResource implements TransferReversalContract |
24
|
|
|
{ |
25
|
|
|
/* ------------------------------------------------------------------------------------------------ |
26
|
|
|
| Getters & Setters |
27
|
|
|
| ------------------------------------------------------------------------------------------------ |
28
|
|
|
*/ |
29
|
|
|
/** |
30
|
|
|
* Get API URL for this Stripe transfer reversal. |
31
|
|
|
* |
32
|
|
|
* @throws \Arcanedev\Stripe\Exceptions\InvalidRequestException |
33
|
|
|
* |
34
|
|
|
* @return string |
35
|
|
|
*/ |
36
|
|
|
public function instanceUrl() |
37
|
|
|
{ |
38
|
|
|
if (is_null($id = $this['id'])) { |
39
|
|
|
throw new InvalidRequestException( |
40
|
|
|
'Could not determine which URL to request: class instance has invalid ID [null]', |
41
|
|
|
null |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
return implode('/', [ |
46
|
|
|
Transfer::classUrl(), |
47
|
|
|
urlencode(str_utf8($this['transfer'])), |
48
|
|
|
'reversals', |
49
|
|
|
urlencode(str_utf8($id)), |
50
|
|
|
]); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/* ------------------------------------------------------------------------------------------------ |
54
|
|
|
| Main Functions |
55
|
|
|
| ------------------------------------------------------------------------------------------------ |
56
|
|
|
*/ |
57
|
|
|
/** |
58
|
|
|
* Saved the transfer reversal. |
59
|
|
|
* @link https://stripe.com/docs/api/php#update_transfer_reversal |
60
|
|
|
* |
61
|
|
|
* @param array|string|null $options |
62
|
|
|
* |
63
|
|
|
* @return self |
64
|
|
|
*/ |
65
|
|
|
public function save($options = null) |
66
|
|
|
{ |
67
|
|
|
return $this->scopedSave($options); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|