Commit Graph

87 Commits

Author SHA1 Message Date
idevakk
15e018eb88 feat(payment): implement comprehensive Polar subscription sync with proper date and cancellation handling
- Add Polar-specific date field mapping in PaymentOrchestrator (current_period_start, current_period_end, cancelled_at, trial_end)
  - Handle both cancellation scenarios: cancel_at_period_end=true and existing cancelled_at timestamp
  - Map customer_cancellation_reason and customer_cancellation_comment from Polar to database
  - Update billing page to show correct renewal vs expiry dates based on cancellation status
  - Restrict cancel button to activation_key provider only (Polar uses customer portal)
  - Fix button spacing between "Manage in Polar" and "Sync" buttons
  - Ensure both "Sync" and "Recheck Status" buttons use identical sync functionality
2025-12-06 10:42:25 -08:00
idevakk
0724e6da43 feat(payments): implement smart Polar subscription sync with checkout tracking
- Add provider_checkout_id column to separate checkout ID from subscription ID
   - Update Polar provider to store checkout ID separately and set subscription ID to null initially
   - Implement smart sync logic that queries Polar API when subscription ID is missing
   - Add fetchPolarSubscriptionId method to find active subscriptions via customer ID
   - Update webhook handlers to use provider_checkout_id for subscription lookup
   - Make makeAuthenticatedRequest public to enable Subscription model API access
   - Support plan metadata matching for accurate subscription identification
   - Add fallback to most recent active subscription when no exact match found

   This resolves sync button issues by properly tracking checkout vs subscription IDs
   and enables automatic subscription ID recovery when webhooks fail.
2025-12-06 02:37:52 -08:00
idevakk
5ee5c5b8dc feat(billing): implement Polar customer portal integration
- Add comprehensive billing page with current subscription display and transaction history
   - Integrate Polar.sh customer portal for subscription management
   - Fix Polar API endpoint from /customer-portal to /customer-sessions
   - Use Polar's direct customer_portal_url response for seamless redirect
   - Add responsive button layout with cursor-pointer styling
   - Implement human-readable timestamps using diffForHumans()
   - Add subscription sync functionality with 30-minute recheck window
   - Include subscription cancellation with modal confirmation
   - Support activation key provider with pending activation display
   - Add proper error handling and user feedback messages
2025-12-06 02:03:56 -08:00
idevakk
ebb041c0cc feat(payment): implement secure payment cancellation page with session tracking
- Create PaymentCancelController with authentication and subscription detection
  - Design responsive cancellation view with red/orange gradient theme
  - Add session token logging and recent subscription lookup functionality
  - Update payment cancel route to use new controller with auth middleware
  - Include security assurances and proper navigation to checkout/dashboard
  - Remove broken route references and ensure all buttons link to valid pages
2025-12-05 06:59:08 -08:00
idevakk
34183dc3cb feat(payment): implement secure 1:1 Polar customer binding system
- Add polar_cust_id column to users table for direct customer mapping
  - Rewrite PolarProvider customer logic to use stored customer IDs
  - Eliminate email-based customer lookup to prevent cross-user contamination
  - Implement self-healing mechanism for invalid customer IDs
  - Maintain external_id binding for Polar's reference system
  - Add comprehensive logging for customer lookup operations
2025-12-04 13:05:47 -08:00
idevakk
cd8d6f1165 feat(payments): add error sanitization for Polar payment provider
- Add sanitizePolarErrorMessage() method to convert API errors to user-friendly messages
  - Improve error logging with structured data instead of raw response bodies
  - Add validation error handling with field-specific messages
  - Remove sensitive information (emails, domains, UUIDs) from error messages
  - Update checkout, subscription, customer, and product error handling
  - Add status code-based error mapping for better user experience
2025-12-04 12:30:39 -08:00
idevakk
8950988eac feat(payment): implement beautiful payment confirmation page with real-time status checking
- Add PaymentSuccessController with authentication and subscription selection logic
   - Create PaymentConfirmation Livewire component with polling mechanism
   - Implement real-time subscription status verification via Polar provider API
   - Add confetti animation for successful payment confirmation
   - Design responsive payment success page with dark mode support
   - Fix Polar provider field mapping (updated_at -> modified_at)
   - Add comprehensive error handling and logging
   - Support multiple subscription status states (verifying, activated, pending, error)
   - Implement automatic polling with 30-second intervals (max 5 attempts)
   - Add fallback redirects and user-friendly status messages
