fix(boletos): diferencia pagamentos e recebimentos

This commit is contained in:
Felipe Coutinho
2026-05-31 15:18:55 -03:00
parent 35abe1b0bf
commit 99bc049cf4
10 changed files with 130 additions and 58 deletions

View File

@@ -63,6 +63,7 @@ export type PayerBoletoItem = {
dueDate: string | null;
boletoPaymentDate: string | null;
isSettled: boolean;
transactionType: string;
};
export type PayerPaymentStatusData = {
@@ -322,6 +323,7 @@ export async function fetchPayerBoletoItems({
dueDate: transactions.dueDate,
boletoPaymentDate: transactions.boletoPaymentDate,
isSettled: transactions.isSettled,
transactionType: transactions.transactionType,
})
.from(transactions)
.leftJoin(
@@ -350,6 +352,7 @@ export async function fetchPayerBoletoItems({
dueDate: toDateOnlyString(row.dueDate),
boletoPaymentDate: toDateOnlyString(row.boletoPaymentDate),
isSettled: Boolean(row.isSettled),
transactionType: row.transactionType,
});
}

View File

@@ -19,7 +19,7 @@ type FinancialDueDateInfo = {
date: string | null;
};
type RelativeFinancialDateContext = "due" | "paid";
type RelativeFinancialDateContext = "due" | "paid" | "received";
export function formatFinancialDateLabel(
value: string | null,
@@ -75,15 +75,17 @@ export function formatRelativeFinancialDateLabel(
return formatFinancialDateLabel(normalizedValue, "Vence em");
}
const settlementLabel = context === "received" ? "Recebido" : "Pago";
if (normalizedValue === referenceDate) {
return "Pago hoje";
return `${settlementLabel} hoje`;
}
if (normalizedValue === yesterday) {
return "Pago ontem";
return `${settlementLabel} ontem`;
}
return formatFinancialDateLabel(normalizedValue, "Pago em");
return formatFinancialDateLabel(normalizedValue, `${settlementLabel} em`);
}
export function buildFinancialStatusLabel({