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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user