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 TransactionDataForDcc extends DataObject
15: {
16: /**
17: * @var AmountData
18: */
19: public $amount = null;
20:
21: /**
22: * @var DateTime
23: */
24: public $transactionTimestamp = null;
25:
26: /**
27: * @var string
28: */
29: public $transactionType = null;
30:
31: /**
32: * @return object
33: */
34: public function toObject()
35: {
36: $object = parent::toObject();
37: if (!is_null($this->amount)) {
38: $object->amount = $this->amount->toObject();
39: }
40: if (!is_null($this->transactionTimestamp)) {
41: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
42: }
43: if (!is_null($this->transactionType)) {
44: $object->transactionType = $this->transactionType;
45: }
46: return $object;
47: }
48:
49: /**
50: * @param object $object
51: * @return $this
52: * @throws UnexpectedValueException
53: */
54: public function fromObject($object)
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'amount')) {
58: if (!is_object($object->amount)) {
59: throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object');
60: }
61: $value = new AmountData();
62: $this->amount = $value->fromObject($object->amount);
63: }
64: if (property_exists($object, 'transactionTimestamp')) {
65: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
66: }
67: if (property_exists($object, 'transactionType')) {
68: $this->transactionType = $object->transactionType;
69: }
70: return $this;
71: }
72: }
73: