From 4691c3ed1d18f4f56b736648b02c3e4c55cd76bd Mon Sep 17 00:00:00 2001 From: "Dhirender Singh (Cofinity-X)" <144212607+dhiren-singh-007@users.noreply.github.com> Date: Thu, 14 Nov 2024 00:38:13 +0100 Subject: [PATCH] fix(osp): added short name in company creation (#1133) * fix(osp): added short name in company creation * updated test --- .../BusinessLogic/NetworkBusinessLogic.cs | 1 + .../Models/PartnerRegistrationData.cs | 3 ++- .../BusinessLogic/NetworkBusinessLogicTests.cs | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs index 67b6957102..203f14a787 100644 --- a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs @@ -141,6 +141,7 @@ private Guid CreatePartnerCompany(ICompanyRepository companyRepository, PartnerR { c.AddressId = address.Id; c.BusinessPartnerNumber = data.BusinessPartnerNumber?.ToUpper(); + c.Shortname = data.ShortName; }); companyRepository.CreateUpdateDeleteIdentifiers(company.Id, Enumerable.Empty<(UniqueIdentifierId, string)>(), data.UniqueIds.Select(x => (x.UniqueIdentifierId, x.Value))); diff --git a/src/administration/Administration.Service/Models/PartnerRegistrationData.cs b/src/administration/Administration.Service/Models/PartnerRegistrationData.cs index 54f5169564..3b539e923b 100644 --- a/src/administration/Administration.Service/Models/PartnerRegistrationData.cs +++ b/src/administration/Administration.Service/Models/PartnerRegistrationData.cs @@ -27,6 +27,7 @@ public record PartnerRegistrationData ( string ExternalId, string Name, + string? ShortName, [property: JsonPropertyName("bpn")] string? BusinessPartnerNumber, string City, string StreetName, @@ -37,7 +38,7 @@ public record PartnerRegistrationData IEnumerable UniqueIds, IEnumerable UserDetails, IEnumerable CompanyRoles -) : RegistrationData(Name, City, StreetName, CountryAlpha2Code, BusinessPartnerNumber, null, Region, null, StreetNumber, ZipCode, UniqueIds); +) : RegistrationData(Name, City, StreetName, CountryAlpha2Code, BusinessPartnerNumber, ShortName, Region, null, StreetNumber, ZipCode, UniqueIds); public record UserDetailData( Guid? IdentityProviderId, diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs index 7736ccf8fd..021ded7494 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs @@ -363,6 +363,7 @@ public async Task HandlePartnerRegistration_WithUserCreationThrowsException_Thro var data = new PartnerRegistrationData( Guid.NewGuid().ToString(), "Test N2N", + null, Bpn, "Munich", "Street", @@ -398,6 +399,7 @@ public async Task HandlePartnerRegistration_WithSingleIdpWithoutAlias_ThrowsServ var data = new PartnerRegistrationData( Guid.NewGuid().ToString(), "Test N2N", + "N2N", Bpn, "Munich", "Street", @@ -438,6 +440,7 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe var data = new PartnerRegistrationData( Guid.NewGuid().ToString(), "Test N2N", + null, Bpn, "Munich", "Street", @@ -522,6 +525,7 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe companies.Should().ContainSingle() .Which.Should().Match(x => x.Name == data.Name && + x.Shortname == data.ShortName && x.CompanyStatusId == CompanyStatusId.PENDING); processes.Should().ContainSingle() .Which.Should().Match( @@ -572,6 +576,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? var data = new PartnerRegistrationData( Guid.NewGuid().ToString(), "Test N2N", + "N2N", businessPartnerNumber, "Munich", "Street", @@ -661,6 +666,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? companies.Should().ContainSingle() .Which.Should().Match(x => x.Name == data.Name && + x.Shortname == data.ShortName && x.CompanyStatusId == CompanyStatusId.PENDING); processes.Should().ContainSingle() .Which.Should().Match(x =>