Completed
Pull Request — master (#67)
by Rafael
01:28
created

BanklyCard   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 64
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A transactions() 0 11 1
A duplicate() 0 4 1
A pciData() 0 4 1
A getByProxy() 0 4 1
1
<?php
2
3
namespace WeDevBr\Bankly;
4
5
use WeDevBr\Bankly\Auth\Auth;
6
use WeDevBr\Bankly\Traits\Rest;
7
use WeDevBr\Bankly\Types\Card\Duplicate;
8
use WeDevBr\Bankly\Types\Card\Password;
9
10
/**
11
 * Class Card
12
 * @author Rafael Teixeira <[email protected]>
13
 * @package WeDevBr\Bankly
14
 */
15
class BanklyCard
16
{
17
    use Rest;
18
19
    /**
20
     * @param string $clientSecret
21
     * @param string $clientId
22
     */
23
    public function __construct($clientSecret = null, $clientId = null)
24
    {
25
        Auth::login()
26
            ->setClientId($clientId)
27
            ->setClientId($clientSecret);
28
    }
29
30
    /**
31
     * @param string $proxy
32
     * @param string $page
33
     * @param integer $pageSize
34
     * @param string $startDate
35
     * @param string $endDate
36
     * @return array
37
     */
38
    public function transactions(string $proxy, string $page, int $pageSize, string $startDate, string $endDate)
39
    {
40
        $query = [
41
            'page' => $page,
42
            'pageSize' => $pageSize,
43
            'startDate' => $startDate,
44
            'endDate' => $endDate
45
        ];
46
47
        return $this->get("/cards/{$proxy}/transactions", $query);
48
    }
49
50
    /**
51
     * @param string $proxy
52
     * @param Duplicate $duplicate
53
     * @return array
54
     */
55
    public function duplicate(string $proxy, Duplicate $duplicate)
56
    {
57
        return $this->post("/cards/{$proxy}/duplicate", $duplicate->toArray());
58
    }
59
60
    /**
61
     * @param string $proxy
62
     * @param Password $password
63
     * @return array
64
     */
65
    public function pciData(string $proxy, Password $password)
66
    {
67
        return $this->post("/cards/{$proxy}/pci", $password->toArray());
68
    }
69
70
    /**
71
     * @param string $proxy
72
     * @return array
73
     */
74
    public function getByProxy(string $proxy)
75
    {
76
        return $this->get("/cards/{$proxy}");
77
    }
78
}
79