diff --git a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java
index 38ff03227..c9ecee0c9 100644
--- a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java
+++ b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/service/ContractServiceDefault.java
@@ -139,7 +139,10 @@ private File createPdfFileContract(String contractTemplatePath, Onboarding onboa
if (PROD_PAGOPA.getValue().equalsIgnoreCase(productId) &&
InstitutionType.PSP == institution.getInstitutionType()) {
setupPSPData(data, manager, onboarding);
- } else if(PROD_PAGOPA.getValue().equalsIgnoreCase(productId) &&
+ } else if (PROD_PAGOPA.getValue().equalsIgnoreCase(productId) &&
+ InstitutionType.PRV == institution.getInstitutionType()) {
+ setupPRVData(data, onboarding);
+ } else if (PROD_PAGOPA.getValue().equalsIgnoreCase(productId) &&
InstitutionType.PSP != institution.getInstitutionType()
&& InstitutionType.PT != institution.getInstitutionType()) {
setECData(data, onboarding);
diff --git a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/utils/PdfMapper.java b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/utils/PdfMapper.java
index c85e84705..7dc49d7a9 100644
--- a/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/utils/PdfMapper.java
+++ b/apps/onboarding-functions/src/main/java/it/pagopa/selfcare/onboarding/utils/PdfMapper.java
@@ -5,6 +5,7 @@
import it.pagopa.selfcare.onboarding.common.PricingPlan;
import it.pagopa.selfcare.onboarding.entity.*;
import it.pagopa.selfcare.onboarding.exception.GenericOnboardingException;
+import org.apache.commons.lang3.StringUtils;
import org.openapi.quarkus.user_registry_json.model.CertifiableFieldResourceOfstring;
import org.openapi.quarkus.user_registry_json.model.UserResource;
@@ -29,6 +30,7 @@ public class PdfMapper {
public static final String PRICING_PLAN = "pricingPlan";
public static final String INSTITUTION_REGISTER_LABEL_VALUE = "institutionRegisterLabelValue";
public static final String ORIGIN_ID_LABEL = "
codice di iscrizione all’Indice delle Pubbliche Amministrazioni e dei gestori di pubblici servizi (I.P.A.) ${originId} ";
+ public static final String INSTITUTION_RECIPIENT_CODE = "institutionRecipientCode";
private PdfMapper() {
}
@@ -115,6 +117,7 @@ public static void setupPSPData(Map map, UserResource validManag
.findFirst()
.map(userMailUuid -> getMailManager(validManager, userMailUuid))
.ifPresent(mail -> map.put("managerPEC", mail));
+
}
public static void setECData(Map map, Onboarding onboarding) {
@@ -124,6 +127,16 @@ public static void setECData(Map map, Onboarding onboarding) {
map.put(INSTITUTION_BUSINESS_REGISTER_PLACE, Optional.ofNullable(institution.getBusinessRegisterPlace()).orElse(UNDERSCORE));
}
+ public static void setupPRVData(Map map, Onboarding onboarding) {
+ addInstitutionRegisterLabelValue(onboarding.getInstitution(), map);
+
+ if (onboarding.getBilling() != null) {
+ map.put(INSTITUTION_RECIPIENT_CODE, Optional.ofNullable(onboarding.getBilling().getRecipientCode()).orElse(UNDERSCORE));
+ }
+
+ setECData(map, onboarding);
+ }
+
public static void setupProdIOData(Onboarding onboarding, Map map, UserResource validManager) {
final Institution institution = onboarding.getInstitution();
final InstitutionType institutionType = institution.getInstitutionType();
@@ -135,7 +148,7 @@ public static void setupProdIOData(Onboarding onboarding, Map ma
addInstitutionRegisterLabelValue(institution, map);
if (onboarding.getBilling() != null) {
- map.put("institutionRecipientCode",onboarding.getBilling().getRecipientCode());
+ map.put(INSTITUTION_RECIPIENT_CODE,onboarding.getBilling().getRecipientCode());
}
map.put("GPSinstitutionName", InstitutionType.GSP == institutionType ? institution.getDescription() : UNDERSCORE);
@@ -164,7 +177,7 @@ public static void setupProdPNData(Map map, Institution institut
addInstitutionRegisterLabelValue(institution, map);
if (billing != null) {
- map.put("institutionRecipientCode", billing.getRecipientCode());
+ map.put(INSTITUTION_RECIPIENT_CODE, billing.getRecipientCode());
}
}
@@ -188,13 +201,17 @@ private static void addPricingPlan(String pricingPlan, Map map)
}
private static void addInstitutionRegisterLabelValue(Institution institution, Map map) {
- if (institution.getPaymentServiceProvider() != null
- && Objects.nonNull(institution.getPaymentServiceProvider().getBusinessRegisterNumber())) {
- map.put("number", institution.getPaymentServiceProvider().getBusinessRegisterNumber());
- map.put(INSTITUTION_REGISTER_LABEL_VALUE, "codice di iscrizione all’Indice delle Pubbliche Amministrazioni e dei gestori di pubblici servizi (I.P.A.) ${number} \n");
- } else {
- map.put(INSTITUTION_REGISTER_LABEL_VALUE, "");
+ String businessRegisterNumber = StringUtils.EMPTY;
+ String businessRegisterNumberLabel = StringUtils.EMPTY;
+
+ if (institution.getPaymentServiceProvider() != null) {
+ businessRegisterNumber = Optional.ofNullable(institution.getPaymentServiceProvider().getBusinessRegisterNumber()).orElse(StringUtils.EMPTY);
+ businessRegisterNumberLabel = "codice di iscrizione all’Indice delle Pubbliche Amministrazioni e dei gestori di pubblici servizi (I.P.A.) ${number} \n";
}
+
+ map.put("number", businessRegisterNumber);
+ map.put(INSTITUTION_REGISTER_LABEL_VALUE, businessRegisterNumberLabel);
+
}
private static void decodePricingPlan(String pricingPlan, String productId, Map map) {
@@ -265,4 +282,5 @@ private static String delegatesToText(List userResources, List