Fix Care integration not enabled after provision.
Deploy Ladill Queue / deploy (push) Successful in 58s

Queue orgs were created with care_enabled false, blocking counters API;
provision now syncs the caller integration flag automatically.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-05 22:06:02 +00:00
co-authored by Cursor
parent 1abc99fa1f
commit ebfc9693c7
2 changed files with 56 additions and 0 deletions
@@ -96,6 +96,10 @@ class IntegrationController extends Controller
AuditLogger::record($owner, 'organization.created', $organization->id, $owner, Organization::class, $organization->id);
}
if (in_array($caller, ['care', 'frontdesk'], true)) {
$this->syncIntegrationFlag($organization->fresh(), $caller, true);
}
return response()->json([
'data' => [
'provisioned' => true,
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace Tests\Feature;
use App\Models\Organization;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class CareIntegrationTest extends TestCase
{
use RefreshDatabase;
protected function careHeaders(string $owner = 'care-owner-uuid'): array
{
config(['qms.service_api_keys.care' => 'test-care-key']);
return [
'Authorization' => 'Bearer test-care-key',
'Accept' => 'application/json',
];
}
public function test_provision_enables_care_integration(): void
{
$owner = 'care-owner-uuid';
$this->postJson('/api/v1/integrations/provision', [
'owner' => $owner,
'organization_name' => 'Care Clinic',
'branch_name' => 'Main',
], $this->careHeaders($owner))
->assertCreated()
->assertJsonPath('data.integrations.care', true);
$organization = Organization::owned($owner)->first();
$this->assertTrue((bool) data_get($organization->settings, 'integrations.care_enabled'));
}
public function test_counters_allowed_after_care_provision(): void
{
$owner = 'care-owner-uuid';
$headers = $this->careHeaders($owner);
$this->postJson('/api/v1/integrations/provision', [
'owner' => $owner,
'organization_name' => 'Care Clinic',
], $headers)->assertSuccessful();
$this->getJson('/api/v1/counters?owner='.$owner, $headers)
->assertOk();
}
}