* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ declare(strict_types=1); namespace PrestaShop\Module\PsEditionBasic\Controller; use Symfony\Component\HttpFoundation\JsonResponse; class AdminPsEditionBasicHomepageController extends AdminPsEditionBasicController { /** * Handle the call back requests * * @return JsonResponse */ public function getSubscription(): JsonResponse { try { $billingService = $this->get('ps_billings.service'); $response = $billingService->getCurrentSubscription(); if ($response['success']) { return new JsonResponse($response['body']); } else { return new JsonResponse(['error' => 'No subscription found'], JsonResponse::HTTP_NOT_FOUND); } } catch (\Exception $e) { return new JsonResponse(['error' => $e], JsonResponse::HTTP_NOT_FOUND); } } }