P
Priya Nair
ENGINEERING MANAGER, KARTKIRANA
Welcome to the team. Finance says our checkout is quietly losing money: totals come out wrong by a few paise on some carts, one coupon made an order almost free, and last night the cart page crashed for a customer. The function below came from a contractor and it ships today. Fix it.
Acceptance criteria:
- Totals are correct for any number of items, and an empty cart returns 0
- couponPercent of 10 means 10 percent off, 100 means free
- The returned total is rounded to exactly 2 decimals, paise-safe
- A negative price or quantity throws an Error with message INVALID_ITEM
- No crashes, ever
0/10
Tests run inside your browser in a sandbox. Nothing you type is stored. AI reviews are limited to 10 per day.