Fire webhook notification after sending emails

This commit is contained in:
Marcus Moore 2023-10-10 15:13:46 -07:00
parent 47a77eabf2
commit ab3a3de59b

View file

@ -45,11 +45,6 @@ class CheckoutableListener
$acceptance = $this->getCheckoutAcceptance($event); $acceptance = $this->getCheckoutAcceptance($event);
try { try {
if ($this->shouldSendWebhookNotification()) {
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckoutNotification($event));
}
if (! $event->checkedOutTo->locale) { if (! $event->checkedOutTo->locale) {
Notification::locale(Setting::getSettings()->locale)->send( Notification::locale(Setting::getSettings()->locale)->send(
$this->getNotifiables($event), $this->getNotifiables($event),
@ -61,6 +56,11 @@ class CheckoutableListener
$this->getCheckoutNotification($event, $acceptance) $this->getCheckoutNotification($event, $acceptance)
); );
} }
if ($this->shouldSendWebhookNotification()) {
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckoutNotification($event));
}
} catch (Exception $e) { } catch (Exception $e) {
if ($e instanceof ClientException){ if ($e instanceof ClientException){
$statusCode = $e->getResponse()->getStatusCode(); $statusCode = $e->getResponse()->getStatusCode();