1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class CapturePaymentShipping extends DataObject
15: {
16: /**
17: * @var AddressPersonal|null
18: */
19: public ?AddressPersonal $address = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $emailAddress = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $shippedFromZip = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $trackingNumber = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->address)) {
43: $object->address = $this->address->toObject();
44: }
45: if (!is_null($this->emailAddress)) {
46: $object->emailAddress = $this->emailAddress;
47: }
48: if (!is_null($this->shippedFromZip)) {
49: $object->shippedFromZip = $this->shippedFromZip;
50: }
51: if (!is_null($this->trackingNumber)) {
52: $object->trackingNumber = $this->trackingNumber;
53: }
54: return $object;
55: }
56:
57: /**
58: * @param object $object
59: *
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject(object $object): CapturePaymentShipping
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'address')) {
67: if (!is_object($object->address)) {
68: throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object');
69: }
70: $value = new AddressPersonal();
71: $this->address = $value->fromObject($object->address);
72: }
73: if (property_exists($object, 'emailAddress')) {
74: $this->emailAddress = $object->emailAddress;
75: }
76: if (property_exists($object, 'shippedFromZip')) {
77: $this->shippedFromZip = $object->shippedFromZip;
78: }
79: if (property_exists($object, 'trackingNumber')) {
80: $this->trackingNumber = $object->trackingNumber;
81: }
82: return $this;
83: }
84: }
85: