commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ShippingInfoImportDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use stdClass;
24 
29 {
35 
40  protected $price;
41 
46  protected $shippingRate;
47 
52  protected $taxRate;
53 
58  protected $taxCategory;
59 
64  protected $shippingMethod;
65 
70  protected $deliveries;
71 
76  protected $discountedPrice;
77 
83 
84 
88  public function __construct(
89  ?string $shippingMethodName = null,
90  ?TypedMoney $price = null,
92  ?TaxRate $taxRate = null,
97  ?string $shippingMethodState = null
98  ) {
99  $this->shippingMethodName = $shippingMethodName;
100  $this->price = $price;
101  $this->shippingRate = $shippingRate;
102  $this->taxRate = $taxRate;
103  $this->taxCategory = $taxCategory;
104  $this->shippingMethod = $shippingMethod;
105  $this->deliveries = $deliveries;
106  $this->discountedPrice = $discountedPrice;
107  $this->shippingMethodState = $shippingMethodState;
108  }
109 
114  public function getShippingMethodName()
115  {
116  if (is_null($this->shippingMethodName)) {
118  $data = $this->raw(self::FIELD_SHIPPING_METHOD_NAME);
119  if (is_null($data)) {
120  return null;
121  }
122  $this->shippingMethodName = (string) $data;
123  }
124 
126  }
127 
132  public function getPrice()
133  {
134  if (is_null($this->price)) {
136  $data = $this->raw(self::FIELD_PRICE);
137  if (is_null($data)) {
138  return null;
139  }
140  $className = TypedMoneyModel::resolveDiscriminatorClass($data);
141  $this->price = $className::of($data);
142  }
143 
144  return $this->price;
145  }
146 
151  public function getShippingRate()
152  {
153  if (is_null($this->shippingRate)) {
155  $data = $this->raw(self::FIELD_SHIPPING_RATE);
156  if (is_null($data)) {
157  return null;
158  }
159 
160  $this->shippingRate = ShippingRateDraftModel::of($data);
161  }
162 
163  return $this->shippingRate;
164  }
165 
170  public function getTaxRate()
171  {
172  if (is_null($this->taxRate)) {
174  $data = $this->raw(self::FIELD_TAX_RATE);
175  if (is_null($data)) {
176  return null;
177  }
178 
179  $this->taxRate = TaxRateModel::of($data);
180  }
181 
182  return $this->taxRate;
183  }
184 
191  public function getTaxCategory()
192  {
193  if (is_null($this->taxCategory)) {
195  $data = $this->raw(self::FIELD_TAX_CATEGORY);
196  if (is_null($data)) {
197  return null;
198  }
199 
200  $this->taxCategory = TaxCategoryKeyReferenceModel::of($data);
201  }
202 
203  return $this->taxCategory;
204  }
205 
212  public function getShippingMethod()
213  {
214  if (is_null($this->shippingMethod)) {
216  $data = $this->raw(self::FIELD_SHIPPING_METHOD);
217  if (is_null($data)) {
218  return null;
219  }
220 
221  $this->shippingMethod = ShippingMethodKeyReferenceModel::of($data);
222  }
223 
224  return $this->shippingMethod;
225  }
226 
233  public function getDeliveries()
234  {
235  if (is_null($this->deliveries)) {
237  $data = $this->raw(self::FIELD_DELIVERIES);
238  if (is_null($data)) {
239  return null;
240  }
241  $this->deliveries = DeliveryCollection::fromArray($data);
242  }
243 
244  return $this->deliveries;
245  }
246 
251  public function getDiscountedPrice()
252  {
253  if (is_null($this->discountedPrice)) {
255  $data = $this->raw(self::FIELD_DISCOUNTED_PRICE);
256  if (is_null($data)) {
257  return null;
258  }
259 
260  $this->discountedPrice = DiscountedLineItemPriceDraftModel::of($data);
261  }
262 
263  return $this->discountedPrice;
264  }
265 
270  public function getShippingMethodState()
271  {
272  if (is_null($this->shippingMethodState)) {
274  $data = $this->raw(self::FIELD_SHIPPING_METHOD_STATE);
275  if (is_null($data)) {
276  return null;
277  }
278  $this->shippingMethodState = (string) $data;
279  }
280 
282  }
283 
284 
288  public function setShippingMethodName(?string $shippingMethodName): void
289  {
290  $this->shippingMethodName = $shippingMethodName;
291  }
292 
296  public function setPrice(?TypedMoney $price): void
297  {
298  $this->price = $price;
299  }
300 
305  {
306  $this->shippingRate = $shippingRate;
307  }
308 
312  public function setTaxRate(?TaxRate $taxRate): void
313  {
314  $this->taxRate = $taxRate;
315  }
316 
321  {
322  $this->taxCategory = $taxCategory;
323  }
324 
329  {
330  $this->shippingMethod = $shippingMethod;
331  }
332 
337  {
338  $this->deliveries = $deliveries;
339  }
340 
345  {
346  $this->discountedPrice = $discountedPrice;
347  }
348 
352  public function setShippingMethodState(?string $shippingMethodState): void
353  {
354  $this->shippingMethodState = $shippingMethodState;
355  }
356 }
__construct(?string $shippingMethodName=null, ?TypedMoney $price=null, ?ShippingRateDraft $shippingRate=null, ?TaxRate $taxRate=null, ?TaxCategoryKeyReference $taxCategory=null, ?ShippingMethodKeyReference $shippingMethod=null, ?DeliveryCollection $deliveries=null, ?DiscountedLineItemPriceDraft $discountedPrice=null, ?string $shippingMethodState=null)