getSingleAggregateSettlementReport()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/*
3
* This file is part of the PayBreak/paybreak-sdk-php package.
4
*
5
* (c) PayBreak <[email protected]>
6
*
7
* For the full copyright and license information, please view the LICENSE
8
* file that was distributed with this source code.
9
*/
10
11
namespace PayBreak\Sdk\Gateways;
12
13
use PayBreak\Sdk\SdkException;
14
use Carbon\Carbon;
15
16
/**
17
 * Application Gateway
18
 *
19
 * @author MS
20
 * @package PayBreak\Sdk\Gateways
21
 */
22
class SettlementGateway extends AbstractGateway
23
{
24
    /**
25
     * @author WN, MS
26
     * @param string $token
27
     * @param Carbon|null $since
28
     * @param Carbon|null $until
29
     * @return array
30
     */
31 1
    public function getSettlementReports($token, Carbon $since = null, Carbon $until = null)
32
    {
33 1
        return $this->fetchDocument(
34 1
            '/v4/settlement-reports',
35 1
            $token,
36 1
            'Settlement',
37
            [
38 1
                'since' => $since !== null?$since->format('Y-m-d'):null,
39 1
                'until' => $until !== null?$until->format('Y-m-d'):null,
40
            ]
41 1
        );
42
    }
43
44
    /**
45
     * @author GK
46
     * @param string $token
47
     * @param Carbon $since
48
     * @param Carbon $until
49
     * @return array
50
     */
51 1
    public function getAggregateSettlementReports($token, Carbon $since, Carbon $until)
52
    {
53 1
        return $this->fetchDocument(
54 1
            '/v4/period-aggregate-settlement-reports',
55 1
            $token,
56 1
            'Settlement',
57
            [
58 1
                'since' => $since->format('Y-m-d'),
59 1
                'until' => $until->format('Y-m-d'),
60
            ]
61 1
        );
62
    }
63
64
    /**
65
     * @author WN
66
     * @param string $token
67
     * @param int $settlementId
68
     * @return array
69
     * @throws SdkException
70
     */
71 1
    public function getSingleSettlementReport($token, $settlementId)
72
    {
73 1
        return $this->fetchDocument('/v4/settlement-reports/' . $settlementId, $token, 'Settlement Report');
74
    }
75
76
    /**
77
     * @author EA
78
     * @param string $token
79
     * @param int $settlementId
80
     * @return array
81
     * @throws SdkException
82
     */
83
    public function getSingleAggregateSettlementReport($token, $settlementId)
84
    {
85
        return $this->fetchDocument('/v4/aggregate-settlement-reports/' . $settlementId, $token, 'Settlement Report');
86
    }
87
}
88