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() |
||
68 | |||
69 | /** |
||
70 | * @return array |
||
71 | */ |
||
72 | public function getEventMap() |
||
93 | |||
94 | /** |
||
95 | * @param Request $request |
||
96 | * @param string $secret |
||
97 | * @param bool $dispatch |
||
98 | * @return EventBase |
||
99 | * |
||
100 | * @throws \InvalidArgumentException |
||
101 | */ |
||
102 | public function parseRequest(Request $request, $secret, $dispatch = true) |
||
120 | |||
121 | /** |
||
122 | * @param Request $request |
||
123 | * @param string $secret |
||
124 | * @return bool |
||
125 | * |
||
126 | * @throws \InvalidArgumentException |
||
127 | */ |
||
128 | protected function checkSecurity(Request $request, $secret) |
||
155 | |||
156 | /** |
||
157 | * @param string $secret |
||
158 | * @param string $signatureHeader |
||
159 | * @param string $payload |
||
160 | * @return bool |
||
161 | */ |
||
162 | protected function validateSignature($secret, $signatureHeader, $payload) |
||
169 | } |
||
170 |