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