feat(128): polkurier shipment service + tracking + UI prepare

PolkurierApiClient rozszerzony do pelnego kontraktu (7 metod):
createShipment/getLabel/getStatus/cancelOrder/getAvailableCarriers/
getInpostParcelMachines/getCourierPoints. Wspolny call() parsuje
envelope {status, response}. Kontrakt zweryfikowany na oficjalnej
dokumentacji PDF v1.11.

PolkurierShipmentService (implements ShipmentProviderInterface)
orchestruje pelen flow: normalizeShipmentType (lowercase), split
ulicy, build recipient/sender/pickup, COD z bank account z
company_settings, extractOrderNumber/extractTrackingNumber
priorytetujace SDK Order entity (number, waybills[0].number).

PolkurierTrackingService (implements ShipmentTrackingInterface)
mapuje statusy O/P/A/WP/D/Z/W przez delivery_status_mappings.

UI panel polkurier w prepare.php z dynamiczna lista uslug z
available_carriers. Bez dedykowanego selektora punktu — operator
wpisuje receiver_point_id w istniejace pole w sekcji Adres odbiorcy.

Migracja 20260514_000115 seedujaca 7 wpisow delivery_status_mappings
z oficjalnej tabeli ORDER_STATUS (O/P/A/WP/D/Z/W).

Live test #114/#115 zakonczony sukcesem po 4 iteracjach
(ReferenceError -> uppercase shipmenttype -> orderno parsing ->
A4/A6 etykieta). Rozmiar etykiety A4/A6 sterowany w panelu klienta
polkurier.pl, NIE przez API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 12:56:36 +02:00
parent 3443879f59
commit c78ac335ee
19 changed files with 5011 additions and 102 deletions

View File

@@ -5,33 +5,33 @@
See: .paul/PROJECT.md (updated 2026-05-07)
**Core value:** Sprzedawca moze obslugiwac zamowienia ze wszystkich kanalow sprzedazy i nadawac przesylki bez przelaczania sie miedzy platformami.
**Current focus:** v3.7 Invoices + operational integrations - Phase 127 polkurier foundation UNIFY zakonczony, transition (commit + ROADMAP/PROJECT update) pending.
**Current focus:** v3.7 Invoices + operational integrations - Phase 128 polkurier ShipmentService loop closed, transition pending (git commit + ROADMAP/PROJECT update).
## Current Position
Milestone: v3.7 Invoices (Fakturownia integration) - In progress
Phase: 127 of TBD (polkurier Integration Foundation) - Complete
Plan: 127-01 complete (SUMMARY.md created); live API verified (`Autoryzacja: 1`)
Status: UNIFY complete, transition pending (git commit + decisions in PROJECT.md)
Last activity: 2026-05-14 - Phase 127-01 UNIFY zakonczony, SUMMARY + changelog utworzone
Phase: 128 of TBD (polkurier ShipmentService + Tracking + UI) - Complete
Plan: 128-01 complete (SUMMARY.md created)
Status: UNIFY complete, transition pending (git commit + Decisions w PROJECT.md + ROADMAP status)
Last activity: 2026-05-14 - Phase 128-01 UNIFY zakonczony, SUMMARY + changelog utworzone
Progress:
- Milestone v3.7: [##########] ~99% (Phase 113-127 complete; transition pending)
- Phase 127: [##########] 100%
- Milestone v3.7: [##########] ~99% (Phase 113-128 complete; transition pending)
- Phase 128: [##########] 100%
## Loop Position
Current loop state:
```
PLAN -> APPLY -> UNIFY
done done done [Loop complete - transition pending]
done done done [Loop complete - transition pending]
```
## Session Continuity
Last session: 2026-05-14
Stopped at: Phase 127-01 UNIFY closed; SUMMARY.md created
Next action: Phase transition (git commit `feat(127): polkurier integration foundation` + Decisions w PROJECT.md), potem wybor kolejnego kandydata v3.7 (np. PolkurierShipmentService albo invoice.created event)
Stopped at: Phase 128-01 UNIFY closed; SUMMARY.md created
Next action: Phase transition (git commit `feat(128): polkurier shipment service + tracking + UI prepare` + Decisions w PROJECT.md + ROADMAP status update), potem wybor kolejnego kandydata v3.7 (paczkomaty UI / shipment_presets polkurier / OrderValuationV2 / invoice.created event / eksport XLSX faktur)
Resume file: .paul/ROADMAP.md
## Pending parallel work
@@ -39,9 +39,9 @@ Resume file: .paul/ROADMAP.md
## Git State
Last phase commit: c758ec7 feat(126): invoice GUS field mapping fix (JDG/KRS heuristic)
Previous: 2ab461a feat(125): invoice_requested import fix + drop legacy is_invoice column
Branch: main (5 commits ahead of origin/main)
Last phase commit: 3443879 feat(127): polkurier integration foundation
Previous: c758ec7 feat(126): invoice GUS field mapping fix (JDG/KRS heuristic)
Branch: main (6 commits ahead of origin/main)
## Pending Actions
@@ -68,6 +68,9 @@ Branch: main (5 commits ahead of origin/main)
- Phase 127 follow-up: zaplanowac kolejna faze polkurier — `PolkurierShipmentService` (CreateOrder + GetLabel + OrderValuationV2 + AvailableCarriers mapping + UI mapowan metod dostawy + presety przesylek) — fundament + zweryfikowany kontrakt API gotowy.
- Phase 127 follow-up: drugi krok — `PolkurierTrackingService` + wpisy w `delivery_status_mappings` (provider='polkurier').
- Phase 127 follow-up: po polkurier shipment service rozwazyc fazy paczkomaty (`InpostParcelMachines` / `PocztexPostOffices` / `Kurier48PostOffices` API juz dostepne w SDK polkuriera).
- Phase 128 follow-up: uruchom migracje gdy XAMPP MySQL online: `php bin/migrate.php` (seed 7 wpisow `provider='polkurier'` w `delivery_status_mappings`).
- Phase 128 follow-up: weryfikacja crona `shipment_tracking_sync` przy pierwszej zywej paczce polkurier w `in_transit` — sprawdz ze `shipment_packages.delivery_status` aktualizuje sie z `D`/`WP`/`Z` przez `DeliveryStatus::normalizeWithOverrides('polkurier', ...)`.
- Phase 128 follow-up: rozmiar etykiety A4 vs A6 sterowany jest w panelu klienta polkurier.pl (Ustawienia konta → Preferencje etykiet), NIE przez API — operator ustawil A6.
## Deferred to Next Milestones