Skip to content

Commit

Permalink
merged in develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Godmartinz committed Oct 30, 2024
1 parent d6ba303 commit b26cae3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 9 additions & 3 deletions app/Listeners/CheckoutableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Illuminate\Support\Facades\Notification;
use Exception;
use Illuminate\Support\Facades\Log;
use Osama\LaravelTeamsNotification\TeamsNotification;

class CheckoutableListener
{
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion app/Livewire/SlackSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
];
Expand Down

0 comments on commit b26cae3

Please sign in to comment.