feat: add zyt medicine bootstrap
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\service\pharmacy;
|
||||
|
||||
final class EjPharmacyShipmentPolicy
|
||||
{
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function isShippedEvent(array $payload): bool
|
||||
{
|
||||
return strtoupper(trim((string) ($payload['event_type'] ?? ''))) === 'ORDER_SHIPPED'
|
||||
|| strtoupper(trim((string) ($payload['status'] ?? ''))) === 'SHIPPED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function nextFulfillmentStatus(int $currentStatus, array $payload): int
|
||||
{
|
||||
if (self::isShippedEvent($payload) && in_array($currentStatus, [1, 2], true)) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
return $currentStatus;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user