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:
@@ -561,6 +561,7 @@ return [
|
||||
'apaczka' => 'Apaczka',
|
||||
'inpost' => 'InPost',
|
||||
'shoppro' => 'shopPRO',
|
||||
'hostedsms' => 'HostedSMS',
|
||||
'shoppro_instances' => ':count instancji',
|
||||
],
|
||||
'status' => [
|
||||
@@ -716,6 +717,51 @@ return [
|
||||
'test_failed' => 'Nie udalo sie polaczyc z API Apaczka.',
|
||||
],
|
||||
],
|
||||
'hostedsms' => [
|
||||
'title' => 'Integracja HostedSMS',
|
||||
'description' => 'Konfiguracja konta HostedSMS do wysylki SMS z orderPRO.',
|
||||
'config' => [
|
||||
'title' => 'Konfiguracja API',
|
||||
],
|
||||
'test' => [
|
||||
'title' => 'Test wysylki SMS',
|
||||
'description' => 'Test realnie wysyla SMS przez HostedSMS SimpleAPI.',
|
||||
],
|
||||
'fields' => [
|
||||
'user_email' => 'UserEmail / login',
|
||||
'password' => 'Haslo',
|
||||
'sender' => 'Sender / nadpis',
|
||||
'convert_message_to_gsm7' => 'Konwertuj tresc do GSM7',
|
||||
'is_active' => 'Integracja aktywna',
|
||||
'test_phone' => 'Numer testowy',
|
||||
'test_message' => 'Tresc testowego SMS',
|
||||
],
|
||||
'password' => [
|
||||
'saved' => 'Haslo jest zapisane. Pozostaw pole puste, aby nie zmieniac.',
|
||||
'missing' => 'Brak zapisanego hasla HostedSMS.',
|
||||
],
|
||||
'hints' => [
|
||||
'sender' => 'Nadpis musi byc aktywny po stronie HostedSMS.',
|
||||
],
|
||||
'status' => [
|
||||
'password' => 'Haslo',
|
||||
'active' => 'Aktywna',
|
||||
'saved' => 'zapisane',
|
||||
'missing' => 'brak',
|
||||
'last_test' => 'Ostatni test',
|
||||
'message_id' => 'Identyfikator wiadomości',
|
||||
],
|
||||
'actions' => [
|
||||
'save' => 'Zapisz ustawienia HostedSMS',
|
||||
'send_test' => 'Wyslij testowy SMS',
|
||||
],
|
||||
'flash' => [
|
||||
'saved' => 'Ustawienia HostedSMS zostaly zapisane.',
|
||||
'save_failed' => 'Nie udalo sie zapisac ustawien HostedSMS.',
|
||||
'test_success' => 'Testowy SMS zostal przyjety przez HostedSMS. MessageId: :message_id.',
|
||||
'test_failed' => 'Nie udalo sie wyslac testowego SMS.',
|
||||
],
|
||||
],
|
||||
'inpost' => [
|
||||
'title' => 'Integracja InPost',
|
||||
'description' => 'Konfiguracja polaczenia z API InPost ShipX do obslugi przesylek.',
|
||||
|
||||
126
resources/views/settings/hostedsms.php
Normal file
126
resources/views/settings/hostedsms.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
$settings = is_array($settings ?? null) ? $settings : [];
|
||||
$userEmail = trim((string) ($settings['user_email'] ?? ''));
|
||||
$sender = trim((string) ($settings['sender'] ?? ''));
|
||||
$hasPassword = (bool) ($settings['has_password'] ?? false);
|
||||
$isActive = (bool) ($settings['is_active'] ?? true);
|
||||
$convertToGsm7 = (bool) ($settings['convert_message_to_gsm7'] ?? false);
|
||||
$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;
|
||||
$lastMessageId = '';
|
||||
if (str_starts_with($lastTestMessage, 'MessageId:')) {
|
||||
$lastMessageId = trim(substr($lastTestMessage, strlen('MessageId:')));
|
||||
}
|
||||
?>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="section-title"><?= $e($t('settings.hostedsms.title')) ?></h2>
|
||||
<p class="muted mt-12"><?= $e($t('settings.hostedsms.description')) ?></p>
|
||||
|
||||
<?php if (!empty($errorMessage)): ?>
|
||||
<div class="alert alert--danger mt-12" role="alert"><?= $e((string) $errorMessage) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($successMessage)): ?>
|
||||
<div class="alert alert--success mt-12" role="status"><?= $e((string) $successMessage) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($testMessage)): ?>
|
||||
<div class="alert alert--info mt-12" role="status"><?= $e((string) $testMessage) ?></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="card mt-16">
|
||||
<h3 class="section-title"><?= $e($t('settings.hostedsms.config.title')) ?></h3>
|
||||
|
||||
<div class="muted mt-12">
|
||||
<?= $e($t('settings.hostedsms.status.password')) ?>:
|
||||
<strong><?= $e($hasPassword ? $t('settings.hostedsms.status.saved') : $t('settings.hostedsms.status.missing')) ?></strong>
|
||||
|
|
||||
<?= $e($t('settings.hostedsms.status.active')) ?>:
|
||||
<strong><?= $e($isActive ? $t('settings.integrations_hub.active.yes') : $t('settings.integrations_hub.active.no')) ?></strong>
|
||||
</div>
|
||||
|
||||
<form class="statuses-form mt-16" action="/settings/integrations/hostedsms/save" method="post" novalidate>
|
||||
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.user_email')) ?></span>
|
||||
<input class="form-control" type="email" name="user_email" maxlength="190" value="<?= $e($userEmail) ?>" required>
|
||||
</label>
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.password')) ?></span>
|
||||
<input class="form-control" type="password" name="password" autocomplete="new-password" placeholder="<?= $hasPassword ? '********' : '' ?>" <?= $hasPassword ? '' : 'required' ?>>
|
||||
<span class="muted"><?= $e($hasPassword ? $t('settings.hostedsms.password.saved') : $t('settings.hostedsms.password.missing')) ?></span>
|
||||
</label>
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.sender')) ?></span>
|
||||
<input class="form-control" type="text" name="sender" maxlength="32" value="<?= $e($sender) ?>" required>
|
||||
<span class="muted"><?= $e($t('settings.hostedsms.hints.sender')) ?></span>
|
||||
</label>
|
||||
|
||||
<label class="form-field form-field--inline">
|
||||
<input type="checkbox" name="convert_message_to_gsm7" value="1"<?= $convertToGsm7 ? ' checked' : '' ?>>
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.convert_message_to_gsm7')) ?></span>
|
||||
</label>
|
||||
|
||||
<label class="form-field form-field--inline">
|
||||
<input type="checkbox" name="is_active" value="1"<?= $isActive ? ' checked' : '' ?>>
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.is_active')) ?></span>
|
||||
</label>
|
||||
|
||||
<div class="form-actions mt-16">
|
||||
<button type="submit" class="btn btn--primary"><?= $e($t('settings.hostedsms.actions.save')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card mt-16">
|
||||
<h3 class="section-title"><?= $e($t('settings.hostedsms.test.title')) ?></h3>
|
||||
<p class="muted mt-12"><?= $e($t('settings.hostedsms.test.description')) ?></p>
|
||||
|
||||
<form class="statuses-form mt-16" action="/settings/integrations/hostedsms/test" method="post" novalidate>
|
||||
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.test_phone')) ?></span>
|
||||
<input class="form-control" type="tel" name="phone" inputmode="tel" placeholder="48xxxxxxxxx" required>
|
||||
</label>
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('settings.hostedsms.fields.test_message')) ?></span>
|
||||
<textarea class="form-control" name="message" rows="4" maxlength="4000" required>Test orderPRO HostedSMS</textarea>
|
||||
</label>
|
||||
|
||||
<div class="form-actions mt-16">
|
||||
<button type="submit" class="btn btn--secondary"><?= $e($t('settings.hostedsms.actions.send_test')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ($lastTestAt !== ''): ?>
|
||||
<div class="alert <?= $lastTestStatus === 'ok' ? 'alert--success' : 'alert--danger' ?> mt-16" role="status">
|
||||
<div>
|
||||
<strong><?= $e($t('settings.hostedsms.status.last_test')) ?>:</strong>
|
||||
<?= $e($lastTestAt) ?>
|
||||
<?php if ($lastTestStatus !== ''): ?>
|
||||
<span class="badge badge--<?= $lastTestStatus === 'ok' ? 'success' : 'muted' ?>"><?= $e(strtoupper($lastTestStatus)) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ($lastTestHttpCode !== null): ?>
|
||||
<span class="badge badge--muted">HTTP <?= $e((string) $lastTestHttpCode) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($lastMessageId !== ''): ?>
|
||||
<div class="mt-12">
|
||||
<?= $e($t('settings.hostedsms.status.message_id')) ?>:
|
||||
<code><?= $e($lastMessageId) ?></code>
|
||||
</div>
|
||||
<?php elseif ($lastTestMessage !== ''): ?>
|
||||
<div class="mt-12"><?= $e($lastTestMessage) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
Reference in New Issue
Block a user