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 CustomerBase extends DataObject
15: {
16: /**
17: * @var CompanyInformation|null
18: */
19: public ?CompanyInformation $companyInformation = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $merchantCustomerId = null;
25:
26: /**
27: * @var string|null
28: *
29: * @deprecated Use companyInformation.vatNumber instead
30: */
31: public ?string $vatNumber = null;
32:
33: /**
34: * @return object
35: */
36: public function toObject(): object
37: {
38: $object = parent::toObject();
39: if (!is_null($this->companyInformation)) {
40: $object->companyInformation = $this->companyInformation->toObject();
41: }
42: if (!is_null($this->merchantCustomerId)) {
43: $object->merchantCustomerId = $this->merchantCustomerId;
44: }
45: if (!is_null($this->vatNumber)) {
46: $object->vatNumber = $this->vatNumber;
47: }
48: return $object;
49: }
50:
51: /**
52: * @param object $object
53: *
54: * @return $this
55: * @throws UnexpectedValueException
56: */
57: public function fromObject(object $object): CustomerBase
58: {
59: parent::fromObject($object);
60: if (property_exists($object, 'companyInformation')) {
61: if (!is_object($object->companyInformation)) {
62: throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object');
63: }
64: $value = new CompanyInformation();
65: $this->companyInformation = $value->fromObject($object->companyInformation);
66: }
67: if (property_exists($object, 'merchantCustomerId')) {
68: $this->merchantCustomerId = $object->merchantCustomerId;
69: }
70: if (property_exists($object, 'vatNumber')) {
71: $this->vatNumber = $object->vatNumber;
72: }
73: return $this;
74: }
75: }
76: