| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\Subscriptions; |
| 4 |
|
| 5 |
use FluentCart\App\App; |
| 6 |
use FluentCart\App\Models\Subscription; |
| 7 |
use FluentCart\App\Modules\Subscriptions\Services\Filter\SubscriptionFilter; |
| 8 |
use FluentCart\Framework\Support\Arr; |
| 9 |
|
| 10 |
class SubscriptionModule |
| 11 |
{ |
| 12 |
public static function register() |
| 13 |
{ |
| 14 |
$self = new static(); |
| 15 |
App::getInstance()->addAction('fluentcart_loaded', [$self, 'init']); |
| 16 |
} |
| 17 |
|
| 18 |
public function init($app) |
| 19 |
{ |
| 20 |
$app->router->group(function ($router) { |
| 21 |
require_once __DIR__ . '/Http/subscriptions-api.php'; |
| 22 |
}); |
| 23 |
|
| 24 |
(new \FluentCart\App\Modules\Subscriptions\Http\Handlers\AdminMenuHandler())->register(); |
| 25 |
|
| 26 |
// Checkout gateway capability gate — new subscription carts, renewals, and reactivations. |
| 27 |
(new \FluentCart\App\Modules\Subscriptions\Services\SubscriptionGatewayGate())->register(); |
| 28 |
|
| 29 |
// Auto-charge engine for system (token-charged) subscription renewal invoices. |
| 30 |
(new \FluentCart\App\Modules\Subscriptions\Services\SystemChargeService())->register(); |
| 31 |
|
| 32 |
add_filter('fluent_cart/admin_filter_options', function ($filterOptions, $args) { |
| 33 |
$filterOptions['subscription_filter_options'] = SubscriptionFilter::getTableFilterOptions(); |
| 34 |
return $filterOptions; |
| 35 |
}, 10, 2); |
| 36 |
} |
| 37 |
} |
| 38 |
|