feat(129): erli status mapping sync

Phase 129 complete:
- Add Erli pull/push status mapping tables, seeds and repositories
- Wire Erli status sync cron for inbox pull and manual-only push
- Add tabbed Erli settings UI, tests and documentation

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-16 00:27:08 +02:00
parent c127ebf04d
commit 7972bb9fa4
28 changed files with 2021 additions and 57 deletions

View File

@@ -5,6 +5,7 @@ namespace Tests\Unit;
use App\Core\Constants\IntegrationSources;
use App\Modules\Settings\ErliOrderMapper;
use App\Modules\Settings\ErliPullStatusMappingRepository;
use PHPUnit\Framework\TestCase;
use RuntimeException;
@@ -51,6 +52,30 @@ final class ErliOrderMapperTest extends TestCase
self::assertTrue($aggregate['order']['is_canceled_by_buyer']);
}
public function testConfiguredPullMappingOverridesDefaultStatus(): void
{
$pullMappings = $this->createMock(ErliPullStatusMappingRepository::class);
$pullMappings
->method('findMappedStatusCode')
->with('purchased')
->willReturn('w_realizacji');
$mapper = new ErliOrderMapper($pullMappings);
$aggregate = $mapper->mapInboxMessage(7, $this->message('purchased'));
self::assertIsArray($aggregate);
self::assertSame('w_realizacji', $aggregate['order']['status_code']);
}
public function testUnknownStatusFallsBackToRawCodeForDiscoveryMappingLater(): void
{
$aggregate = $this->mapper->mapInboxMessage(7, $this->message('readyToProcess'));
self::assertIsArray($aggregate);
self::assertSame('readytoprocess', $aggregate['order']['status_code']);
self::assertSame('readytoprocess', $aggregate['order']['preferences_json']['erli_status_raw']);
}
public function testCompanyInvoiceDataDetectsInvoiceRequest(): void
{
$message = $this->message('purchased');