1: <?php
2: /*
3: * This file was automatically generated.
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: * @package Worldline\Acquiring\Sdk\V1\Domain
13: */
14: class RateData extends DataObject
15: {
16: /**
17: * @var float|null
18: */
19: public ?float $exchangeRate = null;
20:
21: /**
22: * @var float|null
23: */
24: public ?float $invertedExchangeRate = null;
25:
26: /**
27: * @var float|null
28: */
29: public ?float $markUp = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $markUpBasis = null;
35:
36: /**
37: * @var DateTime|null
38: */
39: public ?DateTime $quotationDateTime = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject(): object
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: * @param object $object
67: *
68: * @return $this
69: * @throws UnexpectedValueException
70: */
71: public function fromObject(object $object): RateData
72: {
73: parent::fromObject($object);
74: if (property_exists($object, 'exchangeRate')) {
75: $this->exchangeRate = $object->exchangeRate;
76: }
77: if (property_exists($object, 'invertedExchangeRate')) {
78: $this->invertedExchangeRate = $object->invertedExchangeRate;
79: }
80: if (property_exists($object, 'markUp')) {
81: $this->markUp = $object->markUp;
82: }
83: if (property_exists($object, 'markUpBasis')) {
84: $this->markUpBasis = $object->markUpBasis;
85: }
86: if (property_exists($object, 'quotationDateTime')) {
87: $this->quotationDateTime = new DateTime($object->quotationDateTime);
88: }
89: return $this;
90: }
91: }
92: