1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Bases\ExternalAccount; |
4
|
|
|
use Arcanedev\Stripe\Contracts\Resources\BitcoinReceiver as BitcoinReceiverContract; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class BitcoinReceiver |
8
|
|
|
* |
9
|
|
|
* @package Arcanedev\Stripe\Resources |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
* @link https://stripe.com/docs/api/php#bitcoin_receivers |
12
|
|
|
* |
13
|
|
|
* @property string id |
14
|
|
|
* @property string object |
15
|
|
|
* @property bool active |
16
|
|
|
* @property int amount |
17
|
|
|
* @property int amount_received |
18
|
|
|
* @property int bitcoin_amount |
19
|
|
|
* @property int bitcoin_amount_received |
20
|
|
|
* @property string bitcoin_uri |
21
|
|
|
* @property int created |
22
|
|
|
* @property string currency |
23
|
|
|
* @property Customer customer |
24
|
|
|
* @property string description |
25
|
|
|
* @property string email |
26
|
|
|
* @property bool filled |
27
|
|
|
* @property string inbound_address |
28
|
|
|
* @property bool livemode |
29
|
|
|
* @property \Arcanedev\Stripe\AttachedObject metadata |
30
|
|
|
* @property string payment |
31
|
|
|
* @property string refund_address |
32
|
|
|
* @property \Arcanedev\Stripe\Collection transactions |
33
|
|
|
* @property bool uncaptured_funds |
34
|
|
|
* @property bool used_for_payment |
35
|
|
|
*/ |
36
|
|
|
class BitcoinReceiver extends ExternalAccount implements BitcoinReceiverContract |
37
|
|
|
{ |
38
|
|
|
/* ------------------------------------------------------------------------------------------------ |
39
|
|
|
| Getters & Setters |
40
|
|
|
| ------------------------------------------------------------------------------------------------ |
41
|
|
|
*/ |
42
|
|
|
/** |
43
|
|
|
* @return string The instance URL for this resource. It needs to be special |
44
|
|
|
* cased because it doesn't fit into the standard resource pattern. |
45
|
|
|
*/ |
46
|
3 |
|
public function instanceUrl() |
47
|
|
|
{ |
48
|
3 |
|
if ( ! is_null($result = parent::instanceUrl())) |
49
|
1 |
|
return $result; |
50
|
|
|
|
51
|
3 |
|
return self::classUrl().'/'.urlencode(str_utf8($this['id'])); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* The class URL for this resource. |
56
|
|
|
* It needs to be special cased because it does not fit into the standard resource pattern. |
57
|
|
|
* |
58
|
|
|
* @param string $class |
59
|
|
|
* |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
27 |
|
public static function classUrl($class = '') |
63
|
|
|
{ |
64
|
27 |
|
return '/v1/bitcoin/receivers'; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/* ------------------------------------------------------------------------------------------------ |
68
|
|
|
| Main Functions |
69
|
|
|
| ------------------------------------------------------------------------------------------------ |
70
|
|
|
*/ |
71
|
|
|
/** |
72
|
|
|
* Retrieve Bitcoin Receiver. |
73
|
|
|
* @link https://stripe.com/docs/api/php#retrieve_bitcoin_receiver |
74
|
|
|
* |
75
|
|
|
* @param string $id |
76
|
|
|
* @param string|null $options |
77
|
|
|
* |
78
|
|
|
* @return self |
79
|
|
|
*/ |
80
|
|
|
public static function retrieve($id, $options = null) |
81
|
|
|
{ |
82
|
|
|
return self::scopedRetrieve($id, $options); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* List all Bitcoin Receivers. |
87
|
|
|
* @link https://stripe.com/docs/api/php#list_bitcoin_receivers |
88
|
|
|
* |
89
|
|
|
* @param array|null $params |
90
|
|
|
* @param string|null $options |
91
|
|
|
* |
92
|
|
|
* @return \Arcanedev\Stripe\Collection|array |
93
|
|
|
*/ |
94
|
|
|
public static function all($params = [], $options = null) |
95
|
|
|
{ |
96
|
|
|
return self::scopedAll($params, $options); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Create Bitcoin Receiver Object. |
101
|
|
|
* @link https://stripe.com/docs/api/php#create_bitcoin_receiver |
102
|
|
|
* |
103
|
|
|
* @param array|null $params |
104
|
|
|
* @param string|null $options |
105
|
|
|
* |
106
|
|
|
* @return self|array |
107
|
|
|
*/ |
108
|
24 |
|
public static function create($params = [], $options = null) |
109
|
|
|
{ |
110
|
24 |
|
return self::scopedCreate($params, $options); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Refund the Bitcoin Receiver item. |
115
|
|
|
* |
116
|
|
|
* @param array|null $params |
117
|
|
|
* @param array|string|null $options |
118
|
|
|
* |
119
|
|
|
* @return self |
120
|
|
|
*/ |
121
|
|
|
public function refund($params = [], $options = null) |
122
|
|
|
{ |
123
|
|
|
list($response, $opts) = $this->request( |
124
|
|
|
'post', $this->instanceUrl().'/refund', $params, $options |
125
|
|
|
); |
126
|
|
|
|
127
|
|
|
$this->refreshFrom($response, $opts); |
128
|
|
|
|
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|