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
174 public function getExternalPrice()
175 {
176 if (is_null($this->externalPrice)) {
178 $data = $this->raw(self::FIELD_EXTERNAL_PRICE);
179 if (is_null($data)) {
180 return null;
181 }
182
183 $this->externalPrice = MoneyModel::of($data);
184 }
185
187 }
188
195 public function getExternalTotalPrice()
196 {
197 if (is_null($this->externalTotalPrice)) {
199 $data = $this->raw(self::FIELD_EXTERNAL_TOTAL_PRICE);
200 if (is_null($data)) {
201 return null;
202 }
203
204 $this->externalTotalPrice = ExternalLineItemTotalPriceModel::of($data);
205 }
206
208 }
209
217 {
218 if (is_null($this->shippingDetailsToRemove)) {
220 $data = $this->raw(self::FIELD_SHIPPING_DETAILS_TO_REMOVE);
221 if (is_null($data)) {
222 return null;
223 }
224
225 $this->shippingDetailsToRemove = ItemShippingDetailsDraftModel::of($data);
226 }
227
229 }
230
231
235 public function setLineItemId(?string $lineItemId): void
236 {
237 $this->lineItemId = $lineItemId;
238 }
239
243 public function setLineItemKey(?string $lineItemKey): void
244 {
245 $this->lineItemKey = $lineItemKey;
246 }
247
251 public function setQuantity(?int $quantity): void
252 {
253 $this->quantity = $quantity;
254 }
255
259 public function setExternalPrice(?Money $externalPrice): void
260 {
261 $this->externalPrice = $externalPrice;
262 }
263
268 {
269 $this->externalTotalPrice = $externalTotalPrice;
270 }
271
276 {
277 $this->shippingDetailsToRemove = $shippingDetailsToRemove;
278 }
279}
__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)