Implements Spec 081 provider-connection cutover. Highlights: - Adds provider connection resolution + gating for operations/verification. - Adds provider credential observer wiring. - Updates Filament tenant verify flow to block with next-steps when provider connection isn’t ready. - Adds spec docs under specs/081-provider-connection-cutover/ and extensive Spec081 test coverage. Tests: - vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantSetupTest.php - Focused suites for ProviderConnections/Verification ran during implementation (see local logs). Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box> Reviewed-on: #98
49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Providers;
|
|
|
|
use App\Models\ProviderConnection;
|
|
use App\Support\Providers\ProviderReasonCodes;
|
|
|
|
final class ProviderConnectionResolution
|
|
{
|
|
private function __construct(
|
|
public readonly bool $resolved,
|
|
public readonly ?ProviderConnection $connection,
|
|
public readonly ?string $reasonCode,
|
|
public readonly ?string $extensionReasonCode,
|
|
public readonly ?string $message,
|
|
) {}
|
|
|
|
public static function resolved(ProviderConnection $connection): self
|
|
{
|
|
return new self(
|
|
resolved: true,
|
|
connection: $connection,
|
|
reasonCode: null,
|
|
extensionReasonCode: null,
|
|
message: null,
|
|
);
|
|
}
|
|
|
|
public static function blocked(
|
|
string $reasonCode,
|
|
?string $message = null,
|
|
?string $extensionReasonCode = null,
|
|
?ProviderConnection $connection = null,
|
|
): self {
|
|
return new self(
|
|
resolved: false,
|
|
connection: $connection,
|
|
reasonCode: ProviderReasonCodes::isKnown($reasonCode) ? $reasonCode : ProviderReasonCodes::UnknownError,
|
|
extensionReasonCode: $extensionReasonCode,
|
|
message: $message,
|
|
);
|
|
}
|
|
|
|
public function effectiveReasonCode(): string
|
|
{
|
|
return $this->reasonCode ?? ProviderReasonCodes::UnknownError;
|
|
}
|
|
}
|