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 OrderStatusOutput extends DataObject
15: {
16: /**
17: * @var APIError[]|null
18: */
19: public ?array $errors = null;
20:
21: /**
22: * @var bool|null
23: */
24: public ?bool $isCancellable = null;
25:
26: /**
27: * @var bool|null
28: */
29: public ?bool $isRetriable = null;
30:
31: /**
32: * @var KeyValuePair[]|null
33: */
34: public ?array $providerRawOutput = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $statusCategory = null;
40:
41: /**
42: * @var int|null
43: */
44: public ?int $statusCode = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $statusCodeChangeDateTime = null;
50:
51: /**
52: * @return object
53: */
54: public function toObject(): object
55: {
56: $object = parent::toObject();
57: if (!is_null($this->errors)) {
58: $object->errors = [];
59: foreach ($this->errors as $element) {
60: if (!is_null($element)) {
61: $object->errors[] = $element->toObject();
62: }
63: }
64: }
65: if (!is_null($this->isCancellable)) {
66: $object->isCancellable = $this->isCancellable;
67: }
68: if (!is_null($this->isRetriable)) {
69: $object->isRetriable = $this->isRetriable;
70: }
71: if (!is_null($this->providerRawOutput)) {
72: $object->providerRawOutput = [];
73: foreach ($this->providerRawOutput as $element) {
74: if (!is_null($element)) {
75: $object->providerRawOutput[] = $element->toObject();
76: }
77: }
78: }
79: if (!is_null($this->statusCategory)) {
80: $object->statusCategory = $this->statusCategory;
81: }
82: if (!is_null($this->statusCode)) {
83: $object->statusCode = $this->statusCode;
84: }
85: if (!is_null($this->statusCodeChangeDateTime)) {
86: $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime;
87: }
88: return $object;
89: }
90:
91: /**
92: * @param object $object
93: *
94: * @return $this
95: * @throws UnexpectedValueException
96: */
97: public function fromObject(object $object): OrderStatusOutput
98: {
99: parent::fromObject($object);
100: if (property_exists($object, 'errors')) {
101: if (!is_array($object->errors) && !is_object($object->errors)) {
102: throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object');
103: }
104: $this->errors = [];
105: foreach ($object->errors as $element) {
106: $value = new APIError();
107: $this->errors[] = $value->fromObject($element);
108: }
109: }
110: if (property_exists($object, 'isCancellable')) {
111: $this->isCancellable = $object->isCancellable;
112: }
113: if (property_exists($object, 'isRetriable')) {
114: $this->isRetriable = $object->isRetriable;
115: }
116: if (property_exists($object, 'providerRawOutput')) {
117: if (!is_array($object->providerRawOutput) && !is_object($object->providerRawOutput)) {
118: throw new UnexpectedValueException('value \'' . print_r($object->providerRawOutput, true) . '\' is not an array or object');
119: }
120: $this->providerRawOutput = [];
121: foreach ($object->providerRawOutput as $element) {
122: $value = new KeyValuePair();
123: $this->providerRawOutput[] = $value->fromObject($element);
124: }
125: }
126: if (property_exists($object, 'statusCategory')) {
127: $this->statusCategory = $object->statusCategory;
128: }
129: if (property_exists($object, 'statusCode')) {
130: $this->statusCode = $object->statusCode;
131: }
132: if (property_exists($object, 'statusCodeChangeDateTime')) {
133: $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime;
134: }
135: return $this;
136: }
137: }
138: