feat(128): erli orders import
Phase 128 complete: - add Erli /inbox order import with safe mark-read ACK - add cron/manual import controls and sync state tracking - map Erli orders into orderPRO aggregates with mapper tests and docs
This commit is contained in:
@@ -870,11 +870,18 @@ return [
|
||||
'title' => 'Test polaczenia',
|
||||
'description' => 'Test wykonuje realne, bezpieczne zapytanie GET do API Erli.',
|
||||
],
|
||||
'import' => [
|
||||
'title' => 'Import zamowien',
|
||||
'description' => 'Pobiera nieprzeczytane wiadomosci Erli inbox i importuje obslugiwane zdarzenia zamowien do orderPRO.',
|
||||
],
|
||||
'fields' => [
|
||||
'account_label' => 'Nazwa konta',
|
||||
'api_key' => 'Klucz API',
|
||||
'options' => 'Opcje',
|
||||
'is_active' => 'Integracja aktywna',
|
||||
'orders_fetch_enabled' => 'Wlacz automatyczny import zamowien',
|
||||
'orders_fetch_start_date' => 'Data startu importu',
|
||||
'orders_import_interval_minutes' => 'Interwal importu (minuty)',
|
||||
],
|
||||
'api_key' => [
|
||||
'saved' => 'Klucz API jest zapisany. Pozostaw pole puste, aby nie zmieniac.',
|
||||
@@ -882,6 +889,8 @@ return [
|
||||
],
|
||||
'hints' => [
|
||||
'account_label' => 'Opcjonalna nazwa widoczna w hubie integracji.',
|
||||
'orders_fetch_start_date' => 'Opcjonalnie pominie zdarzenia starsze niz podana data, jesli payload Erli zawiera date zamowienia.',
|
||||
'orders_import_interval_minutes' => 'Dotyczy zadania cron `erli_orders_import`. Zakres: 1-1440 minut.',
|
||||
],
|
||||
'status' => [
|
||||
'secret' => 'Sekret API',
|
||||
@@ -893,12 +902,18 @@ return [
|
||||
'actions' => [
|
||||
'save' => 'Zapisz ustawienia Erli',
|
||||
'test' => 'Test polaczenia',
|
||||
'import_now' => 'Importuj zamowienia teraz',
|
||||
],
|
||||
'flash' => [
|
||||
'saved' => 'Ustawienia Erli zostaly zapisane.',
|
||||
'save_failed' => 'Nie udalo sie zapisac ustawien Erli.',
|
||||
'test_success' => 'Polaczenie z API Erli dziala.',
|
||||
'test_failed' => 'Nie udalo sie polaczyc z API Erli.',
|
||||
'import_success' => 'Import Erli zakonczony. Przetworzone: :processed, nowe: :created, aktualizacje: :updated, bledy: :failed, pominiete: :skipped, inbox ACK: :ack.',
|
||||
'import_failed' => 'Nie udalo sie zaimportowac zamowien Erli.',
|
||||
],
|
||||
'validation' => [
|
||||
'orders_fetch_start_date_invalid' => 'Data startu importu musi miec format RRRR-MM-DD.',
|
||||
],
|
||||
],
|
||||
'inpost' => [
|
||||
|
||||
@@ -7,6 +7,9 @@ $lastTestAt = trim((string) ($settings['last_test_at'] ?? ''));
|
||||
$lastTestStatus = trim((string) ($settings['last_test_status'] ?? ''));
|
||||
$lastTestMessage = trim((string) ($settings['last_test_message'] ?? ''));
|
||||
$lastTestHttpCode = $settings['last_test_http_code'] ?? null;
|
||||
$ordersFetchEnabled = (bool) ($settings['orders_fetch_enabled'] ?? false);
|
||||
$ordersFetchStartDate = trim((string) ($settings['orders_fetch_start_date'] ?? ''));
|
||||
$ordersImportIntervalMinutes = (int) ($ordersImportIntervalMinutes ?? 5);
|
||||
?>
|
||||
|
||||
<section class="card">
|
||||
@@ -24,6 +27,10 @@ $lastTestHttpCode = $settings['last_test_http_code'] ?? null;
|
||||
<?php if (!empty($testMessage)): ?>
|
||||
<div class="mt-12"><?php $type='info'; $message=(string) $testMessage; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($importMessage)): ?>
|
||||
<div class="mt-12"><?php $type='info'; $message=(string) $importMessage; $dismissible=true; include dirname(__DIR__) . '/components/alert.php'; ?></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="card mt-16">
|
||||
@@ -59,15 +66,43 @@ $lastTestHttpCode = $settings['last_test_http_code'] ?? null;
|
||||
<input type="checkbox" name="is_active" value="1"<?= $isActive ? ' checked' : '' ?>>
|
||||
<span><?= $e($t('settings.erli.fields.is_active')) ?></span>
|
||||
</label>
|
||||
<label class="integration-settings-checkboxes__item">
|
||||
<input type="checkbox" name="orders_fetch_enabled" value="1"<?= $ordersFetchEnabled ? ' checked' : '' ?>>
|
||||
<span><?= $e($t('settings.erli.fields.orders_fetch_enabled')) ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.erli.fields.orders_fetch_start_date')) ?></span>
|
||||
<input class="form-control" type="date" name="orders_fetch_start_date" value="<?= $e($ordersFetchStartDate) ?>">
|
||||
<span class="muted"><?= $e($t('settings.erli.hints.orders_fetch_start_date')) ?></span>
|
||||
</label>
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.erli.fields.orders_import_interval_minutes')) ?></span>
|
||||
<input class="form-control" type="number" min="1" max="1440" name="orders_import_interval_minutes" value="<?= $e((string) $ordersImportIntervalMinutes) ?>">
|
||||
<span class="muted"><?= $e($t('settings.erli.hints.orders_import_interval_minutes')) ?></span>
|
||||
</label>
|
||||
|
||||
<div class="form-actions mt-16">
|
||||
<button type="submit" class="btn btn--primary"><?= $e($t('settings.erli.actions.save')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card mt-16">
|
||||
<h3 class="section-title"><?= $e($t('settings.erli.import.title')) ?></h3>
|
||||
<p class="muted mt-12"><?= $e($t('settings.erli.import.description')) ?></p>
|
||||
|
||||
<form class="statuses-form mt-16" action="/settings/integrations/erli/import" method="post">
|
||||
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn--secondary"><?= $e($t('settings.erli.actions.import_now')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card mt-16">
|
||||
<h3 class="section-title"><?= $e($t('settings.erli.test.title')) ?></h3>
|
||||
<p class="muted mt-12"><?= $e($t('settings.erli.test.description')) ?></p>
|
||||
|
||||
Reference in New Issue
Block a user