Passed
Push — master ( 2d74fe...2e6a59 )
by Carl
06:21
created

Card::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by Carl Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Copyright © 2017 PartFire Ltd. All rights reserved.
6
 *
7
 * User:    Carl Owens
8
 * Date:    17/01/2017
9
 * Time:    16:25
10
 * File:    Card.php
11
 **/
12
13
namespace PartFire\MangoPayBundle\Services;
14
15
use PartFire\MangoPayBundle\Models\CardQueryInterface;
16
use PartFire\MangoPayBundle\Models\CardRegistrationsQueryInterface;
17
18
class Card
19
{
20
    /**
21
     * @var CardRegistrationsQueryInterface
22
     */
23
    private $cardRegistrationQuery;
24
    /**
25
     * @var CardQueryInterface
26
     */
27
    private $cardQuery;
28
29
    public function __construct(CardRegistrationsQueryInterface $cardRegistrationsQuery, CardQueryInterface $cardQuery)
30
    {
31
        $this->cardRegistrationQuery = $cardRegistrationsQuery;
32
        $this->cardQuery = $cardQuery;
33
    }
34
35
    /**
36
     * @param string $userId
37
     * @param string $currency
38
     * @param string $cardType
39
     * @param string $tag
40
     * @return null|\PartFire\MangoPayBundle\Models\DTOs\CardRegistration
41
     * Create a card registration
42
     */
43
    public function createRegistration(string $userId, string $currency, string $cardType, string $tag)
44
    {
45
        return $this->cardRegistrationQuery->create($userId, $currency, $cardType, $tag);
46
    }
47
48
    /**
49
     * @param $cardRegisteredId
50
     * update cardRegister after payment form
51
     * @param $registrationData
52
     * @return null|\PartFire\MangoPayBundle\Models\DTOs\CardRegistration
53
     */
54
    public function updateRegistration(string $cardRegisteredId, string $registrationData, string $errorCode)
55
    {
56
        return $this->cardRegistrationQuery->update($cardRegisteredId, $registrationData, $errorCode);
57
    }
58
59
    /**
60
     * @param string $cardRegisteredId
61
     * @return null|\PartFire\MangoPayBundle\Models\DTOs\CardRegistration
62
     */
63
    public function getRegistration(string $cardRegisteredId)
64
    {
65
        return $this->cardRegistrationQuery->get($cardRegisteredId);
66
    }
67
68
    /**
69
     * @param $cardId
70
     * @return null|\PartFire\MangoPayBundle\Models\DTOs\Card
71
     */
72
    public function get($cardId)
73
    {
74
        return $this->cardQuery->get($cardId);
75
    }
76
77
    public function getAll()
78
    {
79
80
    }
81
82
    /**
83
     * @param $cardId
84
     * @return null|\PartFire\MangoPayBundle\Models\DTOs\Card
85
     */
86
    public function deactivate($cardId)
87
    {
88
        return $this->cardQuery->deactivate($cardId);
89
    }
90
}
91