Bill all meet sessions per participant instead of per hour.
Deploy Ladill Meet / deploy (push) Successful in 46s
Deploy Ladill Meet / deploy (push) Successful in 46s
Meetings and webinars now share GHS 0.30 per peak participant, with usage UI and plan quotas updated to match. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,7 +25,7 @@ class MeetBillingTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_session_end_records_streaming_usage_and_debits_wallet(): void
|
||||
public function test_session_end_charges_per_participant(): void
|
||||
{
|
||||
$this->fakeAffordableBilling();
|
||||
|
||||
@@ -53,17 +53,19 @@ class MeetBillingTest extends TestCase
|
||||
'status' => 'ended',
|
||||
'started_at' => now()->subHour(),
|
||||
'ended_at' => now(),
|
||||
'peak_participants' => 4,
|
||||
]);
|
||||
|
||||
app(UsageMeteringService::class)->recordSessionUsage($session);
|
||||
|
||||
$this->assertDatabaseHas('meet_usage_records', [
|
||||
'organization_id' => $organization->id,
|
||||
'metric' => 'streaming_hours',
|
||||
'metric' => 'participant_count',
|
||||
'quantity' => 4,
|
||||
]);
|
||||
|
||||
Http::assertSent(fn ($request) => str_contains($request->url(), '/debit')
|
||||
&& ($request->data()['source'] ?? '') === 'meet_streaming');
|
||||
&& ($request->data()['source'] ?? '') === 'meet_participants');
|
||||
}
|
||||
|
||||
public function test_webinar_session_end_charges_per_participant(): void
|
||||
|
||||
@@ -8,28 +8,6 @@ use Tests\TestCase;
|
||||
|
||||
class MeetBillingServiceTest extends TestCase
|
||||
{
|
||||
public function test_streaming_hours_are_ceiled_with_minimum_one_hour(): void
|
||||
{
|
||||
$billing = app(MeetBillingService::class);
|
||||
|
||||
$session = new Session([
|
||||
'started_at' => now()->subMinutes(10),
|
||||
'ended_at' => now(),
|
||||
]);
|
||||
|
||||
$this->assertSame(1.0, $billing->streamingHoursFor($session));
|
||||
}
|
||||
|
||||
public function test_streaming_amount_minor_matches_hourly_rate(): void
|
||||
{
|
||||
config(['meet.billing.price_per_hour_ghs' => 0.30]);
|
||||
|
||||
$billing = app(MeetBillingService::class);
|
||||
|
||||
$this->assertSame(30, $billing->amountMinorForStreamingHours(1));
|
||||
$this->assertSame(60, $billing->amountMinorForStreamingHours(2));
|
||||
}
|
||||
|
||||
public function test_participant_amount_minor_matches_rate(): void
|
||||
{
|
||||
config(['meet.billing.price_per_participant_ghs' => 0.30]);
|
||||
@@ -40,6 +18,19 @@ class MeetBillingServiceTest extends TestCase
|
||||
$this->assertSame(90, $billing->amountMinorForParticipants(3));
|
||||
}
|
||||
|
||||
public function test_participants_billable_uses_peak_with_minimum_one(): void
|
||||
{
|
||||
$billing = app(MeetBillingService::class);
|
||||
|
||||
$session = new Session(['peak_participants' => 0]);
|
||||
|
||||
$this->assertSame(1, $billing->participantsBillableFor($session));
|
||||
|
||||
$session->peak_participants = 12;
|
||||
|
||||
$this->assertSame(12, $billing->participantsBillableFor($session));
|
||||
}
|
||||
|
||||
public function test_storage_amount_minor_matches_gb_monthly_rate(): void
|
||||
{
|
||||
config(['meet.billing.price_per_gb_month_ghs' => 0.30]);
|
||||
|
||||
Reference in New Issue
Block a user