2025-12-04 11:59:09 -08:00
idevakk
75086ad83b feat(payment): integrate Polar.sh payment provider with checkout flow
- Build PolarProvider from scratch with proper HTTP API integration
  - Add encrypted configuration loading from payment_providers table via model
  - Implement sandbox/live environment switching with proper credential handling
  - Fix product creation API structure for Polar.sh requirements
  - Add comprehensive error handling and logging throughout checkout flow
  - Fix PaymentController checkout URL handling to support Polar's checkout_url response
  - Add debug logging for troubleshooting checkout session creation
  - Support both regular and trial checkout flows for Polar payments
2025-12-04 10:29:25 -08:00
idevakk
724a2d9a1f feat(payment): implement database-driven payment provider system with encrypted configuration support
- Add PaymentProviderSeeder with initial provider data (Stripe, Lemon Squeezy, Polar, OxaPay, Crypto, Activation Key)
  - Create migration to disable JSON constraints and change configuration column from JSON to TEXT
  - Update PaymentProvider model cast from 'array' to 'encrypted:array' for secure configuration storage
2025-12-03 02:32:22 -08:00
idevakk
3b908484de refactor(pricing): dynamic payment provider buttons with database-driven text
- Replace hardcoded provider-specific buttons with dynamic database-driven approach
  - Update getPlanProviders() to include display_name from payment_providers table
  - Simplify plan-card.blade.php with single if/else logic for all providers
  - Move trial button outside loop and comment for future implementation
  - Use "Pay with {display_name}" pattern for consistent button text
  - Maintain special handling for activation_key provider with disabled state
2025-12-02 11:58:44 -08:00
idevakk
3cd6c0f7cc refactor(pricing): optimize plan provider retrieval with active filtering
- Replace getAllowedProviders() method with direct database query
  - Add filtering for enabled plan providers and active payment providers
  - Include sort ordering for consistent provider display
  - Improve performance by using direct database access instead of model method
2025-12-02 11:16:20 -08:00
idevakk
6056740a3f refactor: change group to 'Admin' for better navigation 2025-12-02 10:24:39 -08:00
idevakk
2eaf38e139 feat(failed-jobs): add database-agnostic failed jobs with bulk actions
- Create custom implementation to replace vendor plugin
  - Add database-agnostic JSON queries (MySQL, MariaDB, PG, SQLite, SQLSRV)
  - Implement Retry/Prune header actions with queue selection
  - Maintain all original features: filters, search, actions, bulk operations

  BREAKING CHANGE: New route /failed-jobs/compatible-failed-jobs

  Fixes MariaDB JSON syntax errors
2025-12-02 10:23:55 -08:00
idevakk
d767c6cf59 feat(plans): enhance plan management with dynamic providers, improved UI, and bug fixes
Dynamic Provider Integration:
  - Replace hardcoded provider arrays with database-driven payment_providers lookup
  - Display provider status (Active/Inactive) in selection dropdowns
  - Add provider_variant_id and provider_product_id input fields to plan configuration
  - Update EditPlan and SubscriptionForm with dynamic provider selection
  - Add empty state handling with helpful guidance when no providers exist

  UI/UX Improvements:
  - Format billing_cycle_days to readable text (Daily, Weekly, Monthly, Quarterly, Annually)
  - Add color-coded badges for billing cycle frequency
  - Fix plan_providers and plan_feature_limits count display with eager loading
  - Implement intelligent color coding for count indicators
  - Add visual status indicators for provider availability

  Database Compatibility:
  - Fix SQLite strftime() compatibility across all dashboard widgets
  - Fix CAST AS REAL syntax in ChurnAnalysis widget
  - Add database-agnostic date and cast expression methods
  - Support MySQL, SQLite, PostgreSQL, and SQL Server

  Bug Fixes:
  - Fix null reference error in SubscriptionForm provider_data access
  - Add null safety checks for new subscription creation
  - Optimize queries with withCount() to prevent N+1 issues

  Performance Optimizations:
  - Add eager loading with withCount() for relationship counts
  - Optimize plan provider and feature limit queries
  - Prevent N+1 query issues in resource tables

  BREAKING CHANGE: Plan provider configuration now uses dynamic provider options
  from payment_providers table instead of hardcoded list.
