Completed
Push — master ( 388c50...c3616e )
by ARCANEDEV
8s
created

Payout::retrieve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\Payout as PayoutContract;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class Payout
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 *
12
 * @property  string                            id
13
 * @property  string                            object
14
 * @property  int                               amount
15
 * @property  string                            balance_transaction
16
 * @property  string                            cancellation_balance_transaction
17
 * @property  int                               created
18
 * @property  string                            currency
19
 * @property  int                               arrival_date
20
 * @property  string                            destination
21
 * @property  string                            failure_code
22
 * @property  string                            failure_message
23
 * @property  bool                              livemode
24
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
25
 * @property  string                            method
26
 * @property  string                            recipient
27
 * @property  string                            source_type
28
 * @property  string                            statement_descriptor
29
 * @property  string                            status
30
 * @property  string                            type
31
 */
32
class Payout extends StripeResource implements PayoutContract
33
{
34
    /* -----------------------------------------------------------------
35
     |  Main Methods
36
     | -----------------------------------------------------------------
37
     */
38
39
    /**
40
     * Retrieve a payout.
41
     *
42
     * @param  string             $id
43
     * @param  array|string|null  $options
44
     *
45
     * @return self
46
     */
47 6
    public static function retrieve($id, $options = null)
48
    {
49 6
        return self::scopedRetrieve($id, $options);
50
    }
51
52
    /**
53
     * List all the payouts.
54
     *
55
     * @param  array|null         $params
56
     * @param  array|string|null  $options
57
     *
58
     * @return \Arcanedev\Stripe\Collection|array
59
     */
60
    public static function all($params = null, $options = null)
61
    {
62
        return self::scopedAll($params, $options);
63
    }
64
65
    /**
66
     * Create the payout.
67
     *
68
     * @param  array|null         $params
69
     * @param  array|string|null  $options
70
     *
71
     * @return self
72
     */
73 8
    public static function create($params = null, $options = null)
74
    {
75 8
        return self::scopedCreate($params, $options);
76
    }
77
78
    /**
79
     * Update the payout.
80
     *
81
     * @param  string            $id
82
     * @param  array|null        $params
83
     * @param  array|string|null $options
84
     *
85
     * @return self
86
     */
87
    public static function update($id, $params = null, $options = null)
88
    {
89
        return self::scopedUpdate($id, $params, $options);
90
    }
91
92
    /**
93
     * Cancel the payout.
94
     *
95
     * @return self
96
     */
97
    public function cancel()
98
    {
99
        list($response, $options) = $this->request('post', $this->instanceUrl().'/cancel');
100
        $this->refreshFrom($response, $options);
101
102
        return $this;
103
    }
104
105
    /**
106
     * Save the payout.
107
     *
108
     * @param  array|string|null  $options
109
     *
110
     * @return self
111
     */
112 4
    public function save($options = null)
113
    {
114 4
        return $this->scopedSave($options);
115
    }
116
}
117