paid & deposited

This commit is contained in:
Andreas Knuth 2026-02-20 11:47:06 -06:00
parent cbfbcf9b06
commit 4e6429e9ac
1 changed files with 4 additions and 6 deletions

View File

@ -2119,13 +2119,11 @@ app.post('/api/qbo/sync-payments', async (req, res) => {
// Prüfe ob in QBO bezahlt/teilweise bezahlt
if (qboBalance === 0 && qboTotal > 0) {
// Voll bezahlt in QBO
// Prüfe ob "Deposited" — dafür müssen wir LinkedTxn prüfen
// Wenn Deposit vorhanden → Deposited, sonst → Paid
// Prüfe ob "Deposited" — DepositToAccountRef != Undeposited Funds (221)
let status = 'Paid';
const UNDEPOSITED_FUNDS_ID = '221';
// LinkedTxn aus der Invoice prüfen
if (qboInv.LinkedTxn) {
// Lade die Payments um zu prüfen ob sie deposited sind
for (const txn of qboInv.LinkedTxn) {
if (txn.TxnType === 'Payment') {
try {
@ -2135,8 +2133,8 @@ app.post('/api/qbo/sync-payments', async (req, res) => {
});
const pmData = pmRes.getJson ? pmRes.getJson() : pmRes.json;
const payment = pmData.Payment;
if (payment && payment.DepositToAccountRef) {
// Hat DepositToAccount → wurde deposited
if (payment && payment.DepositToAccountRef &&
payment.DepositToAccountRef.value !== UNDEPOSITED_FUNDS_ID) {
status = 'Deposited';
}
} catch (e) { /* ignore */ }