feat(notifications): implement comprehensive telegram notifications for payment providers

- Add NotifyMe trait with centralized Telegram bot integration
  - Implement webhook notifications for Polar, OxaPay, and ActivationKey providers
  - Add subscription lifecycle notifications (create, activate, cancel, pause, resume)
  - Enhance Polar webhook processing with user context and error handling
  - Fix subscription.updated and subscription.canceled webhook column errors
  - Add idempotent webhook processing to prevent duplicate handling
This commit is contained in:
idevakk
2025-12-08 09:25:19 -08:00
parent 8d8cd44ea5
commit 0d33c57b32
5 changed files with 654 additions and 47 deletions

View File

@@ -2,13 +2,13 @@
namespace App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;
use Exception;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
trait NotifyMe
{
public function sendTelegramNotification($message)
public function sendTelegramNotification($message): bool
{
$botToken = config('app.notify_tg_bot_token');
$chatId = config('app.notify_tg_chat_id');
@@ -28,9 +28,7 @@ trait NotifyMe
];
try {
$response = Http::post($url, $data);
return $response->successful();
return Http::post($url, $data)->successful();
} catch (Exception $e) {
Log::error('Failed to send Telegram notification: '.$e->getMessage());