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