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 CaptureStatusOutput extends DataObject
15: {
16: /**
17: * @var bool|null
18: */
19: public ?bool $isFinal = null;
20:
21: /**
22: * @var bool|null
23: */
24: public ?bool $isRefundable = 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 int|null
38: */
39: public ?int $statusCode = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $statusCodeChangeDateTime = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject(): object
50: {
51: $object = parent::toObject();
52: if (!is_null($this->isFinal)) {
53: $object->isFinal = $this->isFinal;
54: }
55: if (!is_null($this->isRefundable)) {
56: $object->isRefundable = $this->isRefundable;
57: }
58: if (!is_null($this->isRetriable)) {
59: $object->isRetriable = $this->isRetriable;
60: }
61: if (!is_null($this->providerRawOutput)) {
62: $object->providerRawOutput = [];
63: foreach ($this->providerRawOutput as $element) {
64: if (!is_null($element)) {
65: $object->providerRawOutput[] = $element->toObject();
66: }
67: }
68: }
69: if (!is_null($this->statusCode)) {
70: $object->statusCode = $this->statusCode;
71: }
72: if (!is_null($this->statusCodeChangeDateTime)) {
73: $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime;
74: }
75: return $object;
76: }
77:
78: /**
79: * @param object $object
80: *
81: * @return $this
82: * @throws UnexpectedValueException
83: */
84: public function fromObject(object $object): CaptureStatusOutput
85: {
86: parent::fromObject($object);
87: if (property_exists($object, 'isFinal')) {
88: $this->isFinal = $object->isFinal;
89: }
90: if (property_exists($object, 'isRefundable')) {
91: $this->isRefundable = $object->isRefundable;
92: }
93: if (property_exists($object, 'isRetriable')) {
94: $this->isRetriable = $object->isRetriable;
95: }
96: if (property_exists($object, 'providerRawOutput')) {
97: if (!is_array($object->providerRawOutput) && !is_object($object->providerRawOutput)) {
98: throw new UnexpectedValueException('value \'' . print_r($object->providerRawOutput, true) . '\' is not an array or object');
99: }
100: $this->providerRawOutput = [];
101: foreach ($object->providerRawOutput as $element) {
102: $value = new KeyValuePair();
103: $this->providerRawOutput[] = $value->fromObject($element);
104: }
105: }
106: if (property_exists($object, 'statusCode')) {
107: $this->statusCode = $object->statusCode;
108: }
109: if (property_exists($object, 'statusCodeChangeDateTime')) {
110: $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime;
111: }
112: return $this;
113: }
114: }
115: