Refund::list()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Iamolayemi\Paystack\Endpoints;
4
5
class Refund extends Endpoint
6
{
7
    protected const ENDPOINT = '/refund';
8
9
    /**
10
     * Initiate a refund on your integration.
11
     *
12
     * @param  array<string, mixed>  $payload
13
     *
14
     * @link https://paystack.com/docs/api/#refund-create
15
     */
16
    public function create(array $payload): self
17
    {
18
        $this->post($this->url(self::ENDPOINT), $payload);
19
20
        return $this;
21
    }
22
23
    /**
24
     * List refunds available on your integration.
25
     *
26
     * @param  array<string, mixed>  $query
27
     *
28
     * @link https://paystack.com/docs/api/#refund-list
29
     */
30
    public function list(array $query = []): self
31
    {
32
        $this->get($this->url(self::ENDPOINT), $query);
33
34
        return $this;
35
    }
36
37
    /**
38
     * Get details of a refund on your integration.
39
     *
40
     * @link https://paystack.com/docs/api/#refund-fetch
41
     */
42
    public function fetch(string $reference): self
43
    {
44
        $this->get($this->url(self::ENDPOINT).'/'.$reference);
45
46
        return $this;
47
    }
48
}
49