feat(47-shipment-created-automation): immediate shipment automation trigger
Phase 47 complete: - add event shipment.created triggered immediately after shipment creation - add action update_shipment_status with real-change guard and chain-safe emit - update automation UI/options, docs, and PAUL state artifacts
This commit is contained in:
@@ -15,9 +15,9 @@ use Throwable;
|
||||
|
||||
final class AutomationController
|
||||
{
|
||||
private const ALLOWED_EVENTS = ['receipt.created', 'shipment.status_changed'];
|
||||
private const ALLOWED_EVENTS = ['receipt.created', 'shipment.created', 'shipment.status_changed'];
|
||||
private const ALLOWED_CONDITION_TYPES = ['integration', 'shipment_status'];
|
||||
private const ALLOWED_ACTION_TYPES = ['send_email', 'issue_receipt'];
|
||||
private const ALLOWED_ACTION_TYPES = ['send_email', 'issue_receipt', 'update_shipment_status'];
|
||||
private const ALLOWED_RECIPIENTS = ['client', 'client_and_company', 'company'];
|
||||
private const ALLOWED_RECEIPT_ISSUE_DATE_MODES = ['today', 'order_date', 'payment_date'];
|
||||
private const ALLOWED_RECEIPT_DUPLICATE_POLICIES = ['skip_if_exists', 'allow_duplicates'];
|
||||
@@ -416,6 +416,15 @@ final class AutomationController
|
||||
];
|
||||
}
|
||||
|
||||
if ($type === 'update_shipment_status') {
|
||||
$statusKey = trim((string) ($action['shipment_status_key'] ?? ''));
|
||||
if (!array_key_exists($statusKey, self::SHIPMENT_STATUS_OPTIONS)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ['status_key' => $statusKey];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user