Payment::isVerified()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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 2
nc 1
nop 0
1
<?php
2
3
namespace BCRM\BackendBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
use LiteCQRS\Plugin\CRUD\AggregateResource;
9
use Symfony\Component\Validator\Constraints as Assert;
10
11
/**
12
 * Payment Transaction
13
 *
14
 * @ORM\Table(name="payment",uniqueConstraints={@ORM\UniqueConstraint(name="payment_txId",columns={"txId"})})
15
 * @ORM\Entity(repositoryClass="BCRM\BackendBundle\Entity\DoctrinePaymentRepository")
16
 */
17
class Payment extends AggregateResource
18
{
19
    /**
20
     * @var integer
21
     * @ORM\Column(type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     * @ORM\Column(type="string", nullable=false)
30
     */
31
    protected $txId;
32
33
    /**
34
     * @var string
35
     * @ORM\Column(type="string", nullable=false)
36
     */
37
    protected $method;
38
39
    /**
40
     * Transaction payload
41
     *
42
     * @var array
43
     * @ORM\Column(type="json_array", nullable=false)
44
     * @Assert\Type("array")
45
     * @Assert\NotNull()
46
     */
47
    protected $payload;
48
49
    /**
50
     * @var \DateTime
51
     * @ORM\Column(type="datetime", nullable=true)
52
     * @Assert\Type(type="\DateTime")
53
     */
54
    protected $checked;
55
56
    /**
57
     * @var boolean
58
     * @Assert\Type(type="boolean")
59
     * @ORM\Column(type="boolean")
60
     */
61
    protected $verified = false;
62
63
    public function __construct()
64
    {
65
        $this->payload = array();
66
    }
67
68
    /**
69
     * @return int
70
     */
71
    public function getId()
72
    {
73
        return $this->id;
74
    }
75
76
    /**
77
     * @param string $txId
78
     */
79
    public function setTransactionId($txId)
80
    {
81
        $this->txId = $txId;
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function getTransactionId()
88
    {
89
        return $this->txId;
90
    }
91
92
    /**
93
     * @return ArrayCollection
94
     */
95
    public function getPayload()
96
    {
97
        return new ArrayCollection($this->payload);
98
    }
99
100
    /**
101
     * @param ArrayCollection $payload
102
     */
103
    public function setPayload(ArrayCollection $payload)
104
    {
105
        $this->payload = $payload->toArray();
106
    }
107
108
    /**
109
     * @return void
110
     */
111
    public function verify()
112
    {
113
        $this->verified = true;
114
    }
115
116
    /**
117
     * @return bool
118
     */
119
    public function isVerified()
120
    {
121
        return $this->verified;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public function getMethod()
128
    {
129
        return $this->method;
130
    }
131
132
    /**
133
     * @param string $method
134
     */
135
    public function setMethod($method)
136
    {
137
        $this->method = $method;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function __toString()
144
    {
145
        return $this->getTransactionId();
146
    }
147
}
148