Step 00 — Squelette + intégration naïve

3 Bounded Contexts (Sales, Invoicing, LegacyFulfillment) avec :
- Domaines complets (agrégats, VOs, événements, invariants)
- Couche application (commands, queries, ports)
- Infrastructure in-memory (repos, gateway fake)
- Controllers HTTP Symfony
- Couplage naïf synchrone entre BC via NaiveSalesEventPublisher
- 20 tests unitaires et d'intégration passants
This commit is contained in:
2026-03-04 00:27:15 +01:00
commit a4a14e441b
86 changed files with 7059 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace MiniShop\LegacyFulfillment\Interfaces\Http;
use MiniShop\LegacyFulfillment\Application\Query\GetShipmentByExternalOrderRef;
use MiniShop\LegacyFulfillment\Application\Query\GetShipmentByExternalOrderRefHandler;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/fulfillment/orders/{externalOrderId}/shipment', name: 'fulfillment_get_shipment', methods: ['GET'])]
final readonly class GetShipmentController
{
public function __construct(
private GetShipmentByExternalOrderRefHandler $handler,
) {}
public function __invoke(string $externalOrderId): JsonResponse
{
$shipment = ($this->handler)(new GetShipmentByExternalOrderRef($externalOrderId));
if ($shipment === null) {
return new JsonResponse(['error' => 'Shipment not found.'], Response::HTTP_NOT_FOUND);
}
return new JsonResponse([
'orderRef' => $shipment->orderRef->toString(),
'status' => $shipment->status()->value,
'address' => [
'recipientName' => $shipment->address->recipientName,
'street' => $shipment->address->street,
'city' => $shipment->address->city,
'postalCode' => $shipment->address->postalCode,
'country' => $shipment->address->country,
],
'parcel' => [
'weightInGrams' => $shipment->parcel->weightInGrams,
'description' => $shipment->parcel->description,
],
]);
}
}