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
142 public function getPurchaseOrderNumber()
143 {
144 return $this->purchaseOrderNumber;
145 }
146
153 public function getPaymentState()
154 {
155 return $this->paymentState;
156 }
157
164 public function getShipmentState()
165 {
166 return $this->shipmentState;
167 }
168
175 public function getOrderState()
176 {
177 return $this->orderState;
178 }
179
186 public function getState()
187 {
188 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
189 }
190
202 public function getCustom()
203 {
204 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
205 }
206
211 public function withId(?string $id)
212 {
213 $this->id = $id;
214
215 return $this;
216 }
217
222 public function withCart(?CartResourceIdentifier $cart)
223 {
224 $this->cart = $cart;
225
226 return $this;
227 }
228
233 public function withVersion(?int $version)
234 {
235 $this->version = $version;
236
237 return $this;
238 }
239
244 public function withOrderNumber(?string $orderNumber)
245 {
246 $this->orderNumber = $orderNumber;
247
248 return $this;
249 }
250
255 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
256 {
257 $this->purchaseOrderNumber = $purchaseOrderNumber;
258
259 return $this;
260 }
261
266 public function withPaymentState(?string $paymentState)
267 {
268 $this->paymentState = $paymentState;
269
270 return $this;
271 }
272
277 public function withShipmentState(?string $shipmentState)
278 {
279 $this->shipmentState = $shipmentState;
280
281 return $this;
282 }
283
288 public function withOrderState(?string $orderState)
289 {
290 $this->orderState = $orderState;
291
292 return $this;
293 }
294
299 public function withState(?StateResourceIdentifier $state)
300 {
301 $this->state = $state;
302
303 return $this;
304 }
305
310 public function withCustom(?CustomFieldsDraft $custom)
311 {
312 $this->custom = $custom;
313
314 return $this;
315 }
316
322 {
323 $this->cart = $cart;
324
325 return $this;
326 }
327
333 {
334 $this->state = $state;
335
336 return $this;
337 }
338
344 {
345 $this->custom = $custom;
346
347 return $this;
348 }
349
350 public function build(): OrderFromCartDraft
351 {
352 return new OrderFromCartDraftModel(
353 $this->id,
354 $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart,
355 $this->version,
356 $this->orderNumber,
357 $this->purchaseOrderNumber,
358 $this->paymentState,
359 $this->shipmentState,
360 $this->orderState,
361 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
362 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
363 );
364 }
365
366 public static function of(): OrderFromCartDraftBuilder
367 {
368 return new self();
369 }
370}