diff --git a/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Comanda.Orchestrator.Application.csproj b/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Comanda.Orchestrator.Application.csproj
index 0180e7f..3a8c8d7 100644
--- a/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Comanda.Orchestrator.Application.csproj
+++ b/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Comanda.Orchestrator.Application.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Validators/Orders/OrderCreationSchemeValidator.cs b/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Validators/Orders/OrderCreationSchemeValidator.cs
index 7459738..52774b8 100644
--- a/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Validators/Orders/OrderCreationSchemeValidator.cs
+++ b/Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.Application/Validators/Orders/OrderCreationSchemeValidator.cs
@@ -12,6 +12,11 @@ public OrderCreationSchemeValidator()
.IsInEnum()
.WithMessage("fulfillment must be a valid enum value.");
+ RuleFor(order => order.Address)
+ .NotNull()
+ .WithMessage("address must be provided when fulfillment is delivery.")
+ .When(order => order.Fulfillment == Fulfillment.Delivery);
+
RuleFor(order => order.Priority)
.IsInEnum()
.WithMessage("priority must be a valid enum value.");
@@ -20,6 +25,31 @@ public OrderCreationSchemeValidator()
.NotNull()
.WithMessage("metadata must be provided.");
+ When(order => order.Fulfillment == Fulfillment.Delivery && order.Address is not null, () =>
+ {
+ RuleFor(order => order.Address!.Street)
+ .NotEmpty()
+ .WithMessage("The street field is required and cannot be empty.");
+
+ RuleFor(order => order.Address!.Number)
+ .NotEmpty()
+ .WithMessage("The number field is required and represents the street number of the address.");
+
+ RuleFor(order => order.Address!.City)
+ .NotEmpty()
+ .WithMessage("The city field is required and cannot be empty.");
+
+ RuleFor(order => order.Address!.State)
+ .NotEmpty()
+ .WithMessage("The state field is required and cannot be empty.");
+
+ RuleFor(order => order.Address!.ZipCode)
+ .NotEmpty()
+ .WithMessage("The zip code field is required.")
+ .Matches(ExpressionPatterns.Cep)
+ .WithMessage("The zip code is invalid. It must match the Brazilian postal code format.");
+ });
+
When(order => order.Metadata is not null, () =>
{
RuleFor(order => order.Metadata!.MerchantId)