commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartAddShippingMethodActionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use stdClass;
24 
29 {
34  private $shippingKey;
35 
40  private $shippingMethod;
41 
46  private $shippingAddress;
47 
52  private $shippingRateInput;
53 
58  private $externalTaxRate;
59 
64  private $deliveries;
65 
70  private $custom;
71 
78  public function getShippingKey()
79  {
80  return $this->shippingKey;
81  }
82 
90  public function getShippingMethod()
91  {
92  return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
93  }
94 
101  public function getShippingAddress()
102  {
103  return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
104  }
105 
118  public function getShippingRateInput()
119  {
120  return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
121  }
122 
129  public function getExternalTaxRate()
130  {
131  return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
132  }
133 
140  public function getDeliveries()
141  {
142  return $this->deliveries;
143  }
144 
151  public function getCustom()
152  {
153  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
154  }
155 
160  public function withShippingKey(?string $shippingKey)
161  {
162  $this->shippingKey = $shippingKey;
163 
164  return $this;
165  }
166 
171  public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
172  {
173  $this->shippingMethod = $shippingMethod;
174 
175  return $this;
176  }
177 
182  public function withShippingAddress(?BaseAddress $shippingAddress)
183  {
184  $this->shippingAddress = $shippingAddress;
185 
186  return $this;
187  }
188 
193  public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
194  {
195  $this->shippingRateInput = $shippingRateInput;
196 
197  return $this;
198  }
199 
204  public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
205  {
206  $this->externalTaxRate = $externalTaxRate;
207 
208  return $this;
209  }
210 
215  public function withDeliveries(?DeliveryDraftCollection $deliveries)
216  {
217  $this->deliveries = $deliveries;
218 
219  return $this;
220  }
221 
226  public function withCustom(?CustomFieldsDraft $custom)
227  {
228  $this->custom = $custom;
229 
230  return $this;
231  }
232 
238  {
239  $this->shippingMethod = $shippingMethod;
240 
241  return $this;
242  }
243 
248  public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
249  {
250  $this->shippingAddress = $shippingAddress;
251 
252  return $this;
253  }
254 
259  public function withShippingRateInputBuilder(?ShippingRateInputDraftBuilder $shippingRateInput)
260  {
261  $this->shippingRateInput = $shippingRateInput;
262 
263  return $this;
264  }
265 
270  public function withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
271  {
272  $this->externalTaxRate = $externalTaxRate;
273 
274  return $this;
275  }
276 
281  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
282  {
283  $this->custom = $custom;
284 
285  return $this;
286  }
287 
289  {
291  $this->shippingKey,
292  $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
293  $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
294  $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
295  $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
296  $this->deliveries,
297  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
298  );
299  }
300 
301  public static function of(): CartAddShippingMethodActionBuilder
302  {
303  return new self();
304  }
305 }
withShippingMethodBuilder(?ShippingMethodResourceIdentifierBuilder $shippingMethod)
withShippingRateInputBuilder(?ShippingRateInputDraftBuilder $shippingRateInput)