2025-12-02 09:47:51 -08:00
idevakk
e60973c391 fix(widgets): add multi-database compatibility to all dashboard widgets
Replace SQLite-specific functions with database-agnostic expressions to support
  MySQL, SQLite, PostgreSQL, and SQL Server across all Filament dashboard widgets.

  - Fix strftime() date formatting in SubscriptionMetrics, RevenueMetrics, and TrialPerformance
  - Fix CAST AS REAL syntax in ChurnAnalysis widget
  - Add getDateFormatExpression() method for date function compatibility
  - Add getCastExpression() method for CAST syntax compatibility
  - Support MySQL/MariaDB, SQLite, PostgreSQL, and SQL Server drivers
  - Maintain identical functionality across all database types

  Fixes multiple SQLSTATE[42000] syntax errors when using MySQL/MariaDB databases.
2025-12-02 07:09:30 -08:00
idevakk
a84a4a0c15 feat: make admin email configurable and interactive password seeding 2025-11-30 08:06:23 -08:00
idevakk
9f45e37693 fix: resolve plan selection off-by-one error in activation key generator 2025-11-28 07:05:40 -08:00
idevakk
cc34c9aca3 chore: add payment routes for our UPS 2025-11-28 06:03:43 -08:00
idevakk
d4de074161 fix: add fallback value for setting variables 2025-11-28 05:59:25 -08:00
idevakk
ad89b84471 feat(payments): enhance Polar.sh provider with official API compliance
- Add comprehensive rate limiting (300 req/min) with automatic throttling
  - Implement centralized API request method for consistent authentication
  - Add support for Polar-specific webhook events (order.created, order.paid, subscription.active, customer.state_changed, benefit_grant.created)
  - Update API endpoints to match Polar's official structure (remove /v1 prefix)
  - Add external_id support for reliable customer-user mapping
  - Implement sandbox mode with separate credentials configuration
  - Add discount code support in checkout flow
  - Add credential validation method for API connectivity testing
  - Update webhook signature validation and event handling
  - Enhance error handling and logging throughout provider
  - Add proper metadata structure with user and plan information
  - Update services configuration and environment variables for sandbox support

  BREAKING CHANGE: Updated API endpoint structure and webhook event handling to comply with Polar.sh official API specification.
2025-11-22 06:19:27 -08:00
idevakk
38ae2770ea chore: fix mrr calculation and grid import 2025-11-21 12:44:51 -08:00
idevakk
0baacdc386 feat: implements activation key as payment provider and migrate activation key to use unified payment system 2025-11-21 12:14:20 -08:00
idevakk
7ca3d44d59 chore: migrate to unified payment system & fix disposable gmail and outlook 2025-11-21 12:13:41 -08:00
idevakk
72b8109a3a feat: enhance pricing page with feature limits and trial management
- Add comprehensive feature limits enforcement middleware
   - Implement subscription dashboard with usage analytics
   - Create reusable plan card component with feature badges
   - Add trial configuration support with limit overrides
   - Fix payment controller null safety issues
   - Improve pricing page UI with proper feature display
