Completed
Pull Request — master (#22)
by ARCANEDEV
07:43
created

Refund::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 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\RefundInterface;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class     Refund
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 * @link     https://stripe.com/docs/api/php#refund_object
12
 *
13
 * @property  string                            id
14
 * @property  string                            object               // 'refund'
15
 * @property  int                               amount
16
 * @property  string                            balance_transaction
17
 * @property  string                            charge
18
 * @property  int                               created              // timestamp
19
 * @property  string                            currency
20
 * @property  string                            description
21
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
22
 * @property  string                            reason
23
 * @property  string                            receipt_number
24
 */
25
class Refund extends StripeResource implements RefundInterface
26
{
27
    /* ------------------------------------------------------------------------------------------------
28
     |  CRUD Functions
29
     | ------------------------------------------------------------------------------------------------
30
     */
31
    /**
32
     * Retrieve a Refund by ID.
33
     * @link   https://stripe.com/docs/api/php#retrieve_refund
34
     *
35
     * @param  string             $id
36
     * @param  array|string|null  $options
37
     *
38
     * @return self
39
     */
40 5
    public static function retrieve($id, $options = null)
41
    {
42 5
        return self::scopedRetrieve($id, $options);
43
    }
44
45
    /**
46
     * List all refunds.
47
     * @link   https://stripe.com/docs/api/php#list_refunds
48
     *
49
     * @param  array|null         $params
50
     * @param  array|string|null  $options
51
     *
52
     * @return \Arcanedev\Stripe\Collection|array
53
     */
54 10
    public static function all($params = [], $options = null)
55
    {
56 10
        return self::scopedAll($params, $options);
57
    }
58
59
    /**
60
     * Create a Refund.
61
     * @link   https://stripe.com/docs/api/php#create_refund
62
     *
63
     * @param  array|null         $params
64
     * @param  array|string|null  $options
65
     *
66
     * @return self
67
     */
68 20
    public static function create($params = [], $options = null)
69
    {
70 20
        return self::scopedCreate($params, $options);
71
    }
72
73
    /**
74
     * Update a Refund.
75
     * @link   https://stripe.com/docs/api/php#update_refund
76
     *
77
     * @param  string             $id
78
     * @param  array|null         $params
79
     * @param  array|string|null  $options
80
     *
81
     * @return self
82
     */
83
    public static function update($id, $params = [], $options = null)
84
    {
85
        return self::scopedUpdate($id, $params, $options);
86
    }
87
88
    /**
89
     * Update/Save a Refund.
90
     * @link   https://stripe.com/docs/api/php#update_refund
91
     *
92
     * @param  array|string|null  $options
93
     *
94
     * @return self
95
     */
96 10
    public function save($options = null)
97
    {
98 10
        return self::scopedSave($options);
99
    }
100
}
101