Trigger n8n flows for Shopify imports
This commit is contained in:
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../../modules/shared/db.php';
|
||||
require_once __DIR__ . '/shopify-api.php';
|
||||
require_once __DIR__ . '/service.php';
|
||||
require_once __DIR__ . '/../bestellungen/shopify-projection.php';
|
||||
|
||||
function shopify_delta_argument(string $name, array $argv, ?string $default = null): ?string
|
||||
@@ -133,6 +134,16 @@ function run_shopify_delta(array $env, PDO $pdo, string $cutoff, bool $dryRun):
|
||||
static fn (string $gid): array => shopify_delta_load_order($env, $gid),
|
||||
$dryRun
|
||||
);
|
||||
if (!$dryRun && ($result['status'] ?? '') === 'imported') {
|
||||
$labelPayload = build_legacy_label_order_payload($pdo, (int) $result['sales_order_id']);
|
||||
$labelResult = trigger_shipping_label_flow($labelPayload, $env);
|
||||
$excelResult = trigger_excel_webhook((string) ($summaryOrder['name'] ?? $orderGid), $env);
|
||||
$result['label_trigger'] = $labelResult;
|
||||
$result['excel_trigger'] = $excelResult;
|
||||
if (!$labelResult['ok'] || !$excelResult['ok']) {
|
||||
throw new RuntimeException('Mindestens ein n8n-Webhook ist fehlgeschlagen');
|
||||
}
|
||||
}
|
||||
if (($result['status'] ?? '') === 'already_imported') {
|
||||
$counters['already_imported']++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user