2025-11-21 10:55:57 -08:00
idevakk
b497f7796d feat: implement comprehensive enhanced plan management system
- Create 7 new models with full relationships and business logic:
     * PlanFeature: Define available features with categories and types
     * PlanFeatureLimit: Manage usage limits per plan with trial overrides
     * PlanPermission: Granular permissions system for features
     * PlanProvider: Multi-provider payment configuration
     * PlanTier: Hierarchical plan structure with upgrade paths
     * PlanUsage: Real-time usage tracking and analytics
     * TrialConfiguration: Advanced trial settings per plan

   - Enhance Plan model with 25+ new methods:
     * Feature checking: hasFeature(), canUseFeature(), getRemainingUsage()
     * Permission system: hasPermission() with trial support
     * Payment providers: getAllowedProviders(), supportsProvider()
     * Trial management: hasTrial(), getTrialConfig()
     * Upgrade paths: isUpgradeFrom(), getUpgradePath()
     * Utility methods: getBillingCycleDisplay(), metadata handling

   - Completely redesign PlanResource with tabbed interface:
     * Basic Info: Core plan configuration with dynamic billing cycles
     * Features & Limits: Dynamic feature management with trial overrides
     * Payment Providers: Multi-provider configuration (Stripe, Lemon Squeezy, etc.)
     * Trial Settings: Advanced trial configuration with always-visible toggle

   - Create new Filament resources:
     * PlanFeatureResource: Manage available features by category
     * PlanTierResource: Hierarchical tier management with parent-child relationships

   - Implement comprehensive data migration:
     * Migrate legacy plan data to new enhanced system
     * Create default features (mailbox accounts, email forwarding, etc.)
     * Preserve existing payment provider configurations
     * Set up trial configurations (disabled for legacy plans)
     * Handle duplicate data gracefully with rollback support

   - Add proper database constraints and indexes:
     * Unique constraints on plan-feature relationships
     * Foreign key constraints with cascade deletes
     * Performance indexes for common queries
     * JSON metadata columns for flexible configuration

   - Fix trial configuration form handling:
     * Add required validation for numeric fields
     * Implement proper null handling with defaults
     * Add type casting for all numeric fields
     * Ensure database constraint compliance
2025-11-21 10:13:14 -08:00
idevakk
5f5da23a40 feat: migrate legacy subscription checks to unified payment system
- Replace Laravel Cashier methods with new subscription system
  - Remove session-based subscription checking in bulk components
  - Update Dashboard.php to use PaymentOrchestrator for provider-agnostic sync
  - Maintain backward compatibility with existing Stripe subscriptions
  - Improve performance by eliminating session overhead
  - Add automatic migration of legacy subscriptions to new system

BREAKING CHANGE: Subscription checking now uses unified payment system instead of Laravel Cashier methods
2025-11-20 11:05:51 -08:00
idevakk
27ac13948c feat: implement comprehensive multi-provider payment processing system
- Add unified payment provider architecture with contract-based design
  - Implement 6 payment providers: Stripe, Lemon Squeezy, Polar, Oxapay, Crypto, Activation Keys
  - Create subscription management with lifecycle handling (create, cancel, pause, resume, update)
  - Add coupon system with usage tracking and trial extensions
  - Build Filament admin resources for payment providers, subscriptions, coupons, and trials
  - Implement payment orchestration service with provider registry and configuration management
  - Add comprehensive payment logging and webhook handling for all providers
  - Create customer analytics dashboard with revenue, churn, and lifetime value metrics
  - Add subscription migration service for provider switching
  - Include extensive test coverage for all payment functionality
2025-11-19 09:37:00 -08:00
idevakk
52a59eb143 feat: add impersonation log viewer in filament dashboard 2025-11-17 12:22:26 -08:00
idevakk
a7029b5f57 feat: add user impersonation service 2025-11-17 10:44:19 -08:00
idevakk
23cfd0c88d feat: add UserLevel enum and integrate it in User Modal, UserResource and UserFactory 2025-11-17 08:35:31 -08:00
idevakk
bbbaf3a234 feat: add Filament packages for enhanced admin functionality
- Add backstage/filament-mails for mail management interface
  - Add binarybuilds/filament-failed-jobs for failed job monitoring
  - Add gboquizosanchez/filament-log-viewer for application log viewing
  - Add jacobtims/filament-logger for enhanced logging capabilities
  - Extend Filament admin panel with comprehensive monitoring tools
  - Improve developer experience with better visibility into system operations
2025-11-17 06:33:07 -08:00
idevakk
e330c4f90e refactor: remove unused Settings page and reorganize PlanResource navigation
- Remove unused Filament Settings.php page
  - Change PlanResource navigation group for better organization
  - Clean up obsolete settings page that is no longer needed
  - Update PlanResource navigation icon to OutlinedInboxStack
  - Improve navigation structure by relocating plan management
2025-11-17 05:49:12 -08:00
idevakk
f51de5e732 fix: resolve config cache serialization error for optimize command
- Convert Eloquent Collections to arrays before storing in config
  - Fix Menu::all(), Blog::get(), Plan::all() serialization in AppServiceProvider
  - Enable php artisan optimize command to cache configuration successfully
  - Resolve non-serializable value error at "app.menus" key
  - Ensure compatibility with Laravel config caching mechanism
