diff --git a/backend/src/controllers/rest/PaymentController.ts b/backend/src/controllers/rest/PaymentController.ts index ceaed92..8ba8c3d 100644 --- a/backend/src/controllers/rest/PaymentController.ts +++ b/backend/src/controllers/rest/PaymentController.ts @@ -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); diff --git a/frontend/src/components/CustomTokenCalculator.tsx b/frontend/src/components/CustomTokenCalculator.tsx index fb4f31b..c1a7c1e 100644 --- a/frontend/src/components/CustomTokenCalculator.tsx +++ b/frontend/src/components/CustomTokenCalculator.tsx @@ -176,7 +176,7 @@ export default function CustomTokenCalculator({