Loading Controllers/api/v2/pro.php +29 −8 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,8 @@ class pro implements Interfaces\Api ->setUser(Session::getLoggedinUser()); ->setUser(Session::getLoggedinUser()); return Factory::response([ return Factory::response([ 'active' => $manager->isActive() 'isActive' => $manager->isActive(), /* TODO: Send values */ ]); ]); } } Loading @@ -45,13 +46,28 @@ class pro implements Interfaces\Api $manager $manager ->setUser(Session::getLoggedinUser()); ->setUser(Session::getLoggedinUser()); switch ($pages[0]) { case 'enable': // TODO: Send and process payment data $success = $manager->enable(time() + (365 * 86400)); $success = $manager->enable(time() + (365 * 86400)); if (!$success) { return Factory::response([ return Factory::response([ 'done' => $success, 'status' => 'error', 'message' => 'Error activating Pro', ]); ]); } } return Factory::response([/* TODO: Send values */]); default: return Factory::response([ 'status' => 'error', 'message' => 'Unknown method' ]); } } /** /** * Equivalent to HTTP PUT method * Equivalent to HTTP PUT method * @param array $pages * @param array $pages Loading @@ -76,8 +92,13 @@ class pro implements Interfaces\Api $success = $manager->disable(); $success = $manager->disable(); if (!$success) { return Factory::response([ return Factory::response([ 'done' => $success, 'status' => 'error', 'message' => 'Error disabling Pro', ]); ]); } } return Factory::response([]); } } } Core/Pro/Delegates/InitializeValuesDelegate.php +3 −1 Original line number Original line Diff line number Diff line Loading @@ -39,10 +39,12 @@ class InitializeValuesDelegate if (!$values) { if (!$values) { $values = new Values(); $values = new Values(); $values ->setUserGuid($user->guid); } } if (!$values->getDomain()) { if (!$values->getDomain()) { $values->setDomain("pro-{$user->username}.minds.com"); $values->setDomain("pro-{$user->guid}.minds.com"); } } $this->repository $this->repository Loading Core/Pro/Repository.php +2 −2 Original line number Original line Diff line number Diff line Loading @@ -49,11 +49,11 @@ class Repository $cqlOpts = []; $cqlOpts = []; if ($opts['user_guid']) { if ($opts['user_guid']) { $where .= 'user_guid = ?'; $where[] = 'user_guid = ?'; $values[] = new Bigint($opts['user_guid']); $values[] = new Bigint($opts['user_guid']); } elseif ($opts['domain']) { } elseif ($opts['domain']) { $cql = "SELECT * FROM pro_by_domain"; $cql = "SELECT * FROM pro_by_domain"; $where = 'domain = ?'; $where[] = 'domain = ?'; $values[] = $opts['domain']; $values[] = $opts['domain']; } } Loading Loading
Controllers/api/v2/pro.php +29 −8 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,8 @@ class pro implements Interfaces\Api ->setUser(Session::getLoggedinUser()); ->setUser(Session::getLoggedinUser()); return Factory::response([ return Factory::response([ 'active' => $manager->isActive() 'isActive' => $manager->isActive(), /* TODO: Send values */ ]); ]); } } Loading @@ -45,13 +46,28 @@ class pro implements Interfaces\Api $manager $manager ->setUser(Session::getLoggedinUser()); ->setUser(Session::getLoggedinUser()); switch ($pages[0]) { case 'enable': // TODO: Send and process payment data $success = $manager->enable(time() + (365 * 86400)); $success = $manager->enable(time() + (365 * 86400)); if (!$success) { return Factory::response([ return Factory::response([ 'done' => $success, 'status' => 'error', 'message' => 'Error activating Pro', ]); ]); } } return Factory::response([/* TODO: Send values */]); default: return Factory::response([ 'status' => 'error', 'message' => 'Unknown method' ]); } } /** /** * Equivalent to HTTP PUT method * Equivalent to HTTP PUT method * @param array $pages * @param array $pages Loading @@ -76,8 +92,13 @@ class pro implements Interfaces\Api $success = $manager->disable(); $success = $manager->disable(); if (!$success) { return Factory::response([ return Factory::response([ 'done' => $success, 'status' => 'error', 'message' => 'Error disabling Pro', ]); ]); } } return Factory::response([]); } } }
Core/Pro/Delegates/InitializeValuesDelegate.php +3 −1 Original line number Original line Diff line number Diff line Loading @@ -39,10 +39,12 @@ class InitializeValuesDelegate if (!$values) { if (!$values) { $values = new Values(); $values = new Values(); $values ->setUserGuid($user->guid); } } if (!$values->getDomain()) { if (!$values->getDomain()) { $values->setDomain("pro-{$user->username}.minds.com"); $values->setDomain("pro-{$user->guid}.minds.com"); } } $this->repository $this->repository Loading
Core/Pro/Repository.php +2 −2 Original line number Original line Diff line number Diff line Loading @@ -49,11 +49,11 @@ class Repository $cqlOpts = []; $cqlOpts = []; if ($opts['user_guid']) { if ($opts['user_guid']) { $where .= 'user_guid = ?'; $where[] = 'user_guid = ?'; $values[] = new Bigint($opts['user_guid']); $values[] = new Bigint($opts['user_guid']); } elseif ($opts['domain']) { } elseif ($opts['domain']) { $cql = "SELECT * FROM pro_by_domain"; $cql = "SELECT * FROM pro_by_domain"; $where = 'domain = ?'; $where[] = 'domain = ?'; $values[] = $opts['domain']; $values[] = $opts['domain']; } } Loading