commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Cart
TaxedPriceDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\Common\Money
;
12
use
Commercetools\Api\Models\Common\MoneyModel
;
13
use
Commercetools\Api\Models\Common\TypedMoneyDraft
;
14
use
Commercetools\Api\Models\Common\TypedMoneyDraftModel
;
15
use
Commercetools\Base\DateTimeImmutableCollection
;
16
use
Commercetools\Base\JsonObject
;
17
use
Commercetools\Base\JsonObjectModel
;
18
use
Commercetools\Base\MapperFactory
;
19
use stdClass;
20
24
final
class
TaxedPriceDraftModel
extends
JsonObjectModel
implements
TaxedPriceDraft
25
{
30
protected
$totalNet
;
31
36
protected
$totalGross
;
37
42
protected
$taxPortions
;
43
48
protected
$totalTax
;
49
50
54
public
function
__construct
(
55
?
Money
$totalNet
=
null
,
56
?
Money
$totalGross
=
null
,
57
?
TaxPortionDraftCollection
$taxPortions
=
null
,
58
?
TypedMoneyDraft
$totalTax
=
null
59
) {
60
$this->totalNet =
$totalNet
;
61
$this->totalGross =
$totalGross
;
62
$this->taxPortions =
$taxPortions
;
63
$this->totalTax =
$totalTax
;
64
}
65
72
public
function
getTotalNet
()
73
{
74
if
(is_null($this->totalNet)) {
76
$data = $this->
raw
(self::FIELD_TOTAL_NET);
77
if
(is_null($data)) {
78
return
null
;
79
}
80
81
$this->totalNet = MoneyModel::of($data);
82
}
83
84
return
$this->totalNet
;
85
}
86
93
public
function
getTotalGross
()
94
{
95
if
(is_null($this->totalGross)) {
97
$data = $this->
raw
(self::FIELD_TOTAL_GROSS);
98
if
(is_null($data)) {
99
return
null
;
100
}
101
102
$this->totalGross = MoneyModel::of($data);
103
}
104
105
return
$this->totalGross
;
106
}
107
115
public
function
getTaxPortions
()
116
{
117
if
(is_null($this->taxPortions)) {
119
$data = $this->
raw
(self::FIELD_TAX_PORTIONS);
120
if
(is_null($data)) {
121
return
null
;
122
}
123
$this->taxPortions =
TaxPortionDraftCollection::fromArray
($data);
124
}
125
126
return
$this->taxPortions
;
127
}
128
135
public
function
getTotalTax
()
136
{
137
if
(is_null($this->totalTax)) {
139
$data = $this->
raw
(self::FIELD_TOTAL_TAX);
140
if
(is_null($data)) {
141
return
null
;
142
}
143
$className = TypedMoneyDraftModel::resolveDiscriminatorClass($data);
144
$this->totalTax = $className::of($data);
145
}
146
147
return
$this->totalTax
;
148
}
149
150
154
public
function
setTotalNet
(?
Money
$totalNet
): void
155
{
156
$this->totalNet =
$totalNet
;
157
}
158
162
public
function
setTotalGross
(?
Money
$totalGross
): void
163
{
164
$this->totalGross =
$totalGross
;
165
}
166
170
public
function
setTaxPortions
(?
TaxPortionDraftCollection
$taxPortions
): void
171
{
172
$this->taxPortions =
$taxPortions
;
173
}
174
178
public
function
setTotalTax
(?
TypedMoneyDraft
$totalTax
): void
179
{
180
$this->totalTax =
$totalTax
;
181
}
182
}
Commercetools\Api\Models\Cart\TaxPortionDraftCollection
Definition
TaxPortionDraftCollection.php:22
Commercetools\Api\Models\Cart\TaxedPriceDraftModel
Definition
TaxedPriceDraftModel.php:25
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\getTotalGross
getTotalGross()
Definition
TaxedPriceDraftModel.php:93
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\__construct
__construct(?Money $totalNet=null, ?Money $totalGross=null, ?TaxPortionDraftCollection $taxPortions=null, ?TypedMoneyDraft $totalTax=null)
Definition
TaxedPriceDraftModel.php:54
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\$taxPortions
$taxPortions
Definition
TaxedPriceDraftModel.php:42
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\getTotalTax
getTotalTax()
Definition
TaxedPriceDraftModel.php:135
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\setTaxPortions
setTaxPortions(?TaxPortionDraftCollection $taxPortions)
Definition
TaxedPriceDraftModel.php:170
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\$totalGross
$totalGross
Definition
TaxedPriceDraftModel.php:36
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\setTotalTax
setTotalTax(?TypedMoneyDraft $totalTax)
Definition
TaxedPriceDraftModel.php:178
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\setTotalGross
setTotalGross(?Money $totalGross)
Definition
TaxedPriceDraftModel.php:162
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\getTaxPortions
getTaxPortions()
Definition
TaxedPriceDraftModel.php:115
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\getTotalNet
getTotalNet()
Definition
TaxedPriceDraftModel.php:72
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\setTotalNet
setTotalNet(?Money $totalNet)
Definition
TaxedPriceDraftModel.php:154
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\$totalTax
$totalTax
Definition
TaxedPriceDraftModel.php:48
Commercetools\Api\Models\Cart\TaxedPriceDraftModel\$totalNet
$totalNet
Definition
TaxedPriceDraftModel.php:30
Commercetools\Api\Models\Common\MoneyModel
Definition
MoneyModel.php:21
Commercetools\Api\Models\Common\TypedMoneyDraftModel
Definition
TypedMoneyDraftModel.php:21
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Cart\TaxedPriceDraft
Definition
TaxedPriceDraft.php:17
Commercetools\Api\Models\Common\Money
Definition
Money.php:15
Commercetools\Api\Models\Common\TypedMoneyDraft
Definition
TypedMoneyDraft.php:15
Commercetools\Base\CSequence\fromArray
static fromArray(array $data)
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition
Cart.php:9
Generated by
1.9.8