commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PaymentBuilder.php
1<?php
2
3declare(strict_types=1);
10
30use DateTimeImmutable;
31use stdClass;
32
36final class PaymentBuilder implements Builder
37{
42 private $id;
43
48 private $version;
49
54 private $createdAt;
55
60 private $lastModifiedAt;
61
66 private $lastModifiedBy;
67
72 private $createdBy;
73
78 private $customer;
79
84 private $anonymousId;
85
90 private $interfaceId;
91
96 private $amountPlanned;
97
102 private $paymentMethodInfo;
103
108 private $paymentStatus;
109
114 private $transactions;
115
120 private $interfaceInteractions;
121
126 private $custom;
127
132 private $key;
133
140 public function getId()
141 {
142 return $this->id;
143 }
144
151 public function getVersion()
152 {
153 return $this->version;
154 }
155
162 public function getCreatedAt()
163 {
164 return $this->createdAt;
165 }
166
173 public function getLastModifiedAt()
174 {
175 return $this->lastModifiedAt;
176 }
177
184 public function getLastModifiedBy()
185 {
186 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
187 }
188
195 public function getCreatedBy()
196 {
197 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
198 }
199
206 public function getCustomer()
207 {
208 return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
209 }
210
217 public function getAnonymousId()
218 {
219 return $this->anonymousId;
220 }
221
229 public function getInterfaceId()
230 {
231 return $this->interfaceId;
232 }
233
241 public function getAmountPlanned()
242 {
243 return $this->amountPlanned instanceof CentPrecisionMoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned;
244 }
245
252 public function getPaymentMethodInfo()
253 {
254 return $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo;
255 }
256
263 public function getPaymentStatus()
264 {
265 return $this->paymentStatus instanceof PaymentStatusBuilder ? $this->paymentStatus->build() : $this->paymentStatus;
266 }
267
274 public function getTransactions()
275 {
276 return $this->transactions;
277 }
278
285 public function getInterfaceInteractions()
286 {
287 return $this->interfaceInteractions;
288 }
289
296 public function getCustom()
297 {
298 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
299 }
300
307 public function getKey()
308 {
309 return $this->key;
310 }
311
316 public function withId(?string $id)
317 {
318 $this->id = $id;
319
320 return $this;
321 }
322
327 public function withVersion(?int $version)
328 {
329 $this->version = $version;
330
331 return $this;
332 }
333
338 public function withCreatedAt(?DateTimeImmutable $createdAt)
339 {
340 $this->createdAt = $createdAt;
341
342 return $this;
343 }
344
349 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
350 {
351 $this->lastModifiedAt = $lastModifiedAt;
352
353 return $this;
354 }
355
360 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
361 {
362 $this->lastModifiedBy = $lastModifiedBy;
363
364 return $this;
365 }
366
371 public function withCreatedBy(?CreatedBy $createdBy)
372 {
373 $this->createdBy = $createdBy;
374
375 return $this;
376 }
377
382 public function withCustomer(?CustomerReference $customer)
383 {
384 $this->customer = $customer;
385
386 return $this;
387 }
388
393 public function withAnonymousId(?string $anonymousId)
394 {
395 $this->anonymousId = $anonymousId;
396
397 return $this;
398 }
399
404 public function withInterfaceId(?string $interfaceId)
405 {
406 $this->interfaceId = $interfaceId;
407
408 return $this;
409 }
410
415 public function withAmountPlanned(?CentPrecisionMoney $amountPlanned)
416 {
417 $this->amountPlanned = $amountPlanned;
418
419 return $this;
420 }
421
426 public function withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
427 {
428 $this->paymentMethodInfo = $paymentMethodInfo;
429
430 return $this;
431 }
432
437 public function withPaymentStatus(?PaymentStatus $paymentStatus)
438 {
439 $this->paymentStatus = $paymentStatus;
440
441 return $this;
442 }
443
448 public function withTransactions(?TransactionCollection $transactions)
449 {
450 $this->transactions = $transactions;
451
452 return $this;
453 }
454
459 public function withInterfaceInteractions(?CustomFieldsCollection $interfaceInteractions)
460 {
461 $this->interfaceInteractions = $interfaceInteractions;
462
463 return $this;
464 }
465
470 public function withCustom(?CustomFields $custom)
471 {
472 $this->custom = $custom;
473
474 return $this;
475 }
476
481 public function withKey(?string $key)
482 {
483 $this->key = $key;
484
485 return $this;
486 }
487
492 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
493 {
494 $this->lastModifiedBy = $lastModifiedBy;
495
496 return $this;
497 }
498
503 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
504 {
505 $this->createdBy = $createdBy;
506
507 return $this;
508 }
509
515 {
516 $this->customer = $customer;
517
518 return $this;
519 }
520
526 {
527 $this->amountPlanned = $amountPlanned;
528
529 return $this;
530 }
531
536 public function withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
537 {
538 $this->paymentMethodInfo = $paymentMethodInfo;
539
540 return $this;
541 }
542
547 public function withPaymentStatusBuilder(?PaymentStatusBuilder $paymentStatus)
548 {
549 $this->paymentStatus = $paymentStatus;
550
551 return $this;
552 }
553
558 public function withCustomBuilder(?CustomFieldsBuilder $custom)
559 {
560 $this->custom = $custom;
561
562 return $this;
563 }
564
565 public function build(): Payment
566 {
567 return new PaymentModel(
568 $this->id,
569 $this->version,
570 $this->createdAt,
571 $this->lastModifiedAt,
572 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
573 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
574 $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
575 $this->anonymousId,
576 $this->interfaceId,
577 $this->amountPlanned instanceof CentPrecisionMoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned,
578 $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo,
579 $this->paymentStatus instanceof PaymentStatusBuilder ? $this->paymentStatus->build() : $this->paymentStatus,
580 $this->transactions,
581 $this->interfaceInteractions,
582 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
583 $this->key
584 );
585 }
586
587 public static function of(): PaymentBuilder
588 {
589 return new self();
590 }
591}
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withTransactions(?TransactionCollection $transactions)
withCustomerBuilder(?CustomerReferenceBuilder $customer)
withInterfaceInteractions(?CustomFieldsCollection $interfaceInteractions)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withAmountPlannedBuilder(?CentPrecisionMoneyBuilder $amountPlanned)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withCustomBuilder(?CustomFieldsBuilder $custom)
withPaymentStatusBuilder(?PaymentStatusBuilder $paymentStatus)
withAmountPlanned(?CentPrecisionMoney $amountPlanned)
withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
withPaymentStatus(?PaymentStatus $paymentStatus)