Completed
Pull Request — master (#18)
by ARCANEDEV
07:31
created

Refund   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
c 5
b 0
f 1
dl 0
loc 61
wmc 4
lcom 0
cbo 1
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 4 1
A all() 0 4 1
A create() 0 4 1
A save() 0 4 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 = null, $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 = null, $options = null)
69
    {
70 20
        return self::scopedCreate($params, $options);
71
    }
72
73
    /**
74
     * Update/Save a Refund.
75
     * @link   https://stripe.com/docs/api/php#update_refund
76
     *
77
     * @param  array|string|null  $options
78
     *
79
     * @return self
80
     */
81 10
    public function save($options = null)
82
    {
83 10
        return self::scopedSave($options);
84
    }
85
}
86