🔴 P0 total() now returns dollar value instead of cents, breaking charge() expectations
src/cart.ts:4 · 95% confidence · Verified at this revision · Current status: open
total() now divides by 100 and returns a dollar value, but charge() in src/billing.ts still passes it to the payment provider as amount, which its own comment says is integer cents.
Impact: Payments would be sent in the wrong unit: a $25.00 cart is charged as 25 cents, or rejected as a non-integer amount.
src/cart.ts:4 return (cents * qty) / 100;
src/billing.ts:2 // Payment provider amount is integer cents.
src/billing.ts:3
return provider.charge({ amount: total(cart.priceInCents, cart.quantity), currency: "USD" });Suggested fix: Keep total() in cents and format dollars where totals are displayed, or convert back to cents in charge() before calling the provider.