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 $brandSelector = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $cardData = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $cardEntryMode = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $cardOnFileData = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $cardholderVerificationMethod = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $ecommerceData = null; |
49: | |
50: | |
51: | |
52: | |
53: | public $networkTokenData = null; |
54: | |
55: | |
56: | |
57: | |
58: | public $pointOfSaleData = null; |
59: | |
60: | |
61: | |
62: | |
63: | public $walletId = null; |
64: | |
65: | |
66: | |
67: | |
68: | public function toObject() |
69: | { |
70: | $object = parent::toObject(); |
71: | if (!is_null($this->brand)) { |
72: | $object->brand = $this->brand; |
73: | } |
74: | if (!is_null($this->brandSelector)) { |
75: | $object->brandSelector = $this->brandSelector; |
76: | } |
77: | if (!is_null($this->cardData)) { |
78: | $object->cardData = $this->cardData->toObject(); |
79: | } |
80: | if (!is_null($this->cardEntryMode)) { |
81: | $object->cardEntryMode = $this->cardEntryMode; |
82: | } |
83: | if (!is_null($this->cardOnFileData)) { |
84: | $object->cardOnFileData = $this->cardOnFileData->toObject(); |
85: | } |
86: | if (!is_null($this->cardholderVerificationMethod)) { |
87: | $object->cardholderVerificationMethod = $this->cardholderVerificationMethod; |
88: | } |
89: | if (!is_null($this->ecommerceData)) { |
90: | $object->ecommerceData = $this->ecommerceData->toObject(); |
91: | } |
92: | if (!is_null($this->networkTokenData)) { |
93: | $object->networkTokenData = $this->networkTokenData->toObject(); |
94: | } |
95: | if (!is_null($this->pointOfSaleData)) { |
96: | $object->pointOfSaleData = $this->pointOfSaleData->toObject(); |
97: | } |
98: | if (!is_null($this->walletId)) { |
99: | $object->walletId = $this->walletId; |
100: | } |
101: | return $object; |
102: | } |
103: | |
104: | |
105: | |
106: | |
107: | |
108: | |
109: | public function fromObject($object) |
110: | { |
111: | parent::fromObject($object); |
112: | if (property_exists($object, 'brand')) { |
113: | $this->brand = $object->brand; |
114: | } |
115: | if (property_exists($object, 'brandSelector')) { |
116: | $this->brandSelector = $object->brandSelector; |
117: | } |
118: | if (property_exists($object, 'cardData')) { |
119: | if (!is_object($object->cardData)) { |
120: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
121: | } |
122: | $value = new PlainCardData(); |
123: | $this->cardData = $value->fromObject($object->cardData); |
124: | } |
125: | if (property_exists($object, 'cardEntryMode')) { |
126: | $this->cardEntryMode = $object->cardEntryMode; |
127: | } |
128: | if (property_exists($object, 'cardOnFileData')) { |
129: | if (!is_object($object->cardOnFileData)) { |
130: | throw new UnexpectedValueException('value \'' . print_r($object->cardOnFileData, true) . '\' is not an object'); |
131: | } |
132: | $value = new CardOnFileData(); |
133: | $this->cardOnFileData = $value->fromObject($object->cardOnFileData); |
134: | } |
135: | if (property_exists($object, 'cardholderVerificationMethod')) { |
136: | $this->cardholderVerificationMethod = $object->cardholderVerificationMethod; |
137: | } |
138: | if (property_exists($object, 'ecommerceData')) { |
139: | if (!is_object($object->ecommerceData)) { |
140: | throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object'); |
141: | } |
142: | $value = new ECommerceDataForAccountVerification(); |
143: | $this->ecommerceData = $value->fromObject($object->ecommerceData); |
144: | } |
145: | if (property_exists($object, 'networkTokenData')) { |
146: | if (!is_object($object->networkTokenData)) { |
147: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
148: | } |
149: | $value = new NetworkTokenData(); |
150: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
151: | } |
152: | if (property_exists($object, 'pointOfSaleData')) { |
153: | if (!is_object($object->pointOfSaleData)) { |
154: | throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object'); |
155: | } |
156: | $value = new PointOfSaleData(); |
157: | $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData); |
158: | } |
159: | if (property_exists($object, 'walletId')) { |
160: | $this->walletId = $object->walletId; |
161: | } |
162: | return $this; |
163: | } |
164: | } |
165: | |