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