Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Codelist/InvoiceTypeCodeUNTDID1001.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ enum InvoiceTypeCodeUNTDID1001 : string
case DEBIT_ADVICE = '456';
case REVERSAL_OF_DEBIT = '457';
case REVERSAL_OF_CREDIT = '458';
case SELF_BILLED_CORRECTIVE_INVOICE = '471';
case FACTORED_CORRECTIVE_INVOICE = '472';
case SELF_BILLED_FACTORED_CORRECTIVE_INVOICE = '473';
case SELF_BILLED_PREPAYMENT_INVOICE = '500';
case SELF_BILLED_FACTORED_INVOICE = '501';
case SELF_BILLED_FACTORED_CREDIT_NOTE = '502';
case PREPAYMENT_CREDIT_NOTE = '503';
case SELF_BILLED_DEBIT_NOTE = '527';
case FORWARDERS_CREDIT_NOTE = '532';
case FORWARDERS_INVOICE_DISCREPANCY_REPORT = '553';
Expand Down
2 changes: 2 additions & 0 deletions src/Helper/InvoiceTypeCodeUNTDID1001Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public static function isInvoice(InvoiceTypeCodeUNTDID1001 $code): bool
InvoiceTypeCodeUNTDID1001::OPTICAL_CHARACTER_READING_OCR_PAYMENT_CREDIT_NOTE,
InvoiceTypeCodeUNTDID1001::REVERSAL_OF_CREDIT,
InvoiceTypeCodeUNTDID1001::FORWARDERS_CREDIT_NOTE,
InvoiceTypeCodeUNTDID1001::SELF_BILLED_FACTORED_CREDIT_NOTE,
InvoiceTypeCodeUNTDID1001::PREPAYMENT_CREDIT_NOTE,
])
) {
return false;
Expand Down
37 changes: 37 additions & 0 deletions tests/Helper/InvoiceTypeCodeUNTDID1001HelperTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Tiime\EN16931\Tests\Helper;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Tiime\EN16931\Codelist\InvoiceTypeCodeUNTDID1001;
use Tiime\EN16931\Helper\InvoiceTypeCodeUNTDID1001Helper;

final class InvoiceTypeCodeUNTDID1001HelperTest extends TestCase
{
/**
* Codes de l'extension française (annexe 7 PPF, onglet codelists), absents de la codelist EN 16931 v14.
*
* @return iterable<string, array{string, bool}>
*/
public static function frenchCodesProvider(): iterable
{
yield '471' => ['471', true];
yield '472' => ['472', true];
yield '473' => ['473', true];
yield '500' => ['500', true];
yield '501' => ['501', true];
yield '502' => ['502', false];
yield '503' => ['503', false];
}

#[DataProvider('frenchCodesProvider')]
public function testFrenchCodesAreClassified(string $code, bool $isInvoice): void
{
$typeCode = InvoiceTypeCodeUNTDID1001::from($code);

self::assertSame($isInvoice, InvoiceTypeCodeUNTDID1001Helper::isInvoice($typeCode));
}
}