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