Files
zemailnator/app/Http/Controllers/PaymentCancelController.php
idevakk c312ec3325 feat: Prepare Zemailnator for Dokploy deployment
- Add highly optimized Dockerfile with Nginx and PHP-FPM 8.4
- Add docker-compose.yml configured with Redis and MariaDB 10.11
- Implement entrypoint.sh and supervisord.conf for background workers
- Refactor legacy IMAP scripts into scheduled Artisan Commands
- Secure app by removing old routes with hardcoded basic auth credentials
- Configure email attachments to use Laravel Storage instead of insecure public/tmp
2026-02-28 23:17:39 +05:30

52 lines
1.8 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Subscription;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class PaymentCancelController extends Controller
{
/**
* Show the payment cancellation page
*/
public function show(Request $request)
{
// Get the session token from Polar if available
$sessionToken = $request->get('customer_session_token');
Log::info('PaymentCancelController: Cancellation page accessed', [
'user_id' => auth()->id(),
'session_token' => $sessionToken ? substr($sessionToken, 0, 20).'...' : 'none',
'ip_address' => $request->ip(),
'user_agent' => $request->userAgent(),
]);
// Look for any recent subscriptions for this user
$recentSubscription = null;
if (auth()->check()) {
$recentMinutes = 15; // Look for subscriptions in last 15 minutes
$recentSubscription = Subscription::where('user_id', auth()->id())
->where('created_at', '>=', now()->subMinutes($recentMinutes))
->whereIn('status', ['pending_payment', 'incomplete', 'cancelled'])
->orderBy('created_at', 'desc')
->first();
if ($recentSubscription) {
Log::info('PaymentCancelController: Found recent subscription', [
'user_id' => auth()->id(),
'subscription_id' => $recentSubscription->id,
'status' => $recentSubscription->status,
'provider' => $recentSubscription->provider,
]);
}
}
return view('payment.cancel', [
'sessionToken' => $sessionToken,
'recentSubscription' => $recentSubscription,
]);
}
}