← All changes
|
src/Subscriptions/ValueObjects/SubscriptionStatus.php
+28
-10
2.30.0
→
4.16.9
View file →
| @@ -4,8 +4,10 @@ | ||
| 4 | 4 | |
| 5 | 5 | use Give\Framework\Support\ValueObjects\Enum; |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | + * @since 4.8.0 Added a new "trashed" status | |
| 9 | + * @since 3.17.0 Added a new "paused" status | |
| 8 | 10 | * @since 2.19.6 |
| 9 | 11 | * |
| 10 | 12 | * @method static SubscriptionStatus PENDING() |
| 11 | 13 | * @method static SubscriptionStatus ACTIVE() |
| @@ -10,22 +12,25 @@ | ||
| 10 | 12 | * @method static SubscriptionStatus PENDING() |
| 11 | 13 | * @method static SubscriptionStatus ACTIVE() |
| 12 | 14 | * @method static SubscriptionStatus EXPIRED() |
| 13 | 15 | * @method static SubscriptionStatus COMPLETED() |
| 14 | - * @method static SubscriptionStatus REFUNDED() | |
| 15 | - * @method static SubscriptionStatus ABANDONED() | |
| 16 | + * @method static SubscriptionStatus REFUNDED() @deprecated Do not use this. Use SubscriptionStatus::CANCELLED() or SubscriptionStatus::SUSPENDED() instead. | |
| 17 | + * @method static SubscriptionStatus ABANDONED() @deprecated Do not use this. Use SubscriptionStatus::CANCELLED() instead. | |
| 16 | 18 | * @method static SubscriptionStatus FAILING() |
| 17 | 19 | * @method static SubscriptionStatus CANCELLED() |
| 18 | 20 | * @method static SubscriptionStatus SUSPENDED() |
| 21 | + * @method static SubscriptionStatus PAUSED() | |
| 19 | 22 | * @method bool isPending() |
| 20 | 23 | * @method bool isActive() |
| 21 | 24 | * @method bool isExpired() |
| 22 | 25 | * @method bool isCompleted() |
| 23 | - * @method bool isRefunded() | |
| 24 | - * @method bool isAbandoned() | |
| 26 | + * @method bool isRefunded() @deprecated Do not use this. Instead, use the CANCELLED or SUSPENDED statuses. | |
| 27 | + * @method bool isAbandoned() @deprecated Do not use this. Instead, use the CANCELLED status. | |
| 25 | 28 | * @method bool isFailing() |
| 26 | 29 | * @method bool isCancelled() |
| 27 | 30 | * @method bool isSuspended() |
| 31 | + * @method bool isPaused() | |
| 32 | + * @method bool isTrashed() | |
| 28 | 33 | */ |
| 29 | 34 | class SubscriptionStatus extends Enum { |
| 30 | 35 | const PENDING = 'pending'; |
| 31 | 36 | const ACTIVE = 'active'; |
| @@ -30,15 +35,26 @@ | ||
| 30 | 35 | const PENDING = 'pending'; |
| 31 | 36 | const ACTIVE = 'active'; |
| 32 | 37 | const EXPIRED = 'expired'; |
| 33 | 38 | const COMPLETED = 'completed'; |
| 34 | - const REFUNDED = 'refunded'; | |
| 35 | 39 | const FAILING = 'failing'; |
| 36 | 40 | const CANCELLED = 'cancelled'; |
| 41 | + const SUSPENDED = 'suspended'; | |
| 42 | + const PAUSED = 'paused'; | |
| 43 | + const TRASHED = 'trashed'; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @deprecated Do not use this. Use SubscriptionStatus::CANCELLED or SubscriptionStatus::SUSPENDED instead. | |
| 47 | + */ | |
| 48 | + const REFUNDED = 'refunded'; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * @deprecated Do not use this. Use SubscriptionStatus::CANCELLED instead. | |
| 52 | + */ | |
| 37 | 53 | const ABANDONED = 'abandoned'; |
| 38 | - const SUSPENDED = 'suspended'; | |
| 39 | 54 | |
| 40 | 55 | /** |
| 56 | + * @since 3.17.0 Added a new "paused" status | |
| 41 | 57 | * @since 2.24.0 |
| 42 | 58 | * |
| 43 | 59 | * @return array |
| 44 | 60 | */ |
| @@ -44,17 +60,19 @@ | ||
| 44 | 60 | */ |
| 45 | 61 | public static function labels(): array |
| 46 | 62 | { |
| 47 | 63 | return [ |
| 64 | + self::ACTIVE => __( 'Active', 'give' ), | |
| 48 | 65 | self::PENDING => __( 'Pending', 'give' ), |
| 49 | - self::ACTIVE => __( 'Active', 'give' ), | |
| 50 | - self::EXPIRED => __( 'Expired', 'give' ), | |
| 66 | + self::CANCELLED => __( 'Cancelled', 'give' ), | |
| 51 | 67 | self::COMPLETED => __( 'Completed', 'give' ), |
| 52 | - self::REFUNDED => __( 'Refunded', 'give' ), | |
| 68 | + self::PAUSED => __('Paused', 'give'), | |
| 53 | 69 | self::FAILING => __( 'Failed', 'give' ), |
| 54 | - self::CANCELLED => __( 'Cancelled', 'give' ), | |
| 55 | 70 | self::ABANDONED => __( 'Abandoned', 'give' ), |
| 56 | 71 | self::SUSPENDED => __( 'Suspended', 'give' ), |
| 72 | + self::EXPIRED => __( 'Expired', 'give' ), | |
| 73 | + self::REFUNDED => __( 'Refunded', 'give' ), | |
| 74 | + self::TRASHED => __('Trashed', 'give'), | |
| 57 | 75 | ]; |
| 58 | 76 | } |
| 59 | 77 | |
| 60 | 78 | /** |