commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartSetShippingMethodActionModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'setShippingMethod';
29  protected $action;
30 
35  protected $shippingMethod;
36 
41  protected $externalTaxRate;
42 
43 
47  public function __construct(
50  ?string $action = null
51  ) {
52  $this->shippingMethod = $shippingMethod;
53  $this->externalTaxRate = $externalTaxRate;
54  $this->action = $action ?? self::DISCRIMINATOR_VALUE;
55  }
56 
61  public function getAction()
62  {
63  if (is_null($this->action)) {
65  $data = $this->raw(self::FIELD_ACTION);
66  if (is_null($data)) {
67  return null;
68  }
69  $this->action = (string) $data;
70  }
71 
72  return $this->action;
73  }
74 
83  public function getShippingMethod()
84  {
85  if (is_null($this->shippingMethod)) {
87  $data = $this->raw(self::FIELD_SHIPPING_METHOD);
88  if (is_null($data)) {
89  return null;
90  }
91 
92  $this->shippingMethod = ShippingMethodResourceIdentifierModel::of($data);
93  }
94 
95  return $this->shippingMethod;
96  }
97 
104  public function getExternalTaxRate()
105  {
106  if (is_null($this->externalTaxRate)) {
108  $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
109  if (is_null($data)) {
110  return null;
111  }
112 
113  $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
114  }
115 
116  return $this->externalTaxRate;
117  }
118 
119 
124  {
125  $this->shippingMethod = $shippingMethod;
126  }
127 
132  {
133  $this->externalTaxRate = $externalTaxRate;
134  }
135 }
__construct(?ShippingMethodResourceIdentifier $shippingMethod=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?string $action=null)
setShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)