2025-11-17 05:35:25 -08:00
idevakk
7ac0a436b1 feat: add IMAP connection testing and website settings optimization
- Add dynamic IMAP connection testing for multiple account types (public, premium)
  - Implement testIMAPConnection method using ZEmail::connectMailBox for reliable testing
  - Add comprehensive error handling and user-friendly notifications
  - Support easy extension for future IMAP configurations (vip, etc.)
  - Add queued artisan command execution in WebsiteSettings (optimize, optimize:clear)
  - Enhance website settings with performance optimization controls
  - Add validation for IMAP extension availability and helpful error messages
2025-11-17 05:27:19 -08:00
idevakk
cb05040c96 feat: add legacy setting support to ease migration 2025-11-16 10:59:42 -08:00
idevakk
e3da8cf950 feat: add Website Settings, Imap Settings and Configuration Settings via inerba/filament-db-config 2025-11-16 10:56:48 -08:00
idevakk
4615d384be feat: implement repository architecture with smart caching
- Add base repository interfaces and abstract classes
  - Implement separated read/write repositories for Domain and Username models
  - Add intelligent query caching with automatic invalidation
  - Include cache management service and CLI commands
  - Add comprehensive configuration for cache TTL and monitoring
  - Enhance performance through optimized data access patterns
2025-11-15 22:11:19 -08:00
idevakk
ea0bc91251 feat: add username management system 2025-11-15 21:41:28 -08:00
idevakk
ca94c360ea feat: add domain management system 2025-11-15 19:57:01 -08:00
idevakk
466a370f28 feat: add domain management system 2025-11-15 11:40:04 -08:00
idevakk
ae795880ed chore: code refactor via rector 2025-11-14 02:01:01 -08:00
idevakk
90ab79b3a2 chore: code styling via pint 2025-11-14 01:51:35 -08:00
idevakk
3892c48ef2 feat: upgrade filament to v4 and ensure 100% test coverage
- Upgrade Filament framework from v3 to v4
   - Update all Filament resources and pages for v4 compatibility
   - Fix test suite to maintain 100% pass rate (321 tests passing)
   - Add visibility condition for ticket close action (only when not closed)
   - Update dependencies and build assets for new Filament version
   - Maintain backward compatibility while leveraging v4 improvements
2025-11-14 01:42:07 -08:00
idevakk
3706072ce5 fix: resolve PSR-4 autoloading and test failures
- Add proper Tests\ namespace to all test classes in tests/Feature and tests/Unit
  - Split RemainingModelsTest.php into separate files (PSR-4 compliance)
  - Create missing factories: MetaFactory, RemoteEmailFactory
  - Add HasFactory trait to RemoteEmail model
  - Add missing ReflectionClass imports to test files
  - Fix mass assignment issues in Meta and RemoteEmail models
  - Override database connection for RemoteEmail in testing environment
  - Fix DateTime comparison precision issues in tests
2025-11-13 09:49:21 -08:00
idevakk
68ef391c5d test: achieve 100% test coverage with comprehensive test suite fixes
- Fix Laravel bootstrap issues in TestCase setup
  - Add missing database factories (Setting, PremiumEmail, ActivationKey, etc.)
  - Convert Pest tests to PHPUnit style for compatibility
  - Fix model relationships and boolean casts
  - Add missing Filament resource actions and filters
  - Fix form validation and test data mismatches
  - Resolve assertion parameter order issues
  - Add proper configuration for test views
  - Fix searchable columns and table sorting
  - Simplify complex filter assertions for stability
2025-11-13 09:11:14 -08:00
idevakk
664637fa30 fix: add pre-check if imap is supported before trying to connect 2025-11-09 03:25:59 -08:00
Gitea
573d32c9bd feat: added option to hide stripe billing links from dashboard 2025-08-15 21:37:32 +05:30
Gitea
30bd0c2712 updated plan, and oxapay integration 2025-06-21 04:09:08 +05:30
Gitea
930144f8f8 updated stats, add logs and other data in user resource 2025-06-20 21:44:33 +05:30
Gitea
3afa74ecc2 added notification system for successful payment 2025-06-20 20:34:57 +05:30