Skip to content

Commit

Permalink
[SELC-5469] feat: added condition to match PRV onboarding with workfl…
Browse files Browse the repository at this point in the history
…owType CONTRACT_REGISTRATION
  • Loading branch information
pierpaolodidato89 authored Sep 3, 2024
1 parent bfae9ca commit b3abbfa
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ private WorkflowType getWorkflowType(Onboarding onboarding) {
if (InstitutionType.PA.equals(institutionType)
|| isGspAndProdInterop(institutionType, onboarding.getProductId())
|| InstitutionType.SA.equals(institutionType)
|| InstitutionType.AS.equals(institutionType)) {
|| InstitutionType.AS.equals(institutionType)
|| InstitutionType.PRV.equals(institutionType)) {
return WorkflowType.CONTRACT_REGISTRATION;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package it.pagopa.selfcare.onboarding.service.util;

import io.smallrye.mutiny.Uni;
import it.pagopa.selfcare.onboarding.common.InstitutionPaSubunitType;
import it.pagopa.selfcare.onboarding.common.InstitutionType;
import it.pagopa.selfcare.onboarding.common.ProductId;
import it.pagopa.selfcare.onboarding.constants.CustomError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,41 @@ void mockSimpleSearchPOSTAndPersist(UniAsserter asserter) {
.thenReturn(Uni.createFrom().item(new OrchestrationResponse())));
}

@Test
@RunOnVertxContext
void onboarding_PRV(UniAsserter asserter) {
Onboarding request = new Onboarding();
List<UserRequest> users = List.of(manager);
request.setProductId(PROD_INTEROP.getValue());
Institution institutionBaseRequest = new Institution();
institutionBaseRequest.setInstitutionType(InstitutionType.PRV);
institutionBaseRequest.setTaxCode("taxCode");
request.setInstitution(institutionBaseRequest);
List<AggregateInstitution> aggregates = new ArrayList<>();
AggregateInstitution institution = new AggregateInstitution();
aggregates.add(institution);
request.setAggregates(aggregates);

mockPersistOnboarding(asserter);

asserter.execute(() -> when(userRegistryApi.updateUsingPATCH(any(), any()))
.thenReturn(Uni.createFrom().item(Response.noContent().build())));

mockSimpleSearchPOSTAndPersist(asserter);
mockSimpleProductValidAssert(request.getProductId(), false, asserter);
mockVerifyOnboardingNotFound();
mockVerifyAllowedMap(request.getInstitution().getTaxCode(), request.getProductId(), asserter);

asserter.assertThat(() -> onboardingService.onboarding(request, users), Assertions::assertNotNull);

asserter.execute(() -> {
PanacheMock.verify(Onboarding.class).persist(any(Onboarding.class), any());
PanacheMock.verify(Onboarding.class).persistOrUpdate(any(List.class));
PanacheMock.verify(Onboarding.class).find(any(Document.class));
PanacheMock.verifyNoMoreInteractions(Onboarding.class);
});
}

@Test
@RunOnVertxContext
void onboarding_Onboarding_Aggregator(UniAsserter asserter) {
Expand Down

0 comments on commit b3abbfa

Please sign in to comment.