-
-
Notifications
You must be signed in to change notification settings - Fork 635
Expand file tree
/
Copy pathRazorpayIncomingWebhookAction.php
More file actions
29 lines (24 loc) · 970 Bytes
/
RazorpayIncomingWebhookAction.php
File metadata and controls
29 lines (24 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace HiEvents\Http\Actions\Common\Webhooks;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Http\ResponseCodes;
use HiEvents\Services\Application\Handlers\Order\Payment\Razorpay\RazorpayWebhookHandler;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class RazorpayIncomingWebhookAction extends BaseAction
{
public function __invoke(Request $request): Response
{
$payload = $request->getContent();
$signature = $request->header('X-Razorpay-Signature');
dispatch(static function (RazorpayWebhookHandler $handler) use ($payload, $signature) {
$handler->handle($payload, $signature);
})->catch(function (\Throwable $exception) use ($payload) {
logger()->error(__('Failed to handle incoming Razorpay webhook'), [
'exception' => $exception,
'payload' => $payload,
]);
});
return $this->noContentResponse();
}
}