Completed
Push — master ( 4e804b...c0f903 )
by ARCANEDEV
6s
created

Dispute   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 0
cbo 1
dl 0
loc 58
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 4 1
A all() 0 4 1
A save() 0 4 1
A close() 0 6 1
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\DisputeInterface;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class     Dispute
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 * @link     https://stripe.com/docs/api/php#dispute_object
12
 *
13
 * @property  string                                       id
14
 * @property  string                                       object // "dispute"
15
 * @property  bool                                         livemode
16
 * @property  int                                          amount
17
 * @property  string                                       charge
18
 * @property  int                                          created
19
 * @property  string                                       currency
20
 * @property  string                                       reason
21
 * @property  string                                       status
22
 * @property  array                                        balance_transactions
23
 * @property  \Arcanedev\Stripe\Resources\DisputeEvidence  evidence
24
 * @property  array|null                                   evidence_details
25
 * @property  bool                                         is_charge_refundable
26
 * @property  \Arcanedev\Stripe\AttachedObject             metadata
27
 *
28
 * @todo:    Update the properties.
29
 */
30
class Dispute extends StripeResource implements DisputeInterface
31
{
32
    /* ------------------------------------------------------------------------------------------------
33
     |  CRUD Functions
34
     | ------------------------------------------------------------------------------------------------
35
     */
36
    /**
37
     * Get a dispute by id.
38
     *
39
     * @param  string             $id
40
     * @param  array|string|null  $options
41
     *
42
     * @return self
43
     */
44 5
    public static function retrieve($id, $options = null)
45
    {
46 5
        return self::scopedRetrieve($id, $options);
47
    }
48
49
    /**
50
     * Get all disputes.
51
     *
52
     * @param  array|null         $params
53
     * @param  array|string|null  $options
54
     *
55
     * @return \Arcanedev\Stripe\Collection|array
56
     */
57 5
    public static function all($params = null, $options = null)
58
    {
59 5
        return self::scopedAll($params, $options);
60
    }
61
62
    /**
63
     * Save dispute.
64
     *
65
     * @param  array|string|null  $options
66
     *
67
     * @return self
68
     */
69 5
    public function save($options = null)
70
    {
71 5
        return self::scopedSave($options);
72
    }
73
74
    /**
75
     * Close dispute.
76
     *
77
     * @param  array|string|null  $options
78
     *
79
     * @return self
80
     */
81 5
    public function close($options = null)
82
    {
83 5
        $url = $this->instanceUrl() . '/close';
84
85 5
        return self::scopedPostCall($url, [], $options);
86
    }
87
}
88