commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartAddShippingMethodActionModel.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
28{
29 public const DISCRIMINATOR_VALUE = 'addShippingMethod';
34 protected $action;
35
40 protected $shippingKey;
41
46 protected $shippingMethod;
47
53
59
65
70 protected $deliveries;
71
76 protected $custom;
77
83
84
88 public function __construct(
89 ?string $shippingKey = null,
97 ?string $action = null
98 ) {
99 $this->shippingKey = $shippingKey;
100 $this->shippingMethod = $shippingMethod;
101 $this->shippingAddress = $shippingAddress;
102 $this->shippingRateInput = $shippingRateInput;
103 $this->externalTaxRate = $externalTaxRate;
104 $this->deliveries = $deliveries;
105 $this->custom = $custom;
106 $this->estimatedDelivery = $estimatedDelivery;
107 $this->action = $action ?? self::DISCRIMINATOR_VALUE;
108 }
109
114 public function getAction()
115 {
116 if (is_null($this->action)) {
118 $data = $this->raw(self::FIELD_ACTION);
119 if (is_null($data)) {
120 return null;
121 }
122 $this->action = (string) $data;
123 }
124
125 return $this->action;
126 }
127
134 public function getShippingKey()
135 {
136 if (is_null($this->shippingKey)) {
138 $data = $this->raw(self::FIELD_SHIPPING_KEY);
139 if (is_null($data)) {
140 return null;
141 }
142 $this->shippingKey = (string) $data;
143 }
144
145 return $this->shippingKey;
146 }
147
161 public function getShippingMethod()
162 {
163 if (is_null($this->shippingMethod)) {
165 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
166 if (is_null($data)) {
167 return null;
168 }
169
170 $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
171 }
172
174 }
175
182 public function getShippingAddress()
183 {
184 if (is_null($this->shippingAddress)) {
186 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
187 if (is_null($data)) {
188 return null;
189 }
190
191 $this->shippingAddress = BaseAddressModel::of($data);
192 }
193
195 }
196
209 public function getShippingRateInput()
210 {
211 if (is_null($this->shippingRateInput)) {
213 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
214 if (is_null($data)) {
215 return null;
216 }
218 $this->shippingRateInput = $className::of($data);
219 }
220
222 }
223
230 public function getExternalTaxRate()
231 {
232 if (is_null($this->externalTaxRate)) {
234 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
235 if (is_null($data)) {
236 return null;
237 }
238
239 $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
240 }
241
243 }
244
251 public function getDeliveries()
252 {
253 if (is_null($this->deliveries)) {
255 $data = $this->raw(self::FIELD_DELIVERIES);
256 if (is_null($data)) {
257 return null;
258 }
259 $this->deliveries = DeliveryDraftCollection::fromArray($data);
260 }
261
262 return $this->deliveries;
263 }
264
271 public function getCustom()
272 {
273 if (is_null($this->custom)) {
275 $data = $this->raw(self::FIELD_CUSTOM);
276 if (is_null($data)) {
277 return null;
278 }
279
280 $this->custom = CustomFieldsDraftModel::of($data);
281 }
282
283 return $this->custom;
284 }
285
292 public function getEstimatedDelivery()
293 {
294 if (is_null($this->estimatedDelivery)) {
296 $data = $this->raw(self::FIELD_ESTIMATED_DELIVERY);
297 if (is_null($data)) {
298 return null;
299 }
300
301 $this->estimatedDelivery = EstimatedDeliveryModel::of($data);
302 }
303
305 }
306
307
311 public function setShippingKey(?string $shippingKey): void
312 {
313 $this->shippingKey = $shippingKey;
314 }
315
320 {
321 $this->shippingMethod = $shippingMethod;
322 }
323
328 {
329 $this->shippingAddress = $shippingAddress;
330 }
331
336 {
337 $this->shippingRateInput = $shippingRateInput;
338 }
339
344 {
345 $this->externalTaxRate = $externalTaxRate;
346 }
347
352 {
353 $this->deliveries = $deliveries;
354 }
355
359 public function setCustom(?CustomFieldsDraft $custom): void
360 {
361 $this->custom = $custom;
362 }
363
368 {
369 $this->estimatedDelivery = $estimatedDelivery;
370 }
371}
__construct(?string $shippingKey=null, ?ShippingMethodResourceIdentifier $shippingMethod=null, ?BaseAddress $shippingAddress=null, ?ShippingRateInputDraft $shippingRateInput=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?DeliveryDraftCollection $deliveries=null, ?CustomFieldsDraft $custom=null, ?EstimatedDelivery $estimatedDelivery=null, ?string $action=null)