Skip to content

Commit

Permalink
Merge pull request #205 from pagopa/PAGOPA-1488-renewal-debt-positions
Browse files Browse the repository at this point in the history
feat: [PagoPA-1488] renewal debt positions
  • Loading branch information
alessio-acitelli authored Feb 12, 2024
2 parents 1b9784a + d3690de commit f02c89e
Show file tree
Hide file tree
Showing 23 changed files with 702 additions and 20 deletions.
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-gpd-core
description: micro-service to manage Creditor Institution debtor positions
type: application
version: 0.86.0
appVersion: 0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr
version: 0.89.0
appVersion: 0.11.1-4-PAGOPA-1488-renewal-debt-positions
dependencies:
- name: microservice-chart
version: 2.4.0
Expand Down
17 changes: 15 additions & 2 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -93,6 +93,18 @@ microservice-chart:
CRON_JOB_SCHEDULE_ENABLED: "true"
CRON_JOB_SCHEDULE_EXPRESSION_TO_VALID: "0 */10 * * * *"
CRON_JOB_SCHEDULE_EXPRESSION_TO_EXPIRED: "0 */20 * * * *"
CRON_JOB_SCHEDULE_HISTORY_ENABLED: "true"
CRON_JOB_SCHEDULE_HISTORY_TRIGGER: "0 */30 * * * *"
CRON_JOB_SCHEDULE_HISTORY_QUERY: "SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_PAGINATED: "true"
CRON_JOB_SCHEDULE_HISTORY_QUERY_COUNT: "SELECT count(pp.id) FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_QUERY_PAGE_SIZE: "5"
CRON_JOB_SCHEDULE_HISTORY_QUERY_INTERVAL: "7"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_DEFAULTLOCKATMOSTFOR: "5m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATMOSTFOR: "10m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATLEASTFOR: "1m"
GPD_ARCHIVE_SA_PO_TABLE: "paymentoptiontable"
GPD_ARCHIVE_SA_PP_TABLE: "paymentpositiontable"
AUX_DIGIT: "3"
NODE_HOST: "https://api.dev.platform.pagopa.it"
NODE_CHECK_POSITION_PATH: "/nodo/nodo-per-pm/v1/checkPosition"
Expand All @@ -109,6 +121,7 @@ microservice-chart:
SPRING_DATASOURCE_PASSWORD: "db-apd-user-password"
SPRING_DATASOURCE_USERNAME: "db-apd-user-name"
NODE_SUBSCRIPTION_KEY: "gpd-d-node-subscription-key"
GPD_ARCHIVE_SA_CONNECTION_STRING: "gpd-archive-d-sa-connection-string"
keyvault:
name: "pagopa-d-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down Expand Up @@ -138,7 +151,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-1-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.9.0"
pullPolicy: Always
envConfig: {}
envSecret: {}
19 changes: 16 additions & 3 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -85,14 +85,26 @@ microservice-chart:
envConfig:
WEBSITE_SITE_NAME: 'pagopa-p-gpd-core-service'
ENV: 'Azure Kubernetes'
SPRING_DATASOURCE_URL: "jdbc:postgresql://gpd-db.p.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0"
SPRING_DATASOURCE_URL: "jdbc:postgresql://pagopa-p-gpd-pgflex.postgres.database.azure.com:6432/apd?sslmode=require&prepareThreshold=0"
SPRING_DATASOURCE_TYPE: "org.springframework.jdbc.datasource.SimpleDriverDataSource"
SPRING_JPA_HIBERNATE_DDL_AUTO: "validate"
SPRING_JPA_HIBERNATE_SHOW_SQL: "false"
SCHEMA_NAME: "apd"
CRON_JOB_SCHEDULE_ENABLED: "true"
CRON_JOB_SCHEDULE_EXPRESSION_TO_VALID: "0 */30 * * * *"
CRON_JOB_SCHEDULE_EXPRESSION_TO_EXPIRED: "0 */40 * * * *"
CRON_JOB_SCHEDULE_HISTORY_ENABLED: "false"
CRON_JOB_SCHEDULE_HISTORY_TRIGGER: "0 0 2 * * *"
CRON_JOB_SCHEDULE_HISTORY_QUERY: "SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_PAGINATED: "true"
CRON_JOB_SCHEDULE_HISTORY_QUERY_COUNT: "SELECT count(pp.id) FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_QUERY_PAGE_SIZE: "100000"
CRON_JOB_SCHEDULE_HISTORY_QUERY_INTERVAL: "365"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_DEFAULTLOCKATMOSTFOR: "5m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATMOSTFOR: "180m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATLEASTFOR: "15m"
GPD_ARCHIVE_SA_PO_TABLE: "paymentoptiontable"
GPD_ARCHIVE_SA_PP_TABLE: "paymentpositiontable"
AUX_DIGIT: "3"
NODE_HOST: "https://api.platform.pagopa.it/"
NODE_CHECK_POSITION_PATH: "/nodo/nodo-per-pm/v1/checkPosition"
Expand All @@ -109,6 +121,7 @@ microservice-chart:
SPRING_DATASOURCE_PASSWORD: "db-apd-user-password"
SPRING_DATASOURCE_USERNAME: "db-apd-user-name"
NODE_SUBSCRIPTION_KEY: "gpd-p-node-subscription-key"
GPD_ARCHIVE_SA_CONNECTION_STRING: "gpd-archive-p-sa-connection-string"
keyvault:
name: "pagopa-p-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down Expand Up @@ -147,7 +160,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-1-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.9.0"
pullPolicy: Always
envConfig: {}
envSecret: {}
19 changes: 16 additions & 3 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -85,14 +85,26 @@ microservice-chart:
envConfig:
WEBSITE_SITE_NAME: 'pagopa-u-gpd-core-service'
ENV: 'Azure Kubernetes'
SPRING_DATASOURCE_URL: "jdbc:postgresql://gpd-db.u.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0"
SPRING_DATASOURCE_URL: "jdbc:postgresql://pagopa-u-gpd-pgflex.postgres.database.azure.com:6432/apd?sslmode=require&prepareThreshold=0"
SPRING_DATASOURCE_TYPE: "org.springframework.jdbc.datasource.SimpleDriverDataSource"
SPRING_JPA_HIBERNATE_DDL_AUTO: "validate"
SPRING_JPA_HIBERNATE_SHOW_SQL: "false"
SCHEMA_NAME: "apd"
CRON_JOB_SCHEDULE_ENABLED: "true"
CRON_JOB_SCHEDULE_EXPRESSION_TO_VALID: "0 */10 * * * *"
CRON_JOB_SCHEDULE_EXPRESSION_TO_EXPIRED: "0 */20 * * * *"
CRON_JOB_SCHEDULE_HISTORY_ENABLED: "false"
CRON_JOB_SCHEDULE_HISTORY_TRIGGER: "0 */45 * * * *"
CRON_JOB_SCHEDULE_HISTORY_QUERY: "SELECT pp FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_PAGINATED: "true"
CRON_JOB_SCHEDULE_HISTORY_QUERY_COUNT: "SELECT count(pp.id) FROM PaymentPosition pp WHERE pp.status IN ('PAID', 'REPORTED', 'INVALID', 'EXPIRED') AND pp.lastUpdatedDate < ?1"
CRON_JOB_SCHEDULE_HISTORY_QUERY_PAGE_SIZE: "100000"
CRON_JOB_SCHEDULE_HISTORY_QUERY_INTERVAL: "90"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_DEFAULTLOCKATMOSTFOR: "5m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATMOSTFOR: "30m"
CRON_JOB_SCHEDULE_HISTORY_SHEDLOCK_LOCKATLEASTFOR: "5m"
GPD_ARCHIVE_SA_PO_TABLE: "paymentoptiontable"
GPD_ARCHIVE_SA_PP_TABLE: "paymentpositiontable"
AUX_DIGIT: "3"
NODE_HOST: "https://api.uat.platform.pagopa.it"
NODE_CHECK_POSITION_PATH: "/nodo/nodo-per-pm/v1/checkPosition"
Expand All @@ -109,6 +121,7 @@ microservice-chart:
SPRING_DATASOURCE_PASSWORD: "db-apd-user-password"
SPRING_DATASOURCE_USERNAME: "db-apd-user-name"
NODE_SUBSCRIPTION_KEY: "gpd-u-node-subscription-key"
GPD_ARCHIVE_SA_CONNECTION_STRING: "gpd-archive-u-sa-connection-string"
keyvault:
name: "pagopa-u-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down Expand Up @@ -138,7 +151,7 @@ microservice-chart:
create: true
image:
repository: ghcr.io/pagopa/pagopa-debt-position
tag: "0.11.1-1-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
tag: "0.9.0"
pullPolicy: Always
envConfig: {}
envSecret: {}
2 changes: 1 addition & 1 deletion openapi/openapi_external.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Debt Position",
"description": "Progetto Gestione Posizioni Debitorie",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
"version": "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_external_massive.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Debt Position",
"description": "Progetto Gestione Posizioni Debitorie",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
"version": "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Debt Position",
"description": "Progetto Gestione Posizioni Debitorie",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
"version": "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi_send.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "PagoPA API Debt Position",
"description": "Progetto Gestione Posizioni Debitorie",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr"
"version": "0.11.1-4-PAGOPA-1488-renewal-debt-positions"
},
"servers": [
{
Expand Down
41 changes: 40 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>it.gov.pagopa.debtposition</groupId>
<artifactId>gpd</artifactId>
<version>0.11.1-2-PAGOPA-1436-infra-use-dns-pgflex-for-bcdr</version>
<version>0.11.1-4-PAGOPA-1488-renewal-debt-positions</version>
<name>Gestione Posizioni Debitorie</name>
<description>Progetto Gestione Posizioni Debitorie</description>
<properties>
Expand All @@ -21,6 +21,10 @@
<jackson-datatype-jsr310-version>2.13.1</jackson-datatype-jsr310-version>
<flyway-version>8.5.10</flyway-version>
<openfeign-version>3.1.8</openfeign-version>
<azure.data.table.version>12.3.18</azure.data.table.version>
<azure.core.version>1.45.1</azure.core.version>
<shedlock.version>5.10.2</shedlock.version>
<mockito-inline.version>5.2.0</mockito-inline.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -55,6 +59,34 @@
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<!-- Start cosmos tables-->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>${azure.core.version}</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-tables</artifactId>
<version>${azure.data.table.version}</version>
</dependency>
<!-- End cosmos tables -->
<!-- Start ShedLock -->
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>${shedlock.version}</version>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc-template</artifactId>
<version>${shedlock.version}</version>
</dependency>
<!-- End ShedLock -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand Down Expand Up @@ -91,6 +123,13 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<!-- overriding the managed version of mockito for mocking final classes -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito-inline.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
package it.gov.pagopa.debtposition.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;

@Configuration
@EnableScheduling
@EnableAsync
@ConditionalOnProperty(name = "cron.job.schedule.enabled", matchIfMissing = true)
@EnableSchedulerLock(defaultLockAtMostFor = "${cron.job.schedule.history.shedlock.defaultlockatmostfor}")
public class SchedulerConfig {
@Value("${spring.jpa.properties.hibernate.default_schema:apd}")
private String defaultSchema;
@Bean
public LockProvider lockProvider(DataSource dataSource) {
return new JdbcTemplateLockProvider(dataSource, defaultSchema+".shedlock");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import it.gov.pagopa.debtposition.model.enumeration.PaymentOptionStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -49,6 +52,7 @@
columnNames = {"iuv", "organization_fiscal_code"})
},
indexes = @Index(name = "payment_option_payment_position_id_idx", columnList = "payment_position_id"))
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionId")
public class PaymentOption implements Serializable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -32,6 +35,7 @@
@AllArgsConstructor
@Entity
@Builder
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentOptionMetadataId")
public class PaymentOptionMetadata implements Serializable {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -32,6 +36,7 @@
},
indexes = @Index(name = "payment_position_status_validity_date_idx", columnList = "status, validity_date")
)
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@paymentPositionId")
public class PaymentPosition implements Serializable {


Expand Down
4 changes: 4 additions & 0 deletions src/main/java/it/gov/pagopa/debtposition/entity/Transfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import it.gov.pagopa.debtposition.model.enumeration.TransferStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down Expand Up @@ -50,6 +53,7 @@
columnNames = {"iuv", "organization_fiscal_code", "transfer_id"})
},
indexes = @Index(name = "transfer_payment_option_id_idx", columnList = "payment_option_id"))
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferId")
public class Transfer implements Serializable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -32,6 +35,7 @@
@AllArgsConstructor
@Entity
@Builder
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@transferMetadataId")
public class TransferMetadata implements Serializable {

/**
Expand Down
Loading

0 comments on commit f02c89e

Please sign in to comment.