100 lines
3.9 KiB
Markdown
100 lines
3.9 KiB
Markdown
---
|
||
phase: 06-integrations-refactoring
|
||
plan: 02
|
||
subsystem: domain
|
||
tags: [apilo, integrations, refactoring, migration]
|
||
|
||
requires:
|
||
- phase: 06-01
|
||
provides: ApiloRepository class with all apilo* methods
|
||
provides:
|
||
- "Wszyscy konsumenci apilo* używają ApiloRepository"
|
||
- "IntegrationsRepository lean (~225 linii): settings, logi, product linking, ShopPRO"
|
||
affects: []
|
||
|
||
tech-stack:
|
||
added: []
|
||
patterns:
|
||
- "IntegrationsController z dwoma repozytoriami: IntegrationsRepository + ApiloRepository"
|
||
|
||
key-files:
|
||
created: []
|
||
modified:
|
||
- autoload/admin/Controllers/IntegrationsController.php
|
||
- autoload/admin/App.php
|
||
- autoload/Domain/Order/OrderAdminService.php
|
||
- cron.php
|
||
- autoload/Domain/Integrations/IntegrationsRepository.php
|
||
- tests/Unit/Domain/Integrations/IntegrationsRepositoryTest.php
|
||
- tests/Unit/admin/Controllers/IntegrationsControllerTest.php
|
||
|
||
key-decisions:
|
||
- "IntegrationsController dostał ApiloRepository jako drugi argument konstruktora"
|
||
- "OrderAdminService: tylko 3 z 5 instancji zmienione na ApiloRepository (2 używają getSettings — zostają)"
|
||
- "cron.php: $apiloRepository obok $integrationsRepository (oba potrzebne)"
|
||
|
||
patterns-established:
|
||
- "Kontroler używający dwóch repozytoriów: każde do swojej domeny"
|
||
|
||
duration: ~20min
|
||
started: 2026-03-12T00:00:00Z
|
||
completed: 2026-03-12T00:00:00Z
|
||
---
|
||
|
||
# Phase 6 Plan 02: Migracja konsumentów + cleanup IntegrationsRepository
|
||
|
||
**Wszyscy konsumenci apilo* zmigrowano na ApiloRepository; IntegrationsRepository oczyszczono do ~225 linii; 818/818 testów green.**
|
||
|
||
## Performance
|
||
|
||
| Metric | Value |
|
||
|--------|-------|
|
||
| Duration | ~20 min |
|
||
| Completed | 2026-03-12 |
|
||
| Tasks | 3 / 3 |
|
||
| Files modified | 7 |
|
||
|
||
## Acceptance Criteria Results
|
||
|
||
| Criterion | Status | Notes |
|
||
|-----------|--------|-------|
|
||
| AC-1: IntegrationsController używa ApiloRepository dla apilo* | Pass | 6 wywołań przeniesione |
|
||
| AC-2: OrderAdminService i cron.php używają ApiloRepository | Pass | 3 metody + 5 wywołań w cron |
|
||
| AC-3: IntegrationsRepository nie zawiera metod apilo* | Pass | 0 wystąpień apilo* |
|
||
| AC-4: Pełna suite green | Pass | 818/818 testów |
|
||
|
||
## Accomplishments
|
||
|
||
- IntegrationsRepository: ~650 linii usunięte, zostały settings + logi + product linking + ShopPRO
|
||
- IntegrationsController: nowy konstruktor `(IntegrationsRepository, ApiloRepository)`
|
||
- OrderAdminService: 3 metody (resendToApilo, syncApiloPayment, syncApiloStatus) używają ApiloRepository
|
||
- cron.php: `$apiloRepository` dla 5 wywołań apilo*; `$integrationsRepository` dla getSettings/saveSetting
|
||
- IntegrationsRepositoryTest: oczyszczony z 8 duplikatów apilo testów + przywrócone 3 testy generyczne
|
||
- IntegrationsControllerTest: zaktualizowany do nowego 2-arg konstruktora
|
||
|
||
## Files Modified
|
||
|
||
| File | Zmiana |
|
||
|------|--------|
|
||
| `autoload/admin/Controllers/IntegrationsController.php` | +ApiloRepository dependency, 6 apilo* calls rerouted |
|
||
| `autoload/admin/App.php` | Inject ApiloRepository do IntegrationsController |
|
||
| `autoload/Domain/Order/OrderAdminService.php` | 3× IntegrationsRepository → ApiloRepository |
|
||
| `cron.php` | +$apiloRepository, 5 apilo* calls rerouted |
|
||
| `autoload/Domain/Integrations/IntegrationsRepository.php` | Usunięto ~650 linii apilo* |
|
||
| `tests/Unit/Domain/Integrations/IntegrationsRepositoryTest.php` | Cleanup + przywrócone testy generyczne |
|
||
| `tests/Unit/admin/Controllers/IntegrationsControllerTest.php` | Zaktualizowany do 2-arg konstruktora |
|
||
|
||
## Deviations from Plan
|
||
|
||
- IntegrationsControllerTest wymagał aktualizacji (nie był w planie) — auto-fix podczas weryfikacji
|
||
- 3 testy przypadkowo usunięte przez regex (testAllPublicMethodsExist, testSettingsTableMapping, testShopproProviderWorks) — przywrócone
|
||
|
||
## Next Phase Readiness
|
||
|
||
**Ready:** Refaktoring fazy 6 kompletny. IntegrationsRepository lean, ApiloRepository izolowany.
|
||
**Blockers:** Brak
|
||
|
||
---
|
||
*Phase: 06-integrations-refactoring, Plan: 02*
|
||
*Completed: 2026-03-12*
|