mirror of
https://github.com/anikeen-com/id.git
synced 2026-11-06 23:58:35 +00:00
Add the billing limit event types
This commit is contained in:
2 files changed
+23
No files matched your search
@@ -61,6 +61,21 @@ final class EventType
|
|||||||
/** A checkout session was not confirmed within 24 hours; its drafts were cancelled. */
|
/** A checkout session was not confirmed within 24 hours; its drafts were cancelled. */
|
||||||
public const CHECKOUT_EXPIRED = 'checkout.expired';
|
public const CHECKOUT_EXPIRED = 'checkout.expired';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user's open monthly bill reached their billing limit: start no new paid service for them.
|
||||||
|
* `data.object` is the billing limit as the app reads it (with `version`), `data.reason`
|
||||||
|
* `booking` or `limit_changed`. Opt-in: only endpoints that select this event get it (not
|
||||||
|
* through `*`), and only apps that may read the limit of a user connected to them.
|
||||||
|
*/
|
||||||
|
public const BILLING_LIMIT_REACHED = 'billing_limit.reached';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A user whose billing limit was reached has room again. `data.object` is the billing limit
|
||||||
|
* (with `version`), `data.reason` `limit_changed`, `limit_removed`, `voided`, `period_reset`
|
||||||
|
* or `order_changed`. Opt-in like BILLING_LIMIT_REACHED.
|
||||||
|
*/
|
||||||
|
public const BILLING_LIMIT_AVAILABLE = 'billing_limit.available';
|
||||||
|
|
||||||
public const TEST = 'webhook.test';
|
public const TEST = 'webhook.test';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ class WebhookTest extends TestCase
|
|||||||
$this->assertContains(EventType::ORDER_REFUNDED, EventType::all());
|
$this->assertContains(EventType::ORDER_REFUNDED, EventType::all());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_billing_limit_events_have_their_own_types(): void
|
||||||
|
{
|
||||||
|
$this->assertSame('billing_limit.reached', EventType::BILLING_LIMIT_REACHED);
|
||||||
|
$this->assertSame('billing_limit.available', EventType::BILLING_LIMIT_AVAILABLE);
|
||||||
|
$this->assertContains(EventType::BILLING_LIMIT_REACHED, EventType::all());
|
||||||
|
$this->assertContains(EventType::BILLING_LIMIT_AVAILABLE, EventType::all());
|
||||||
|
}
|
||||||
|
|
||||||
public function test_a_change_carries_the_previous_attributes(): void
|
public function test_a_change_carries_the_previous_attributes(): void
|
||||||
{
|
{
|
||||||
$this->payload = json_encode(['id' => '01JEVT', 'type' => EventType::SUBSCRIPTION_UPDATED, 'created' => time(), 'data' => [
|
$this->payload = json_encode(['id' => '01JEVT', 'type' => EventType::SUBSCRIPTION_UPDATED, 'created' => time(), 'data' => [
|
||||||
|
|||||||
Reference in new issue
Block a user