Remove direct Excel webhook helper
This commit is contained in:
@@ -166,7 +166,7 @@ try {
|
|||||||
|
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
|
|
||||||
$excelTrigger = trigger_excel_webhook($externalRef, $env);
|
$excelTrigger = dispatch_order_import_webhooks($pdo, $env);
|
||||||
|
|
||||||
json_response(201, [
|
json_response(201, [
|
||||||
'ok' => true,
|
'ok' => true,
|
||||||
|
|||||||
@@ -135,31 +135,6 @@ function trigger_shipping_label_flow(array $order, array $localEnv): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function trigger_excel_webhook(string $externalRef, array $localEnv): array
|
|
||||||
{
|
|
||||||
$url = derive_excel_webhook_url($localEnv);
|
|
||||||
if ($url === '') {
|
|
||||||
return [
|
|
||||||
'enabled' => false,
|
|
||||||
'ok' => false,
|
|
||||||
'message' => 'Excel webhook URL not configured',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$headers = build_n8n_webhook_headers($localEnv);
|
|
||||||
throttle_webhook_channel('excel', 5);
|
|
||||||
$result = post_json($url, ['Bestellnummer' => $externalRef], $headers, 20);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'enabled' => true,
|
|
||||||
'ok' => $result['ok'],
|
|
||||||
'status' => $result['status'],
|
|
||||||
'url' => $url,
|
|
||||||
'message' => $result['ok'] ? 'Excel webhook triggered' : ($result['error'] !== '' ? $result['error'] : 'Excel webhook returned non-2xx'),
|
|
||||||
'responseBody' => $result['body'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispatch_order_import_webhooks(PDO $pdo, array $localEnv, int $limit = 20): array
|
function dispatch_order_import_webhooks(PDO $pdo, array $localEnv, int $limit = 20): array
|
||||||
{
|
{
|
||||||
$url = derive_excel_webhook_url($localEnv);
|
$url = derive_excel_webhook_url($localEnv);
|
||||||
|
|||||||
Reference in New Issue
Block a user