commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomShippingDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use stdClass;
25 
30 {
35  protected $key;
36 
42 
47  protected $shippingAddress;
48 
53  protected $shippingRate;
54 
59  protected $shippingRateInput;
60 
65  protected $taxCategory;
66 
71  protected $externalTaxRate;
72 
77  protected $deliveries;
78 
83  protected $custom;
84 
85 
89  public function __construct(
90  ?string $key = null,
91  ?string $shippingMethodName = null,
99  ) {
100  $this->key = $key;
101  $this->shippingMethodName = $shippingMethodName;
102  $this->shippingAddress = $shippingAddress;
103  $this->shippingRate = $shippingRate;
104  $this->shippingRateInput = $shippingRateInput;
105  $this->taxCategory = $taxCategory;
106  $this->externalTaxRate = $externalTaxRate;
107  $this->deliveries = $deliveries;
108  $this->custom = $custom;
109  }
110 
117  public function getKey()
118  {
119  if (is_null($this->key)) {
121  $data = $this->raw(self::FIELD_KEY);
122  if (is_null($data)) {
123  return null;
124  }
125  $this->key = (string) $data;
126  }
127 
128  return $this->key;
129  }
130 
137  public function getShippingMethodName()
138  {
139  if (is_null($this->shippingMethodName)) {
141  $data = $this->raw(self::FIELD_SHIPPING_METHOD_NAME);
142  if (is_null($data)) {
143  return null;
144  }
145  $this->shippingMethodName = (string) $data;
146  }
147 
149  }
150 
157  public function getShippingAddress()
158  {
159  if (is_null($this->shippingAddress)) {
161  $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
162  if (is_null($data)) {
163  return null;
164  }
165 
166  $this->shippingAddress = BaseAddressModel::of($data);
167  }
168 
169  return $this->shippingAddress;
170  }
171 
178  public function getShippingRate()
179  {
180  if (is_null($this->shippingRate)) {
182  $data = $this->raw(self::FIELD_SHIPPING_RATE);
183  if (is_null($data)) {
184  return null;
185  }
186 
187  $this->shippingRate = ShippingRateDraftModel::of($data);
188  }
189 
190  return $this->shippingRate;
191  }
192 
205  public function getShippingRateInput()
206  {
207  if (is_null($this->shippingRateInput)) {
209  $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
210  if (is_null($data)) {
211  return null;
212  }
214  $this->shippingRateInput = $className::of($data);
215  }
216 
218  }
219 
226  public function getTaxCategory()
227  {
228  if (is_null($this->taxCategory)) {
230  $data = $this->raw(self::FIELD_TAX_CATEGORY);
231  if (is_null($data)) {
232  return null;
233  }
234 
235  $this->taxCategory = TaxCategoryResourceIdentifierModel::of($data);
236  }
237 
238  return $this->taxCategory;
239  }
240 
247  public function getExternalTaxRate()
248  {
249  if (is_null($this->externalTaxRate)) {
251  $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
252  if (is_null($data)) {
253  return null;
254  }
255 
256  $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
257  }
258 
259  return $this->externalTaxRate;
260  }
261 
268  public function getDeliveries()
269  {
270  if (is_null($this->deliveries)) {
272  $data = $this->raw(self::FIELD_DELIVERIES);
273  if (is_null($data)) {
274  return null;
275  }
276  $this->deliveries = DeliveryDraftCollection::fromArray($data);
277  }
278 
279  return $this->deliveries;
280  }
281 
288  public function getCustom()
289  {
290  if (is_null($this->custom)) {
292  $data = $this->raw(self::FIELD_CUSTOM);
293  if (is_null($data)) {
294  return null;
295  }
296 
297  $this->custom = CustomFieldsDraftModel::of($data);
298  }
299 
300  return $this->custom;
301  }
302 
303 
307  public function setKey(?string $key): void
308  {
309  $this->key = $key;
310  }
311 
315  public function setShippingMethodName(?string $shippingMethodName): void
316  {
317  $this->shippingMethodName = $shippingMethodName;
318  }
319 
324  {
325  $this->shippingAddress = $shippingAddress;
326  }
327 
332  {
333  $this->shippingRate = $shippingRate;
334  }
335 
340  {
341  $this->shippingRateInput = $shippingRateInput;
342  }
343 
348  {
349  $this->taxCategory = $taxCategory;
350  }
351 
356  {
357  $this->externalTaxRate = $externalTaxRate;
358  }
359 
364  {
365  $this->deliveries = $deliveries;
366  }
367 
371  public function setCustom(?CustomFieldsDraft $custom): void
372  {
373  $this->custom = $custom;
374  }
375 }
setExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
setTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
setShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
__construct(?string $key=null, ?string $shippingMethodName=null, ?BaseAddress $shippingAddress=null, ?ShippingRateDraft $shippingRate=null, ?ShippingRateInputDraft $shippingRateInput=null, ?TaxCategoryResourceIdentifier $taxCategory=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?DeliveryDraftCollection $deliveries=null, ?CustomFieldsDraft $custom=null)