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 PaymentProduct840SpecificOutput extends DataObject
15: {
16: /**
17: * @var Address|null
18: */
19: public ?Address $billingAddress = null;
20:
21: /**
22: * @var PaymentProduct840CustomerAccount|null
23: */
24: public ?PaymentProduct840CustomerAccount $customerAccount = null;
25:
26: /**
27: * @var Address|null
28: */
29: public ?Address $customerAddress = null;
30:
31: /**
32: * @var ProtectionEligibility|null
33: */
34: public ?ProtectionEligibility $protectionEligibility = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->billingAddress)) {
43: $object->billingAddress = $this->billingAddress->toObject();
44: }
45: if (!is_null($this->customerAccount)) {
46: $object->customerAccount = $this->customerAccount->toObject();
47: }
48: if (!is_null($this->customerAddress)) {
49: $object->customerAddress = $this->customerAddress->toObject();
50: }
51: if (!is_null($this->protectionEligibility)) {
52: $object->protectionEligibility = $this->protectionEligibility->toObject();
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): PaymentProduct840SpecificOutput
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'billingAddress')) {
67: if (!is_object($object->billingAddress)) {
68: throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object');
69: }
70: $value = new Address();
71: $this->billingAddress = $value->fromObject($object->billingAddress);
72: }
73: if (property_exists($object, 'customerAccount')) {
74: if (!is_object($object->customerAccount)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->customerAccount, true) . '\' is not an object');
76: }
77: $value = new PaymentProduct840CustomerAccount();
78: $this->customerAccount = $value->fromObject($object->customerAccount);
79: }
80: if (property_exists($object, 'customerAddress')) {
81: if (!is_object($object->customerAddress)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->customerAddress, true) . '\' is not an object');
83: }
84: $value = new Address();
85: $this->customerAddress = $value->fromObject($object->customerAddress);
86: }
87: if (property_exists($object, 'protectionEligibility')) {
88: if (!is_object($object->protectionEligibility)) {
89: throw new UnexpectedValueException('value \'' . print_r($object->protectionEligibility, true) . '\' is not an object');
90: }
91: $value = new ProtectionEligibility();
92: $this->protectionEligibility = $value->fromObject($object->protectionEligibility);
93: }
94: return $this;
95: }
96: }
97: