mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-04 22:59:41 +00:00
Add subscription status helpers
status() returns draft, trial, active, paused, cancelling, expired or cancelled (SubscriptionStatus constants), derived from the fields the same way Anikeen ID derives its status, so it also works with older responses. isActive() is true while the subscription runs and is paid. Both Subscription and AppSubscription have them. Document the states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2faccac0f4
commit
ce820cd198
7 files changed
+348
-117
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Anikeen\Id\Resources;
|
||||
|
||||
use Anikeen\Id\Concerns\HasSubscriptionStatus;
|
||||
use Anikeen\Id\Exceptions\ApiException;
|
||||
use Anikeen\Id\Support\AppRequest;
|
||||
use DateTimeInterface;
|
||||
@@ -24,7 +25,9 @@ use JsonSerializable;
|
||||
* @property bool $active
|
||||
* @property bool $autorenew
|
||||
* @property bool $cancelled
|
||||
* @property ?string $status "active" or "inactive"
|
||||
* @property ?string $status draft, trial, active, paused, cancelling, expired or cancelled, see status()
|
||||
* @property ?string $cancels_at when a scheduled cancellation takes effect
|
||||
* @property ?string $trial_ends_at
|
||||
* @property ?string $starts_at
|
||||
* @property ?string $ends_at
|
||||
* @property ?string $accounting_at
|
||||
@@ -36,6 +39,8 @@ use JsonSerializable;
|
||||
*/
|
||||
class AppSubscription implements JsonSerializable
|
||||
{
|
||||
use HasSubscriptionStatus;
|
||||
|
||||
public function __construct(protected object $data)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user