From 2200b6c6305469b71f136286423a276cf4bef2ca Mon Sep 17 00:00:00 2001 From: Richard Garcia Date: Sat, 21 Feb 2026 12:01:47 -0300 Subject: [PATCH 1/2] =?UTF-8?q?feature(#2):=20this=20commit=20updates=20th?= =?UTF-8?q?e=20=E2=80=9Ccomanda.internal.contracts=E2=80=9D=20package=20to?= =?UTF-8?q?=20version=201.0.8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Comanda.Orchestrator.Application.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ - + From 2b474de7d20c6195aee71d0eccbd34e8ee26ddcb Mon Sep 17 00:00:00 2001 From: Richard Garcia Date: Sat, 21 Feb 2026 12:02:55 -0300 Subject: [PATCH 2/2] feature(#2): this commit adds validation rules for the address field when fulfillment is delivery, requiring related fields to be filled in, with validation of the Brazilian ZIP code format --- .../Orders/OrderCreationSchemeValidator.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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)