Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix: institution type from ipa and mapper contract path (#336)
Browse files Browse the repository at this point in the history
* save PA when create from ipa

* fix toOnboarding mapper
  • Loading branch information
manuraf authored Dec 18, 2023
1 parent fd6dd09 commit 46e1d4f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.pagopa.selfcare.mscore.core.strategy;

import it.pagopa.selfcare.commons.base.utils.InstitutionType;
import it.pagopa.selfcare.mscore.api.InstitutionConnector;
import it.pagopa.selfcare.mscore.api.PartyRegistryProxyConnector;
import it.pagopa.selfcare.mscore.constant.Origin;
Expand Down Expand Up @@ -87,6 +88,7 @@ private Institution getInstitutionEC(String taxCode, InstitutionProxyInfo instit
GeographicTaxonomies geotax = partyRegistryProxyConnector.getExtByCode(institutionProxyInfo.getIstatCode());

newInstitution.setExternalId(taxCode);
newInstitution.setInstitutionType(InstitutionType.PA);
newInstitution.setOrigin(Origin.IPA.getValue());
newInstitution.setCreatedAt(OffsetDateTime.now());
newInstitution.setCity(Optional.ofNullable(geotax.getDescription())
Expand All @@ -113,6 +115,7 @@ private Institution mappingToInstitutionIPAAoo(CreateInstitutionStrategyInput st
AreaOrganizzativaOmogenea areaOrganizzativaOmogenea = partyRegistryProxyConnector.getAooById(strategyInput.getSubunitCode());
GeographicTaxonomies geotax = partyRegistryProxyConnector.getExtByCode(areaOrganizzativaOmogenea.getCodiceComuneISTAT());
Institution newInstitution = new Institution();
newInstitution.setInstitutionType(InstitutionType.PA);
newInstitution.setOriginId(areaOrganizzativaOmogenea.getId());
newInstitution.setDescription(areaOrganizzativaOmogenea.getDenominazioneAoo());
newInstitution.setDigitalAddress(TYPE_MAIL_PEC.equals(areaOrganizzativaOmogenea.getTipoMail1())
Expand Down Expand Up @@ -152,6 +155,7 @@ private Institution mappingToInstitutionIPAUo(CreateInstitutionStrategyInput str
UnitaOrganizzativa unitaOrganizzativa = partyRegistryProxyConnector.getUoById(strategyInput.getSubunitCode());
GeographicTaxonomies geotax = partyRegistryProxyConnector.getExtByCode(unitaOrganizzativa.getCodiceComuneISTAT());
Institution newInstitution = new Institution();
newInstitution.setInstitutionType(InstitutionType.PA);
newInstitution.setOriginId(unitaOrganizzativa.getId());
newInstitution.setDescription(unitaOrganizzativa.getDescrizioneUo());
newInstitution.setDigitalAddress(TYPE_MAIL_PEC.equals(unitaOrganizzativa.getTipoMail1())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ void shouldCreateInstitutionFromIpaAoo() {
.build());

//Then
assertThat(actual.getInstitutionType()).isEqualTo(InstitutionType.PA);
assertThat(actual.getOriginId()).isEqualTo(dummyAreaOrganizzativaOmogenea.getId());
assertThat(actual.getDescription()).isEqualTo(dummyAreaOrganizzativaOmogenea.getDenominazioneAoo());
assertThat(actual.getDigitalAddress()).isEqualTo(dummyInstitutionProxyInfo.getDigitalAddress());
Expand Down Expand Up @@ -294,6 +295,7 @@ void shouldCreateInstitutionFromIpaUo() {
assertThat(actual.getOriginId()).isEqualTo(dummyUnitaOrganizzativa.getId());
assertThat(actual.getDescription()).isEqualTo(dummyUnitaOrganizzativa.getDescrizioneUo());

assertThat(actual.getInstitutionType()).isEqualTo(InstitutionType.PA);
assertThat(actual.getDigitalAddress()).isEqualTo(dummyInstitutionProxyInfo.getDigitalAddress());
assertThat(actual.getAddress()).isEqualTo(dummyUnitaOrganizzativa.getIndirizzo());
assertThat(actual.getZipCode()).isEqualTo(dummyUnitaOrganizzativa.getCAP());
Expand Down Expand Up @@ -371,6 +373,7 @@ void shouldCreateInstitutionFromIpaUoRetrievingExistingEc() {
assertThat(actual.getOriginId()).isEqualTo(dummyUnitaOrganizzativa.getId());
assertThat(actual.getDescription()).isEqualTo(dummyUnitaOrganizzativa.getDescrizioneUo());

assertThat(actual.getInstitutionType()).isEqualTo(InstitutionType.PA);
assertThat(actual.getDigitalAddress()).isEqualTo(dummyInstitutionProxyInfo.getDigitalAddress());
assertThat(actual.getAddress()).isEqualTo(dummyUnitaOrganizzativa.getIndirizzo());
assertThat(actual.getZipCode()).isEqualTo(dummyUnitaOrganizzativa.getCAP());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ default Boolean mapSignContract(Boolean signContract) {
return Optional.ofNullable(signContract).orElse(true);
}

@Mapping(target = "contract", source = "contractPath")
Onboarding toOnboarding(InstitutionOnboardingRequest onboardingRequest);
}

0 comments on commit 46e1d4f

Please sign in to comment.