Completed
Push — develop ( 432368...503592 )
by Sean
9s
created

SettlementGateway::getSettlementReports()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.0987

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 9
cp 0.7778
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 6
nc 1
nop 3
crap 3.0987
1
<?php
2
/*
3
* This file is part of the PayBreak/basket 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
     * @param string $token
46
     * @param int $settlementId
47
     * @return array
48
     * @throws SdkException
49
     */
50 1
    public function getSingleSettlementReport($token, $settlementId)
51
    {
52 1
        return $this->fetchDocument('/v4/settlement-reports/' . $settlementId, $token, 'Settlement Report');
53
    }
54
55
    /**
56
     * @author EA
57
     * @param string $token
58
     * @param int $settlementId
59
     * @return array
60
     * @throws SdkException
61
     */
62
    public function getSingleAggregateSettlementReport($token, $settlementId)
63
    {
64
        return $this->fetchDocument('/v4/aggregate-settlement-reports/' . $settlementId, $token, 'Settlement Report');
65
    }
66
}
67