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