Completed
Push — develop ( 6d2c09...d7687e )
by Wojciech
10s
created

SettlementGateway   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 45
ccs 10
cts 12
cp 0.8333
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSettlementReports() 0 12 3
A getSingleSettlementReport() 0 4 1
A getSingleAggregateSettlementReport() 0 4 1
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 2
    public function getSettlementReports($token, Carbon $since = null, Carbon $until = null)
32
    {
33 2
        return $this->fetchDocument(
34 2
            '/v4/settlement-reports',
35 2
            $token,
36 2
            'Settlement',
37
            [
38 2
                'since' => $since !== null?$since->format('Y-m-d'):null,
39 2
                'until' => $until !== null?$until->format('Y-m-d'):null,
40
            ]
41 2
        );
42
    }
43
44
    /**
45
     * @param string $token
46
     * @param int $settlementId
47
     * @return array
48
     * @throws SdkException
49
     */
50 2
    public function getSingleSettlementReport($token, $settlementId)
51
    {
52 2
        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