feat(115): wystawianie faktury z zamowienia (lokalne + delegowane Fakturownia)

Phase 115 complete (vertical slice "zamowienie z NIP -> faktura PDF"):
- Task 1: InvoiceRepository + InvoiceService (dual-flow orchestrator) +
  InvoiceIssueException + FakturowniaApiClient::createInvoice + buildPdfUrl
- Task 2: InvoiceController + OrdersController::toggleInvoiceRequested +
  OrdersRepository::setInvoiceRequested + auto-import invoice_requested z
  Allegro (invoice.required) i shopPRO (5-key flexible parser) + show.php
  (toggle w zakladce Platnosci + warunkowy przycisk Wystaw fakture)
- Task 3: Lista wystawionych /settings/accounting/invoices/issued z filtrami
  + invoice_preview + invoice_pdf Dompdf template + hub link
- Task 3b (dodany): NIP lookup przez MF Biala Lista (publiczne API, bez
  rejestracji) — MfWhitelistApiClient w src/Core/Http/ + /api/nip/lookup +
  przycisk "Pobierz z GUS" w formularzu

Auto-fixes podczas smoke testu (5):
- GUS endpoint Fakturowni nie istnial (HTML 404 -> "json is not valid");
  switch na MF Biala Liste
- PHP 8.5 curl_close() deprecation wycieka HTML przed JSON; usuniete z
  MfWhitelistApiClient i FakturowniaApiClient (3 miejsca)
- Fakturownia 422 payment_to_kind_days (nieistniejace pole) -> usuniete
- Generic "error" w 422 -> parser plaskuje errors: {pole: [...]} +
  error_log z 1000 znakow raw body
- Fakturownia security odrzuca seller_*/department_id jako "create new
  department"; usuniete z payloadu (Fakturownia uzywa danych konta)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-10 23:34:50 +02:00
parent 6129042ff6
commit 33ee1a1cf5
28 changed files with 3228 additions and 45 deletions

View File

@@ -10,14 +10,14 @@ See: .paul/PROJECT.md (updated 2026-05-07)
## Current Position
Milestone: v3.7 Invoices (Fakturownia integration) — In progress
Phase: 115 of TBD (Wystawianie faktury z zamowienia) — Not started
Phase: 116 of TBD (TBD — kandydaci v3.7 lub przejscie na kolejny milestone) — Not started
Plan: pending
Status: Phase 114 complete (transition done); ready to plan Phase 115
Last activity: 2026-05-10 — UNIFY 114-01 complete, Phase 114 closed, transition done
Status: Phase 115 closed; transition done; ready to plan kolejna faze
Last activity: 2026-05-10 — UNIFY 115-01 complete + transition: PROJECT.md/ROADMAP.md/changelog zaktualizowane
Progress:
- Milestone v3.7: [███░░░░░░░] ~30% (Phase 113 + 114 zamkniete; planowane ~5 faz)
- Phase 114: [██████████] 100% — Complete
- Milestone v3.7: [██████░░░░] ~55% (Phase 113 + 114 + 115 zamkniete; kandydaci: XLSX invoices export, INVOICE-IDEMP-115, invoice.created event, curl_close shopPRO backfill)
- Phase 115: [██████████] 100% — Complete
## Loop Position
@@ -26,24 +26,25 @@ Current loop state:
v3.7 milestone:
Phase 113 (Fakturownia Integration Foundation): Complete
Phase 114 (Accounting Configs Refactor): Complete
Phase 115 (Wystawianie faktury z zamowienia): not started
Phase 115 (Wystawianie faktury z zamowienia): Complete
Phase 116 (TBD): not started
```
```
PLAN ──▶ APPLY ──▶ UNIFY
✓ ✓ ✓ [Phase 114 closed; ready for Phase 115 plan]
✓ ✓ ✓ [Phase 115 closed; ready for Phase 116 plan]
```
## Session Continuity
Last session: 2026-05-10
Stopped at: Phase 114 transition complete (PROJECT.md + ROADMAP.md updated, SUMMARY zapisany)
Next action: /paul:plan dla Phase 115 (wystawianie faktury z zamowienia, lokalna numeracja + delegacja Fakturownia)
Resume file: .paul/phases/114-accounting-configs-refactor/114-01-SUMMARY.md
Stopped at: Phase 115 transition complete (PROJECT.md + ROADMAP.md updated, SUMMARY zapisany, changelog zaktualizowany)
Next action: /paul:plan dla kolejnej fazy (v3.7 kandydaci: XLSX export listy faktur, INVOICE-IDEMP-115, invoice.created automation event, lub backfill `curl_close()` w shopPRO)
Resume file: .paul/phases/115-invoice-from-order/115-01-SUMMARY.md
## Git State
Last commit: 2382018 feat(113): fakturownia integration foundation
Last commit: 6129042 feat(114): accounting configs refactor + invoice configs CRUD
Branch: main
Feature branches merged: none