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
78
82 public function __construct(
83 ?string $shippingKey = null,
90 ?string $action = null
91 ) {
92 $this->shippingKey = $shippingKey;
93 $this->shippingMethod = $shippingMethod;
94 $this->shippingAddress = $shippingAddress;
95 $this->shippingRateInput = $shippingRateInput;
96 $this->externalTaxRate = $externalTaxRate;
97 $this->deliveries = $deliveries;
98 $this->custom = $custom;
99 $this->action = $action ?? self::DISCRIMINATOR_VALUE;
100 }
101
106 public function getAction()
107 {
108 if (is_null($this->action)) {
110 $data = $this->raw(self::FIELD_ACTION);
111 if (is_null($data)) {
112 return null;
113 }
114 $this->action = (string) $data;
115 }
116
117 return $this->action;
118 }
119
126 public function getShippingKey()
127 {
128 if (is_null($this->shippingKey)) {
130 $data = $this->raw(self::FIELD_SHIPPING_KEY);
131 if (is_null($data)) {
132 return null;
133 }
134 $this->shippingKey = (string) $data;
135 }
136
137 return $this->shippingKey;
138 }
139
147 public function getShippingMethod()
148 {
149 if (is_null($this->shippingMethod)) {
151 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
152 if (is_null($data)) {
153 return null;
154 }
155
156 $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
157 }
158
160 }
161
168 public function getShippingAddress()
169 {
170 if (is_null($this->shippingAddress)) {
172 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
173 if (is_null($data)) {
174 return null;
175 }
176
177 $this->shippingAddress = BaseAddressModel::of($data);
178 }
179
181 }
182
195 public function getShippingRateInput()
196 {
197 if (is_null($this->shippingRateInput)) {
199 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
200 if (is_null($data)) {
201 return null;
202 }
204 $this->shippingRateInput = $className::of($data);
205 }
206
208 }
209
216 public function getExternalTaxRate()
217 {
218 if (is_null($this->externalTaxRate)) {
220 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
221 if (is_null($data)) {
222 return null;
223 }
224
225 $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
226 }
227
229 }
230
237 public function getDeliveries()
238 {
239 if (is_null($this->deliveries)) {
241 $data = $this->raw(self::FIELD_DELIVERIES);
242 if (is_null($data)) {
243 return null;
244 }
245 $this->deliveries = DeliveryDraftCollection::fromArray($data);
246 }
247
248 return $this->deliveries;
249 }
250
257 public function getCustom()
258 {
259 if (is_null($this->custom)) {
261 $data = $this->raw(self::FIELD_CUSTOM);
262 if (is_null($data)) {
263 return null;
264 }
265
266 $this->custom = CustomFieldsDraftModel::of($data);
267 }
268
269 return $this->custom;
270 }
271
272
276 public function setShippingKey(?string $shippingKey): void
277 {
278 $this->shippingKey = $shippingKey;
279 }
280
285 {
286 $this->shippingMethod = $shippingMethod;
287 }
288
293 {
294 $this->shippingAddress = $shippingAddress;
295 }
296
301 {
302 $this->shippingRateInput = $shippingRateInput;
303 }
304
309 {
310 $this->externalTaxRate = $externalTaxRate;
311 }
312
317 {
318 $this->deliveries = $deliveries;
319 }
320
324 public function setCustom(?CustomFieldsDraft $custom): void
325 {
326 $this->custom = $custom;
327 }
328}
__construct(?string $shippingKey=null, ?ShippingMethodResourceIdentifier $shippingMethod=null, ?BaseAddress $shippingAddress=null, ?ShippingRateInputDraft $shippingRateInput=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?DeliveryDraftCollection $deliveries=null, ?CustomFieldsDraft $custom=null, ?string $action=null)