1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class Dispute extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $disputeOutput = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $id = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $paymentId = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $status = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $statusOutput = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
45: | { |
46: | $object = parent::toObject(); |
47: | if (!is_null($this->disputeOutput)) { |
48: | $object->disputeOutput = $this->disputeOutput->toObject(); |
49: | } |
50: | if (!is_null($this->id)) { |
51: | $object->id = $this->id; |
52: | } |
53: | if (!is_null($this->paymentId)) { |
54: | $object->paymentId = $this->paymentId; |
55: | } |
56: | if (!is_null($this->status)) { |
57: | $object->status = $this->status; |
58: | } |
59: | if (!is_null($this->statusOutput)) { |
60: | $object->statusOutput = $this->statusOutput->toObject(); |
61: | } |
62: | return $object; |
63: | } |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | public function fromObject($object) |
71: | { |
72: | parent::fromObject($object); |
73: | if (property_exists($object, 'disputeOutput')) { |
74: | if (!is_object($object->disputeOutput)) { |
75: | throw new UnexpectedValueException('value \'' . print_r($object->disputeOutput, true) . '\' is not an object'); |
76: | } |
77: | $value = new DisputeOutput(); |
78: | $this->disputeOutput = $value->fromObject($object->disputeOutput); |
79: | } |
80: | if (property_exists($object, 'id')) { |
81: | $this->id = $object->id; |
82: | } |
83: | if (property_exists($object, 'paymentId')) { |
84: | $this->paymentId = $object->paymentId; |
85: | } |
86: | if (property_exists($object, 'status')) { |
87: | $this->status = $object->status; |
88: | } |
89: | if (property_exists($object, 'statusOutput')) { |
90: | if (!is_object($object->statusOutput)) { |
91: | throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); |
92: | } |
93: | $value = new DisputeStatusOutput(); |
94: | $this->statusOutput = $value->fromObject($object->statusOutput); |
95: | } |
96: | return $this; |
97: | } |
98: | } |
99: | |