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 GetDccRateResponse extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $disclaimerDisplay = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $disclaimerReceipt = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $proposal = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $result = null; |
34: | |
35: | |
36: | |
37: | |
38: | public function toObject() |
39: | { |
40: | $object = parent::toObject(); |
41: | if (!is_null($this->disclaimerDisplay)) { |
42: | $object->disclaimerDisplay = $this->disclaimerDisplay; |
43: | } |
44: | if (!is_null($this->disclaimerReceipt)) { |
45: | $object->disclaimerReceipt = $this->disclaimerReceipt; |
46: | } |
47: | if (!is_null($this->proposal)) { |
48: | $object->proposal = $this->proposal->toObject(); |
49: | } |
50: | if (!is_null($this->result)) { |
51: | $object->result = $this->result; |
52: | } |
53: | return $object; |
54: | } |
55: | |
56: | |
57: | |
58: | |
59: | |
60: | |
61: | public function fromObject($object) |
62: | { |
63: | parent::fromObject($object); |
64: | if (property_exists($object, 'disclaimerDisplay')) { |
65: | $this->disclaimerDisplay = $object->disclaimerDisplay; |
66: | } |
67: | if (property_exists($object, 'disclaimerReceipt')) { |
68: | $this->disclaimerReceipt = $object->disclaimerReceipt; |
69: | } |
70: | if (property_exists($object, 'proposal')) { |
71: | if (!is_object($object->proposal)) { |
72: | throw new UnexpectedValueException('value \'' . print_r($object->proposal, true) . '\' is not an object'); |
73: | } |
74: | $value = new DccProposal(); |
75: | $this->proposal = $value->fromObject($object->proposal); |
76: | } |
77: | if (property_exists($object, 'result')) { |
78: | $this->result = $object->result; |
79: | } |
80: | return $this; |
81: | } |
82: | } |
83: | |