Fix toFixed error by converting string prices to numbers

This commit is contained in:
2025-09-20 17:47:04 +02:00
parent 332016317a
commit 544854ec3f
3 changed files with 13 additions and 4 deletions
@@ -67,9 +67,18 @@ export class PaymentController {
ORDER BY quantity ASC
`);
// Convert decimal fields to numbers
const packages = Array.isArray(rows) ? rows.map((pkg: any) => ({
...pkg,
total_price: Number(pkg.total_price),
price_per_token: Number(pkg.price_per_token),
discount_percentage: Number(pkg.discount_percentage),
quantity: Number(pkg.quantity)
})) : [];
return {
success: true,
packages: Array.isArray(rows) ? rows : []
packages
};
} catch (error) {
console.error('Error getting token packages:', error);