Completed
Pull Request — master (#64)
by Rafael
02:06
created

BanklyCard::duplicate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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