Skip to content

Commit

Permalink
fix send job overwriting bounce and other status
Browse files Browse the repository at this point in the history
  • Loading branch information
199ocero committed Jun 2, 2024
1 parent 69f9b91 commit 8d3ea04
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/Jobs/Ses/SendJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,19 @@ public function handle(): void
->first();

if ($campaignLog) {
$campaignLog->status = CampaignLogStatusType::SENT->value;
$campaignLog->sent_at = Carbon::parse($message['mail']['timestamp']);
$campaignLog->save();
if (! in_array($campaignLog->status, [
CampaignLogStatusType::BOUNCE->value,
CampaignLogStatusType::COMPLAINT->value,
CampaignLogStatusType::DELIVERED->value,
CampaignLogStatusType::REJECTED->value,
CampaignLogStatusType::FAILED->value,
CampaignLogStatusType::RENDERING_FAILURE->value,
CampaignLogStatusType::DELIVERY_DELAY->value,
])) {
$campaignLog->status = CampaignLogStatusType::SENT->value;
$campaignLog->sent_at = Carbon::parse($message['mail']['timestamp']);
$campaignLog->save();
}
}
}
}

0 comments on commit 8d3ea04

Please sign in to comment.