diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index bdd5de443e7b..1b3005ce2649 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -717,7 +717,7 @@ public static function generateRandomString($length = 10) * @since [v7.0.14] * @return array */ - public static function deprecationCheck(){ + public static function deprecationCheck() : array { // The check and message that the user is still using the deprecated version $deprecations = [ 'ms_teams_deprecated' => array( diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 7d8b5c1c9df5..b9b176f16f72 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -30,6 +30,7 @@ use Illuminate\Support\Facades\Notification; use Exception; use Illuminate\Support\Facades\Log; +use Osama\LaravelTeamsNotification\TeamsNotification; class CheckoutableListener { @@ -80,11 +81,16 @@ public function onCheckedOut($event) Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); } } - // Send Webhook notification if ($this->shouldSendWebhookNotification()) { - Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) - ->notify($this->getCheckoutNotification($event, $acceptance)); + if (Setting::getSettings()->webhook_selected === 'microsoft') { + $message = $this->getCheckoutNotification($event)->toMicrosoftTeams(); + $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint); + $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams + } else { + Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + ->notify($this->getCheckoutNotification($event, $acceptance)); + } } } catch (ClientException $e) { Log::debug("Exception caught during checkout notification: " . $e->getMessage()); diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 39f965f87a88..64196b5dd9b9 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -64,7 +64,7 @@ public function mount() { "name" => trans('admin/settings/general.ms_teams'), "icon" => "fa-brands fa-microsoft", "placeholder" => "https://abcd.webhook.office.com/webhookb2/XXXXXXX", - "link" => "https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet#create-incoming-webhooks-1", + "link" => "https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498", "test" => "msTeamTestWebhook" ), ];