1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class WebhooksEvent extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $apiVersion = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $created = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $dispute = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $id = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $merchantId = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $payment = null; |
45: | |
46: | |
47: | |
48: | |
49: | public $payout = null; |
50: | |
51: | |
52: | |
53: | |
54: | public $refund = null; |
55: | |
56: | |
57: | |
58: | |
59: | public $token = null; |
60: | |
61: | |
62: | |
63: | |
64: | public $type = null; |
65: | |
66: | |
67: | |
68: | |
69: | public function toObject() |
70: | { |
71: | $object = parent::toObject(); |
72: | if (!is_null($this->apiVersion)) { |
73: | $object->apiVersion = $this->apiVersion; |
74: | } |
75: | if (!is_null($this->created)) { |
76: | $object->created = $this->created; |
77: | } |
78: | if (!is_null($this->dispute)) { |
79: | $object->dispute = $this->dispute->toObject(); |
80: | } |
81: | if (!is_null($this->id)) { |
82: | $object->id = $this->id; |
83: | } |
84: | if (!is_null($this->merchantId)) { |
85: | $object->merchantId = $this->merchantId; |
86: | } |
87: | if (!is_null($this->payment)) { |
88: | $object->payment = $this->payment->toObject(); |
89: | } |
90: | if (!is_null($this->payout)) { |
91: | $object->payout = $this->payout->toObject(); |
92: | } |
93: | if (!is_null($this->refund)) { |
94: | $object->refund = $this->refund->toObject(); |
95: | } |
96: | if (!is_null($this->token)) { |
97: | $object->token = $this->token->toObject(); |
98: | } |
99: | if (!is_null($this->type)) { |
100: | $object->type = $this->type; |
101: | } |
102: | return $object; |
103: | } |
104: | |
105: | |
106: | |
107: | |
108: | |
109: | |
110: | public function fromObject($object) |
111: | { |
112: | parent::fromObject($object); |
113: | if (property_exists($object, 'apiVersion')) { |
114: | $this->apiVersion = $object->apiVersion; |
115: | } |
116: | if (property_exists($object, 'created')) { |
117: | $this->created = $object->created; |
118: | } |
119: | if (property_exists($object, 'dispute')) { |
120: | if (!is_object($object->dispute)) { |
121: | throw new UnexpectedValueException('value \'' . print_r($object->dispute, true) . '\' is not an object'); |
122: | } |
123: | $value = new DisputeResponse(); |
124: | $this->dispute = $value->fromObject($object->dispute); |
125: | } |
126: | if (property_exists($object, 'id')) { |
127: | $this->id = $object->id; |
128: | } |
129: | if (property_exists($object, 'merchantId')) { |
130: | $this->merchantId = $object->merchantId; |
131: | } |
132: | if (property_exists($object, 'payment')) { |
133: | if (!is_object($object->payment)) { |
134: | throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); |
135: | } |
136: | $value = new PaymentResponse(); |
137: | $this->payment = $value->fromObject($object->payment); |
138: | } |
139: | if (property_exists($object, 'payout')) { |
140: | if (!is_object($object->payout)) { |
141: | throw new UnexpectedValueException('value \'' . print_r($object->payout, true) . '\' is not an object'); |
142: | } |
143: | $value = new PayoutResponse(); |
144: | $this->payout = $value->fromObject($object->payout); |
145: | } |
146: | if (property_exists($object, 'refund')) { |
147: | if (!is_object($object->refund)) { |
148: | throw new UnexpectedValueException('value \'' . print_r($object->refund, true) . '\' is not an object'); |
149: | } |
150: | $value = new RefundResponse(); |
151: | $this->refund = $value->fromObject($object->refund); |
152: | } |
153: | if (property_exists($object, 'token')) { |
154: | if (!is_object($object->token)) { |
155: | throw new UnexpectedValueException('value \'' . print_r($object->token, true) . '\' is not an object'); |
156: | } |
157: | $value = new TokenResponse(); |
158: | $this->token = $value->fromObject($object->token); |
159: | } |
160: | if (property_exists($object, 'type')) { |
161: | $this->type = $object->type; |
162: | } |
163: | return $this; |
164: | } |
165: | } |
166: | |