1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use DateTime; |
8: | use UnexpectedValueException; |
9: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class RateData extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $exchangeRate = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $invertedExchangeRate = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $markUp = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $markUpBasis = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $quotationDateTime = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
45: | { |
46: | $object = parent::toObject(); |
47: | if (!is_null($this->exchangeRate)) { |
48: | $object->exchangeRate = $this->exchangeRate; |
49: | } |
50: | if (!is_null($this->invertedExchangeRate)) { |
51: | $object->invertedExchangeRate = $this->invertedExchangeRate; |
52: | } |
53: | if (!is_null($this->markUp)) { |
54: | $object->markUp = $this->markUp; |
55: | } |
56: | if (!is_null($this->markUpBasis)) { |
57: | $object->markUpBasis = $this->markUpBasis; |
58: | } |
59: | if (!is_null($this->quotationDateTime)) { |
60: | $object->quotationDateTime = $this->quotationDateTime->format('Y-m-d\\TH:i:s.vP'); |
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, 'exchangeRate')) { |
74: | $this->exchangeRate = $object->exchangeRate; |
75: | } |
76: | if (property_exists($object, 'invertedExchangeRate')) { |
77: | $this->invertedExchangeRate = $object->invertedExchangeRate; |
78: | } |
79: | if (property_exists($object, 'markUp')) { |
80: | $this->markUp = $object->markUp; |
81: | } |
82: | if (property_exists($object, 'markUpBasis')) { |
83: | $this->markUpBasis = $object->markUpBasis; |
84: | } |
85: | if (property_exists($object, 'quotationDateTime')) { |
86: | $this->quotationDateTime = new DateTime($object->quotationDateTime); |
87: | } |
88: | return $this; |
89: | } |
90: | } |
91: | |