CluPilotCloud/tests/Feature/Billing
nexxo c1896e70fc
tests / pest (push) Failing after 7m9s Details
tests / assets (push) Successful in 24s Details
tests / release (push) Has been skipped Details
Render an invoice, with the arithmetic held to integer cents
TCPDF 6, deliberately, after installing 7 and finding out what it is. Version 7
is not a newer TCPDF; it is a compatibility shim over tc-lib-pdf whose own
mapping table lists 115 of 293 methods as stubs, and whose font package ships
no font files at all — the first render died on a missing helvetica.json. The
6.x line carries a hundred and sixty-five fonts, a working writeHTML and real
header and footer hooks, and is what everybody means by TCPDF.

The body is a Blade template handed to writeHTML rather than a hundred Cell()
calls with millimetre coordinates, because this table has to be adjusted the
first time somebody sees it on paper, and nobody adjusts the second kind.

InvoiceMath is integer cents end to end, and rounds once. A percentage applied
line by line and rounded each time drifts from the same percentage applied to
the sum — three lines at 3,33 € less 10 % is 99 cents that way and 100 cents
the honest way, and the customer's calculator is what finds it. Gross is always
derived from net and never the reverse: taking VAT back out of a gross figure
returns a different number often enough to matter. A discount and a surcharge
are one operation with opposite signs, so nothing has to remember which of two
flags means which.

Quantities are thousandths, because hours, gigabytes and part-months are all
real, and are printed with the trailing zeroes stripped — "12,000 Std." reads
as a defect.

Every line shows quantity, unit price net, total net AND total gross: this goes
to businesses and to consumers, and each reads a different column first.

Verifying it took two goes and both failures were mine. `strings` over a PDF set
in a Unicode font finds nothing, because the text is stored as subset glyph ids
— the check has to render in a core font to be a check at all. And two of the
strings I then declared missing were simply expectations I had got wrong.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 01:41:46 +02:00
..
FinanceSettingsTest.php Give the console a Finance tab: company details, VAT rate, invoice series 2026-07-29 01:18:43 +02:00
InvoiceMathTest.php Render an invoice, with the arithmetic held to integer cents 2026-07-29 01:41:46 +02:00
InvoiceNumberTest.php Lay the foundation for self-issued invoices: series, numbers, frozen documents 2026-07-29 00:57:06 +02:00
PlanCatalogueTest.php feat(admin): a console for creating, pricing and scheduling plans 2026-07-26 12:41:51 +02:00
PlanChangeTest.php feat(billing): the plan catalogue becomes three tables, and config stops selling 2026-07-26 12:05:56 +02:00
ProofRegisterTest.php feat(billing): a proof register, and modules frozen at their booked price 2026-07-26 13:07:34 +02:00
StripeBillingTest.php fix(billing): hold only what cannot be matched, and let migrations roll back 2026-07-26 13:57:11 +02:00