Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OR-2335 corrigeer dubbel #1032

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# [8.190.0](https://github.com/informatievlaanderen/association-registry/compare/v8.189.0...v8.190.0) (2024-12-19)


### Bug Fixes

* or-2334 change exception message ([972b82e](https://github.com/informatievlaanderen/association-registry/commit/972b82e81b41caae146e186b8993bae8d3c91725))
* or-2334 fix english validation messages for dubbles ([32b6b14](https://github.com/informatievlaanderen/association-registry/commit/32b6b14d361453845de0907c908dfef2204dcccb))


### Features

* or-2334 dont allow markeer als dubbel when vereniging is authentieke vereniging ([e0b101a](https://github.com/informatievlaanderen/association-registry/commit/e0b101a5e8c788269cda78f0682d99d50ce4fa8e))

# [8.189.0](https://github.com/informatievlaanderen/association-registry/compare/v8.188.0...v8.189.0) (2024-12-18)


### Bug Fixes

* or-2334 add markeer dubbel controller as superadmin only ([75b2459](https://github.com/informatievlaanderen/association-registry/commit/75b2459452b614f8267027cd2ffecf6f1f27817e))
* or-2334 remove PostgresSqlOptionsSection from acm api ([8a7c8c1](https://github.com/informatievlaanderen/association-registry/commit/8a7c8c11a77ac0d8c31fd13b123c30088ac45383))


### Features

* or-2334 deny VZER to be marked as double ([6137cfa](https://github.com/informatievlaanderen/association-registry/commit/6137cfacb47c350cd0048956931ecf567ef9ffad))
* or-2334 implement markeer als dubbel in acm ([12b1e79](https://github.com/informatievlaanderen/association-registry/commit/12b1e79d1d1dd357f2524edbcdde3e28b5dbec5c))
* or-2334 update corresponderende vCodes when vereniging aanvaardde dubbele vereniging ([145c451](https://github.com/informatievlaanderen/association-registry/commit/145c451c6a79159263563f4a2930dbc03517786d))

# [8.188.0](https://github.com/informatievlaanderen/association-registry/compare/v8.187.2...v8.188.0) (2024-12-18)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "association-registry",
"version": "8.188.0",
"version": "8.190.0",
"description": "Association registry.",
"author": "Basisregisters Vlaanderen",
"license": "EUPL-1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ public class MarkeerAlsDubbelVanValidator : AbstractValidator<MarkeerAlsDubbelVa
{
public MarkeerAlsDubbelVanValidator()
{
RuleFor(r => r.IsDubbelVan)
.NotNull()
.NotEmpty()
.WithVeldIsVerplichtMessage(nameof(MarkeerAlsDubbelVanRequest.IsDubbelVan));
this.RequireNotNullOrEmpty(request => request.IsDubbelVan);
}
}
11 changes: 10 additions & 1 deletion src/AssociationRegistry/Resources/ExceptionMessages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/AssociationRegistry/Resources/ExceptionMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@
<value>Een vereniging kan geen dubbel worden van een niet bestaande vereniging.</value>
</data>
<data name="VerenigingKanGeenDubbelWordenVanEenVerenigingReedsGemarkeerdAlsDubbel">
<value>Een vereniging kan geen dubbel worden van vereniging die zelf al een dubbel is van een andere vereniging.</value>
<value>Een vereniging kan geen dubbel worden van een vereniging die zelf al een dubbel is.</value>
</data>
<data name="VerenigingKanGeenDubbelWordenVanZichzelf">
<value>Een vereniging kan geen dubbel worden van zichzelf.</value>
</data>
<data name="AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden">
<value>Een authentieke vereniging kan geen dubbel worden van een andere vereniging.</value>
</data>
<data name="LidmaatschapIsOverlappend">
<value>Een lidmaatschap mag niet overlappen voor eenzelfde vereniging.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace AssociationRegistry.Vereniging.Exceptions;

using Be.Vlaanderen.Basisregisters.AggregateSource;
using Resources;
using System.Runtime.Serialization;

[Serializable]
public class AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden : DomainException
{
public AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden() : base(ExceptionMessages.AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden)
{
}

protected AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
3 changes: 3 additions & 0 deletions src/AssociationRegistry/Vereniging/Vereniging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ public void SchrijfInInPubliekeDatastroom()
public void MarkeerAlsDubbelVan(VCode isDubbelVan)
{
Throw<VerenigingKanGeenDubbelWordenVanZichzelf>.If(isDubbelVan.Equals(VCode));

Throw<AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden>.If(State.CorresponderendeVCodes.Any());

AddEvent(VerenigingWerdGemarkeerdAlsDubbelVan.With(VCode, isDubbelVan));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
namespace AssociationRegistry.Test.Admin.Api.Commands.FeitelijkeVereniging.When_MarkeerAlsDubbelVan.CommandHandling;

using Acties.MarkeerAlsDubbelVan;
using AssociationRegistry.Framework;
using AutoFixture;
using Common.AutoFixture;
using Common.Framework;
using Common.Scenarios.CommandHandling;
using FluentAssertions;
using GrarConsumer.FusieEvents.When_Consuming_Merger_Events;
using Marten;
using Messages;
using Moq;
using Resources;
using Vereniging;
using Vereniging.Exceptions;
using Wolverine;
using Wolverine.Marten;
using Xunit;
using Xunit.Categories;

[UnitTest]
public class Given_An_Authentieke_Vereniging
{
private readonly Fixture _fixture;
private readonly VerenigingAanvaarddeDubbeleVerenigingScenario _scenario;
private readonly VerenigingRepositoryMock _verenigingRepositoryMock;
private readonly MarkeerAlsDubbelVanCommandHandler _commandHandler;
private Mock<IMartenOutbox> _martenOutbox;

public Given_An_Authentieke_Vereniging()
{
_fixture = new Fixture().CustomizeDomain();
_scenario = new VerenigingAanvaarddeDubbeleVerenigingScenario();
_verenigingRepositoryMock = new VerenigingRepositoryMock(_scenario.GetVerenigingState());

_martenOutbox = new Mock<IMartenOutbox>();

_commandHandler = new MarkeerAlsDubbelVanCommandHandler(
_verenigingRepositoryMock,
_martenOutbox.Object,
Mock.Of<IDocumentSession>()
);
}

[Fact]
public async Task Then_It_Throws()
{
var command = _fixture.Create<MarkeerAlsDubbelVanCommand>() with
{
VCode = _scenario.VCode,
VCodeAuthentiekeVereniging = _fixture.Create<VCode>(),
};

var exception = await Assert.ThrowsAsync<AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden>(async () => await _commandHandler.Handle(new CommandEnvelope<MarkeerAlsDubbelVanCommand>(command, _fixture.Create<CommandMetadata>())));

exception.Message.Should().Be(ExceptionMessages.AuthentiekeVerenigingKanNietAlsDubbelGemarkeerdWorden);

_martenOutbox.Verify(x => x.SendAsync(It.IsAny<AanvaardDubbeleVerenigingMessage>(), It.IsAny<DeliveryOptions>()), Times.Never);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public void Has_validation_error_IsDubbelVan_is_verplicht()
var result = validator.TestValidate(request);

result.ShouldHaveValidationErrorFor(toeRequest => toeRequest.IsDubbelVan)
.WithErrorMessage($"'{nameof(MarkeerAlsDubbelVanRequest.IsDubbelVan)}' is verplicht.");
.WithErrorMessage($"'{nameof(MarkeerAlsDubbelVanRequest.IsDubbelVan)}' mag niet leeg zijn.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace AssociationRegistry.Test.Common.Scenarios.CommandHandling;

using AssociationRegistry.Framework;
using AutoFixture;
using Events;
using global::AutoFixture;
using Vereniging;

public class VerenigingAanvaarddeDubbeleVerenigingScenario : CommandhandlerScenarioBase
{
public FeitelijkeVerenigingWerdGeregistreerd AuthentiekeVerenigingWerdGeregistreerd { get; }
public VerenigingAanvaarddeDubbeleVereniging VerenigingAanvaarddeDubbeleVereniging { get; set; }

public VerenigingAanvaarddeDubbeleVerenigingScenario()
{
var fixture = new Fixture().CustomizeDomain();

AuthentiekeVerenigingWerdGeregistreerd = fixture.Create<FeitelijkeVerenigingWerdGeregistreerd>();

VerenigingAanvaarddeDubbeleVereniging = fixture.Create<VerenigingAanvaarddeDubbeleVereniging>() with
{
VCode = AuthentiekeVerenigingWerdGeregistreerd.VCode,
};
}

public override VCode VCode => VCode.Create(AuthentiekeVerenigingWerdGeregistreerd.VCode);

public override IEnumerable<IEvent> Events()
=>
[
AuthentiekeVerenigingWerdGeregistreerd,
VerenigingAanvaarddeDubbeleVereniging,
];
}
Loading