Disputes::updateDispute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Srmklive\PayPal\Traits\PayPalAPI;
4
5
trait Disputes
6
{
7
    /**
8
     * List disputes.
9
     *
10
     * @throws \Throwable
11
     *
12
     * @return array|\Psr\Http\Message\StreamInterface|string
13
     *
14
     * @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_list
15
     */
16
    public function listDisputes()
17
    {
18
        $this->apiEndPoint = "v1/customer/disputes?page_size={$this->page_size}";
19
20
        $this->verb = 'get';
21
22
        return $this->doPayPalRequest();
23
    }
24
25
    /**
26
     * Update a dispute.
27
     *
28
     * @param string $dispute_id
29
     * @param array  $data
30
     *
31
     * @throws \Throwable
32
     *
33
     * @return array|\Psr\Http\Message\StreamInterface|string
34
     *
35
     * @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_patch
36
     */
37
    public function updateDispute(string $dispute_id, array $data)
38
    {
39
        $this->apiEndPoint = "v1/customer/disputes/{$dispute_id}";
40
41
        $this->options['json'] = $data;
42
43
        $this->verb = 'patch';
44
45
        return $this->doPayPalRequest(false);
46
    }
47
48
    /**
49
     * Get dispute details.
50
     *
51
     * @param string $dispute_id
52
     *
53
     * @throws \Throwable
54
     *
55
     * @return array|\Psr\Http\Message\StreamInterface|string
56
     *
57
     * @see https://developer.paypal.com/docs/api/customer-disputes/v1/#disputes_get
58
     */
59
    public function showDisputeDetails(string $dispute_id)
60
    {
61
        $this->apiEndPoint = "v1/customer/disputes/{$dispute_id}";
62
63
        $this->verb = 'get';
64
65
        return $this->doPayPalRequest();
66
    }
67
}
68