diff --git a/build.gradle.kts b/build.gradle.kts index 24543b8..32a4308 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,6 +36,8 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework.boot:spring-boot-starter-data-rest") + implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("io.micrometer:micrometer-tracing-bridge-otel:$micrometerVersion") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:$springDocOpenApiVersion") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/enums/PaymentOptionType.java b/src/main/java/it/gov/pagopa/pu/debtpositions/enums/PaymentOptionType.java new file mode 100644 index 0000000..4e668c7 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/enums/PaymentOptionType.java @@ -0,0 +1,7 @@ +package it.gov.pagopa.pu.debtpositions.enums; + +public enum PaymentOptionType { + SINGLE_INSTALLMENT, + INSTALMENTS, + DOWN_PAYMENT +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPosition.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPosition.java new file mode 100644 index 0000000..bcd09f4 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPosition.java @@ -0,0 +1,38 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Entity +@Table(name = "debt_position") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class DebtPosition implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "debt_position_generator") + @SequenceGenerator(name = "debt_position_generator", sequenceName = "debt_position_seq", allocationSize = 1) + private Long debtPositionId; + private String iupdOrg; + private String iupdPagoPa; + private String description; + private String status; + private Long ingestionFlowFileId; + private Long ingestionFlowFileLineNumber; + private Long organizationId; + private Long debtPositionTypeOrgId; + private LocalDate notificationDate; + private LocalDate validityDate; + private boolean flagIuvVolatile; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionType.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionType.java new file mode 100644 index 0000000..60149b1 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionType.java @@ -0,0 +1,35 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "debt_position_type") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class DebtPositionType { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "debt_position_type_generator") + @SequenceGenerator(name = "debt_position_type_generator", sequenceName = "debt_position_type_seq", allocationSize = 1) + private Long debtPositionTypeId; + private Long brokerId; + private String code; + private String description; + private String orgType; + private String macroArea; + private String serviceType; + private String collectingReason; + private String taxonomyCode; + private boolean flagAnonymousFiscalCode; + private boolean flagMandatoryDueDate; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrg.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrg.java new file mode 100644 index 0000000..efe6526 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrg.java @@ -0,0 +1,47 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "debt_position_type_org") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class DebtPositionTypeOrg { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "debt_position_type_org_generator") + @SequenceGenerator(name = "debt_position_type_org_generator", sequenceName = "debt_position_type_org_seq", allocationSize = 1) + private Long debtPositionTypeOrgId; + private Long debtPositionTypeId; + private Long organizationId; + private String balance; + private String code; + private String description; + private String iban; + private String postalIban; + private String postalAccountCode; + private String holderPostalCC; + private String orgSector; + private String xsdDefinitionRef; + private Long amountCents; + private String externalPaymentUrl; + private boolean flagAnonymousFiscalCode; + private boolean flagMandatoryDueDate; + private boolean flagSpontaneous; + private boolean flagNotifyIO; + private boolean flagActive; + private boolean flagNotifyOutcomePush; + private Long notifyOutcomePushOrgSilServiceId; + private boolean flagAmountActualization; + private Long amountActualizationOrgSilServiceId; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrgOperators.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrgOperators.java new file mode 100644 index 0000000..234a1c6 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/DebtPositionTypeOrgOperators.java @@ -0,0 +1,26 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "debt_position_type_org_operators") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class DebtPositionTypeOrgOperators { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "debt_position_type_org_operators_generator") + @SequenceGenerator(name = "debt_position_type_org_operators_generator", sequenceName = "debt_position_type_org_operators_seq", allocationSize = 1) + private Long debtPositionTypeOrgOperatorId; + private Long debtPositionTypeOrgId; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Installment.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Installment.java new file mode 100644 index 0000000..a9970a1 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Installment.java @@ -0,0 +1,42 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Entity +@Table(name = "installment") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Installment { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "installment_generator") + @SequenceGenerator(name = "installment_generator", sequenceName = "installment_seq", allocationSize = 1) + private Long installmentId; + private Long paymentOptionId; + private String status; + private String iud; + private String iuv; + private String iur; + private LocalDate dueDate; + private String paymentTypeCode; + private Long amountCents; + private Long notificationFeeCents; + private String remittanceInformation; + private String humanFriendlyRemittanceInformation; + private String balance; + private String legacyPaymentMetadata; + private Long personalDataId; + private Character debtorEntityType; + private byte[] debtorFiscalCodeHash; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/IuvSequenceNumber.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/IuvSequenceNumber.java new file mode 100644 index 0000000..61ea73d --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/IuvSequenceNumber.java @@ -0,0 +1,27 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "iuv_sequence_number") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class IuvSequenceNumber { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "iuv_sequence_number_generator") + @SequenceGenerator(name = "iuv_sequence_number_generator", sequenceName = "iuv_sequence_number_seq", allocationSize = 1) + private Long id; + private Long organizationId; + private Long sequenceNumber; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/PaymentOption.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/PaymentOption.java new file mode 100644 index 0000000..a9e6180 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/PaymentOption.java @@ -0,0 +1,35 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import it.gov.pagopa.pu.debtpositions.enums.PaymentOptionType; +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Entity +@Table(name = "payment_option") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class PaymentOption { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "payment_option_generator") + @SequenceGenerator(name = "payment_option_generator", sequenceName = "payment_option_seq", allocationSize = 1) + private Long paymentOptionId; + private Long debtPositionId; + private Long totalAmountCents; + private String status; + private boolean multiDebtor; + private LocalDate dueDate; + private String description; + @Enumerated(EnumType.STRING) + private PaymentOptionType paymentOptionType; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Receipt.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Receipt.java new file mode 100644 index 0000000..c9ad72b --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Receipt.java @@ -0,0 +1,52 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Entity +@Table(name = "receipt") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Receipt { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "receipt_generator") + @SequenceGenerator(name = "receipt_generator", sequenceName = "receipt_seq", allocationSize = 1) + private Long receiptId; + private Long installmentId; + private Long paymentReceiptId; + private String noticeNumber; + private String orgFiscalCode; + private String outcome; + private String creditorReferenceId; + private Long paymentAmountCents; + private String description; + private String companyName; + private String officeName; + private String idPsp; + private String pspFiscalCode; + private String pspPartitaIva; + private String pspCompanyName; + private String idChannel; + private String channelDescription; + private String paymentMethod; + private Long feeCents; + private LocalDateTime paymentDateTime; + private LocalDate applicationDate; + private LocalDate transferDate; + private byte[] receiptBytes; + private boolean standin; + private Character debtorEntityType; + private Long personalDataId; + private byte[] debtorFiscalCodeHash; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Stamp.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Stamp.java new file mode 100644 index 0000000..8f84294 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Stamp.java @@ -0,0 +1,18 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.Embeddable; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Embeddable +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Stamp { + + private String stampType; + private String stampHashDocument; + private String stampProvincialResidence; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java new file mode 100644 index 0000000..08f7de6 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java @@ -0,0 +1,36 @@ +package it.gov.pagopa.pu.debtpositions.model; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "transfer") +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Transfer { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "transfer_generator") + @SequenceGenerator(name = "transfer_generator", sequenceName = "transfer_seq", allocationSize = 1) + private Long transferId; + private Long installmentId; + private String orgFiscalCode; + private String orgName; + private Long amountCents; + private String remittanceInformation; + @Embedded + private Stamp stamp; + private String iban; + private String postalIban; + private String category; + private Long transferIndex; + private LocalDateTime creationDate; + private LocalDateTime updateDate; + private Long operatorExternalUserId; + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionRepository.java new file mode 100644 index 0000000..2c5c106 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.DebtPosition; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "debt_position", path = "debtPosition") +public interface DebtPositionRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgOperatorsRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgOperatorsRepository.java new file mode 100644 index 0000000..3f7ad78 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgOperatorsRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.DebtPositionTypeOrgOperators; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "debt_position_type_org_operators", path = "debtPositionTypeOrgOperators") +public interface DebtPositionTypeOrgOperatorsRepository extends JpaRepository{ + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgRepository.java new file mode 100644 index 0000000..134f5df --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeOrgRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.DebtPositionTypeOrg; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "debt_position_type_org", path = "debtPositionTypeOrg") +public interface DebtPositionTypeOrgRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeRepository.java new file mode 100644 index 0000000..b846a15 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/DebtPositionTypeRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.DebtPositionType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "debt_position_type", path = "debtPositionType") +public interface DebtPositionTypeRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/InstallmentRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/InstallmentRepository.java new file mode 100644 index 0000000..dff6f19 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/InstallmentRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.Installment; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "installment", path = "installment") +public interface InstallmentRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/IuvSequenceNumberRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/IuvSequenceNumberRepository.java new file mode 100644 index 0000000..adc3d15 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/IuvSequenceNumberRepository.java @@ -0,0 +1,9 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.IuvSequenceNumber; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "iuv_sequence_number", path = "iuvSequenceNumber") +public interface IuvSequenceNumberRepository extends JpaRepository { +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/PaymentOptionRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/PaymentOptionRepository.java new file mode 100644 index 0000000..43b71b6 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/PaymentOptionRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.PaymentOption; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "payment_option", path = "paymentOption") +public interface PaymentOptionRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/ReceiptRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/ReceiptRepository.java new file mode 100644 index 0000000..7e0ed97 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/ReceiptRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.Receipt; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "receipt", path = "receipt") +public interface ReceiptRepository extends JpaRepository { + +} diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/repository/TransferRepository.java b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/TransferRepository.java new file mode 100644 index 0000000..ff59920 --- /dev/null +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/repository/TransferRepository.java @@ -0,0 +1,10 @@ +package it.gov.pagopa.pu.debtpositions.repository; + +import it.gov.pagopa.pu.debtpositions.model.Transfer; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "transfer", path = "transfer") +public interface TransferRepository extends JpaRepository { + +}