Skip to content

Commit 22b16c4

Browse files
committed
Check if the transaction id exists in our database
1 parent 940fb53 commit 22b16c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Listeners/OnWebhookCall.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ public function handle(WebhookCallReceived $event)
2424
'data' => $event->request->all()
2525
]);
2626

27-
$response = ElasticEmail::Email()->GetStatus($event->request->transaction, $showFailed = false, $showSent = true, $showDelivered = true, $showPending = true, $showOpened = true, $showClicked = false, $showAbuse = false, $showUnsubscribed = false, $showErrors = false, $showMessageIDs = false);
28-
2927
$outbound = ElasticEmailOutbound::where('transaction_id', $event->request->transaction)->first();
3028

29+
if(is_null($outbound)){
30+
return false;
31+
}
32+
33+
$response = ElasticEmail::Email()->GetStatus($event->request->transaction, $showFailed = false, $showSent = true, $showDelivered = true, $showPending = true, $showOpened = true, $showClicked = false, $showAbuse = false, $showUnsubscribed = false, $showErrors = false, $showMessageIDs = false);
34+
3135
if($response->deliveredcount > 0 && is_null($outbound->delivered_at)){
3236
$outbound->delivered_at = now();
3337
$outbound->save();

0 commit comments

Comments
 (0)