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 $brandSelector = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $captureImmediately = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $cardData = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $cardEntryMode = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $cardholderVerificationMethod = 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->brandSelector)) { |
65: | $object->brandSelector = $this->brandSelector; |
66: | } |
67: | if (!is_null($this->captureImmediately)) { |
68: | $object->captureImmediately = $this->captureImmediately; |
69: | } |
70: | if (!is_null($this->cardData)) { |
71: | $object->cardData = $this->cardData->toObject(); |
72: | } |
73: | if (!is_null($this->cardEntryMode)) { |
74: | $object->cardEntryMode = $this->cardEntryMode; |
75: | } |
76: | if (!is_null($this->cardholderVerificationMethod)) { |
77: | $object->cardholderVerificationMethod = $this->cardholderVerificationMethod; |
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, 'brandSelector')) { |
100: | $this->brandSelector = $object->brandSelector; |
101: | } |
102: | if (property_exists($object, 'captureImmediately')) { |
103: | $this->captureImmediately = $object->captureImmediately; |
104: | } |
105: | if (property_exists($object, 'cardData')) { |
106: | if (!is_object($object->cardData)) { |
107: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
108: | } |
109: | $value = new PlainCardData(); |
110: | $this->cardData = $value->fromObject($object->cardData); |
111: | } |
112: | if (property_exists($object, 'cardEntryMode')) { |
113: | $this->cardEntryMode = $object->cardEntryMode; |
114: | } |
115: | if (property_exists($object, 'cardholderVerificationMethod')) { |
116: | $this->cardholderVerificationMethod = $object->cardholderVerificationMethod; |
117: | } |
118: | if (property_exists($object, 'networkTokenData')) { |
119: | if (!is_object($object->networkTokenData)) { |
120: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
121: | } |
122: | $value = new NetworkTokenData(); |
123: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
124: | } |
125: | if (property_exists($object, 'walletId')) { |
126: | $this->walletId = $object->walletId; |
127: | } |
128: | return $this; |
129: | } |
130: | } |
131: | |