commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderFromCartDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final class OrderFromCartDraftBuilder implements Builder
28{
33 private $id;
34
39 private $cart;
40
45 private $version;
46
51 private $orderNumber;
52
57 private $purchaseOrderNumber;
58
63 private $paymentState;
64
69 private $shipmentState;
70
75 private $orderState;
76
81 private $state;
82
87 private $custom;
88
95 public function getId()
96 {
97 return $this->id;
98 }
99
107 public function getCart()
108 {
109 return $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart;
110 }
111
118 public function getVersion()
119 {
120 return $this->version;
121 }
122
130 public function getOrderNumber()
131 {
132 return $this->orderNumber;
133 }
134
143 public function getPurchaseOrderNumber()
144 {
145 return $this->purchaseOrderNumber;
146 }
147
154 public function getPaymentState()
155 {
156 return $this->paymentState;
157 }
158
165 public function getShipmentState()
166 {
167 return $this->shipmentState;
168 }
169
176 public function getOrderState()
177 {
178 return $this->orderState;
179 }
180
187 public function getState()
188 {
189 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
190 }
191
203 public function getCustom()
204 {
205 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
206 }
207
212 public function withId(?string $id)
213 {
214 $this->id = $id;
215
216 return $this;
217 }
218
223 public function withCart(?CartResourceIdentifier $cart)
224 {
225 $this->cart = $cart;
226
227 return $this;
228 }
229
234 public function withVersion(?int $version)
235 {
236 $this->version = $version;
237
238 return $this;
239 }
240
245 public function withOrderNumber(?string $orderNumber)
246 {
247 $this->orderNumber = $orderNumber;
248
249 return $this;
250 }
251
256 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
257 {
258 $this->purchaseOrderNumber = $purchaseOrderNumber;
259
260 return $this;
261 }
262
267 public function withPaymentState(?string $paymentState)
268 {
269 $this->paymentState = $paymentState;
270
271 return $this;
272 }
273
278 public function withShipmentState(?string $shipmentState)
279 {
280 $this->shipmentState = $shipmentState;
281
282 return $this;
283 }
284
289 public function withOrderState(?string $orderState)
290 {
291 $this->orderState = $orderState;
292
293 return $this;
294 }
295
300 public function withState(?StateResourceIdentifier $state)
301 {
302 $this->state = $state;
303
304 return $this;
305 }
306
311 public function withCustom(?CustomFieldsDraft $custom)
312 {
313 $this->custom = $custom;
314
315 return $this;
316 }
317
323 {
324 $this->cart = $cart;
325
326 return $this;
327 }
328
334 {
335 $this->state = $state;
336
337 return $this;
338 }
339
345 {
346 $this->custom = $custom;
347
348 return $this;
349 }
350
351 public function build(): OrderFromCartDraft
352 {
353 return new OrderFromCartDraftModel(
354 $this->id,
355 $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart,
356 $this->version,
357 $this->orderNumber,
358 $this->purchaseOrderNumber,
359 $this->paymentState,
360 $this->shipmentState,
361 $this->orderState,
362 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
363 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
364 );
365 }
366
367 public static function of(): OrderFromCartDraftBuilder
368 {
369 return new self();
370 }
371}