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