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|null
18: */
19: public ?string $apiVersion = null;
20:
21: /**
22: * @var CaptureResponse|null
23: */
24: public ?CaptureResponse $capture = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $created = null;
30:
31: /**
32: * @var DisputeResponse|null
33: */
34: public ?DisputeResponse $dispute = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $id = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $merchantId = null;
45:
46: /**
47: * @var PaymentResponse|null
48: */
49: public ?PaymentResponse $payment = null;
50:
51: /**
52: * @var PayoutResponse|null
53: */
54: public ?PayoutResponse $payout = null;
55:
56: /**
57: * @var RefundResponse|null
58: */
59: public ?RefundResponse $refund = null;
60:
61: /**
62: * @var TokenResponse|null
63: */
64: public ?TokenResponse $token = null;
65:
66: /**
67: * @var string|null
68: */
69: public ?string $type = null;
70:
71: /**
72: * @return object
73: */
74: public function toObject(): object
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: *
116: * @return $this
117: * @throws UnexpectedValueException
118: */
119: public function fromObject(object $object): WebhooksEvent
120: {
121: parent::fromObject($object);
122: if (property_exists($object, 'apiVersion')) {
123: $this->apiVersion = $object->apiVersion;
124: }
125: if (property_exists($object, 'capture')) {
126: if (!is_object($object->capture)) {
127: throw new UnexpectedValueException('value \'' . print_r($object->capture, true) . '\' is not an object');
128: }
129: $value = new CaptureResponse();
130: $this->capture = $value->fromObject($object->capture);
131: }
132: if (property_exists($object, 'created')) {
133: $this->created = $object->created;
134: }
135: if (property_exists($object, 'dispute')) {
136: if (!is_object($object->dispute)) {
137: throw new UnexpectedValueException('value \'' . print_r($object->dispute, true) . '\' is not an object');
138: }
139: $value = new DisputeResponse();
140: $this->dispute = $value->fromObject($object->dispute);
141: }
142: if (property_exists($object, 'id')) {
143: $this->id = $object->id;
144: }
145: if (property_exists($object, 'merchantId')) {
146: $this->merchantId = $object->merchantId;
147: }
148: if (property_exists($object, 'payment')) {
149: if (!is_object($object->payment)) {
150: throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object');
151: }
152: $value = new PaymentResponse();
153: $this->payment = $value->fromObject($object->payment);
154: }
155: if (property_exists($object, 'payout')) {
156: if (!is_object($object->payout)) {
157: throw new UnexpectedValueException('value \'' . print_r($object->payout, true) . '\' is not an object');
158: }
159: $value = new PayoutResponse();
160: $this->payout = $value->fromObject($object->payout);
161: }
162: if (property_exists($object, 'refund')) {
163: if (!is_object($object->refund)) {
164: throw new UnexpectedValueException('value \'' . print_r($object->refund, true) . '\' is not an object');
165: }
166: $value = new RefundResponse();
167: $this->refund = $value->fromObject($object->refund);
168: }
169: if (property_exists($object, 'token')) {
170: if (!is_object($object->token)) {
171: throw new UnexpectedValueException('value \'' . print_r($object->token, true) . '\' is not an object');
172: }
173: $value = new TokenResponse();
174: $this->token = $value->fromObject($object->token);
175: }
176: if (property_exists($object, 'type')) {
177: $this->type = $object->type;
178: }
179: return $this;
180: }
181: }
182: