/** @var string $jsonPayload */
$jsonPayload =
json_encode($webhookData, \JSON_THROW_ON_ERROR
);
$headers =
[ 'Content-Type' => 'application/json',
'sw-version' =>
$this->shopwareVersion,
AuthMiddleware::SHOPWARE_CONTEXT_LANGUAGE =>
$languageId,
AuthMiddleware::SHOPWARE_USER_LANGUAGE =>
$userLocale,
];
if ($event instanceof AppFlowActionEvent
) { $headers =
array_merge($headers,
$event->
getWebhookHeaders());
} $request =
new Request( 'POST',
$webhook->
getUrl(),
$headers,
$jsonPayload );
if ($webhook->
getApp() !== null &&
$webhook->
getApp()->
getAppSecret() !== null
) { $request =
$request->
withHeader(