1 | <?php |
||
13 | class Webhook |
||
14 | { |
||
15 | /** |
||
16 | * @var EventDispatcher |
||
17 | */ |
||
18 | protected $eventDispatcher; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $eventName; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $payload; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $delivery; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $eventMap; |
||
39 | |||
40 | /** |
||
41 | * Webhook constructor. |
||
42 | * @param EventDispatcher $eventDispatcher |
||
43 | */ |
||
44 | public function __construct(EventDispatcher $eventDispatcher = null) |
||
49 | |||
50 | /** |
||
51 | * @param string $event |
||
52 | * @return string |
||
53 | */ |
||
54 | public function getEventClassName($event) |
||
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | public function getDefaultEventNames() |
||
95 | |||
96 | /** |
||
97 | * @return array |
||
98 | */ |
||
99 | public function getEventMap() |
||
113 | |||
114 | /** |
||
115 | * @param Request $request |
||
116 | * @param string $secret |
||
117 | * @param bool $dispatch |
||
118 | * @return EventBase |
||
119 | * |
||
120 | * @throws \InvalidArgumentException |
||
121 | */ |
||
122 | public function parseRequest(Request $request, $secret, $dispatch = true) |
||
140 | |||
141 | /** |
||
142 | * @param Request $request |
||
143 | * @param string $secret |
||
144 | * @return bool |
||
145 | * |
||
146 | * @throws \InvalidArgumentException |
||
147 | */ |
||
148 | protected function checkSecurity(Request $request, $secret) |
||
175 | |||
176 | /** |
||
177 | * @param string $secret |
||
178 | * @param string $signatureHeader |
||
179 | * @param string $payload |
||
180 | * @return bool |
||
181 | */ |
||
182 | protected function validateSignature($secret, $signatureHeader, $payload) |
||
189 | } |
||
190 |