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:
10: /**
11: * @package Worldline\Connect\Sdk\V1\Domain
12: */
13: class RefundResult extends AbstractOrderStatus
14: {
15: /**
16: * @var RefundOutput|null
17: */
18: public ?RefundOutput $refundOutput = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $status = null;
24:
25: /**
26: * @var OrderStatusOutput|null
27: */
28: public ?OrderStatusOutput $statusOutput = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->refundOutput)) {
37: $object->refundOutput = $this->refundOutput->toObject();
38: }
39: if (!is_null($this->status)) {
40: $object->status = $this->status;
41: }
42: if (!is_null($this->statusOutput)) {
43: $object->statusOutput = $this->statusOutput->toObject();
44: }
45: return $object;
46: }
47:
48: /**
49: * @param object $object
50: *
51: * @return $this
52: * @throws UnexpectedValueException
53: */
54: public function fromObject(object $object): RefundResult
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'refundOutput')) {
58: if (!is_object($object->refundOutput)) {
59: throw new UnexpectedValueException('value \'' . print_r($object->refundOutput, true) . '\' is not an object');
60: }
61: $value = new RefundOutput();
62: $this->refundOutput = $value->fromObject($object->refundOutput);
63: }
64: if (property_exists($object, 'status')) {
65: $this->status = $object->status;
66: }
67: if (property_exists($object, 'statusOutput')) {
68: if (!is_object($object->statusOutput)) {
69: throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object');
70: }
71: $value = new OrderStatusOutput();
72: $this->statusOutput = $value->fromObject($object->statusOutput);
73: }
74: return $this;
75: }
76: }
77: