diff --git a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs index 51522cb5b7..6aa306ea19 100644 --- a/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs +++ b/src/administration/Administration.Service/BusinessLogic/NetworkBusinessLogic.cs @@ -180,14 +180,17 @@ public Task RetriggerProcessStep(Guid externalId, ProcessStepTypeId processStepT private async Task<(IEnumerable RoleData, IDictionary? IdentityProviderIdAliase, (Guid IdentityProviderId, string Alias)? SingleIdentityProviderIdAlias, IEnumerable AllIdentityProviderIds)> ValidatePartnerRegistrationData(PartnerRegistrationData data, INetworkRepository networkRepository, IIdentityProviderRepository identityProviderRepository, Guid ownerCompanyId) { - if (string.IsNullOrWhiteSpace(data.Bpn) || !BpnRegex.IsMatch(data.Bpn)) + if (data.Bpn != null) { - throw new ControllerArgumentException("BPN must contain exactly 16 characters and must be prefixed with BPNL", nameof(data.Bpn)); - } + if (!BpnRegex.IsMatch(data.Bpn)) + { + throw new ControllerArgumentException("BPN must contain exactly 16 characters and must be prefixed with BPNL", nameof(data.Bpn)); + } - if (await _portalRepositories.GetInstance().CheckBpnExists(data.Bpn).ConfigureAwait(false)) - { - throw new ControllerArgumentException($"The Bpn {data.Bpn} already exists", nameof(data.Bpn)); + if (await _portalRepositories.GetInstance().CheckBpnExists(data.Bpn).ConfigureAwait(false)) + { + throw new ControllerArgumentException($"The Bpn {data.Bpn} already exists", nameof(data.Bpn)); + } } if (!data.CompanyRoles.Any()) diff --git a/src/externalsystems/OnboardingServiceProvider.Library/Models/OnboardingServiceProviderCallbackData.cs b/src/externalsystems/OnboardingServiceProvider.Library/Models/OnboardingServiceProviderCallbackData.cs index 8d4a700c61..4d37ed66cf 100644 --- a/src/externalsystems/OnboardingServiceProvider.Library/Models/OnboardingServiceProviderCallbackData.cs +++ b/src/externalsystems/OnboardingServiceProvider.Library/Models/OnboardingServiceProviderCallbackData.cs @@ -34,7 +34,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.OnboardingServiceProvider.Library. public record OnboardingServiceProviderCallbackData( [property: JsonPropertyName("externalId")] Guid ExternalId, [property: JsonPropertyName("applicationId")] Guid ApplicationId, - [property: JsonPropertyName("bpn")] string Bpn, + [property: JsonPropertyName("bpn")] string? Bpn, [property: JsonPropertyName("status")] CompanyApplicationStatusId? Status, [property: JsonPropertyName("message")] string? Message ); diff --git a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs index edde5baa74..3d02632f05 100644 --- a/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs +++ b/src/externalsystems/OnboardingServiceProvider.Library/OnboardingServiceProviderBusinessLogic.cs @@ -57,11 +57,6 @@ public OnboardingServiceProviderBusinessLogic(IOnboardingServiceProviderService throw new UnexpectedConditionException("No external registration found"); } - if (string.IsNullOrWhiteSpace(data.Bpn)) - { - throw new UnexpectedConditionException("Bpn must be set"); - } - if (processStepTypeId == ProcessStepTypeId.TRIGGER_CALLBACK_OSP_DECLINED && data.Comments.Count() != 1) { throw new UnexpectedConditionException("Message for decline should be set"); diff --git a/src/mailing/Mailing.Template/EmailTemplates/osp_welcome_email.html b/src/mailing/Mailing.Template/EmailTemplates/osp_welcome_email.html index f4eea5098a..126d933f99 100644 --- a/src/mailing/Mailing.Template/EmailTemplates/osp_welcome_email.html +++ b/src/mailing/Mailing.Template/EmailTemplates/osp_welcome_email.html @@ -90,9 +90,16 @@ -

- Dear {userName},

your registration at the Catena-X dataspace got based on your request successfully generated by {osp} for idps {idpAliasse}.

We have created your registration request. Before the registration validation is taking place, a final check from your side confirming your registration data and confirming the terms & conditions is needed.

Please follow the link below to access your registration data and to confirm the company role related terms & conditions.
You may want to update the company roles by selecting additional roles.

+

+ Dear {userName},

your registration at the Catena-X dataspace got based on your request successfully generated by {osp}.

We have created your registration request. Before the registration validation is taking place, a final check from your side confirming your registration data and confirming the terms & conditions is needed.

Please follow the link below to access your registration data and to confirm the company role related terms & conditions.
You may want to update the company roles by selecting additional roles. + +
Please note: you can login with your {osp} account by clicking on the company login path * +

+ {idpalias} +

* and entering your {osp} user credentials. In case the authentication runs on errors, please have a look at the + help + or contact your onboarding service provider {osp} +

@@ -167,11 +174,16 @@ style="Margin:0;padding-top:15px;padding-bottom:15px;padding-left:30px;padding-right:30px;text-align: left;">

- if the request was not triggered by you, you can close the application by clicking here
{hostname}/{closeApplicationUrl}The above link does not work?
Copy/Paste this URL into your + Browser:
{hostname}/registration/external

+

+
+

I need more information and help?
@@ -183,6 +195,26 @@ + + + + + +
+
diff --git a/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs b/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs index 62e95ead15..fa1bcb6729 100644 --- a/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs +++ b/src/processes/NetworkRegistration.Library/NetworkRegistrationHandler.cs @@ -132,7 +132,7 @@ private async Task SendMails(IEnumerable companyUserWithRol { "hostname", _settings.BasePortalAddress }, { "osp", ospName }, { "url", _settings.BasePortalAddress }, - { "idpAliasse", string.Join(",", idpAliasse) } + { "idpalias", string.Join(",", idpAliasse) } }; await _mailingService.SendMails(receiver, mailParameters, templates).ConfigureAwait(false); } diff --git a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs index 5c32ed6216..112d7fc0de 100644 --- a/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs +++ b/tests/administration/Administration.Service.Tests/BusinessLogic/NetworkBusinessLogicTests.cs @@ -107,7 +107,6 @@ public NetworkBusinessLogicTests() #region HandlePartnerRegistration [Theory] - [InlineData(null)] [InlineData("")] [InlineData("TEST00000012")] [InlineData("BPNL1234567899")] @@ -532,8 +531,10 @@ public async Task HandlePartnerRegistration_WithIdpNotSetAndOnlyOneIdp_CallsExpe A.CallTo(() => _portalRepositories.SaveAsync()).MustHaveHappenedOnceExactly(); } - [Fact] - public async Task HandlePartnerRegistration_WithValidData_CallsExpected() + [Theory] + [InlineData(Bpnl)] + [InlineData((string?)null)] + public async Task HandlePartnerRegistration_WithValidData_CallsExpected(string? bpnl) { // Arrange var newCompanyId = Guid.NewGuid(); @@ -551,7 +552,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected() var data = new PartnerRegistrationData( Guid.NewGuid(), "Test N2N", - Bpnl, + bpnl, "Munich", "Street", "DE", @@ -656,7 +657,7 @@ public async Task HandlePartnerRegistration_WithValidData_CallsExpected() x.ProcessId == newProcessId && x.ApplicationId == newApplicationId); - A.CallTo(() => _userProvisioningService.GetOrCreateCompanyUser(A._, "test-alias", A._, newCompanyId, IdpId, Bpnl)) + A.CallTo(() => _userProvisioningService.GetOrCreateCompanyUser(A._, "test-alias", A._, newCompanyId, IdpId, bpnl)) .MustHaveHappenedOnceExactly(); A.CallTo(() => _identityProviderRepository.CreateCompanyIdentityProviders(A>.That.IsSameSequenceAs(new[] { new ValueTuple(newCompanyId, IdpId) }))) .MustHaveHappenedOnceExactly(); diff --git a/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs b/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs index 1b55d31651..5603cf8fc9 100644 --- a/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs +++ b/tests/externalsystems/OnboardingServiceProvider.Library.Tests/OnboardingServiceProviderBusinessLogicTests.cs @@ -96,24 +96,6 @@ public async Task TriggerProviderCallback_WithoutExternalId_ThrowsUnexpectedCond ex.Message.Should().Be("No external registration found"); } - [Fact] - public async Task TriggerProviderCallback_WithoutBpn_ThrowsUnexpectedConditionException() - { - // Arrange - var networkRegistrationId = Guid.NewGuid(); - var secret = Encoding.UTF8.GetBytes(_fixture.Create()); - var details = new OspDetails("https://callback.url", "https://auth.url", "test1", secret); - A.CallTo(() => _networkRepository.GetCallbackData(networkRegistrationId, ProcessStepTypeId.TRIGGER_CALLBACK_OSP_APPROVED)) - .Returns((details, Guid.NewGuid(), null, Guid.NewGuid(), Enumerable.Empty())); - - // Act - async Task Act() => await _sut.TriggerProviderCallback(networkRegistrationId, ProcessStepTypeId.TRIGGER_CALLBACK_OSP_APPROVED, CancellationToken.None).ConfigureAwait(false); - - // Assert - var ex = await Assert.ThrowsAsync(Act); - ex.Message.Should().Be("Bpn must be set"); - } - [Fact] public async Task TriggerProviderCallback_WithMultipleDeclineMessages_ThrowsUnexpectedConditionException() {