52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
use App\Services\Billing\InvoiceDocument;
|
|
|
|
/**
|
|
* The issuer's own VAT number is labelled.
|
|
*
|
|
* It was printed bare, between the register number and the court, on every page of
|
|
* every invoice. The document was valid — the reverse-charge note is printed and
|
|
* the RECIPIENT's number is labelled — but an auditor scanning for "UID" found the
|
|
* recipient's and not ours, so the one number an Austrian invoice is legally
|
|
* worthless without read as a reference of some kind.
|
|
*/
|
|
$issuer = [
|
|
'name' => 'CluPilot Cloud e.U.',
|
|
'address' => 'Dreherstraße 66/1/8',
|
|
'postcode' => '1110',
|
|
'city' => 'Wien',
|
|
'register_number' => 'FN 123456a',
|
|
'register_court' => 'Handelsgericht Wien',
|
|
'vat_id' => 'ATU00000000',
|
|
];
|
|
|
|
it('labels the issuer VAT number, and only that one', function () use ($issuer) {
|
|
$columns = InvoiceDocument::footerColumns($issuer, 'UID');
|
|
|
|
expect($columns[2])->toBe([
|
|
// Its neighbours stay as they are: a Firmenbuch number and a court name
|
|
// announce themselves, an ATU string does not.
|
|
'FN 123456a',
|
|
'UID: ATU00000000',
|
|
'Handelsgericht Wien',
|
|
]);
|
|
});
|
|
|
|
it('leaves out the line entirely when no VAT number is recorded', function () use ($issuer) {
|
|
// A label with nothing after it is worse than the bare number was. The company
|
|
// details are required before an invoice can be issued at all, so this is the
|
|
// half-configured installation rather than a document anybody receives.
|
|
$columns = InvoiceDocument::footerColumns(['vat_id' => ''] + $issuer, 'UID');
|
|
|
|
expect($columns[2])->toBe(['FN 123456a', 'Handelsgericht Wien']);
|
|
});
|
|
|
|
it('drops empty details rather than leaving gaps where they would be', function () {
|
|
$columns = InvoiceDocument::footerColumns(['name' => 'Nur ein Name']);
|
|
|
|
expect($columns[0])->toBe(['Nur ein Name'])
|
|
->and($columns[1])->toBe([])
|
|
->and($columns[3])->toBe([]);
|
|
});
|