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 RefundCustomer extends DataObject
15: {
16: /**
17: * @var AddressPersonal|null
18: */
19: public ?AddressPersonal $address = null;
20:
21: /**
22: * @var CompanyInformation|null
23: */
24: public ?CompanyInformation $companyInformation = null;
25:
26: /**
27: * @var ContactDetailsBase|null
28: */
29: public ?ContactDetailsBase $contactDetails = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $fiscalNumber = 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->companyInformation)) {
46: $object->companyInformation = $this->companyInformation->toObject();
47: }
48: if (!is_null($this->contactDetails)) {
49: $object->contactDetails = $this->contactDetails->toObject();
50: }
51: if (!is_null($this->fiscalNumber)) {
52: $object->fiscalNumber = $this->fiscalNumber;
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): RefundCustomer
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, 'companyInformation')) {
74: if (!is_object($object->companyInformation)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object');
76: }
77: $value = new CompanyInformation();
78: $this->companyInformation = $value->fromObject($object->companyInformation);
79: }
80: if (property_exists($object, 'contactDetails')) {
81: if (!is_object($object->contactDetails)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object');
83: }
84: $value = new ContactDetailsBase();
85: $this->contactDetails = $value->fromObject($object->contactDetails);
86: }
87: if (property_exists($object, 'fiscalNumber')) {
88: $this->fiscalNumber = $object->fiscalNumber;
89: }
90: return $this;
91: }
92: }
93: