fix: isolate public subscribe from integration job failures

Queue Weeztix/Mailwizz after the HTTP response and catch dispatch errors.
Jobs log Mailwizz/Weeztix API failures without rethrowing so sync driver
and terminating callbacks do not surface 500s after a successful create.

Add JS fallback for non-JSON error responses, deployment note, and a
regression test for failing Mailwizz under QUEUE_CONNECTION=sync.

Made-with: Cursor
This commit is contained in:
2026-04-05 11:47:59 +02:00
parent d802ce2a7c
commit de83a6fb76
6 changed files with 102 additions and 27 deletions

View File

@@ -19,6 +19,27 @@ class SyncSubscriberToMailwizzTest extends TestCase
{
use RefreshDatabase;
public function test_subscribe_returns_ok_when_mailwizz_api_fails_under_sync_queue(): void
{
Http::fake([
'*' => Http::response(['status' => 'error', 'message' => 'service unavailable'], 503),
]);
$page = $this->makePageWithMailwizz();
$this->postJson(route('public.subscribe', ['publicPage' => $page->slug]), [
'first_name' => 'Broken',
'last_name' => 'Mailwizz',
'email' => 'broken-mailwizz@example.com',
])
->assertOk()
->assertJson(['success' => true]);
$subscriber = Subscriber::query()->where('email', 'broken-mailwizz@example.com')->first();
$this->assertNotNull($subscriber);
$this->assertFalse($subscriber->synced_to_mailwizz);
}
public function test_subscribe_with_mailwizz_config_runs_sync_create_path_and_marks_synced(): void
{
Http::fake(function (Request $request) {