From 148250fbe3ec08e7fdfa8a45e6ad38a5ba0ca3df Mon Sep 17 00:00:00 2001 From: Giulia Tremolada Date: Tue, 5 Nov 2024 17:52:12 +0100 Subject: [PATCH] add userAggregatorContractMappings field in Product --- apps/onboarding-functions/pom.xml | 6 ++-- apps/onboarding-ms/pom.xml | 4 +-- apps/pom.xml | 2 +- libs/onboarding-sdk-azure-storage/pom.xml | 2 +- libs/onboarding-sdk-common/pom.xml | 2 +- libs/onboarding-sdk-crypto/pom.xml | 2 +- libs/onboarding-sdk-pom/pom.xml | 2 +- libs/onboarding-sdk-product/pom.xml | 4 +-- .../entity/PHASE_ADDITION_ALLOWED.java | 5 ++- .../selfcare/product/entity/Product.java | 32 ++++++++++++++++++- test-coverage/pom.xml | 8 ++--- 11 files changed, 51 insertions(+), 18 deletions(-) diff --git a/apps/onboarding-functions/pom.xml b/apps/onboarding-functions/pom.xml index 61c5e765a..e375585c6 100644 --- a/apps/onboarding-functions/pom.xml +++ b/apps/onboarding-functions/pom.xml @@ -193,17 +193,17 @@ it.pagopa.selfcare onboarding-sdk-crypto - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-azure-storage - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-product - 0.4.0 + 0.4.1 org.apache.commons diff --git a/apps/onboarding-ms/pom.xml b/apps/onboarding-ms/pom.xml index 0b34b8b2f..0fa11ce1f 100644 --- a/apps/onboarding-ms/pom.xml +++ b/apps/onboarding-ms/pom.xml @@ -243,12 +243,12 @@ it.pagopa.selfcare onboarding-sdk-azure-storage - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-product - 0.4.0 + 0.4.1 diff --git a/apps/pom.xml b/apps/pom.xml index 62180cdae..2050f606d 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -16,7 +16,7 @@ it.pagopa.selfcare onboarding-sdk-common - 0.4.0 + 0.4.1 diff --git a/libs/onboarding-sdk-azure-storage/pom.xml b/libs/onboarding-sdk-azure-storage/pom.xml index e0b53e6d5..946de1e7b 100644 --- a/libs/onboarding-sdk-azure-storage/pom.xml +++ b/libs/onboarding-sdk-azure-storage/pom.xml @@ -6,7 +6,7 @@ it.pagopa.selfcare onboarding-sdk-pom - 0.4.0 + 0.4.1 ../onboarding-sdk-pom diff --git a/libs/onboarding-sdk-common/pom.xml b/libs/onboarding-sdk-common/pom.xml index 8d59ebe10..e380556c8 100644 --- a/libs/onboarding-sdk-common/pom.xml +++ b/libs/onboarding-sdk-common/pom.xml @@ -4,7 +4,7 @@ it.pagopa.selfcare onboarding-sdk-pom - 0.4.0 + 0.4.1 ../onboarding-sdk-pom onboarding-sdk-common diff --git a/libs/onboarding-sdk-crypto/pom.xml b/libs/onboarding-sdk-crypto/pom.xml index 0ee3014cd..c470b7397 100644 --- a/libs/onboarding-sdk-crypto/pom.xml +++ b/libs/onboarding-sdk-crypto/pom.xml @@ -4,7 +4,7 @@ it.pagopa.selfcare onboarding-sdk-pom - 0.4.0 + 0.4.1 ../onboarding-sdk-pom onboarding-sdk-crypto diff --git a/libs/onboarding-sdk-pom/pom.xml b/libs/onboarding-sdk-pom/pom.xml index 78e65a0aa..472f5c72b 100644 --- a/libs/onboarding-sdk-pom/pom.xml +++ b/libs/onboarding-sdk-pom/pom.xml @@ -6,7 +6,7 @@ onboarding-sdk-pom pom onboarding-sdk-pom - 0.4.0 + 0.4.1 17 diff --git a/libs/onboarding-sdk-product/pom.xml b/libs/onboarding-sdk-product/pom.xml index d54bbc7b7..96a01c197 100644 --- a/libs/onboarding-sdk-product/pom.xml +++ b/libs/onboarding-sdk-product/pom.xml @@ -4,12 +4,12 @@ it.pagopa.selfcare onboarding-sdk-pom - 0.4.0 + 0.4.1 ../onboarding-sdk-pom onboarding-sdk-product onboarding-sdk-product - 0.4.0 + 0.4.1 2.15.2 diff --git a/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/PHASE_ADDITION_ALLOWED.java b/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/PHASE_ADDITION_ALLOWED.java index 6c4cb863e..acab1b80e 100644 --- a/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/PHASE_ADDITION_ALLOWED.java +++ b/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/PHASE_ADDITION_ALLOWED.java @@ -9,7 +9,10 @@ public enum PHASE_ADDITION_ALLOWED { DASHBOARD("dashboard"), //Phase on dashboard "Aggiunta Utenti" when a sign contract is needed - DASHBOARD_ASYNC("dashboard-async"); + DASHBOARD_ASYNC("dashboard-async"), + + //Phase on dashboard "Aggiunta Utenti" for aggregators when a sign contract is needed + DASHBOARD_AGGREGATOR("dashboard-aggregator"); public final String value; diff --git a/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/Product.java b/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/Product.java index f926b4374..e61c66955 100644 --- a/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/Product.java +++ b/libs/onboarding-sdk-product/src/main/java/it/pagopa/selfcare/product/entity/Product.java @@ -1,9 +1,10 @@ package it.pagopa.selfcare.product.entity; import it.pagopa.selfcare.onboarding.common.PartyRole; +import org.apache.commons.lang3.StringUtils; + import java.time.Instant; import java.util.*; -import org.apache.commons.lang3.StringUtils; public class Product { @@ -36,6 +37,7 @@ public class Product { private List consumers; private Map institutionContractMappings; private Map userContractMappings; + private Map userAggregatorContractMappings; public String getId() { return id; @@ -300,6 +302,14 @@ public void setUserContractMappings(Map userContractMa this.userContractMappings = userContractMappings; } + public Map getUserAggregatorContractMappings() { + return userAggregatorContractMappings; + } + + public void setUserAggregatorContractMappings(Map userAggregatorContractMappings) { + this.userAggregatorContractMappings = userAggregatorContractMappings; + } + public String getAlias() { return alias; } @@ -347,4 +357,24 @@ && getInstitutionContractMappings().containsKey(institutionType)) { } return contractTemplate; } + + /** + * This method returns ContractTemplate associate with a specific InstitutionType for UserAggregatorContract. + * In case none InstitutionType exists on contractMapping, it returns the default ContractTemplate. + * + * @param institutionType InstitutionType + * @return ContractTemplate + */ + public ContractTemplate getUserAggregatorContractTemplate(String institutionType) { + ContractTemplate userAggregatorContractTemplate = new ContractTemplate(); + if (Objects.nonNull(getUserAggregatorContractMappings())) { + if (Objects.nonNull(institutionType) + && getUserAggregatorContractMappings().containsKey(institutionType)) { + userAggregatorContractTemplate = getUserAggregatorContractMappings().get(institutionType); + } else if (getUserAggregatorContractMappings().containsKey(CONTRACT_TYPE_DEFAULT)) { + userAggregatorContractTemplate = getUserAggregatorContractMappings().get(CONTRACT_TYPE_DEFAULT); + } + } + return userAggregatorContractTemplate; + } } diff --git a/test-coverage/pom.xml b/test-coverage/pom.xml index b42a7533a..14460340f 100644 --- a/test-coverage/pom.xml +++ b/test-coverage/pom.xml @@ -77,22 +77,22 @@ it.pagopa.selfcare onboarding-sdk-product - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-common - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-azure-storage - 0.4.0 + 0.4.1 it.pagopa.selfcare onboarding-sdk-crypto - 0.4.0 + 0.4.1