Passed
Push — develop ( 9e7d49...f1713a )
by Gergely
02:07
created

CustomerIntelligenceGateway::performPreApproval()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
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
/**
14
 * Customer Intelligence Gateway
15
 *
16
 * @author GK
17
 */
18
class CustomerIntelligenceGateway extends AbstractGateway
19
{
20
    /**
21
     * @author GK
22
     * @param string $installation
23
     * @param string $token
24
     * @param int $offset
25
     * @param int $limit
26
     * @return array
27
     * @throws \WNowicki\Generic\Exception
28
     */
29 1
    public function getCustomerIntelligence($installation, $token, $offset = 0, $limit = 20)
30
    {
31 1
        return $this->fetchDocument(
32 1
            '/v4/installations/' . $installation . '/lead-score?offset=' . $offset . '&limit=' . $limit,
33 1
            $token,
34
            'LeadScore'
35 1
        );
36
    }
37
38
    /**
39
     * @author GK
40
     * @param string $installation
41
     * @param array $body
42
     * @param string $token
43
     * @return array
44
     * @throws \WNowicki\Generic\Exception
45
     */
46 1
    public function performLeadScore($installation, array $body, $token)
47
    {
48 1
        return $this->postDocument(
49 1
            '/v4/installations/' . $installation . '/lead-score',
50 1
            $body,
51 1
            $token,
52
            'LeadScore'
53 1
        );
54
    }
55
56
    /**
57
     * @author GK
58
     * @param string $installation
59
     * @param array $body
60
     * @param string $token
61
     * @return array
62
     * @throws \WNowicki\Generic\Exception
63
     */
64 1
    public function performPreApproval($installation, array $body, $token)
65
    {
66 1
        return $this->postDocument(
67 1
            '/v4/installations/' . $installation . '/pre-approval',
68 1
            $body,
69 1
            $token,
70
            'PreApproval'
71 1
        );
72
    }
73
}
74