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