Invoice::getCurrencyRate()   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
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\InvoiceBundle\Entity;
14
15
use Carbon\Carbon;
16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\Common\Collections\Collection;
18
use Knp\DoctrineBehaviors\Model\Blameable\Blameable;
19
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
20
use WellCommerce\Bundle\AppBundle\Entity\ClientBillingAddress;
21
use WellCommerce\Bundle\AppBundle\Entity\ShopAwareTrait;
22
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Identifiable;
23
use WellCommerce\Bundle\CoreBundle\Entity\EntityInterface;
24
use WellCommerce\Bundle\CoreBundle\Helper\Helper;
25
use WellCommerce\Bundle\OrderBundle\Entity\OrderAwareTrait;
26
use WellCommerce\Extra\InvoiceBundle\Entity\InvoiceExtraTrait;
27
28
/**
29
 * Class Invoice
30
 *
31
 * @author  Adam Piotrowski <[email protected]>
32
 */
33
class Invoice implements EntityInterface
34
{
35
    use Identifiable;
36
    use Timestampable;
37
    use Blameable;
38
    use OrderAwareTrait;
39
    use ShopAwareTrait;
40
    use InvoiceExtraTrait;
41
    
42
    const DEFAULT_PROCESSOR = 'generic';
43
    
44
    protected $guid               = '';
45
    protected $number             = '';
46
    protected $currency           = '';
47
    protected $currencyRate       = 1.0000;
48
    protected $shippingMethodName = '';
49
    protected $paymentMethodName  = '';
50
    protected $date;
51
    protected $dueDate;
52
    protected $paid               = true;
53
    protected $amountDue          = 0.00;
54
    protected $amountPaid         = 0.00;
55
    protected $signature          = '';
56
    protected $processor          = self::DEFAULT_PROCESSOR;
57
    
58
    /**
59
     * @var Collection
60
     */
61
    protected $items;
62
    
63
    /**
64
     * @var ClientBillingAddress
65
     */
66
    protected $billingAddress;
67
    
68
    public function __construct()
69
    {
70
        $this->items   = new ArrayCollection();
71
        $this->guid    = Helper::generateGuid();
72
        $this->date    = Carbon::now();
73
        $this->dueDate = Carbon::now();
74
    }
75
    
76
    public function getGuid(): string
77
    {
78
        return $this->guid;
79
    }
80
    
81
    public function setGuid(string $guid)
82
    {
83
        $this->guid = $guid;
84
    }
85
    
86
    public function getNumber(): string
87
    {
88
        return $this->number;
89
    }
90
    
91
    public function setNumber(string $number)
92
    {
93
        $this->number = $number;
94
    }
95
    
96
    public function getCurrency(): string
97
    {
98
        return $this->currency;
99
    }
100
    
101
    public function setCurrency(string $currency)
102
    {
103
        $this->currency = $currency;
104
    }
105
    
106
    public function getCurrencyRate(): float
107
    {
108
        return $this->currencyRate;
109
    }
110
    
111
    public function setCurrencyRate(float $currencyRate)
112
    {
113
        $this->currencyRate = $currencyRate;
114
    }
115
    
116
    public function getShippingMethodName(): string
117
    {
118
        return $this->shippingMethodName;
119
    }
120
    
121
    public function setShippingMethodName(string $shippingMethodName)
122
    {
123
        $this->shippingMethodName = $shippingMethodName;
124
    }
125
    
126
    public function getPaymentMethodName(): string
127
    {
128
        return $this->paymentMethodName;
129
    }
130
    
131
    public function setPaymentMethodName(string $paymentMethodName)
132
    {
133
        $this->paymentMethodName = $paymentMethodName;
134
    }
135
    
136
    public function getDate(): \DateTime
137
    {
138
        return $this->date;
139
    }
140
    
141
    public function setDate(\DateTime $date)
142
    {
143
        $this->date = $date;
144
    }
145
    
146
    public function getDueDate(): \DateTime
147
    {
148
        return $this->dueDate;
149
    }
150
    
151
    public function setDueDate(\DateTime $dueDate)
152
    {
153
        $this->dueDate = $dueDate;
154
    }
155
    
156
    public function isPaid(): bool
157
    {
158
        return $this->paid;
159
    }
160
    
161
    public function setPaid(bool $paid)
162
    {
163
        $this->paid = $paid;
164
    }
165
    
166
    public function getAmountDue(): float
167
    {
168
        return $this->amountDue;
169
    }
170
    
171
    public function setAmountDue(float $amountDue)
172
    {
173
        $this->amountDue = $amountDue;
174
    }
175
    
176
    public function getAmountPaid(): float
177
    {
178
        return $this->amountPaid;
179
    }
180
    
181
    public function setAmountPaid(float $amountPaid)
182
    {
183
        $this->amountPaid = $amountPaid;
184
    }
185
    
186
    public function getItems(): Collection
187
    {
188
        return $this->items;
189
    }
190
    
191
    public function setItems(Collection $items)
192
    {
193
        $this->items = $items;
194
    }
195
    
196
    public function getBillingAddress(): ClientBillingAddress
197
    {
198
        return $this->billingAddress;
199
    }
200
    
201
    public function setBillingAddress(ClientBillingAddress $billingAddress)
202
    {
203
        $this->billingAddress = $billingAddress;
204
    }
205
    
206
    public function getSignature(): string
207
    {
208
        return $this->signature;
209
    }
210
    
211
    public function setSignature(string $signature)
212
    {
213
        $this->signature = $signature;
214
    }
215
    
216
    public function getProcessor(): string
217
    {
218
        return $this->processor;
219
    }
220
    
221
    public function setProcessor(string $processor)
222
    {
223
        $this->processor = $processor;
224
    }
225
}
226