header('X-API-SECURITY') && $request->header('X-API-SECURITY') == config('services.postmark.token')) { ProcessPostmarkWebhook::dispatch($request->all())->delay(10); return response()->json(['message' => 'Success'], 200); } return response()->json(['message' => 'Unauthorized'], 403); } /** * Process Postmark Webhook. * * * @OA\Post( * path="/api/v1/postmark_inbound_webhook", * operationId="postmarkInboundWebhook", * tags={"postmark"}, * summary="Processing inbound webhooks from PostMark", * description="Adds an credit to the system", * @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), * @OA\Parameter(ref="#/components/parameters/include"), * @OA\Response( * response=200, * description="Returns the saved credit object", * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), * @OA\JsonContent(ref="#/components/schemas/Credit"), * ), * @OA\Response( * response=422, * description="Validation error", * @OA\JsonContent(ref="#/components/schemas/ValidationError"), * * ), * @OA\Response( * response="default", * description="Unexpected Error", * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) */ public function inboundWebhook(Request $request) { if ($request->header('X-API-SECURITY') && $request->header('X-API-SECURITY') == config('services.postmark.token')) { ProcessPostmarkInboundWebhook::dispatch($request->all())->delay(10); return response()->json(['message' => 'Success'], 200); } return response()->json(['message' => 'Unauthorized'], 403); } }