CheckoutSessionStatus.php
7 months ago
ErrorCode.php
7 months ago
ErrorType.php
7 months ago
FulfillmentType.php
7 months ago
LinkType.php
7 months ago
MessageContentType.php
7 months ago
MessageType.php
7 months ago
OrderStatus.php
7 months ago
PaymentMethod.php
7 months ago
PaymentProvider.php
7 months ago
RefundType.php
7 months ago
TotalType.php
7 months ago
OrderStatus.php
67 lines
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | namespace Automattic\WooCommerce\Internal\Agentic\Enums\Specs; |
| 4 | |
| 5 | /** |
| 6 | * Order status values as defined in the Agentic Commerce Protocol. |
| 7 | * |
| 8 | * @since 10.3.0 |
| 9 | */ |
| 10 | class OrderStatus { |
| 11 | /** |
| 12 | * Order has been created. |
| 13 | */ |
| 14 | const CREATED = 'created'; |
| 15 | |
| 16 | /** |
| 17 | * Order requires manual review. |
| 18 | */ |
| 19 | const MANUAL_REVIEW = 'manual_review'; |
| 20 | |
| 21 | /** |
| 22 | * Order has been confirmed. |
| 23 | */ |
| 24 | const CONFIRMED = 'confirmed'; |
| 25 | |
| 26 | /** |
| 27 | * Order has been canceled. |
| 28 | */ |
| 29 | const CANCELED = 'canceled'; |
| 30 | |
| 31 | /** |
| 32 | * Order has been shipped. |
| 33 | */ |
| 34 | const SHIPPED = 'shipped'; |
| 35 | |
| 36 | /** |
| 37 | * Order has been fulfilled. |
| 38 | */ |
| 39 | const FULFILLED = 'fulfilled'; |
| 40 | |
| 41 | /** |
| 42 | * Get all valid order statuses. |
| 43 | * |
| 44 | * @return array Array of valid order status values. |
| 45 | */ |
| 46 | public static function get_all() { |
| 47 | return array( |
| 48 | self::CREATED, |
| 49 | self::MANUAL_REVIEW, |
| 50 | self::CONFIRMED, |
| 51 | self::CANCELED, |
| 52 | self::SHIPPED, |
| 53 | self::FULFILLED, |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Check if a status is valid. |
| 59 | * |
| 60 | * @param string $status Status to check. |
| 61 | * @return bool True if valid, false otherwise. |
| 62 | */ |
| 63 | public static function is_valid( $status ) { |
| 64 | return in_array( $status, self::get_all(), true ); |
| 65 | } |
| 66 | } |
| 67 |