Skip to content

Commit

Permalink
[PAGOPA-2359] rework after review
Browse files Browse the repository at this point in the history
  • Loading branch information
aacitelli authored and aacitelli committed Nov 28, 2024
2 parents 858f15c + 0305242 commit 690fa42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class PaymentNotice implements Serializable {
*/
private static final long serialVersionUID = -5951473285697199137L;

@Schema(description = "Unique ID of the Debt Position (for positions originating from ACA)",
@Schema(description = "Unique ID of the Debt Position (for positions originating from ACA the IUPD starts with ACA_)",
required = true)
private String iupd;
@Schema(description = "Tax code of the person to whom the Debt Position is registered", required = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@ public class PaymentPositionRepository implements PanacheRepository<PaymentPosit
private static final String DUE_DATE_QUERY =
BASE_QUERY + " AND EXISTS (from ppos.paymentOption AS po WHERE po.dueDate >= ?2)";

public String buildQueryBase() {
public String buildQuery(String query) {
return keepAca
? BASE_QUERY + " AND ppos.serviceType IN ('ACA', 'GPD')"
: BASE_QUERY + " AND ppos.serviceType = 'GPD'";
}

public String buildQueryWithDueDate() {
return keepAca
? DUE_DATE_QUERY + " AND ppos.serviceType IN ('ACA', 'GPD')"
: DUE_DATE_QUERY + " AND ppos.serviceType = 'GPD'";
? query + " AND ppos.serviceType IN ('ACA', 'GPD')"
: query + " AND ppos.serviceType = 'GPD'";
}

/**
Expand All @@ -49,7 +43,7 @@ public String buildQueryWithDueDate() {
public List<PaymentPosition> findPaymentPositionsByTaxCodeAndDueDate(
String taxCode, LocalDate dueDate, Integer limit, Integer page) {

String query = (dueDate == null) ? buildQueryBase() : buildQueryWithDueDate();
String query = (dueDate == null) ? buildQuery(BASE_QUERY) : buildQuery(DUE_DATE_QUERY);

return dueDate == null
? find(query, taxCode)
Expand Down

0 comments on commit 690fa42

Please sign in to comment.