From 9c7e65b894bc2d9f17df5a4a4d714ccb4a81e8e2 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 30 Oct 2025 13:05:52 +0100 Subject: [PATCH] Round prices UP and change portfolio name to "Puffin Portfolio" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Changed portfolio description from "Portfolio {ID}" to "Puffin Portfolio" - Round pricePerTon UP using Math.ceil() instead of exact decimals - Round total cost UP using Math.ceil() Example: $237.19 per ton → $238 per ton 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- server/routes/checkout.js | 2 +- src/components/OffsetOrder.tsx | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/routes/checkout.js b/server/routes/checkout.js index 2422d2d..d020d69 100644 --- a/server/routes/checkout.js +++ b/server/routes/checkout.js @@ -70,7 +70,7 @@ router.post('/create-session', async (req, res) => { currency: 'usd', product_data: { name: `Carbon Offset - ${tons} tons`, - description: `Portfolio ${portfolioId} at $${pricePerTon}/ton`, + description: `Puffin Portfolio at $${Math.ceil(pricePerTon)}/ton`, // images: ['https://puffinoffset.com/images/carbon-offset.png'], // Optional: Add your logo when available }, unit_amount: baseAmount, // Base amount in cents diff --git a/src/components/OffsetOrder.tsx b/src/components/OffsetOrder.tsx index f53083a..f22be25 100644 --- a/src/components/OffsetOrder.tsx +++ b/src/components/OffsetOrder.tsx @@ -166,8 +166,8 @@ export function OffsetOrder({ tons, monetaryAmount, onBack, calculatorType }: Pr const renderPortfolioPrice = (portfolio: Portfolio) => { try { - // Get the price per ton from the portfolio - const pricePerTon = portfolio.pricePerTon || 18; // Default based on Wren Climate Fund average + // Get the price per ton from the portfolio and round UP to next whole number + const pricePerTon = Math.ceil(portfolio.pricePerTon || 18); return formatCurrency(pricePerTon, currencies.USD); } catch (err) { console.error('Error formatting portfolio price:', err); @@ -175,8 +175,9 @@ export function OffsetOrder({ tons, monetaryAmount, onBack, calculatorType }: Pr } }; - // Calculate offset cost using the portfolio price - const offsetCost = monetaryAmount || (portfolio ? actualOffsetTons * (portfolio.pricePerTon || 18) : 0); + // Calculate offset cost using the portfolio price (rounded UP) + const roundedPricePerTon = portfolio ? Math.ceil(portfolio.pricePerTon || 18) : 18; + const offsetCost = monetaryAmount || (portfolio ? Math.ceil(actualOffsetTons * roundedPricePerTon) : 0); return (