debug
This commit is contained in:
@@ -13,12 +13,19 @@ final class EjPharmacyShipmentPolicy
|
||||
|| strtoupper(trim((string) ($payload['status'] ?? ''))) === 'SHIPPED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function isWorkflowStepEvent(array $payload): bool
|
||||
{
|
||||
return strtoupper(trim((string) ($payload['event_type'] ?? ''))) === 'WORKFLOW_STEP_COMPLETED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function isCompletedEvent(array $payload): bool
|
||||
{
|
||||
return strtoupper(trim((string) ($payload['status'] ?? ''))) === 'COMPLETED'
|
||||
|| (strtoupper(trim((string) ($payload['event_type'] ?? ''))) === 'WORKFLOW_STEP_COMPLETED'
|
||||
&& (bool) ($payload['final'] ?? false));
|
||||
// A workflow node (including the final “ship” node) is only a
|
||||
// pharmacy-process update. It must not close the ZYT business order.
|
||||
return !self::isWorkflowStepEvent($payload)
|
||||
&& strtoupper(trim((string) ($payload['status'] ?? ''))) === 'COMPLETED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
@@ -47,6 +54,12 @@ final class EjPharmacyShipmentPolicy
|
||||
? $rollbackStatus
|
||||
: ($currentStatus === 9 ? 2 : $currentStatus);
|
||||
}
|
||||
if (self::isWorkflowStepEvent($payload)) {
|
||||
// EJ workflow callbacks are informational nodes. Keep the ZYT
|
||||
// fulfillment status unchanged; only explicit shipment/completion
|
||||
// events may advance it.
|
||||
return $currentStatus;
|
||||
}
|
||||
if (self::isShippedEvent($payload) && in_array($currentStatus, [1, 2], true)) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user