Skip to content

Commit

Permalink
Next release 2.35.0 (#534)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessio Cialini <63233981+alessio-cialini@users.noreply.github.com>
Co-authored-by: Pasquale Spica <36746022+pasqualespica@users.noreply.github.com>
Co-authored-by: pagopa-github-bot <github-bot@pagopa.it>
Co-authored-by: svariant <samuele.varianti@nttdata.com>
Co-authored-by: Samuele Varianti <128470180+svariant@users.noreply.github.com>
Co-authored-by: Alessio Cialini <alessio.cialini@emeal.nttdata.com>
  • Loading branch information
7 people authored Dec 19, 2024
1 parent 22f5bab commit 0e7d898
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .identity/00_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data "azurerm_resource_group" "apim_resource_group" {
}

data "azurerm_user_assigned_identity" "identity_cd_01"{
name = "${local.prefix}-${var.env_short}-${local.domain}-01-github-cd-identity"
name = "${local.prefix}-${var.env_short}-${local.domain}-job-01-github-cd-identity"
resource_group_name = "${local.prefix}-${var.env_short}-identity-rg"
}

Expand Down
1 change: 1 addition & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8965,6 +8965,7 @@
"BIZ",
"FDR_ORG",
"FDR_PSP",
"QI_FDR_KPI",
"BO_EXT_EC",
"BO_EXT_PSP",
"PRINT_NOTICE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum Subscription {
BIZ("/products/bizevents", "BIZ - Recupero ricevute Ente Creditore", "biz-", CI, null, false),
FDR_ORG("/products/fdr-org", "FdR - Flussi di Rendicontazione (EC)", "fdrorg-", CI, "fdr", true),
FDR_PSP("/products/fdr-psp", "FdR - Flussi di Rendicontazione (PSP)", "fdrpsp-", PSP, "fdr", true),
QI_FDR_KPI("/products/qi-fdr-kpi", "FdR - Quality Improvement KPI API", "qifdrkpiservice-", PSP, "qi", true),
BO_EXT_EC("/apis/%s-backoffice-external-ec-api-v1", "Backoffice External (EC)", "selfcareboexternalec-", CI, "backoffice_external", false),
BO_EXT_PSP("/apis/%s-backoffice-external-psp-api-v1", "Backoffice External (PSP)", "selfcareboexternalpsp-", PSP, "backoffice_external", false),
PRINT_NOTICE("/products/pagopa_notices_service_external", "Stampa Avvisi", "printnotice-", CI, null, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public InstitutionApiKeysResource getInstitutionApiKeys(String institutionId) {
/**
* Create the subscription's api keys to the specified subscription for the specified institution.
* <p>
* If the subscription is for {@link Subscription#BO_EXT_EC} or {@link Subscription#BO_EXT_PSP} then it configure
* If the subscription configuration {@link Subscription} require authorizer then it call
* the Authorizer config service in order to enable the authorization process.
*
* @param institutionId the id of the institution
Expand All @@ -187,7 +187,7 @@ public InstitutionApiKeysResource getInstitutionApiKeys(String institutionId) {
public InstitutionApiKeysResource createSubscriptionKeys(String institutionId, Subscription subscriptionCode) {
InstitutionResponse institution = getInstitutionResponse(institutionId);
checkIfInstitutionCanOperateOnSubscriptionOtherwiseThrowException(institution, subscriptionCode);
if (subscriptionCode.equals(Subscription.FDR_PSP) && !InstitutionType.PT.equals(institution.getInstitutionType())) {
if (isPSPCodeRequiredForProvidedSubscriptionAnInstitution(subscriptionCode, institution)) {
checkIfPSPCodeIsAvailableOtherwiseThrowException(institution, subscriptionCode);
}

Expand Down Expand Up @@ -229,8 +229,8 @@ public InstitutionApiKeysResource createSubscriptionKeys(String institutionId, S
/**
* Regenerate the primary subscription key to the specified subscription for the given institution.
* <p>
* If the subscription is for {@link Subscription#BO_EXT_EC} or {@link Subscription#BO_EXT_PSP} then it update
* the Authorizer config service with the new api key.
* If the subscription configuration {@link Subscription} require authorizer then it call
* the Authorizer config service in order to enable the authorization process.
*
* @param institutionId the id of the institution
* @param subscriptionId the id of the subscription
Expand All @@ -240,7 +240,7 @@ public void regeneratePrimaryKey(@NotNull String institutionId, @NotNull String
var prefix = subscriptionId.split("-")[0] + "-";
Subscription subscription = Subscription.fromPrefix(prefix);
checkIfInstitutionCanOperateOnSubscriptionOtherwiseThrowException(institution, subscription);
if (subscription.equals(Subscription.FDR_PSP) && !InstitutionType.PT.equals(institution.getInstitutionType())) {
if (isPSPCodeRequiredForProvidedSubscriptionAnInstitution(subscription, institution)) {
checkIfPSPCodeIsAvailableOtherwiseThrowException(institution, subscription);
}
this.apimClient.regeneratePrimaryKey(subscriptionId);
Expand All @@ -253,8 +253,8 @@ public void regeneratePrimaryKey(@NotNull String institutionId, @NotNull String
/**
* Regenerate the secondary subscription key to the specified subscription for the given institution.
* <p>
* If the subscription is for {@link Subscription#BO_EXT_EC} or {@link Subscription#BO_EXT_PSP} then it update
* the Authorizer config service with the new api key.
* If the subscription configuration {@link Subscription} require authorizer then it call
* the Authorizer config service in order to enable the authorization process.
*
* @param institutionId the id of the institution
* @param subscriptionId the id of the subscription
Expand All @@ -264,7 +264,7 @@ public void regenerateSecondaryKey(@NotNull String institutionId, @NotNull Strin
var prefix = subscriptionId.split("-")[0] + "-";
Subscription subscription = Subscription.fromPrefix(prefix);
checkIfInstitutionCanOperateOnSubscriptionOtherwiseThrowException(institution, subscription);
if (subscription.equals(Subscription.FDR_PSP) && !InstitutionType.PT.equals(institution.getInstitutionType())) {
if (isPSPCodeRequiredForProvidedSubscriptionAnInstitution(subscription, institution)) {
checkIfPSPCodeIsAvailableOtherwiseThrowException(institution, subscription);
}
this.apimClient.regenerateSecondaryKey(subscriptionId);
Expand Down Expand Up @@ -459,7 +459,7 @@ private AuthorizationEntity getAuthorizationEntity(
String taxCode
) {
String value = taxCode;
if (subscription.equals(Subscription.FDR_PSP)) {
if (subscription.equals(Subscription.FDR_PSP) || subscription.equals(Subscription.QI_FDR_KPI)) {
try {
value = this.legacyPspCodeUtil.retrievePspCode(taxCode, false);
} catch (Exception e) {
Expand Down Expand Up @@ -560,7 +560,7 @@ private AuthorizationConfig getAuthorizationConfig(
authorizationMetadata = buildAuthorizationMetadata(ciSegregationCodes);
}
}
if (subscription.equals(Subscription.BO_EXT_EC) || subscription.equals(Subscription.BO_EXT_PSP)) {
if (subscription.equals(Subscription.BO_EXT_EC) || subscription.equals(Subscription.BO_EXT_PSP) || subscription.equals(Subscription.QI_FDR_KPI)) {
authorizationEntities.add(
AuthorizationEntity.builder()
.name(institution.getDescription())
Expand Down Expand Up @@ -599,5 +599,11 @@ private char getEnvironment() {
private record AuthorizationConfig(List<AuthorizationEntity> authorizationEntities,
List<AuthorizationMetadata> authorizationMetadata) {


}

private boolean isPSPCodeRequiredForProvidedSubscriptionAnInstitution(Subscription subscriptionCode, InstitutionResponse institution) {
return (subscriptionCode.equals(Subscription.FDR_PSP) || subscriptionCode.equals(Subscription.QI_FDR_KPI))
&& !InstitutionType.PT.equals(institution.getInstitutionType());
}
}
Loading

0 comments on commit 0e7d898

Please sign in to comment.