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 WebhooksEvent extends DataObject
15: {
16: /**
17: * @var string
18: */
19: public $apiVersion = null;
20:
21: /**
22: * @var CaptureResponse
23: */
24: public $capture = null;
25:
26: /**
27: * @var string
28: */
29: public $created = null;
30:
31: /**
32: * @var DisputeResponse
33: */
34: public $dispute = null;
35:
36: /**
37: * @var string
38: */
39: public $id = null;
40:
41: /**
42: * @var string
43: */
44: public $merchantId = null;
45:
46: /**
47: * @var PaymentResponse
48: */
49: public $payment = null;
50:
51: /**
52: * @var PayoutResponse
53: */
54: public $payout = null;
55:
56: /**
57: * @var RefundResponse
58: */
59: public $refund = null;
60:
61: /**
62: * @var TokenResponse
63: */
64: public $token = null;
65:
66: /**
67: * @var string
68: */
69: public $type = null;
70:
71: /**
72: * @return object
73: */
74: public function toObject()
75: {
76: $object = parent::toObject();
77: if (!is_null($this->apiVersion)) {
78: $object->apiVersion = $this->apiVersion;
79: }
80: if (!is_null($this->capture)) {
81: $object->capture = $this->capture->toObject();
82: }
83: if (!is_null($this->created)) {
84: $object->created = $this->created;
85: }
86: if (!is_null($this->dispute)) {
87: $object->dispute = $this->dispute->toObject();
88: }
89: if (!is_null($this->id)) {
90: $object->id = $this->id;
91: }
92: if (!is_null($this->merchantId)) {
93: $object->merchantId = $this->merchantId;
94: }
95: if (!is_null($this->payment)) {
96: $object->payment = $this->payment->toObject();
97: }
98: if (!is_null($this->payout)) {
99: $object->payout = $this->payout->toObject();
100: }
101: if (!is_null($this->refund)) {
102: $object->refund = $this->refund->toObject();
103: }
104: if (!is_null($this->token)) {
105: $object->token = $this->token->toObject();
106: }
107: if (!is_null($this->type)) {
108: $object->type = $this->type;
109: }
110: return $object;
111: }
112:
113: /**
114: * @param object $object
115: * @return $this
116: * @throws UnexpectedValueException
117: */
118: public function fromObject($object)
119: {
120: parent::fromObject($object);
121: if (property_exists($object, 'apiVersion')) {
122: $this->apiVersion = $object->apiVersion;
123: }
124: if (property_exists($object, 'capture')) {
125: if (!is_object($object->capture)) {
126: throw new UnexpectedValueException('value \'' . print_r($object->capture, true) . '\' is not an object');
127: }
128: $value = new CaptureResponse();
129: $this->capture = $value->fromObject($object->capture);
130: }
131: if (property_exists($object, 'created')) {
132: $this->created = $object->created;
133: }
134: if (property_exists($object, 'dispute')) {
135: if (!is_object($object->dispute)) {
136: throw new UnexpectedValueException('value \'' . print_r($object->dispute, true) . '\' is not an object');
137: }
138: $value = new DisputeResponse();
139: $this->dispute = $value->fromObject($object->dispute);
140: }
141: if (property_exists($object, 'id')) {
142: $this->id = $object->id;
143: }
144: if (property_exists($object, 'merchantId')) {
145: $this->merchantId = $object->merchantId;
146: }
147: if (property_exists($object, 'payment')) {
148: if (!is_object($object->payment)) {
149: throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object');
150: }
151: $value = new PaymentResponse();
152: $this->payment = $value->fromObject($object->payment);
153: }
154: if (property_exists($object, 'payout')) {
155: if (!is_object($object->payout)) {
156: throw new UnexpectedValueException('value \'' . print_r($object->payout, true) . '\' is not an object');
157: }
158: $value = new PayoutResponse();
159: $this->payout = $value->fromObject($object->payout);
160: }
161: if (property_exists($object, 'refund')) {
162: if (!is_object($object->refund)) {
163: throw new UnexpectedValueException('value \'' . print_r($object->refund, true) . '\' is not an object');
164: }
165: $value = new RefundResponse();
166: $this->refund = $value->fromObject($object->refund);
167: }
168: if (property_exists($object, 'token')) {
169: if (!is_object($object->token)) {
170: throw new UnexpectedValueException('value \'' . print_r($object->token, true) . '\' is not an object');
171: }
172: $value = new TokenResponse();
173: $this->token = $value->fromObject($object->token);
174: }
175: if (property_exists($object, 'type')) {
176: $this->type = $object->type;
177: }
178: return $this;
179: }
180: }
181: