Issue cashier booth tickets when financial gates block service.
Deploy Ladill Care / deploy (push) Successful in 41s

Pay-before-service holds now create a billing queue ticket (via an open bill) so cashiers can Call next / Serve; clearance completes the ticket and releases the clinical line as before.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 19:29:29 +00:00
co-authored by Cursor
parent c3219a1bf1
commit 131ccd6edb
9 changed files with 405 additions and 23 deletions
@@ -9,8 +9,10 @@ use App\Models\Payment;
use App\Models\WorkflowStage;
use App\Services\Care\AuditLogger;
use App\Services\Care\BillService;
use App\Services\Care\BranchContext;
use App\Services\Care\CareFeatures;
use App\Services\Care\CarePermissions;
use App\Services\Care\CareQueueBridge;
use App\Services\Care\CareQueueContexts;
use App\Services\Care\OrganizationResolver;
use App\Services\Care\Workflow\FinancialGateService;
@@ -35,6 +37,8 @@ class FinancialObligationController extends Controller
protected WorkflowQueueReleaseService $queueRelease,
protected WorkflowStageCompletionService $workflowCompletion,
protected BillService $bills,
protected CareQueueBridge $queueBridge,
protected BranchContext $branchContext,
) {}
public function index(Request $request): View
@@ -43,7 +47,10 @@ class FinancialObligationController extends Controller
$organization = $this->organization($request);
abort_unless($this->features->enabled($organization, CareFeatures::WORKFLOW_ENGINE), 404);
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
$member = $this->member($request);
$permissions = app(CarePermissions::class);
$branchScope = app(OrganizationResolver::class)->branchScope($member);
$branchId = $this->branchContext->resolve($request, $organization, $member);
$status = (string) $request->query('status', FinancialObligation::STATUS_PENDING);
$obligations = FinancialObligation::owned($this->ownerRef($request))
@@ -61,8 +68,13 @@ class FinancialObligationController extends Controller
'clearanceMethods' => config('care_workflows.clearance_methods', []),
'paymentModes' => config('care_workflows.payment_modes', []),
'paymentMethods' => collect(config('care.payment_methods', []))->except(['gateway'])->all(),
'canClear' => app(CarePermissions::class)
->can($this->member($request), 'payments.manage'),
'canClear' => $permissions->can($member, 'payments.manage'),
'branchId' => $branchId,
'queueIntegration' => $branchId && $permissions->handlesFloorCare($member)
? $this->queueBridge->listMeta($organization, CareQueueContexts::BILLING, $branchId)
: ['enabled' => false],
'canManageQueue' => $permissions->can($member, 'service_queues.console')
&& $permissions->handlesFloorCare($member),
]);
}
@@ -139,19 +151,21 @@ class FinancialObligationController extends Controller
return $locked->fresh();
});
$organization = $this->organization($request);
$visit = $settled->visit;
if ($visit) {
$advance = $this->workflows->refreshGate($visit);
if ($advance?->stage?->type === 'payment') {
$this->workflowCompletion->complete(
$this->organization($request),
$organization,
$visit,
CareQueueContexts::BILLING,
$this->ownerRef($request),
$this->ownerRef($request),
);
} else {
$this->queueRelease->releaseCurrent($this->organization($request), $visit);
$this->queueRelease->releaseCurrent($organization, $visit);
}
}