commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ShippingDraftModel.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final class ShippingDraftModel extends JsonObjectModel implements ShippingDraft
28{
33 protected $key;
34
39 protected $shippingMethod;
40
46
52
58
63 protected $deliveries;
64
69 protected $custom;
70
71
75 public function __construct(
76 ?string $key = null,
83 ) {
84 $this->key = $key;
85 $this->shippingMethod = $shippingMethod;
86 $this->shippingAddress = $shippingAddress;
87 $this->shippingRateInput = $shippingRateInput;
88 $this->externalTaxRate = $externalTaxRate;
89 $this->deliveries = $deliveries;
90 $this->custom = $custom;
91 }
92
99 public function getKey()
100 {
101 if (is_null($this->key)) {
103 $data = $this->raw(self::FIELD_KEY);
104 if (is_null($data)) {
105 return null;
106 }
107 $this->key = (string) $data;
108 }
109
110 return $this->key;
111 }
112
119 public function getShippingMethod()
120 {
121 if (is_null($this->shippingMethod)) {
123 $data = $this->raw(self::FIELD_SHIPPING_METHOD);
124 if (is_null($data)) {
125 return null;
126 }
127
128 $this->shippingMethod = ShippingMethodReferenceModel::of($data);
129 }
130
132 }
133
140 public function getShippingAddress()
141 {
142 if (is_null($this->shippingAddress)) {
144 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
145 if (is_null($data)) {
146 return null;
147 }
148
149 $this->shippingAddress = BaseAddressModel::of($data);
150 }
151
153 }
154
167 public function getShippingRateInput()
168 {
169 if (is_null($this->shippingRateInput)) {
171 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
172 if (is_null($data)) {
173 return null;
174 }
176 $this->shippingRateInput = $className::of($data);
177 }
178
180 }
181
188 public function getExternalTaxRate()
189 {
190 if (is_null($this->externalTaxRate)) {
192 $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
193 if (is_null($data)) {
194 return null;
195 }
196
197 $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
198 }
199
201 }
202
209 public function getDeliveries()
210 {
211 if (is_null($this->deliveries)) {
213 $data = $this->raw(self::FIELD_DELIVERIES);
214 if (is_null($data)) {
215 return null;
216 }
217 $this->deliveries = DeliveryDraftCollection::fromArray($data);
218 }
219
220 return $this->deliveries;
221 }
222
229 public function getCustom()
230 {
231 if (is_null($this->custom)) {
233 $data = $this->raw(self::FIELD_CUSTOM);
234 if (is_null($data)) {
235 return null;
236 }
237
238 $this->custom = CustomFieldsDraftModel::of($data);
239 }
240
241 return $this->custom;
242 }
243
244
248 public function setKey(?string $key): void
249 {
250 $this->key = $key;
251 }
252
257 {
258 $this->shippingMethod = $shippingMethod;
259 }
260
265 {
266 $this->shippingAddress = $shippingAddress;
267 }
268
273 {
274 $this->shippingRateInput = $shippingRateInput;
275 }
276
281 {
282 $this->externalTaxRate = $externalTaxRate;
283 }
284
289 {
290 $this->deliveries = $deliveries;
291 }
292
296 public function setCustom(?CustomFieldsDraft $custom): void
297 {
298 $this->custom = $custom;
299 }
300}
setShippingMethod(?ShippingMethodReference $shippingMethod)
setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
setDeliveries(?DeliveryDraftCollection $deliveries)
__construct(?string $key=null, ?ShippingMethodReference $shippingMethod=null, ?BaseAddress $shippingAddress=null, ?ShippingRateInputDraft $shippingRateInput=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?DeliveryDraftCollection $deliveries=null, ?CustomFieldsDraft $custom=null)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)