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 UpdateTokenRequest extends DataObject
15: {
16: /**
17: * @var TokenCard
18: */
19: public $card = null;
20:
21: /**
22: * @var TokenEWallet
23: */
24: public $eWallet = null;
25:
26: /**
27: * @var TokenNonSepaDirectDebit
28: */
29: public $nonSepaDirectDebit = null;
30:
31: /**
32: * @var int
33: */
34: public $paymentProductId = null;
35:
36: /**
37: * @var TokenSepaDirectDebitWithoutCreditor
38: */
39: public $sepaDirectDebit = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject()
45: {
46: $object = parent::toObject();
47: if (!is_null($this->card)) {
48: $object->card = $this->card->toObject();
49: }
50: if (!is_null($this->eWallet)) {
51: $object->eWallet = $this->eWallet->toObject();
52: }
53: if (!is_null($this->nonSepaDirectDebit)) {
54: $object->nonSepaDirectDebit = $this->nonSepaDirectDebit->toObject();
55: }
56: if (!is_null($this->paymentProductId)) {
57: $object->paymentProductId = $this->paymentProductId;
58: }
59: if (!is_null($this->sepaDirectDebit)) {
60: $object->sepaDirectDebit = $this->sepaDirectDebit->toObject();
61: }
62: return $object;
63: }
64:
65: /**
66: * @param object $object
67: * @return $this
68: * @throws UnexpectedValueException
69: */
70: public function fromObject($object)
71: {
72: parent::fromObject($object);
73: if (property_exists($object, 'card')) {
74: if (!is_object($object->card)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object');
76: }
77: $value = new TokenCard();
78: $this->card = $value->fromObject($object->card);
79: }
80: if (property_exists($object, 'eWallet')) {
81: if (!is_object($object->eWallet)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->eWallet, true) . '\' is not an object');
83: }
84: $value = new TokenEWallet();
85: $this->eWallet = $value->fromObject($object->eWallet);
86: }
87: if (property_exists($object, 'nonSepaDirectDebit')) {
88: if (!is_object($object->nonSepaDirectDebit)) {
89: throw new UnexpectedValueException('value \'' . print_r($object->nonSepaDirectDebit, true) . '\' is not an object');
90: }
91: $value = new TokenNonSepaDirectDebit();
92: $this->nonSepaDirectDebit = $value->fromObject($object->nonSepaDirectDebit);
93: }
94: if (property_exists($object, 'paymentProductId')) {
95: $this->paymentProductId = $object->paymentProductId;
96: }
97: if (property_exists($object, 'sepaDirectDebit')) {
98: if (!is_object($object->sepaDirectDebit)) {
99: throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebit, true) . '\' is not an object');
100: }
101: $value = new TokenSepaDirectDebitWithoutCreditor();
102: $this->sepaDirectDebit = $value->fromObject($object->sepaDirectDebit);
103: }
104: return $this;
105: }
106: }
107: