Reclassify self-named transactions (VICENTETIRAD) as self_transfer

This commit is contained in:
Kavi 2026-06-02 04:28:09 -04:00
parent fae5af446f
commit b266542591
1 changed files with 7 additions and 0 deletions

View File

@ -134,13 +134,20 @@
// really internal movements — debt repayments to cards (the purchases already // really internal movements — debt repayments to cards (the purchases already
// happened on those cards; only interest/fees are new costs) and known // happened on those cards; only interest/fees are new costs) and known
// card-payment intermediaries (MACH→Servipag for Rappi card, etc.) // card-payment intermediaries (MACH→Servipag for Rappi card, etc.)
// Reclassify transactions that the raw parser tagged as 'expense' but are
// really internal movements.
const DEBT_RE = /TRASPASO\s+(A\s+DEUDA|POR\s+CIERRE\s+DE\s+CUENTA|DE\s+DEUDA\b|DEUDA\s*(NACIONAL|INTERNACIONAL)?$)/i; const DEBT_RE = /TRASPASO\s+(A\s+DEUDA|POR\s+CIERRE\s+DE\s+CUENTA|DE\s+DEUDA\b|DEUDA\s*(NACIONAL|INTERNACIONAL)?$)/i;
const CPAY_RE = /PAGO\s+EN\s+SERVIPAG\.COM|COMPRA\s+MACH\s+COMERCIOS.*SERVIPAG/i; const CPAY_RE = /PAGO\s+EN\s+SERVIPAG\.COM|COMPRA\s+MACH\s+COMERCIOS.*SERVIPAG/i;
// Transactions where the counterparty is the account holder themselves
const SELF_RE = /VICENTETIRAD|VICENTE\s*TIRAD/i;
TX = TX.map(t => { TX = TX.map(t => {
if (t.flow_type !== 'expense') return t; if (t.flow_type !== 'expense') return t;
if (DEBT_RE.test(t.description) || CPAY_RE.test(t.description)) { if (DEBT_RE.test(t.description) || CPAY_RE.test(t.description)) {
return { ...t, flow_type: 'card_payment', internal: true }; return { ...t, flow_type: 'card_payment', internal: true };
} }
if (SELF_RE.test(t.description) || SELF_RE.test(t.counterparty || '')) {
return { ...t, flow_type: 'self_transfer', internal: true };
}
return t; return t;
}); });
MONTHS = [...new Set(TX.map(t => t.ym))].sort(); MONTHS = [...new Set(TX.map(t => t.ym))].sort();