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 CardPaymentDataForRefund extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $brand = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $captureImmediately = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $cardData = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $cardEntryMode = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $networkTokenData = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $pointOfSaleData = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $walletId = null; |
49: | |
50: | |
51: | |
52: | |
53: | public function toObject() |
54: | { |
55: | $object = parent::toObject(); |
56: | if (!is_null($this->brand)) { |
57: | $object->brand = $this->brand; |
58: | } |
59: | if (!is_null($this->captureImmediately)) { |
60: | $object->captureImmediately = $this->captureImmediately; |
61: | } |
62: | if (!is_null($this->cardData)) { |
63: | $object->cardData = $this->cardData->toObject(); |
64: | } |
65: | if (!is_null($this->cardEntryMode)) { |
66: | $object->cardEntryMode = $this->cardEntryMode; |
67: | } |
68: | if (!is_null($this->networkTokenData)) { |
69: | $object->networkTokenData = $this->networkTokenData->toObject(); |
70: | } |
71: | if (!is_null($this->pointOfSaleData)) { |
72: | $object->pointOfSaleData = $this->pointOfSaleData->toObject(); |
73: | } |
74: | if (!is_null($this->walletId)) { |
75: | $object->walletId = $this->walletId; |
76: | } |
77: | return $object; |
78: | } |
79: | |
80: | |
81: | |
82: | |
83: | |
84: | |
85: | public function fromObject($object) |
86: | { |
87: | parent::fromObject($object); |
88: | if (property_exists($object, 'brand')) { |
89: | $this->brand = $object->brand; |
90: | } |
91: | if (property_exists($object, 'captureImmediately')) { |
92: | $this->captureImmediately = $object->captureImmediately; |
93: | } |
94: | if (property_exists($object, 'cardData')) { |
95: | if (!is_object($object->cardData)) { |
96: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
97: | } |
98: | $value = new PlainCardData(); |
99: | $this->cardData = $value->fromObject($object->cardData); |
100: | } |
101: | if (property_exists($object, 'cardEntryMode')) { |
102: | $this->cardEntryMode = $object->cardEntryMode; |
103: | } |
104: | if (property_exists($object, 'networkTokenData')) { |
105: | if (!is_object($object->networkTokenData)) { |
106: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
107: | } |
108: | $value = new NetworkTokenData(); |
109: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
110: | } |
111: | if (property_exists($object, 'pointOfSaleData')) { |
112: | if (!is_object($object->pointOfSaleData)) { |
113: | throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object'); |
114: | } |
115: | $value = new PointOfSaleData(); |
116: | $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData); |
117: | } |
118: | if (property_exists($object, 'walletId')) { |
119: | $this->walletId = $object->walletId; |
120: | } |
121: | return $this; |
122: | } |
123: | } |
124: | |