commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartRemoveLineItemActionModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
24 public const DISCRIMINATOR_VALUE = 'removeLineItem';
29 protected $action;
30
35 protected $lineItemId;
36
41 protected $lineItemKey;
42
47 protected $quantity;
48
53 protected $externalPrice;
54
60
66
67
71 public function __construct(
72 ?string $lineItemId = null,
73 ?string $lineItemKey = null,
74 ?int $quantity = null,
75 ?Money $externalPrice = null,
78 ?string $action = null
79 ) {
80 $this->lineItemId = $lineItemId;
81 $this->lineItemKey = $lineItemKey;
82 $this->quantity = $quantity;
83 $this->externalPrice = $externalPrice;
84 $this->externalTotalPrice = $externalTotalPrice;
85 $this->shippingDetailsToRemove = $shippingDetailsToRemove;
86 $this->action = $action ?? self::DISCRIMINATOR_VALUE;
87 }
88
93 public function getAction()
94 {
95 if (is_null($this->action)) {
97 $data = $this->raw(self::FIELD_ACTION);
98 if (is_null($data)) {
99 return null;
100 }
101 $this->action = (string) $data;
102 }
103
104 return $this->action;
105 }
106
113 public function getLineItemId()
114 {
115 if (is_null($this->lineItemId)) {
117 $data = $this->raw(self::FIELD_LINE_ITEM_ID);
118 if (is_null($data)) {
119 return null;
120 }
121 $this->lineItemId = (string) $data;
122 }
123
124 return $this->lineItemId;
125 }
126
133 public function getLineItemKey()
134 {
135 if (is_null($this->lineItemKey)) {
137 $data = $this->raw(self::FIELD_LINE_ITEM_KEY);
138 if (is_null($data)) {
139 return null;
140 }
141 $this->lineItemKey = (string) $data;
142 }
143
144 return $this->lineItemKey;
145 }
146
154 public function getQuantity()
155 {
156 if (is_null($this->quantity)) {
158 $data = $this->raw(self::FIELD_QUANTITY);
159 if (is_null($data)) {
160 return null;
161 }
162 $this->quantity = (int) $data;
163 }
164
165 return $this->quantity;
166 }
167
175 public function getExternalPrice()
176 {
177 if (is_null($this->externalPrice)) {
179 $data = $this->raw(self::FIELD_EXTERNAL_PRICE);
180 if (is_null($data)) {
181 return null;
182 }
183
184 $this->externalPrice = MoneyModel::of($data);
185 }
186
188 }
189
196 public function getExternalTotalPrice()
197 {
198 if (is_null($this->externalTotalPrice)) {
200 $data = $this->raw(self::FIELD_EXTERNAL_TOTAL_PRICE);
201 if (is_null($data)) {
202 return null;
203 }
204
205 $this->externalTotalPrice = ExternalLineItemTotalPriceModel::of($data);
206 }
207
209 }
210
218 {
219 if (is_null($this->shippingDetailsToRemove)) {
221 $data = $this->raw(self::FIELD_SHIPPING_DETAILS_TO_REMOVE);
222 if (is_null($data)) {
223 return null;
224 }
225
226 $this->shippingDetailsToRemove = ItemShippingDetailsDraftModel::of($data);
227 }
228
230 }
231
232
236 public function setLineItemId(?string $lineItemId): void
237 {
238 $this->lineItemId = $lineItemId;
239 }
240
244 public function setLineItemKey(?string $lineItemKey): void
245 {
246 $this->lineItemKey = $lineItemKey;
247 }
248
252 public function setQuantity(?int $quantity): void
253 {
254 $this->quantity = $quantity;
255 }
256
260 public function setExternalPrice(?Money $externalPrice): void
261 {
262 $this->externalPrice = $externalPrice;
263 }
264
269 {
270 $this->externalTotalPrice = $externalTotalPrice;
271 }
272
277 {
278 $this->shippingDetailsToRemove = $shippingDetailsToRemove;
279 }
280}
__construct(?string $lineItemId=null, ?string $lineItemKey=null, ?int $quantity=null, ?Money $externalPrice=null, ?ExternalLineItemTotalPrice $externalTotalPrice=null, ?ItemShippingDetailsDraft $shippingDetailsToRemove=null, ?string $action=null)
setExternalTotalPrice(?ExternalLineItemTotalPrice $externalTotalPrice)
setShippingDetailsToRemove(?ItemShippingDetailsDraft $shippingDetailsToRemove)