1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use UnexpectedValueException; |
8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
9: | |
10: | |
11: | |
12: | |
13: | class CardPaymentDataForVerification extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $brand = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $cardData = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $cardEntryMode = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $cardOnFileData = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $cardholderVerificationMethod = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $ecommerceData = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $networkTokenData = null; |
49: | |
50: | |
51: | |
52: | |
53: | public $walletId = null; |
54: | |
55: | |
56: | |
57: | |
58: | public function toObject() |
59: | { |
60: | $object = parent::toObject(); |
61: | if (!is_null($this->brand)) { |
62: | $object->brand = $this->brand; |
63: | } |
64: | if (!is_null($this->cardData)) { |
65: | $object->cardData = $this->cardData->toObject(); |
66: | } |
67: | if (!is_null($this->cardEntryMode)) { |
68: | $object->cardEntryMode = $this->cardEntryMode; |
69: | } |
70: | if (!is_null($this->cardOnFileData)) { |
71: | $object->cardOnFileData = $this->cardOnFileData->toObject(); |
72: | } |
73: | if (!is_null($this->cardholderVerificationMethod)) { |
74: | $object->cardholderVerificationMethod = $this->cardholderVerificationMethod; |
75: | } |
76: | if (!is_null($this->ecommerceData)) { |
77: | $object->ecommerceData = $this->ecommerceData->toObject(); |
78: | } |
79: | if (!is_null($this->networkTokenData)) { |
80: | $object->networkTokenData = $this->networkTokenData->toObject(); |
81: | } |
82: | if (!is_null($this->walletId)) { |
83: | $object->walletId = $this->walletId; |
84: | } |
85: | return $object; |
86: | } |
87: | |
88: | |
89: | |
90: | |
91: | |
92: | |
93: | public function fromObject($object) |
94: | { |
95: | parent::fromObject($object); |
96: | if (property_exists($object, 'brand')) { |
97: | $this->brand = $object->brand; |
98: | } |
99: | if (property_exists($object, 'cardData')) { |
100: | if (!is_object($object->cardData)) { |
101: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
102: | } |
103: | $value = new PlainCardData(); |
104: | $this->cardData = $value->fromObject($object->cardData); |
105: | } |
106: | if (property_exists($object, 'cardEntryMode')) { |
107: | $this->cardEntryMode = $object->cardEntryMode; |
108: | } |
109: | if (property_exists($object, 'cardOnFileData')) { |
110: | if (!is_object($object->cardOnFileData)) { |
111: | throw new UnexpectedValueException('value \'' . print_r($object->cardOnFileData, true) . '\' is not an object'); |
112: | } |
113: | $value = new CardOnFileData(); |
114: | $this->cardOnFileData = $value->fromObject($object->cardOnFileData); |
115: | } |
116: | if (property_exists($object, 'cardholderVerificationMethod')) { |
117: | $this->cardholderVerificationMethod = $object->cardholderVerificationMethod; |
118: | } |
119: | if (property_exists($object, 'ecommerceData')) { |
120: | if (!is_object($object->ecommerceData)) { |
121: | throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object'); |
122: | } |
123: | $value = new ECommerceDataForAccountVerification(); |
124: | $this->ecommerceData = $value->fromObject($object->ecommerceData); |
125: | } |
126: | if (property_exists($object, 'networkTokenData')) { |
127: | if (!is_object($object->networkTokenData)) { |
128: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
129: | } |
130: | $value = new NetworkTokenData(); |
131: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
132: | } |
133: | if (property_exists($object, 'walletId')) { |
134: | $this->walletId = $object->walletId; |
135: | } |
136: | return $this; |
137: | } |
138: | } |
139: | |