U-D/U-E/O5: Prozess-Tester im eigenen Prozess (standardmäßig gesperrt, 15 Negativtests, statischer Wächter), Szenarien und Bericht, Kanalereignisse (API-Eingang ohne Umbau von iCal/Mail), Abschluss nach finanzieller Klärung, Löschfrist 30 Tage
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c255783cec
commit
0689c0a591
68 files changed
+3350
-35
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Support\Process;
|
||||
|
||||
use App\Channels\Contracts\ChannelConnector;
|
||||
use App\Channels\Contracts\DeliversEvents;
|
||||
use App\Channels\Events\IncomingBooking;
|
||||
use App\Channels\Events\PaymentReported;
|
||||
use App\Channels\Events\Provenance;
|
||||
use App\Models\Channel;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* N7: a portal interface as it could come later – only an adapter and its registry entry. It reads the portal's
|
||||
* bookings over HTTP (faked in the test) and delivers normalised channel events; it decides nothing.
|
||||
*/
|
||||
final class FakeApiConnector implements ChannelConnector, DeliversEvents
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'fake_api';
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Beispiel-Schnittstelle (Test)';
|
||||
}
|
||||
|
||||
public static function settingsSchema(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function canImport(Channel $channel): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function fetchOccupations(Channel $channel): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function fetchEvents(Channel $channel, ?CarbonImmutable $since): array
|
||||
{
|
||||
$events = [];
|
||||
foreach ((array) Http::get('https://api.portal.example/bookings')->json('bookings', []) as $row) {
|
||||
$provenance = new Provenance($channel, 'api', Provenance::AUTHENTICATED, (string) $row['reference'], 'fake-api:'.$row['reference'], CarbonImmutable::now());
|
||||
$events[] = new IncomingBooking($provenance, CarbonImmutable::parse($row['arrival']), CarbonImmutable::parse($row['departure']), $row['guests'] ?? null);
|
||||
if (isset($row['paid'])) {
|
||||
$events[] = new PaymentReported($provenance, (int) $row['paid'], CarbonImmutable::parse($row['paid_on']));
|
||||
}
|
||||
}
|
||||
|
||||
return $events;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user