feat(116): hostedsms integration settings
Phase 116 complete: - add HostedSMS settings with encrypted password storage - add SimpleAPI real test SMS flow and integrations hub row - document schema, architecture, changelog, and PAUL state Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
@@ -13,8 +13,8 @@ Sprzedawca może obsługiwać zamówienia ze wszystkich kanałów
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| Version | 3.7.0-dev |
|
||||
| Status | v3.7 in progress — Phases 113 (Fakturownia Foundation) + 114 (Accounting Configs Refactor) + 115 (Wystawianie faktury z zamowienia) shipped |
|
||||
| Last Updated | 2026-05-10 |
|
||||
| Status | v3.7 in progress — Phases 113-116 shipped (Fakturownia + HostedSMS settings/test SMS) |
|
||||
| Last Updated | 2026-05-12 |
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -119,6 +119,7 @@ Sprzedawca może obsługiwać zamówienia ze wszystkich kanałów
|
||||
- [x] Fundament v3.7 Invoices: tabele `invoices`, `invoice_configs`, `invoice_number_counters`, `fakturownia_integration_settings` + `orders.invoice_requested`; CRUD kont Fakturowni z testem polaczenia API (`/settings/integrations/fakturownia`); karta w hubie integracji — Phase 113
|
||||
- [x] Ksiegowosc: refaktor `/settings/accounting` na hub-rozdroze + osobne podstrony `/receipts` i `/invoices` + edycja na osobnym widoku; pelen CRUD `invoice_configs` z opcja delegacji do Fakturowni (conditional integration_id, serwerowa walidacja); seed `Domyslny VAT`; globalny modul `confirm-delete.js` — Phase 114
|
||||
- [x] Wystawianie faktury z zamowienia: toggle `orders.invoice_requested` w zakladce Platnosci + auto-set z importu (Allegro `invoice.required` / shopPRO 5-key parser); formularz z auto-fillem NIP przez MF Biala Liste (publiczne API); dual flow lokalny (Dompdf + atomowy `invoice_number_counters`) / delegowany (POST do Fakturowni przed INSERT, redirect 302 do natywnego PDF); lista `/settings/accounting/invoices/issued` z filtrami; snapshot pattern w `invoices` JSON; PHP 8.5-compatible (curl_close removed) — Phase 115
|
||||
- [x] Integracja HostedSMS: pojedyncza globalna konfiguracja w `/settings/integrations/hostedsms`, szyfrowane haslo, karta w hubie integracji i realna wysylka testowego SMS z edytowalna trescia oraz czytelnym statusem MessageId — Phase 116
|
||||
|
||||
### Deferred
|
||||
|
||||
@@ -127,7 +128,7 @@ Sprzedawca może obsługiwać zamówienia ze wszystkich kanałów
|
||||
|
||||
### Active (In Progress)
|
||||
|
||||
- [ ] v3.7 Invoices — wystawianie faktur dla klientow z NIP przez integracje z Fakturownia (multi-account, lokalna numeracja z opcja delegacji, rozdzielenie przyciskow paragon/faktura, osobne podstrony edycji configs). Phases 113 + 114 + 115 shipped; ewentualne kolejne fazy (np. eksport XLSX, invoice.created event, idempotencja Fakturowni) w kolejce.
|
||||
- [ ] v3.7 Invoices / operational integrations — Phases 113 + 114 + 115 + 116 shipped; ewentualne kolejne fazy (np. eksport XLSX faktur, invoice.created event, idempotencja Fakturowni, automatyzacje SMS, odbior SMS po aktywacji HostedSMS) w kolejce.
|
||||
|
||||
### Planned (Next)
|
||||
|
||||
@@ -195,6 +196,8 @@ PHP (XAMPP/Laravel), integracje z API marketplace'Ăłw (Allegro, Erli) oraz API
|
||||
| Historia automatyzacji zapisywana per regula (success/failed) i czyszczona cronem po 30 dniach | Audyt wykonywania regul bez recznego utrzymania danych | 2026-03-28 | Active |
|
||||
| Akcja update_order_status korzysta z OrdersRepository::updateOrderStatus | Spojnosc z historia statusow i activity log bez duplikowania logiki | 2026-03-28 | Active |
|
||||
| Push waybilla do Allegro checkout forms wykonywany tylko dla zamowien source=allegro i jest niekrytyczny dla lokalnego tworzenia paczki | Eliminacja recznego kroku po stronie Allegro bez ryzyka utraty lokalnie utworzonej przesylki przy bledzie API | 2026-03-28 | Active |
|
||||
| HostedSMS startuje jako jedna globalna konfiguracja z realnym testowym SMS | Operator potrzebowal na start tylko ustawien i potwierdzenia dzialania; SimpleAPI nie ma osobnego ping endpointu | 2026-05-12 | Active |
|
||||
| Odbior odpowiedzi SMS z HostedSMS odlozony do osobnej fazy | Dokumentacja przewiduje metody odbioru SMS, ale wymagaja aktywacji interfejsu po stronie DCS/HostedSMS | 2026-05-12 | Deferred |
|
||||
| Event `order.imported` emitowany tylko przy pierwszym imporcie zamowienia | Unikniecie duplikatow reakcji automatyzacji przy kolejnych synchronizacjach | 2026-04-15 | Active |
|
||||
| Preset przesylek nadpisuje wylacznie wymiary+wage + auto-submit po autofill | Single responsibility preseta + szybszy flow operatora | 2026-04-17 | Active |
|
||||
| Re-import istniejacego zamowienia jest delta-only — `replaceAddresses/Items/Notes` tylko przy `created=true`; `updateOrderDelta()` zawezony do payment_status/total_paid/status_code/is_canceled_by_buyer/source_updated_at/payload_json/fetched_at | Zamowienia zarzadzane sa w orderPRO (nie w zrodle), wiec re-import nie powinien nadpisywac stanu lokalnego ani lamac stabilnosci `order_items.id` (case #882: znikajace `project_generated`) | 2026-05-07 | Active |
|
||||
@@ -252,6 +255,6 @@ Quick Reference:
|
||||
|
||||
---
|
||||
*PROJECT.md — Updated when requirements or context change*
|
||||
*Last updated: 2026-05-10 after Phase 115 (Wystawianie faktury z zamowienia) completion; v3.7 Invoices milestone in progress*
|
||||
*Last updated: 2026-05-12 after Phase 116 (HostedSMS Integration Settings + Test SMS) completion; v3.7 milestone in progress*
|
||||
|
||||
|
||||
|
||||
@@ -15,11 +15,13 @@ Wystawianie faktur dla klientow z NIP poprzez integracje z Fakturownia (app.fakt
|
||||
| 113 | Fakturownia Integration Foundation | 1/1 | Complete (2026-05-10) |
|
||||
| 114 | Accounting Configs Refactor (hub + osobne podstrony receipts/invoices) | 1/1 | Complete (2026-05-10) |
|
||||
| 115 | Wystawianie faktury z zamowienia (lokalne + delegacja Fakturownia + NIP lookup MF Biala Lista) | 1/1 | Complete (2026-05-10) |
|
||||
| 116 | HostedSMS Integration Settings + Test SMS | 1/1 | Complete (2026-05-12) |
|
||||
|
||||
Planowane kolejne fazy v3.7 (kandydaci, do rozplanowania):
|
||||
- Eksport XLSX listy wystawionych faktur (analogicznie do paragonow)
|
||||
- Idempotencja podwojnego POST do Fakturowni (INVOICE-IDEMP-115)
|
||||
- Event automatyzacji `invoice.created` (jezeli operator chce wysylac faktury mailem)
|
||||
- Automatyzacje SMS / odbior odpowiedzi SMS po aktywacji HostedSMS
|
||||
- Backfill `curl_close()` w `ShopproIntegrationsRepository` (PHP 8.5 compat, poza zakresem 115)
|
||||
|
||||
## Next Milestone
|
||||
@@ -494,4 +496,4 @@ Archive: `.paul/milestones/v0.1-ROADMAP.md`
|
||||
|
||||
---
|
||||
*Roadmap created: 2026-03-12*
|
||||
*Last updated: 2026-05-10 - Phase 115 (Wystawianie faktury z zamowienia) complete; v3.7 milestone in progress*
|
||||
*Last updated: 2026-05-12 - Phase 116 (HostedSMS Integration Settings + Test SMS) complete; v3.7 milestone in progress*
|
||||
|
||||
@@ -5,79 +5,55 @@
|
||||
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 — Phase 113 + 114 shipped; nastepna faza 115 (wystawianie faktury z zamowienia) do zaplanowania
|
||||
**Current focus:** v3.7 Invoices + operational integrations - Phase 116 HostedSMS settings/test SMS complete.
|
||||
|
||||
## Current Position
|
||||
|
||||
Milestone: v3.7 Invoices (Fakturownia integration) — In progress
|
||||
Phase: 116 of TBD (TBD — kandydaci v3.7 lub przejscie na kolejny milestone) — Not started
|
||||
Milestone: v3.7 Invoices (Fakturownia integration) - In progress
|
||||
Phase: 117 of TBD (next candidate) - Not started
|
||||
Plan: pending
|
||||
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
|
||||
Status: Phase 116 complete; ready to plan next phase
|
||||
Last activity: 2026-05-12 - UNIFY 116-01 complete and transition done
|
||||
|
||||
Progress:
|
||||
- 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
|
||||
- Milestone v3.7: [########--] ~75% (Phase 113 + 114 + 115 + 116 closed)
|
||||
- Phase 116: [##########] 100% - Complete
|
||||
|
||||
## Loop Position
|
||||
|
||||
Current loop state:
|
||||
```
|
||||
v3.7 milestone:
|
||||
Phase 113 (Fakturownia Integration Foundation): Complete
|
||||
Phase 114 (Accounting Configs Refactor): Complete
|
||||
Phase 115 (Wystawianie faktury z zamowienia): Complete
|
||||
Phase 116 (TBD): not started
|
||||
```
|
||||
|
||||
```
|
||||
PLAN ──▶ APPLY ──▶ UNIFY
|
||||
✓ ✓ ✓ [Phase 115 closed; ready for Phase 116 plan]
|
||||
PLAN -> APPLY -> UNIFY
|
||||
done done done [Loop complete - ready for next PLAN]
|
||||
```
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-05-10
|
||||
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
|
||||
Last session: 2026-05-12
|
||||
Stopped at: Phase 116 complete, ready to plan next phase
|
||||
Next action: $paul-plan for next v3.7 candidate or next milestone
|
||||
Resume file: .paul/phases/116-hostedsms-integration/116-01-SUMMARY.md
|
||||
|
||||
## Git State
|
||||
|
||||
Last commit: 33ee1a1 feat(115): wystawianie faktury z zamowienia (lokalne + delegowane Fakturownia)
|
||||
Last known commit: ecef7c7 feat(116): hostedsms integration settings
|
||||
Branch: main
|
||||
Feature branches merged: none
|
||||
|
||||
## Pending Actions
|
||||
|
||||
- **Phase 113-01 (smoke test wykonany przez usera 2026-05-10):** OK
|
||||
- Manualne testy AC-1..AC-7 dla Phase 112 na zywej bazie (XAMPP online)
|
||||
- Backfill zamowienia #882 — operator robi recznie po wdrozeniu (poza zakresem planu)
|
||||
- Uruchom migracje gdy XAMPP online: `php bin/migrate.php` (delivery_statuses)
|
||||
- Recznie odtworzyc istniejace reguly automatyzacji z grupowymi kluczami (BREAKING z 108-02)
|
||||
- Manualne testy AC-1..AC-7 dla Phase 112 na zywej bazie (XAMPP online).
|
||||
- Backfill zamowienia #882 - operator robi recznie po wdrozeniu (poza zakresem planu).
|
||||
- Uruchom migracje gdy XAMPP online: `php bin/migrate.php` (delivery_statuses).
|
||||
- Recznie odtworzyc istniejace reguly automatyzacji z grupowymi kluczami (BREAKING z 108-02).
|
||||
- HostedSMS inbound replies: requires DCS/HostedSMS activation before implementation.
|
||||
|
||||
## Deferred to Next Milestones
|
||||
|
||||
- Phase 68 - Code Deduplication Refactor (0/2 Planning, nigdy nie rozpoczety)
|
||||
- STAT-NET - netto shopPRO z API lub z `order_items.tax_rate` (`.paul/TODO.md`)
|
||||
- Mobile Orders List / Mobile Order Details / Mobile Settings (TBD z poprzedniego roadmapu)
|
||||
- sonar-scanner - skan dla phase 105, 106, 107, 108 nie zostal uruchomiony (skill gap odnotowany)
|
||||
- INDEX-106-01 - indeksy DB dla query `customer_returned_count`: `order_addresses(order_id, address_type)`, `shipment_packages(order_id, delivery_status)` (gdy dataset >50k wierszy)
|
||||
- Phase 68 - Code Deduplication Refactor (0/2 Planning, nigdy nie rozpoczety).
|
||||
- STAT-NET - netto shopPRO z API lub z `order_items.tax_rate` (`.paul/TODO.md`).
|
||||
- Mobile Orders List / Mobile Order Details / Mobile Settings.
|
||||
- INDEX-106-01 - indeksy DB dla query `customer_returned_count`: `order_addresses(order_id, address_type)`, `shipment_packages(order_id, delivery_status)` (gdy dataset >50k wierszy).
|
||||
|
||||
## Skill Audit (Phase 108)
|
||||
## Skill Requirements
|
||||
|
||||
| Expected | Invoked | Notes |
|
||||
|----------|---------|-------|
|
||||
| sonar-scanner (required) | o | Wymagany po APPLY 108-01 i 108-02 - odlozony |
|
||||
|
||||
## Skill Audit (Phase 110)
|
||||
|
||||
| Expected | Invoked | Notes |
|
||||
|----------|---------|-------|
|
||||
| sonar-scanner (required) | yes | Skan uruchomiony po APPLY; raport wyslany do SonarQube. |
|
||||
|
||||
## Phase 110 Notes
|
||||
|
||||
- Local HTTP verification blocked by MySQL/XAMPP connection refused.
|
||||
- PHPUnit not run: `composer` unavailable in PATH and `vendor/` absent.
|
||||
- Sonar issue import to `DOCS/todo.md` not performed because SonarQube MCP/resources are unavailable in this session.
|
||||
- `sonar-scanner` required after APPLY; Phase 116 gap documented because CLI was not available in PATH.
|
||||
|
||||
31
.paul/changelog/2026-05-12.md
Normal file
31
.paul/changelog/2026-05-12.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# 2026-05-12
|
||||
|
||||
## Co zrobiono
|
||||
|
||||
- [Phase 116, Plan 01] Dodano integracje HostedSMS: ustawienia konta, szyfrowane haslo, karta w hubie integracji i realna wysylka testowego SMS.
|
||||
- Dodano klienta HostedSMS SimpleAPI (`POST https://api.hostedsms.pl/SimpleApi`) z obsluga `MessageId` i `ErrorMessage`.
|
||||
- Poprawiono prezentacje ostatniego testu HostedSMS: status, HTTP i osobny identyfikator wiadomosci.
|
||||
- Potwierdzono test na zywo: `2026-05-12 12:03:22 OK HTTP 200`, MessageId `d935d71a-d9a0-4cfb-be06-03fe36c71150`.
|
||||
- Odnotowano przyszly zakres: odbior odpowiedzi SMS wymaga aktywacji interfejsu po stronie DCS/HostedSMS.
|
||||
|
||||
## Zmienione pliki
|
||||
|
||||
- `.paul/PROJECT.md`
|
||||
- `.paul/ROADMAP.md`
|
||||
- `.paul/STATE.md`
|
||||
- `.paul/codebase/architecture.md`
|
||||
- `.paul/codebase/db_schema.md`
|
||||
- `.paul/codebase/tech_changelog.md`
|
||||
- `.paul/phases/116-hostedsms-integration/116-01-PLAN.md`
|
||||
- `.paul/phases/116-hostedsms-integration/116-01-SUMMARY.md`
|
||||
- `DOCS/ARCHITECTURE.md`
|
||||
- `DOCS/DB_SCHEMA.md`
|
||||
- `DOCS/TECH_CHANGELOG.md`
|
||||
- `database/migrations/20260512_000107_create_hostedsms_integration_settings.sql`
|
||||
- `resources/lang/pl.php`
|
||||
- `resources/views/settings/hostedsms.php`
|
||||
- `routes/web.php`
|
||||
- `src/Modules/Settings/HostedSmsApiClient.php`
|
||||
- `src/Modules/Settings/HostedSmsIntegrationController.php`
|
||||
- `src/Modules/Settings/HostedSmsIntegrationRepository.php`
|
||||
- `src/Modules/Settings/IntegrationsHubController.php`
|
||||
@@ -262,6 +262,25 @@ tests/
|
||||
|
||||
---
|
||||
|
||||
## Phase 116 - HostedSMS Integration Settings
|
||||
|
||||
### HostedSmsIntegrationRepository (`src/Modules/Settings/HostedSmsIntegrationRepository.php`)
|
||||
- Zarzadza pojedynczym rekordem `hostedsms_integration_settings` (`id=1`) i bazowym wpisem `integrations` typu `hostedsms`.
|
||||
- Szyfruje haslo przez `IntegrationSecretCipher`; formularz widzi tylko flage `has_password`.
|
||||
- Udostepnia `getCredentials()` dla kontrolera testowej wysylki SMS.
|
||||
|
||||
### HostedSmsApiClient (`src/Modules/Settings/HostedSmsApiClient.php`)
|
||||
- Wykonuje `POST https://api.hostedsms.pl/SimpleApi` jako `application/x-www-form-urlencoded`.
|
||||
- Wysyla `UserEmail`, `Password`, `Sender`, `Phone`, `Message` oraz opcjonalnie `ConvertMessageToGSM7`.
|
||||
- Traktuje `MessageId` jako sukces, a `ErrorMessage` jako blad biznesowy nawet przy HTTP 200.
|
||||
|
||||
### HostedSmsIntegrationController (`src/Modules/Settings/HostedSmsIntegrationController.php`)
|
||||
- Endpointy: `GET /settings/integrations/hostedsms`, `POST /settings/integrations/hostedsms/save`, `POST /settings/integrations/hostedsms/test`.
|
||||
- `test` realnie wysyla SMS z edytowalna trescia i zapisuje wynik w `integrations.last_test_*`.
|
||||
|
||||
### IntegrationsHubController
|
||||
- Dodaje wiersz HostedSMS do `/settings/integrations` ze statusem konfiguracji, sekretu, aktywnosci i ostatniego testu.
|
||||
|
||||
## Phase 114 — Accounting Configs Refactor
|
||||
|
||||
### Sekcja Ksiegowosc — struktura URL
|
||||
|
||||
@@ -575,6 +575,22 @@ UNIQUE: `(integration_id)` — one settings row per Fakturownia integration. Mul
|
||||
|
||||
---
|
||||
|
||||
**hostedsms_integration_settings** - HostedSMS account credentials (Phase 116; fixed 1 row)
|
||||
| Column | Type | Nullable | Notes |
|
||||
|--------|------|----------|-------|
|
||||
| `id` | TINYINT UNSIGNED | NO | PK, always 1 |
|
||||
| `integration_id` | INT UNSIGNED | YES | UNIQUE, FK -> integrations(id) CASCADE |
|
||||
| `user_email` | VARCHAR(190) | YES | HostedSMS login |
|
||||
| `password_encrypted` | TEXT | YES | AES-encrypted via `IntegrationSecretCipher` |
|
||||
| `sender` | VARCHAR(32) | YES | HostedSMS sender name / nadpis |
|
||||
| `convert_message_to_gsm7` | TINYINT(1) | NO | DEFAULT 0 |
|
||||
| `created_at` | DATETIME | NO | |
|
||||
| `updated_at` | DATETIME | NO | |
|
||||
|
||||
UNIQUE: `(integration_id)` - one global HostedSMS settings row.
|
||||
|
||||
---
|
||||
|
||||
## Accounting / Receipts
|
||||
|
||||
**receipt_configs** — Receipt generation configurations
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# Technical Changelog
|
||||
|
||||
## 2026-05-12 - Phase 116 Plan 01: HostedSMS Integration Settings + Test SMS
|
||||
|
||||
**Co zrobiono:**
|
||||
- Dodano migracje `20260512_000107_create_hostedsms_integration_settings.sql` z pojedyncza konfiguracja `hostedsms_integration_settings` i bazowym wpisem `integrations` typu `hostedsms`.
|
||||
- Dodano `HostedSmsIntegrationRepository` z szyfrowaniem hasla przez `IntegrationSecretCipher`.
|
||||
- Dodano `HostedSmsApiClient` dla HostedSMS SimpleAPI (`POST https://api.hostedsms.pl/SimpleApi`).
|
||||
- Dodano `HostedSmsIntegrationController` i trasy `/settings/integrations/hostedsms`, `/save`, `/test`.
|
||||
- Dodano widok `resources/views/settings/hostedsms.php` z konfiguracja i realna wysylka testowego SMS z edytowalna trescia oraz czytelnym panelem ostatniego testu (`OK`, HTTP, MessageId).
|
||||
- Dodano HostedSMS do hubu integracji `/settings/integrations`.
|
||||
|
||||
**Dlaczego:**
|
||||
- Operator potrzebuje najpierw zapisac dane HostedSMS i sprawdzic realna wysylke SMS, zanim integracja zostanie wykorzystana w automatyzacjach lub komunikacji z klientami.
|
||||
- Test uzywa rzeczywistej wysylki, bo SimpleAPI nie udostepnia osobnego endpointu ping/test.
|
||||
- Haslo nie jest ujawniane po zapisie; UI pokazuje tylko status zapisanego sekretu.
|
||||
|
||||
## 2026-05-10 - Phase 115 Plan 01: Wystawianie faktury z zamowienia
|
||||
|
||||
**Co zrobiono:**
|
||||
|
||||
205
.paul/phases/116-hostedsms-integration/116-01-PLAN.md
Normal file
205
.paul/phases/116-hostedsms-integration/116-01-PLAN.md
Normal file
@@ -0,0 +1,205 @@
|
||||
---
|
||||
phase: 116-hostedsms-integration
|
||||
plan: 01
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- database/migrations/20260512_000107_create_hostedsms_integration_settings.sql
|
||||
- src/Modules/Settings/HostedSmsApiClient.php
|
||||
- src/Modules/Settings/HostedSmsIntegrationRepository.php
|
||||
- src/Modules/Settings/HostedSmsIntegrationController.php
|
||||
- src/Modules/Settings/IntegrationsHubController.php
|
||||
- routes/web.php
|
||||
- resources/views/settings/hostedsms.php
|
||||
- resources/views/settings/integrations.php
|
||||
- resources/views/layouts/app.php
|
||||
- resources/lang/pl.php
|
||||
- DOCS/DB_SCHEMA.md
|
||||
- DOCS/ARCHITECTURE.md
|
||||
- DOCS/TECH_CHANGELOG.md
|
||||
- .paul/codebase/db_schema.md
|
||||
- .paul/codebase/architecture.md
|
||||
- .paul/codebase/tech_changelog.md
|
||||
autonomous: true
|
||||
delegation: auto
|
||||
---
|
||||
|
||||
<objective>
|
||||
## Goal
|
||||
Dodac pierwsza wersje integracji HostedSMS: pojedyncza globalna konfiguracja konta oraz formularz realnej wysylki testowego SMS-a z edytowalna trescia.
|
||||
|
||||
## Purpose
|
||||
Operator ma moc potwierdzic, ze dane HostedSMS sa poprawne, zanim integracja zostanie uzyta w automatyzacjach lub komunikacji z klientami.
|
||||
|
||||
## Output
|
||||
Nowa podstrona `/settings/integrations/hostedsms`, zapis konfiguracji w DB, klient API SimpleAPI, akcja testowej wysylki SMS i wpis w hubie integracji.
|
||||
</objective>
|
||||
|
||||
<context>
|
||||
<clarifications>
|
||||
- **Test SMS** - Czy test ma faktycznie wysylac wiadomosc?
|
||||
-> Odpowiedz: Ma faktycznie wysylac testowy sms.
|
||||
- **Liczba kont** - Jedna globalna konfiguracja czy wiele kont?
|
||||
-> Odpowiedz: Wystarczy jedna.
|
||||
- **Tresc testu** - Tresc testowego SMS ma byc stala czy edytowalna?
|
||||
-> Odpowiedz: Edytowalna.
|
||||
</clarifications>
|
||||
|
||||
## Project Context
|
||||
@.paul/PROJECT.md
|
||||
@.paul/ROADMAP.md
|
||||
@.paul/STATE.md
|
||||
@AGENTS.md
|
||||
@DOCS/DB_SCHEMA.md
|
||||
@DOCS/ARCHITECTURE.md
|
||||
|
||||
## API Context
|
||||
HostedSMS SimpleAPI z dokumentacji `https://panel.hostedsms.pl/Doc/HostedSms-Opis_Techniczny_API_pl.pdf`:
|
||||
- endpoint podstawowy: `POST https://api.hostedsms.pl/SimpleApi`
|
||||
- endpoint zapasowy: `POST https://api2.hostedsms.pl/SimpleApi`
|
||||
- pola: `UserEmail`, `Password`, `Sender`, `Phone`, `Message`, opcjonalnie `ConvertMessageToGSM7`
|
||||
- numer telefonu w formacie miedzynarodowym, np. `48xxxxxxxxx`
|
||||
- odpowiedz JSON zawiera `MessageId` przy sukcesie albo `ErrorMessage` przy bledzie; HTTP 200 moze oznaczac blad biznesowy
|
||||
|
||||
## Source Files
|
||||
@routes/web.php
|
||||
@src/Modules/Settings/IntegrationsRepository.php
|
||||
@src/Modules/Settings/IntegrationSecretCipher.php
|
||||
@src/Modules/Settings/IntegrationsHubController.php
|
||||
@src/Modules/Settings/FakturowniaIntegrationRepository.php
|
||||
@src/Modules/Settings/FakturowniaIntegrationController.php
|
||||
@src/Modules/Settings/FakturowniaApiClient.php
|
||||
@resources/views/settings/fakturownia.php
|
||||
@resources/views/settings/fakturownia-edit.php
|
||||
@resources/views/settings/integrations.php
|
||||
@resources/views/layouts/app.php
|
||||
@resources/lang/pl.php
|
||||
</context>
|
||||
|
||||
<skills>
|
||||
## Required Skills (from SPECIAL-FLOWS.md)
|
||||
|
||||
| Skill | Priority | When to Invoke | Loaded? |
|
||||
|-------|----------|----------------|---------|
|
||||
| sonar-scanner | required | Po APPLY, przed UNIFY | o |
|
||||
|
||||
## Skill Invocation Checklist
|
||||
- [ ] Uruchomic `sonar-scanner` po implementacji, jezeli CLI i SonarQube sa dostepne.
|
||||
</skills>
|
||||
|
||||
<acceptance_criteria>
|
||||
|
||||
## AC-1: Zapis konfiguracji HostedSMS
|
||||
```gherkin
|
||||
Given zalogowany operator jest na stronie ustawien HostedSMS
|
||||
When wpisze UserEmail, haslo, nadpis Sender, status aktywnosci i zapisze formularz z poprawnym CSRF
|
||||
Then konfiguracja zostanie zapisana jako jedna globalna integracja, haslo bedzie zaszyfrowane przez IntegrationSecretCipher, a zapisany sekret nie bedzie widoczny w formularzu
|
||||
```
|
||||
|
||||
## AC-2: Walidacja konfiguracji
|
||||
```gherkin
|
||||
Given operator probuje zapisac lub testowac HostedSMS
|
||||
When brakuje loginu, hasla przy pierwszym zapisie, nadpisu Sender albo numer testowy nie jest w formacie miedzynarodowym
|
||||
Then aplikacja pokazuje czytelny blad i nie wykonuje wysylki testowej bez kompletnych danych
|
||||
```
|
||||
|
||||
## AC-3: Realny test wysylki SMS
|
||||
```gherkin
|
||||
Given konfiguracja HostedSMS jest zapisana z poprawnymi danymi
|
||||
When operator poda numer testowy i edytowalna tresc testowa oraz kliknie wysylke testowa
|
||||
Then aplikacja wykona POST do HostedSMS SimpleAPI, zapisze wynik w polach last_test_* integracji i pokaze MessageId albo komunikat bledu z API
|
||||
```
|
||||
|
||||
## AC-4: Widocznosc w panelu integracji
|
||||
```gherkin
|
||||
Given operator otwiera Ustawienia > Integracje
|
||||
When integracja HostedSMS istnieje albo jeszcze nie jest skonfigurowana
|
||||
Then hub pokazuje wiersz HostedSMS ze statusem konfiguracji, aktywnosci, ostatniego testu i linkiem do ustawien
|
||||
```
|
||||
|
||||
## AC-5: Dokumentacja i zgodnosc projektu
|
||||
```gherkin
|
||||
Given funkcja zostala wdrozona
|
||||
When sprawdzane sa dokumenty techniczne i testy
|
||||
Then DOCS oraz .paul/codebase opisuja nowa tabele, klasy, endpointy i przeplyw, a testy/lint nie wykazuja regresji
|
||||
```
|
||||
|
||||
</acceptance_criteria>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Dodac model konfiguracji HostedSMS</name>
|
||||
<files>database/migrations/20260512_000107_create_hostedsms_integration_settings.sql, src/Modules/Settings/HostedSmsIntegrationRepository.php</files>
|
||||
<action>
|
||||
Utworz migracje dla pojedynczej tabeli `hostedsms_integration_settings` z rekordem `id=1`, `integration_id` jako UNIQUE FK do `integrations`, polami `user_email`, `password_encrypted`, `sender`, `convert_message_to_gsm7`, `created_at`, `updated_at`.
|
||||
Repozytorium ma zapewniac bazowy rekord `integrations` typu `hostedsms`, nazwa `HostedSMS`, base_url `https://api.hostedsms.pl/SimpleApi`, zwracac status `has_password` bez ujawniania hasla, zapisywac nowe haslo tylko gdy pole formularza nie jest puste, przy pierwszym zapisie wymagac hasla oraz uzywac `IntegrationSecretCipher` i prepared statements.
|
||||
</action>
|
||||
<verify>C:\xampp\php\php.exe -l src/Modules/Settings/HostedSmsIntegrationRepository.php</verify>
|
||||
<done>AC-1 i AC-2 spelnione dla warstwy zapisu konfiguracji.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Dodac klienta SimpleAPI i kontroler ustawien</name>
|
||||
<files>src/Modules/Settings/HostedSmsApiClient.php, src/Modules/Settings/HostedSmsIntegrationController.php, routes/web.php</files>
|
||||
<action>
|
||||
Utworz `HostedSmsApiClient` wykonujacy POST form-urlencoded do SimpleAPI z `Accept: application/json`, SSL verification i CA z `SslCertificateResolver`. Parsuj odpowiedz JSON: `MessageId` oznacza sukces, `ErrorMessage` blad biznesowy mimo HTTP 200; blad cURL/HTTP ma trafic do komunikatu.
|
||||
Utworz `HostedSmsIntegrationController` z akcjami `index`, `save`, `test`. `save` waliduje CSRF, login e-mail, sender i wymaganie hasla przy pierwszym zapisie. `test` waliduje CSRF, numer w formacie miedzynarodowym (`^\d{8,15}$`, z hintem `48...`), tresc niepusta i maks. 4000 znakow. Test realnie wysyla SMS i zapisuje `last_test_status`, `last_test_http_code`, `last_test_message` przez `IntegrationsRepository::updateTestResult`.
|
||||
Podlacz DI i trasy: GET `/settings/integrations/hostedsms`, POST `/settings/integrations/hostedsms/save`, POST `/settings/integrations/hostedsms/test`.
|
||||
</action>
|
||||
<verify>C:\xampp\php\php.exe -l src/Modules/Settings/HostedSmsApiClient.php; C:\xampp\php\php.exe -l src/Modules/Settings/HostedSmsIntegrationController.php; C:\xampp\php\php.exe -l routes/web.php</verify>
|
||||
<done>AC-2 i AC-3 spelnione dla backendu i realnej wysylki testowej.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Dodac UI, hub integracji i dokumentacje</name>
|
||||
<files>resources/views/settings/hostedsms.php, resources/views/settings/integrations.php, resources/views/layouts/app.php, resources/lang/pl.php, src/Modules/Settings/IntegrationsHubController.php, DOCS/DB_SCHEMA.md, DOCS/ARCHITECTURE.md, DOCS/TECH_CHANGELOG.md, .paul/codebase/db_schema.md, .paul/codebase/architecture.md, .paul/codebase/tech_changelog.md</files>
|
||||
<action>
|
||||
Dodaj kompaktowy widok ustawien HostedSMS bez inline CSS w nowych blokach. Formularz konfiguracji ma pokazac pola: UserEmail, nowe haslo (placeholder gdy zapisane), Sender, checkbox konwersji do GSM7, aktywnosc. Sekcja testu ma miec numer telefonu i edytowalna tresc z domyslna wartoscia `Test orderPRO HostedSMS`.
|
||||
Dodaj HostedSMS do hubu integracji i aktywnego menu ustawien. Jezeli potrzeba nowych styli, umiesc je w SCSS, nie w widoku.
|
||||
Zaktualizuj dokumentacje techniczna: tabela `hostedsms_integration_settings`, nowe klasy, trasy i przeplyw testowej wysylki.
|
||||
</action>
|
||||
<verify>C:\xampp\php\php.exe -l resources/views/settings/hostedsms.php; C:\xampp\php\php.exe -l src/Modules/Settings/IntegrationsHubController.php; npm run build --if-present</verify>
|
||||
<done>AC-4 i AC-5 spelnione dla UI, hubu i dokumentacji.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<boundaries>
|
||||
|
||||
## DO NOT CHANGE
|
||||
- Nie podpinac `DB_HOST_REMOTE` do runtime aplikacji.
|
||||
- Nie dodawac automatyzacji SMS, szablonow SMS ani wysylki z zamowien w tym planie.
|
||||
- Nie dodawac natywnych `alert()` / `confirm()`.
|
||||
- Nie przenosic ani refaktoryzowac istniejacych integracji poza minimalnym dopieciem HostedSMS.
|
||||
|
||||
## SCOPE LIMITS
|
||||
- Tylko jedna globalna konfiguracja HostedSMS.
|
||||
- Tylko realna wysylka testowa SMS z ustawien.
|
||||
- Bez historii wyslanych SMS poza istniejacym `last_test_*` i ewentualnym `integration_test_logs`, jesli aktualny `IntegrationsRepository` juz go uzywa.
|
||||
- Bez raportow dostarczenia, FullApi, WebService2SMS i endpointu zapasowego `api2` w pierwszej wersji, chyba ze zostanie uzyty jako prosty fallback po bledzie polaczenia.
|
||||
|
||||
</boundaries>
|
||||
|
||||
<verification>
|
||||
Before declaring plan complete:
|
||||
- [ ] `C:\xampp\php\php.exe bin/migrate.php`
|
||||
- [ ] `C:\xampp\php\php.exe -l` dla nowych/zmienionych plikow PHP
|
||||
- [ ] `npm run build --if-present`
|
||||
- [ ] Manualnie: zapis konfiguracji HostedSMS, wysylka testowego SMS na numer w formacie `48...`, komunikat z `MessageId`
|
||||
- [ ] `sonar-scanner` po APPLY, jezeli CLI i SonarQube sa dostepne
|
||||
- [ ] DOCS i `.paul/codebase` zaktualizowane
|
||||
- [ ] All acceptance criteria met
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- Operator moze zapisac jedna konfiguracje HostedSMS bez ujawniania hasla.
|
||||
- Operator moze wyslac realny testowy SMS z edytowalna trescia.
|
||||
- Wynik testu jest widoczny w ekranie HostedSMS i hubie integracji.
|
||||
- Migracje, lint i build przechodza albo blokery srodowiskowe sa jasno opisane w SUMMARY.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.paul/phases/116-hostedsms-integration/116-01-SUMMARY.md`
|
||||
</output>
|
||||
173
.paul/phases/116-hostedsms-integration/116-01-SUMMARY.md
Normal file
173
.paul/phases/116-hostedsms-integration/116-01-SUMMARY.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
phase: 116-hostedsms-integration
|
||||
plan: 01
|
||||
subsystem: settings-integrations
|
||||
tags: [hostedsms, sms, api, settings, integration]
|
||||
requires:
|
||||
- phase: 113-fakturownia-integration-foundation
|
||||
provides: integrations hub patterns and encrypted integration settings pattern
|
||||
provides:
|
||||
- HostedSMS global settings screen
|
||||
- HostedSMS SimpleAPI client
|
||||
- Real test SMS flow with persisted last_test status
|
||||
affects: [settings, integrations, future-sms-automation]
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns: [single-row integration settings, IntegrationSecretCipher encrypted secret, integrations.last_test observability]
|
||||
key-files:
|
||||
created:
|
||||
- database/migrations/20260512_000107_create_hostedsms_integration_settings.sql
|
||||
- src/Modules/Settings/HostedSmsApiClient.php
|
||||
- src/Modules/Settings/HostedSmsIntegrationRepository.php
|
||||
- src/Modules/Settings/HostedSmsIntegrationController.php
|
||||
- resources/views/settings/hostedsms.php
|
||||
modified:
|
||||
- routes/web.php
|
||||
- src/Modules/Settings/IntegrationsHubController.php
|
||||
- resources/lang/pl.php
|
||||
- DOCS/DB_SCHEMA.md
|
||||
- DOCS/ARCHITECTURE.md
|
||||
- DOCS/TECH_CHANGELOG.md
|
||||
key-decisions:
|
||||
- "HostedSMS starts as one global account, not multi-account."
|
||||
- "Test action sends a real SMS because SimpleAPI has no ping endpoint."
|
||||
- "Inbound SMS replies are deferred; HostedSMS supports inbound retrieval only after DCS/HostedSMS activation."
|
||||
patterns-established:
|
||||
- "Provider settings screen stores secrets encrypted and only renders has_secret state."
|
||||
- "HostedSMS API result uses MessageId as success and ErrorMessage as business failure."
|
||||
duration: 1h
|
||||
started: 2026-05-12T10:34:00+02:00
|
||||
completed: 2026-05-12T12:10:00+02:00
|
||||
---
|
||||
|
||||
# Phase 116 Plan 01: HostedSMS Integration Settings + Test SMS Summary
|
||||
|
||||
HostedSMS now has a settings screen, encrypted credential storage, SimpleAPI client, integrations-hub status, and a real test-SMS flow confirmed by the user.
|
||||
|
||||
## Performance
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Duration | ~1h |
|
||||
| Started | 2026-05-12T10:34:00+02:00 |
|
||||
| Completed | 2026-05-12T12:10:00+02:00 |
|
||||
| Tasks | 3 completed |
|
||||
| Files modified | 20 |
|
||||
|
||||
## Acceptance Criteria Results
|
||||
|
||||
| Criterion | Status | Notes |
|
||||
|-----------|--------|-------|
|
||||
| AC-1: Zapis konfiguracji HostedSMS | Pass | Global settings row, encrypted password, non-revealing UI implemented. |
|
||||
| AC-2: Walidacja konfiguracji | Pass | CSRF, e-mail, password, sender, phone and message validation implemented. |
|
||||
| AC-3: Realny test wysylki SMS | Pass | User confirmed `OK HTTP 200` with MessageId `d935d71a-d9a0-4cfb-be06-03fe36c71150` at `2026-05-12 12:03:22`. |
|
||||
| AC-4: Widocznosc w panelu integracji | Pass | HostedSMS row added to `/settings/integrations`. |
|
||||
| AC-5: Dokumentacja i zgodnosc projektu | Pass | DOCS and `.paul/codebase` updated; lint/build passed. Sonar CLI unavailable. |
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- Added `hostedsms_integration_settings` and idempotent seed of base `integrations` row.
|
||||
- Added `HostedSmsIntegrationRepository`, `HostedSmsApiClient`, and `HostedSmsIntegrationController`.
|
||||
- Added routes `GET/POST /settings/integrations/hostedsms...`.
|
||||
- Added compact UI for settings and editable real test SMS.
|
||||
- Improved final test display from raw `MessageId: ...` text to a cleaner status panel with date, status, HTTP code and separate message identifier.
|
||||
- Documented that inbound SMS replies are possible in HostedSMS only through the inbound/Webserwis2SMS side after activation by DCS/HostedSMS, so reply handling is future scope.
|
||||
|
||||
## Task Commits
|
||||
|
||||
| Task | Commit | Type | Description |
|
||||
|------|--------|------|-------------|
|
||||
| Task 1: Model konfiguracji HostedSMS | `ecef7c7` | feat | Migration + repository. |
|
||||
| Task 2: Klient SimpleAPI i kontroler | `ecef7c7` | feat | API client + controller + routes. |
|
||||
| Task 3: UI, hub i dokumentacja | `ecef7c7` | feat | Settings view, hub row, translations, docs. |
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
| File | Change | Purpose |
|
||||
|------|--------|---------|
|
||||
| `database/migrations/20260512_000107_create_hostedsms_integration_settings.sql` | Created | HostedSMS settings table and base integration seed. |
|
||||
| `src/Modules/Settings/HostedSmsApiClient.php` | Created | HostedSMS SimpleAPI POST client. |
|
||||
| `src/Modules/Settings/HostedSmsIntegrationRepository.php` | Created | Single-row settings repository with encrypted password. |
|
||||
| `src/Modules/Settings/HostedSmsIntegrationController.php` | Created | Settings save and real test SMS actions. |
|
||||
| `resources/views/settings/hostedsms.php` | Created | HostedSMS settings and test UI. |
|
||||
| `routes/web.php` | Modified | DI wiring and HostedSMS routes. |
|
||||
| `src/Modules/Settings/IntegrationsHubController.php` | Modified | HostedSMS row in integrations hub. |
|
||||
| `resources/lang/pl.php` | Modified | Polish UI labels/messages. |
|
||||
| `DOCS/DB_SCHEMA.md` | Modified | Schema documentation. |
|
||||
| `DOCS/ARCHITECTURE.md` | Modified | Architecture documentation. |
|
||||
| `DOCS/TECH_CHANGELOG.md` | Modified | Technical changelog. |
|
||||
| `.paul/codebase/*` | Modified | PAUL codebase docs mirror. |
|
||||
| `.paul/PROJECT.md` | Modified | Phase 116 marked as shipped. |
|
||||
| `.paul/ROADMAP.md` | Modified | Phase 116 marked complete. |
|
||||
| `.paul/STATE.md` | Modified | Loop closed and next action updated. |
|
||||
|
||||
## Decisions Made
|
||||
|
||||
| Decision | Rationale | Impact |
|
||||
|----------|-----------|--------|
|
||||
| One HostedSMS account | User confirmed one account is enough for first version. | Simpler table and UI; no account selector needed. |
|
||||
| Real SMS test | User requested actual test SMS and SimpleAPI has no ping endpoint. | Test consumes provider credits but verifies the real path. |
|
||||
| Editable test message | User requested editable message. | UI exposes a textarea with default `Test orderPRO HostedSMS`. |
|
||||
| Defer inbound replies | HostedSMS requires inbound interface activation by provider. | Future phase can add `GetUnreadInputSmses` / `GetInputSmses` polling after activation. |
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Summary
|
||||
|
||||
| Type | Count | Impact |
|
||||
|------|-------|--------|
|
||||
| Scope additions | 1 | Cosmetic improvement to last-test panel after user feedback. |
|
||||
| Deferred | 1 | Inbound SMS reply handling deferred. |
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. Last test display too raw**
|
||||
- **Found during:** User verification after successful SMS.
|
||||
- **Issue:** UI showed `MessageId: ...` as plain text.
|
||||
- **Fix:** Split the persisted MessageId into a separate `Identyfikator wiadomości` row inside a status alert.
|
||||
- **Files:** `resources/views/settings/hostedsms.php`, `resources/lang/pl.php`, changelog docs.
|
||||
- **Verification:** PHP lint and user accepted: "jest ok".
|
||||
|
||||
### Deferred Items
|
||||
|
||||
- HostedSMS inbound replies: Requires provider-side activation of the inbound/Webserwis2SMS feature, then a future plan can poll/store inbound messages.
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
| Issue | Resolution |
|
||||
|-------|------------|
|
||||
| Local migration initially blocked because MySQL refused connection | User later confirmed working test in app, so DB/runtime path is verified. |
|
||||
| `sonar-scanner` unavailable in PATH | Documented as skill gap; not blocking UNIFY. |
|
||||
| `vendor/bin/phpunit` missing | Documented; no PHPUnit run. |
|
||||
|
||||
## Verification Results
|
||||
|
||||
- PASS: PHP lint for new/changed PHP files and view/lang files.
|
||||
- PASS: `npm run build --if-present`.
|
||||
- PASS: `git diff --check` with line-ending warnings only.
|
||||
- PASS: User confirmed real HostedSMS test SMS: `2026-05-12 12:03:22 OK HTTP 200`, MessageId `d935d71a-d9a0-4cfb-be06-03fe36c71150`.
|
||||
- GAP: `sonar-scanner` not available in PATH.
|
||||
- GAP: PHPUnit unavailable because `vendor/bin/phpunit` is missing.
|
||||
|
||||
## Skill Audit
|
||||
|
||||
| Expected | Invoked | Notes |
|
||||
|----------|---------|-------|
|
||||
| sonar-scanner | Gap | CLI not found in PATH during APPLY verification. |
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
**Ready:**
|
||||
- HostedSMS credentials can be saved and verified.
|
||||
- Future SMS automation can reuse `HostedSmsIntegrationRepository::getCredentials()` and `HostedSmsApiClient::sendSms()`.
|
||||
|
||||
**Concerns:**
|
||||
- Inbound SMS replies require HostedSMS/DCS activation before implementation.
|
||||
- No persistent SMS send history exists yet beyond `integrations.last_test_*`.
|
||||
|
||||
**Blockers:**
|
||||
- None for closing Phase 116.
|
||||
|
||||
---
|
||||
*Phase: 116-hostedsms-integration, Plan: 01*
|
||||
*Completed: 2026-05-12*
|
||||
Reference in New Issue
Block a user