Skip to content

Commit

Permalink
[P4ADEV-1667] create model and repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedetta-fabbri committed Dec 17, 2024
1 parent c67bce6 commit d09ad1b
Show file tree
Hide file tree
Showing 21 changed files with 454 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package it.gov.pagopa.pu.debtpositions.enums;

public enum PaymentOptionType {
SINGLE_INSTALLMENT,
INSTALMENTS,
DOWN_PAYMENT
}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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;

}
52 changes: 52 additions & 0 deletions src/main/java/it/gov/pagopa/pu/debtpositions/model/Receipt.java
Original file line number Diff line number Diff line change
@@ -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;

}
18 changes: 18 additions & 0 deletions src/main/java/it/gov/pagopa/pu/debtpositions/model/Stamp.java
Original file line number Diff line number Diff line change
@@ -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;

}
36 changes: 36 additions & 0 deletions src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
@@ -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<DebtPosition,Long> {

}
Loading

0 comments on commit d09ad1b

Please sign in to comment.