const roundMoney = value => Math.round((Number(value) || 0) * 100) / 100; const PLATFORM_FEES = { vinted: { name: 'Vinted', calculate(price) { const gross = roundMoney(price); return { gross, fees: 0, net: gross, breakdown: '0 € Verkaufsgebühr für Verkäufer. Den Käuferschutz zahlt der Käufer zusätzlich.', note: 'Optionale Hervorhebungen oder andere Zusatzdienste sind nicht enthalten.', seller_type: 'privat', verified_at: '2026-07-08', }; }, }, 'ebay-ka': { name: 'Kleinanzeigen', calculate(price) { const gross = roundMoney(price); return { gross, fees: 0, net: gross, breakdown: '0 € Verkaufsprovision beim normalen Privatverkauf.', note: 'Kosten können bei Zusatzoptionen, überschrittenen Anzeigenlimits oder bestimmten Fahrzeug-/Spezialkategorien entstehen.', seller_type: 'privat', verified_at: '2026-07-08', }; }, }, 'ebay-de': { name: 'eBay.de', calculate(price) { const gross = roundMoney(price); return { gross, fees: 0, net: gross, breakdown: '0 € Verkaufsprovision für private Verkäufer bei Verkäufen innerhalb Deutschlands.', note: 'Gebühren für Zusatzoptionen und gegebenenfalls internationale Verkäufe sind nicht enthalten.', seller_type: 'privat', verified_at: '2026-07-08', }; }, }, etsy: { name: 'Etsy', calculate(price) { const gross = roundMoney(price); const transaction = gross * 0.065; const processing = gross * 0.04 + 0.30; const fees = roundMoney(transaction + processing); return { gross, fees, net: roundMoney(gross - fees), breakdown: '6,5 % Transaktionsgebühr + 4 % + 0,30 € Etsy Payments.', note: 'Zusätzlich 0,20 USD Einstellgebühr je Artikel/Erneuerung; mögliche USt., Währungsumrechnung und Werbegebühren sind nicht eingerechnet.', seller_type: 'shop', verified_at: '2026-07-08', }; }, }, }; export function calculateFees(platform, price) { const calc = PLATFORM_FEES[platform]; if (!calc) { const gross = roundMoney(price); return { gross, fees: 0, net: gross, breakdown: 'Unbekannte Plattform', note: '', seller_type: 'unknown' }; } return calc.calculate(price); } export function getAllFees(price) { const result = {}; for (const [id, calc] of Object.entries(PLATFORM_FEES)) result[id] = calc.calculate(price); return result; }