commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
TaxedPriceDraftModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
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,
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
171 {
172 $this->taxPortions = $taxPortions;
173 }
174
178 public function setTotalTax(?TypedMoneyDraft $totalTax): void
179 {
180 $this->totalTax = $totalTax;
181 }
182}
__construct(?Money $totalNet=null, ?Money $totalGross=null, ?TaxPortionDraftCollection $taxPortions=null, ?TypedMoneyDraft $totalTax=null)
setTaxPortions(?TaxPortionDraftCollection $taxPortions)
static fromArray(array $data)