Dispute::save()   A
last analyzed

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
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\Dispute as DisputeContract;
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  int                                          amount
16
 * @property  array                                        balance_transactions
17
 * @property  string                                       charge
18
 * @property  int                                          created               // timestamp
19
 * @property  string                                       currency
20
 * @property  \Arcanedev\Stripe\AttachedObject             evidence
21
 * @property  \Arcanedev\Stripe\StripeObject               evidence_details
22
 * @property  bool                                         is_charge_refundable
23
 * @property  bool                                         livemode
24
 * @property  \Arcanedev\Stripe\AttachedObject             metadata
25
 * @property  string                                       reason
26
 * @property  string                                       status
27
 */
28
class Dispute extends StripeResource implements DisputeContract
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Main Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Get all Disputes.
36
     * @link   https://stripe.com/docs/api/php#list_disputes
37
     *
38
     * @param  array|null         $params
39
     * @param  array|string|null  $options
40
     *
41
     * @return \Arcanedev\Stripe\Collection|array
42
     */
43 2
    public static function all($params = [], $options = null)
44
    {
45 2
        return self::scopedAll($params, $options);
46
    }
47
48
    /**
49
     * Get a Dispute by id.
50
     * @link   https://stripe.com/docs/api/php#retrieve_dispute
51
     *
52
     * @param  string             $id
53
     * @param  array|string|null  $options
54
     *
55
     * @return self
56
     */
57 6
    public static function retrieve($id, $options = null)
58
    {
59 6
        return self::scopedRetrieve($id, $options);
60
    }
61
62
    /**
63
     * Update a Dispute.
64
     * @link   https://stripe.com/docs/api/php#update_dispute
65
     *
66
     * @param  string             $id
67
     * @param  array|null         $params
68
     * @param  array|string|null  $options
69
     *
70
     * @return self
71
     */
72 2
    public static function update($id, $params = [], $options = null)
73
    {
74 2
        return self::scopedUpdate($id, $params, $options);
75
    }
76
77
    /**
78
     * Save a Dispute.
79
     * @link   https://stripe.com/docs/api/php#update_dispute
80
     *
81
     * @param  array|string|null  $options
82
     *
83
     * @return self
84
     */
85 2
    public function save($options = null)
86
    {
87 2
        return self::scopedSave($options);
88
    }
89
90
    /**
91
     * Close a Dispute.
92
     * @link   https://stripe.com/docs/api/php#close_dispute
93
     *
94
     * @param  array|string|null  $options
95
     *
96
     * @return self
97
     */
98 2
    public function close($options = null)
99
    {
100 2
        return self::scopedPostCall($this->instanceUrl().'/close', [], $options);
101
    }
102
}
103