diff --git a/src/externalsystems/Bpdm.Library/BpdmService.cs b/src/externalsystems/Bpdm.Library/BpdmService.cs index e74657cc47..444feee5f3 100644 --- a/src/externalsystems/Bpdm.Library/BpdmService.cs +++ b/src/externalsystems/Bpdm.Library/BpdmService.cs @@ -183,6 +183,10 @@ public async Task SetCxMembership(string businessPartnerNumber, Cancellati { using var httpClient = await _tokenService.GetAuthorizedClient(_settings, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + // Same User (which we have for BPDM service) can be used to call Business Partner Pool + // But BaseAddress of Business Partner Pool is different as its deployed on another server. + httpClient.BaseAddress = new Uri(_settings.BusinessPartnerPoolBaseAddress); + var requestData = new BpdmCxMembership( new BpdmCxMembershipDto[]{ new(businessPartnerNumber, true) diff --git a/src/externalsystems/Bpdm.Library/BpdmServiceSettings.cs b/src/externalsystems/Bpdm.Library/BpdmServiceSettings.cs index ff155a4417..0440bbebf7 100644 --- a/src/externalsystems/Bpdm.Library/BpdmServiceSettings.cs +++ b/src/externalsystems/Bpdm.Library/BpdmServiceSettings.cs @@ -34,4 +34,7 @@ public class BpdmServiceSettings : KeyVaultAuthSettings public bool UseDimWallet { get; set; } public bool StartSharingStateAsReady { get; set; } + + [Required(AllowEmptyStrings = false)] + public string BusinessPartnerPoolBaseAddress { get; set; } = null!; } diff --git a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs index 9ab5342b1b..d9523ddbc3 100644 --- a/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs +++ b/src/registration/ApplicationActivation.Library/ApplicationActivationService.cs @@ -267,7 +267,7 @@ await provisioningManager.DeleteClientRolesFromCentralUserAsync(iamUserId, roleN return new IApplicationChecklistService.WorkerChecklistProcessStepExecutionResult( ProcessStepStatusId.DONE, null, - Enumerable.Repeat(_settings.UseDimWallet ? ProcessStepTypeId.FINISH_APPLICATION_ACTIVATION : ProcessStepTypeId.SET_MEMBERSHIP, 1), + Enumerable.Repeat(_settings.UseDimWallet ? ProcessStepTypeId.SET_CX_MEMBERSHIP_IN_BPDM : ProcessStepTypeId.SET_MEMBERSHIP, 1), null, true, null); @@ -306,7 +306,7 @@ await provisioningManager.DeleteClientRolesFromCentralUserAsync(iamUserId, roleN throw new ConflictException("BusinessPartnerNumber must be set"); } - var resultMessage = await bpdmService.SetCxMembership(businessPartnerNumber, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); + await bpdmService.SetCxMembership(businessPartnerNumber, cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None); return new IApplicationChecklistService.WorkerChecklistProcessStepExecutionResult( ProcessStepStatusId.DONE, null, diff --git a/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs b/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs index 78b426e284..9488e68929 100644 --- a/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs +++ b/tests/externalsystems/Bpdm.Library/BpdmServiceTests.cs @@ -48,6 +48,7 @@ public BpdmServiceTests() Scope = "test", Username = "user@name", BaseAddress = "https://base.address.com", + BusinessPartnerPoolBaseAddress = "https://business.partner.pool.base.address.com", ClientId = "CatenaX", ClientSecret = "pass@Secret", GrantType = "cred", @@ -673,7 +674,7 @@ public async Task SetCxMembership_WithValidData_DoesNotThrowException() var httpMessageHandlerMock = new HttpMessageHandlerMock(HttpStatusCode.OK); using var httpClient = new HttpClient(httpMessageHandlerMock) { - BaseAddress = new Uri("https://base.address.com") + BaseAddress = new Uri("https://business.partner.pool.base.address.com") }; A.CallTo(() => _tokenService.GetAuthorizedClient(_options.Value, A._)) .Returns(httpClient); @@ -694,7 +695,7 @@ public async Task SetCxMembership_WithInvalidData_ThrowsServiceException() var httpMessageHandlerMock = new HttpMessageHandlerMock(HttpStatusCode.BadRequest); using var httpClient = new HttpClient(httpMessageHandlerMock) { - BaseAddress = new Uri("https://base.address.com") + BaseAddress = new Uri("https://business.partner.pool.base.address.com") }; A.CallTo(() => _tokenService.GetAuthorizedClient(_options.Value, A._)).Returns(httpClient); var sut = new BpdmService(_tokenService, _options); diff --git a/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs b/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs index 0f1599cfbf..0d5dace84e 100644 --- a/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs +++ b/tests/registration/ApplicationActivation.Library.Tests/ApplicationActivationTests.cs @@ -552,7 +552,7 @@ public async Task SetTheme_WithValid_ReturnsExpected(bool useDimWallet) //Assert var expectedProcessStepTypeId = - useDimWallet ? ProcessStepTypeId.FINISH_APPLICATION_ACTIVATION : ProcessStepTypeId.SET_MEMBERSHIP; + useDimWallet ? ProcessStepTypeId.SET_CX_MEMBERSHIP_IN_BPDM : ProcessStepTypeId.SET_MEMBERSHIP; A.CallTo(() => _provisioningManager.UpdateSharedRealmTheme("idp1", _settings.LoginTheme)).MustHaveHappenedOnceExactly(); result.StepStatusId.Should().Be(ProcessStepStatusId.DONE); result.ScheduleStepTypeIds.Should().ContainSingle()