Menu

A Passing Balance Test Can Hide a Broken Invoice
📰

A Passing Balance Test Can Hide a Broken Invoice

DEV Community: javascript·Bokeping uTaxes·1 day ago
#cIAoGR3Z
#devtojavascript#devto#dev#total#paid
Reading 0:00
15s threshold

A brake shop charges $562.72 for a repair. The customer paid the $85 diagnostic fee at drop-off, and that payment belongs to the same invoice. The card reader at pickup should ask for $477.72.

Here’s a bug that survives an assertion on the balance alone. One implementation records a $562.72 sale and an $85 payment. Another quietly reduces the sale to $477.72 and records no payment. Both can display $477.72 due . Only the first one can explain the $85 receipt the customer is holding.

Reproduce it in a spreadsheet

In the sample workbook, row 19 charges $85 for diagnosing brake noise. The other lines cover labor, pads, rotors and supplies. They bring the subtotal to $544.00. With the sheet’s $18.72 example tax, cell E35 reads $562.72.

Leave the charge in row 19. Enter 85 in E36 ( Amount paid ). E37 ( Balance due ) uses =E35-E36 and changes to $477.72. E35 stays at $562.72.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.