Care needs POST /tickets on the service-auth stack so check-in and department handoffs can create queue tickets without Sanctum. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -208,4 +208,35 @@ class CareIntegrationTest extends TestCase
|
||||
|
||||
$this->assertSame(1, Branch::owned($owner)->count());
|
||||
}
|
||||
|
||||
public function test_care_can_issue_ticket_via_service_api(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$this->provisionCareOrg($owner);
|
||||
|
||||
$queueUuid = $this->postJson('/api/v1/queues', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Consultation',
|
||||
'prefix' => 'C',
|
||||
'branch_name' => 'Main',
|
||||
'external_key' => 'care:dept:consultation:queue:1',
|
||||
'strategy' => 'fifo',
|
||||
], $headers)->assertCreated()->json('data.uuid');
|
||||
|
||||
$this->postJson('/api/v1/tickets', [
|
||||
'owner' => $owner,
|
||||
'service_queue_id' => $queueUuid,
|
||||
'customer_name' => 'Ada Patient',
|
||||
'source' => 'appointment',
|
||||
'metadata' => [
|
||||
'care_entity' => 'appointment',
|
||||
'care_entity_id' => 42,
|
||||
],
|
||||
], $headers)
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.ticket_number', 'C001')
|
||||
->assertJsonPath('data.status', 'waiting')
|
||||
->assertJsonPath('data.customer_name', 'Ada Patient');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user