1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class TokenCardData extends DataObject
15: {
16: /**
17: * @var CardWithoutCvv|null
18: */
19: public ?CardWithoutCvv $cardWithoutCvv = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $firstTransactionDate = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $providerReference = null;
30:
31: /**
32: * @return object
33: */
34: public function toObject(): object
35: {
36: $object = parent::toObject();
37: if (!is_null($this->cardWithoutCvv)) {
38: $object->cardWithoutCvv = $this->cardWithoutCvv->toObject();
39: }
40: if (!is_null($this->firstTransactionDate)) {
41: $object->firstTransactionDate = $this->firstTransactionDate;
42: }
43: if (!is_null($this->providerReference)) {
44: $object->providerReference = $this->providerReference;
45: }
46: return $object;
47: }
48:
49: /**
50: * @param object $object
51: *
52: * @return $this
53: * @throws UnexpectedValueException
54: */
55: public function fromObject(object $object): TokenCardData
56: {
57: parent::fromObject($object);
58: if (property_exists($object, 'cardWithoutCvv')) {
59: if (!is_object($object->cardWithoutCvv)) {
60: throw new UnexpectedValueException('value \'' . print_r($object->cardWithoutCvv, true) . '\' is not an object');
61: }
62: $value = new CardWithoutCvv();
63: $this->cardWithoutCvv = $value->fromObject($object->cardWithoutCvv);
64: }
65: if (property_exists($object, 'firstTransactionDate')) {
66: $this->firstTransactionDate = $object->firstTransactionDate;
67: }
68: if (property_exists($object, 'providerReference')) {
69: $this->providerReference = $object->providerReference;
70: }
71: return $this;
72: }
73: }
74: