Skip to content

Commit

Permalink
fix(osp): added short name in company creation (#1133)
Browse files Browse the repository at this point in the history
* fix(osp): added short name in company creation
* updated test
  • Loading branch information
dhiren-singh-007 authored Nov 13, 2024
1 parent cf3aa20 commit 4691c3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public record PartnerRegistrationData
(
string ExternalId,
string Name,
string? ShortName,
[property: JsonPropertyName("bpn")] string? BusinessPartnerNumber,
string City,
string StreetName,
Expand All @@ -37,7 +38,7 @@ public record PartnerRegistrationData
IEnumerable<CompanyUniqueIdData> UniqueIds,
IEnumerable<UserDetailData> UserDetails,
IEnumerable<CompanyRoleId> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public async Task HandlePartnerRegistration_WithUserCreationThrowsException_Thro
var data = new PartnerRegistrationData(
Guid.NewGuid().ToString(),
"Test N2N",
null,
Bpn,
"Munich",
"Street",
Expand Down Expand Up @@ -398,6 +399,7 @@ public async Task HandlePartnerRegistration_WithSingleIdpWithoutAlias_ThrowsServ
var data = new PartnerRegistrationData(
Guid.NewGuid().ToString(),
"Test N2N",
"N2N",
Bpn,
"Munich",
"Street",
Expand Down Expand Up @@ -438,6 +440,7 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe
var data = new PartnerRegistrationData(
Guid.NewGuid().ToString(),
"Test N2N",
null,
Bpn,
"Munich",
"Street",
Expand Down Expand Up @@ -522,6 +525,7 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe
companies.Should().ContainSingle()
.Which.Should().Match<Company>(x =>
x.Name == data.Name &&
x.Shortname == data.ShortName &&
x.CompanyStatusId == CompanyStatusId.PENDING);
processes.Should().ContainSingle()
.Which.Should().Match<Process>(
Expand Down Expand Up @@ -572,6 +576,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string?
var data = new PartnerRegistrationData(
Guid.NewGuid().ToString(),
"Test N2N",
"N2N",
businessPartnerNumber,
"Munich",
"Street",
Expand Down Expand Up @@ -661,6 +666,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string?
companies.Should().ContainSingle()
.Which.Should().Match<Company>(x =>
x.Name == data.Name &&
x.Shortname == data.ShortName &&
x.CompanyStatusId == CompanyStatusId.PENDING);
processes.Should().ContainSingle()
.Which.Should().Match<Process>(x =>
Expand Down

0 comments on commit 4691c3e

Please sign in to comment.