Move the rest of the functions to the service. #311
This commit is contained in:
parent
05af87ed9c
commit
3300400456
4 changed files with 543 additions and 371 deletions
|
|
@ -2,147 +2,18 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use Doctrine\ORM\Query;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Doctrine\DBAL\DBALException;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
|
||||||
|
|
||||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
|
||||||
|
|
||||||
use App\Ramcar\APIResult;
|
use App\Ramcar\APIResult;
|
||||||
use App\Ramcar\JOStatus;
|
|
||||||
use App\Ramcar\InvoiceCriteria;
|
|
||||||
use App\Ramcar\CMBServiceType;
|
|
||||||
use App\Ramcar\ServiceType;
|
|
||||||
use App\Ramcar\WarrantyClass;
|
|
||||||
use App\Ramcar\APIRiderStatus;
|
|
||||||
use App\Ramcar\TransactionOrigin;
|
|
||||||
use App\Ramcar\CMBTradeInType;
|
|
||||||
use App\Ramcar\TradeInType;
|
|
||||||
use App\Ramcar\InvoiceStatus;
|
|
||||||
use App\Ramcar\ModeOfPayment;
|
|
||||||
use App\Ramcar\JOEventType;
|
|
||||||
|
|
||||||
use App\Service\InvoiceGeneratorInterface;
|
|
||||||
use App\Service\MQTTClient;
|
|
||||||
use App\Service\WarrantyHandler;
|
|
||||||
use App\Service\RedisClientProvider;
|
|
||||||
use App\Service\RiderCache;
|
|
||||||
use App\Service\RiderAPIHandlerInterface;
|
use App\Service\RiderAPIHandlerInterface;
|
||||||
|
|
||||||
use App\Entity\RiderSession;
|
|
||||||
use App\Entity\Customer;
|
|
||||||
use App\Entity\VehicleManufacturer;
|
|
||||||
use App\Entity\Vehicle;
|
|
||||||
use App\Entity\CustomerVehicle;
|
|
||||||
use App\Entity\JobOrder;
|
|
||||||
use App\Entity\Promo;
|
|
||||||
use App\Entity\Battery;
|
|
||||||
use App\Entity\BatteryModel;
|
|
||||||
use App\Entity\BatterySize;
|
|
||||||
use App\Entity\RiderRating;
|
|
||||||
use App\Entity\Rider;
|
|
||||||
use App\Entity\User;
|
|
||||||
use App\Entity\JOEvent;
|
|
||||||
use App\Entity\Warranty;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use DateInterval;
|
|
||||||
|
|
||||||
// Rider API controller
|
// Rider API controller
|
||||||
// TODO: Need to refactor this into a service
|
|
||||||
class RAPIController extends Controller
|
class RAPIController extends Controller
|
||||||
{
|
{
|
||||||
protected $session;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
// one device = one session, since we have control over the devices
|
|
||||||
// when a rider logs in, we just change the rider assigned to the device
|
|
||||||
// when a rider logs out, we remove the rider assigned to the device
|
|
||||||
$this->session = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function checkMissingParameters(Request $req, $params = [])
|
|
||||||
{
|
|
||||||
$missing = [];
|
|
||||||
|
|
||||||
// check if parameters are there
|
|
||||||
foreach ($params as $param)
|
|
||||||
{
|
|
||||||
if ($req->getMethod() == 'GET')
|
|
||||||
{
|
|
||||||
$check = $req->query->get($param);
|
|
||||||
if ($check == null)
|
|
||||||
$missing[] = $param;
|
|
||||||
}
|
|
||||||
else if ($req->getMethod() == 'POST')
|
|
||||||
{
|
|
||||||
$check = $req->request->get($param);
|
|
||||||
if ($check == null)
|
|
||||||
$missing[] = $param;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return $params;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $missing;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: type hint entity manager
|
|
||||||
protected function checkAPIKey($em, $api_key)
|
|
||||||
{
|
|
||||||
// find the api key (session id)
|
|
||||||
$session = $em->getRepository(RiderSession::class)->find($api_key);
|
|
||||||
if ($session == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return $session;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function checkParamsAndKey(Request $req, $em, $params)
|
|
||||||
{
|
|
||||||
// returns APIResult object
|
|
||||||
$res = new APIResult();
|
|
||||||
|
|
||||||
// check for api_key in query string
|
|
||||||
$api_key = $req->query->get('api_key');
|
|
||||||
if (empty($api_key))
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('Missing API key');
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check missing parameters
|
|
||||||
$missing = $this->checkMissingParameters($req, $params);
|
|
||||||
if (count($missing) > 0)
|
|
||||||
{
|
|
||||||
$miss_string = implode(', ', $missing);
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('Missing parameter(s): ' . $miss_string);
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check api key
|
|
||||||
$sess = $this->checkAPIKey($em, $req->query->get('api_key'));
|
|
||||||
if ($sess == null)
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('Invalid API Key');
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// store session
|
|
||||||
$this->session = $sess;
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function register(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
public function register(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
{
|
{
|
||||||
$res = new APIResult();
|
$res = new APIResult();
|
||||||
|
|
@ -231,44 +102,6 @@ class RAPIController extends Controller
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkJO(Request $req, $required_params, &$jo = null)
|
|
||||||
{
|
|
||||||
// set jo status to in transit
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
|
||||||
if ($res->isError())
|
|
||||||
return $res;
|
|
||||||
|
|
||||||
// are we logged in?
|
|
||||||
if (!$this->session->hasRider())
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('No logged in rider.');
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rider = $this->session->getRider();
|
|
||||||
|
|
||||||
// check if we have an active JO
|
|
||||||
$jo = $rider->getActiveJobOrder();
|
|
||||||
if ($jo == null)
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('No active job order.');
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the jo_id sent is the same as our active jo
|
|
||||||
if ($req->request->get('jo_id') != $jo->getID())
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('Job order selected is not active job order.');
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function acceptJobOrder(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
public function acceptJobOrder(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
{
|
{
|
||||||
$res = new APIResult();
|
$res = new APIResult();
|
||||||
|
|
@ -380,236 +213,91 @@ class RAPIController extends Controller
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function available(Request $req)
|
public function available(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$res = new APIResult();
|
||||||
$required_params = [];
|
|
||||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
|
||||||
if ($res->isError())
|
|
||||||
return $res->getReturnResponse();
|
|
||||||
|
|
||||||
// make rider available
|
$data = $rapi_handler->available($req);
|
||||||
$this->session->getRider()->setAvailable(true);
|
|
||||||
|
|
||||||
// TODO: log rider available
|
if (isset($data['error']))
|
||||||
$em->flush();
|
{
|
||||||
|
$message = $data['error'];
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
$res->setError(true)
|
||||||
|
->setErrorMessage($message);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
public function getPromos(Request $req)
|
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$required_params = [];
|
|
||||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
|
||||||
if ($res->isError())
|
|
||||||
return $res->getReturnResponse();
|
|
||||||
|
|
||||||
$promos = $em->getRepository(Promo::class)->findAll();
|
|
||||||
|
|
||||||
$promo_data = [];
|
|
||||||
foreach ($promos as $promo)
|
|
||||||
{
|
|
||||||
$promo_data[] = [
|
|
||||||
'id' => $promo->getID(),
|
|
||||||
'name' => $promo->getName(),
|
|
||||||
'code' => $promo->getCode(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'promos' => $promo_data,
|
|
||||||
];
|
|
||||||
$res->setData($data);
|
$res->setData($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// response
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBatteries(Request $req)
|
public function getPromos(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
{
|
{
|
||||||
// get batteries, models, and sizes
|
$res = new APIResult();
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$required_params = [];
|
|
||||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
|
||||||
if ($res->isError())
|
|
||||||
return $res->getReturnResponse();
|
|
||||||
|
|
||||||
$batts = $em->getRepository(Battery::class)->findAll();
|
$data = $rapi_handler->getPromos($req);
|
||||||
$models = $em->getRepository(BatteryModel::class)->findAll();
|
|
||||||
$sizes = $em->getRepository(BatterySize::class)->findAll();
|
|
||||||
|
|
||||||
$batt_data = [];
|
if (isset($data['error']))
|
||||||
foreach ($batts as $batt)
|
|
||||||
{
|
{
|
||||||
$batt_data[] = [
|
$message = $data['error'];
|
||||||
'id' => $batt->getID(),
|
|
||||||
'model_id' => $batt->getModel()->getID(),
|
$res->setError(true)
|
||||||
'size_id' => $batt->getSize()->getID(),
|
->setErrorMessage($message);
|
||||||
'sell_price' => $batt->getSellingPrice(),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$model_data = [];
|
|
||||||
foreach ($models as $model)
|
|
||||||
{
|
{
|
||||||
$model_data[] = [
|
|
||||||
'id' => $model->getID(),
|
|
||||||
'name' => $model->getName(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$size_data = [];
|
|
||||||
foreach ($sizes as $size)
|
|
||||||
{
|
|
||||||
$size_data[] = [
|
|
||||||
'id' => $size->getID(),
|
|
||||||
'name' => $size->getName(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'batteries' => $batt_data,
|
|
||||||
'models' => $model_data,
|
|
||||||
'sizes' => $size_data,
|
|
||||||
];
|
|
||||||
|
|
||||||
$res->setData($data);
|
$res->setData($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// response
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function debugRequest(Request $req)
|
public function getBatteries(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
{
|
{
|
||||||
$all = $req->request->all();
|
$res = new APIResult();
|
||||||
error_log(print_r($all, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changeService(Request $req, InvoiceGeneratorInterface $ic)
|
$data = $rapi_handler->getBatteries($req);
|
||||||
|
|
||||||
|
if (isset($data['error']))
|
||||||
{
|
{
|
||||||
$this->debugRequest($req);
|
$message = $data['error'];
|
||||||
|
|
||||||
// allow rider to change service, promo, battery and trade-in options
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
$required_params = ['jo_id', 'stype_id', 'promo_id'];
|
|
||||||
$res = $this->checkJO($req, $required_params, $jo);
|
|
||||||
if ($res->isError())
|
|
||||||
return $res->getReturnResponse();
|
|
||||||
|
|
||||||
// check service type
|
|
||||||
$stype_id = $req->request->get('stype_id');
|
|
||||||
if ((!CMBServiceType::validate($stype_id)) ||
|
|
||||||
(!ServiceType::validate($stype_id)))
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
$res->setError(true)
|
||||||
->setErrorMessage('Invalid service type - ' . $stype_id);
|
->setErrorMessage($message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res->setData($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// response
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check promo id
|
public function changeService(Request $req, RiderAPIHandlerInterface $rapi_handler)
|
||||||
$promo_id = $req->request->get('promo_id');
|
|
||||||
// no promo
|
|
||||||
if ($promo_id == 0)
|
|
||||||
$promo = null;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$promo = $em->getRepository(Promo::class)->find($promo_id);
|
$res = new APIResult();
|
||||||
if ($promo == null)
|
|
||||||
|
$data = $rapi_handler->changeService($req);
|
||||||
|
|
||||||
|
if (isset($data['error']))
|
||||||
{
|
{
|
||||||
|
$message = $data['error'];
|
||||||
|
|
||||||
$res->setError(true)
|
$res->setError(true)
|
||||||
->setErrorMessage('Invalid promo id - ' . $promo_id);
|
->setErrorMessage($message);
|
||||||
return $res->getReturnResponse();
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
$res->setData($data);
|
||||||
// check or number
|
}
|
||||||
$or_num = $req->request->get('or_num');
|
|
||||||
if ($or_num != null)
|
// response
|
||||||
$jo->setORNum($or_num);
|
|
||||||
|
|
||||||
// coolant
|
|
||||||
$flag_coolant = $req->request->get('flag_coolant', 'false');
|
|
||||||
if ($flag_coolant == 'true')
|
|
||||||
$jo->setHasCoolant(true);
|
|
||||||
else
|
|
||||||
$jo->setHasCoolant(false);
|
|
||||||
|
|
||||||
// has motolite battery
|
|
||||||
$cv = $jo->getCustomerVehicle();
|
|
||||||
$has_motolite = $req->request->get('has_motolite', 'false');
|
|
||||||
if ($has_motolite == 'true')
|
|
||||||
$cv->setHasMotoliteBattery(true);
|
|
||||||
else
|
|
||||||
$cv->setHasMotoliteBattery(false);
|
|
||||||
$em->persist($cv);
|
|
||||||
|
|
||||||
// check battery id
|
|
||||||
$batt_id = $req->request->get('batt_id', null);
|
|
||||||
// no battery
|
|
||||||
if ($batt_id == 0 || $batt_id == null)
|
|
||||||
$battery = null;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$battery = $em->getRepository(Battery::class)->find($batt_id);
|
|
||||||
if ($battery == null)
|
|
||||||
{
|
|
||||||
$res->setError(true)
|
|
||||||
->setErrorMessage('Invalid battery id - ' . $batt_id);
|
|
||||||
return $res->getReturnResponse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check trade in
|
|
||||||
$trade_in = $req->request->get('trade_in');
|
|
||||||
if ((!CMBTradeInType::validate($trade_in)) ||
|
|
||||||
(!TradeInType::validate($trade_in)))
|
|
||||||
$trade_in = null;
|
|
||||||
|
|
||||||
// check mode of payment
|
|
||||||
$mode = $req->request->get('mode_of_payment');
|
|
||||||
if (!ModeOfPayment::validate($mode))
|
|
||||||
$mode = ModeOfPayment::CASH;
|
|
||||||
$jo->setModeOfPayment($mode);
|
|
||||||
|
|
||||||
|
|
||||||
// generate new invoice
|
|
||||||
$crit = new InvoiceCriteria();
|
|
||||||
$crit->setServiceType($stype_id);
|
|
||||||
$crit->setCustomerVehicle($cv);
|
|
||||||
$crit->setHasCoolant($jo->hasCoolant());
|
|
||||||
|
|
||||||
if ($promo != null)
|
|
||||||
$crit->addPromo($promo);
|
|
||||||
|
|
||||||
if ($battery != null)
|
|
||||||
{
|
|
||||||
$crit->addEntry($battery, $trade_in, 1);
|
|
||||||
error_log('adding entry for battery - ' . $battery->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
$invoice = $ic->generateInvoice($crit);
|
|
||||||
|
|
||||||
// remove previous invoice
|
|
||||||
$old_invoice = $jo->getInvoice();
|
|
||||||
$em->remove($old_invoice);
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
// save job order
|
|
||||||
$jo->setServiceType($stype_id);
|
|
||||||
|
|
||||||
// save invoice
|
|
||||||
$jo->setInvoice($invoice);
|
|
||||||
$em->persist($invoice);
|
|
||||||
|
|
||||||
// add event log
|
|
||||||
$rider = $this->session->getRider();
|
|
||||||
$event = new JOEvent();
|
|
||||||
$event->setDateHappen(new DateTime())
|
|
||||||
->setTypeID(JOEventType::RIDER_EDIT)
|
|
||||||
->setJobOrder($jo)
|
|
||||||
->setRider($rider);
|
|
||||||
$em->persist($event);
|
|
||||||
|
|
||||||
$em->flush();
|
|
||||||
// TODO: send mqtt event (?)
|
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ use App\Ramcar\CMBTradeInType;
|
||||||
use App\Ramcar\JOStatus;
|
use App\Ramcar\JOStatus;
|
||||||
use App\Ramcar\JOEventType;
|
use App\Ramcar\JOEventType;
|
||||||
use App\Ramcar\InvoiceStatus;
|
use App\Ramcar\InvoiceStatus;
|
||||||
|
use App\Ramcar\ModeOfPayment;
|
||||||
|
use App\Ramcar\InvoiceCriteria;
|
||||||
|
|
||||||
use App\Service\RiderAPIHandlerInterface;
|
use App\Service\RiderAPIHandlerInterface;
|
||||||
use App\Service\RedisClientProvider;
|
use App\Service\RedisClientProvider;
|
||||||
|
|
@ -18,11 +20,16 @@ use App\Service\RiderCache;
|
||||||
use App\Service\MQTTClient;
|
use App\Service\MQTTClient;
|
||||||
use App\Service\WarrantyHandler;
|
use App\Service\WarrantyHandler;
|
||||||
use App\Service\JobOrderHandlerInterface;
|
use App\Service\JobOrderHandlerInterface;
|
||||||
|
use App\Service\InvoiceGeneratorInterface;
|
||||||
|
|
||||||
use App\Entity\RiderSession;
|
use App\Entity\RiderSession;
|
||||||
use App\Entity\Rider;
|
use App\Entity\Rider;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Entity\JOEvent;
|
use App\Entity\JOEvent;
|
||||||
|
use App\Entity\Promo;
|
||||||
|
use App\Entity\Battery;
|
||||||
|
use App\Entity\BatteryModel;
|
||||||
|
use App\Entity\BatterySize;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
|
@ -36,12 +43,14 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
protected $mclient;
|
protected $mclient;
|
||||||
protected $wh;
|
protected $wh;
|
||||||
protected $jo_handler;
|
protected $jo_handler;
|
||||||
|
protected $ic;
|
||||||
protected $session;
|
protected $session;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, RedisClientProvider $redis,
|
public function __construct(EntityManagerInterface $em, RedisClientProvider $redis,
|
||||||
EncoderFactoryInterface $ef, RiderCache $rcache,
|
EncoderFactoryInterface $ef, RiderCache $rcache,
|
||||||
string $country_code, MQTTClient $mclient,
|
string $country_code, MQTTClient $mclient,
|
||||||
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler)
|
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler,
|
||||||
|
InvoiceGeneratorInterface $ic)
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->redis = $redis;
|
$this->redis = $redis;
|
||||||
|
|
@ -51,6 +60,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
$this->mclient = $mclient;
|
$this->mclient = $mclient;
|
||||||
$this->wh = $wh;
|
$this->wh = $wh;
|
||||||
$this->jo_handler = $jo_handler;
|
$this->jo_handler = $jo_handler;
|
||||||
|
$this->ic = $ic;
|
||||||
|
|
||||||
// one device = one session, since we have control over the devices
|
// one device = one session, since we have control over the devices
|
||||||
// when a rider logs in, we just change the rider assigned to the device
|
// when a rider logs in, we just change the rider assigned to the device
|
||||||
|
|
@ -566,6 +576,228 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function available(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
// make rider available
|
||||||
|
$this->session->getRider()->setAvailable(true);
|
||||||
|
|
||||||
|
// TODO: log rider available
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPromos(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
$promos = $this->em->getRepository(Promo::class)->findAll();
|
||||||
|
|
||||||
|
$promo_data = [];
|
||||||
|
foreach ($promos as $promo)
|
||||||
|
{
|
||||||
|
$promo_data[] = [
|
||||||
|
'id' => $promo->getID(),
|
||||||
|
'name' => $promo->getName(),
|
||||||
|
'code' => $promo->getCode(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'promos' => $promo_data,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBatteries(Request $req)
|
||||||
|
{
|
||||||
|
// get batteries, models, and sizes
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
$batts = $this->em->getRepository(Battery::class)->findAll();
|
||||||
|
$models = $this->em->getRepository(BatteryModel::class)->findAll();
|
||||||
|
$sizes = $this->em->getRepository(BatterySize::class)->findAll();
|
||||||
|
|
||||||
|
$batt_data = [];
|
||||||
|
foreach ($batts as $batt)
|
||||||
|
{
|
||||||
|
$batt_data[] = [
|
||||||
|
'id' => $batt->getID(),
|
||||||
|
'model_id' => $batt->getModel()->getID(),
|
||||||
|
'size_id' => $batt->getSize()->getID(),
|
||||||
|
'sell_price' => $batt->getSellingPrice(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$model_data = [];
|
||||||
|
foreach ($models as $model)
|
||||||
|
{
|
||||||
|
$model_data[] = [
|
||||||
|
'id' => $model->getID(),
|
||||||
|
'name' => $model->getName(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$size_data = [];
|
||||||
|
foreach ($sizes as $size)
|
||||||
|
{
|
||||||
|
$size_data[] = [
|
||||||
|
'id' => $size->getID(),
|
||||||
|
'name' => $size->getName(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'batteries' => $batt_data,
|
||||||
|
'models' => $model_data,
|
||||||
|
'sizes' => $size_data,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeService(Request $req)
|
||||||
|
{
|
||||||
|
$this->debugRequest($req);
|
||||||
|
|
||||||
|
// allow rider to change service, promo, battery and trade-in options
|
||||||
|
$required_params = ['jo_id', 'stype_id', 'promo_id'];
|
||||||
|
$data = $this->checkJO($req, $required_params, $jo);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
// check service type
|
||||||
|
$stype_id = $req->request->get('stype_id');
|
||||||
|
if (!CMBServiceType::validate($stype_id))
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid service type - ' . $stype_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check promo id
|
||||||
|
$promo_id = $req->request->get('promo_id');
|
||||||
|
// no promo
|
||||||
|
if ($promo_id == 0)
|
||||||
|
$promo = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$promo = $this->em->getRepository(Promo::class)->find($promo_id);
|
||||||
|
if ($promo == null)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid promo id - ' . $promo_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check or number
|
||||||
|
$or_num = $req->request->get('or_num');
|
||||||
|
if ($or_num != null)
|
||||||
|
$jo->setORNum($or_num);
|
||||||
|
|
||||||
|
// coolant
|
||||||
|
$flag_coolant = $req->request->get('flag_coolant', 'false');
|
||||||
|
if ($flag_coolant == 'true')
|
||||||
|
$jo->setHasCoolant(true);
|
||||||
|
else
|
||||||
|
$jo->setHasCoolant(false);
|
||||||
|
|
||||||
|
// has motolite battery
|
||||||
|
$cv = $jo->getCustomerVehicle();
|
||||||
|
$has_motolite = $req->request->get('has_motolite', 'false');
|
||||||
|
if ($has_motolite == 'true')
|
||||||
|
$cv->setHasMotoliteBattery(true);
|
||||||
|
else
|
||||||
|
$cv->setHasMotoliteBattery(false);
|
||||||
|
$this->em->persist($cv);
|
||||||
|
|
||||||
|
// check battery id
|
||||||
|
$batt_id = $req->request->get('batt_id', null);
|
||||||
|
// no battery
|
||||||
|
if ($batt_id == 0 || $batt_id == null)
|
||||||
|
$battery = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$battery = $this->em->getRepository(Battery::class)->find($batt_id);
|
||||||
|
if ($battery == null)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid battery id - ' . $batt_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check trade in
|
||||||
|
$trade_in = $req->request->get('trade_in');
|
||||||
|
if (!CMBTradeInType::validate($trade_in))
|
||||||
|
$trade_in = null;
|
||||||
|
|
||||||
|
// check mode of payment
|
||||||
|
$mode = $req->request->get('mode_of_payment');
|
||||||
|
if (!ModeOfPayment::validate($mode))
|
||||||
|
$mode = ModeOfPayment::CASH;
|
||||||
|
$jo->setModeOfPayment($mode);
|
||||||
|
|
||||||
|
// generate new invoice
|
||||||
|
$crit = new InvoiceCriteria();
|
||||||
|
$crit->setServiceType($stype_id);
|
||||||
|
$crit->setCustomerVehicle($cv);
|
||||||
|
$crit->setHasCoolant($jo->hasCoolant());
|
||||||
|
|
||||||
|
if ($promo != null)
|
||||||
|
$crit->addPromo($promo);
|
||||||
|
|
||||||
|
if ($battery != null)
|
||||||
|
{
|
||||||
|
$crit->addEntry($battery, $trade_in, 1);
|
||||||
|
error_log('adding entry for battery - ' . $battery->getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice = $this->ic->generateInvoice($crit);
|
||||||
|
|
||||||
|
// remove previous invoice
|
||||||
|
$old_invoice = $jo->getInvoice();
|
||||||
|
$this->em->remove($old_invoice);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
// save job order
|
||||||
|
$jo->setServiceType($stype_id);
|
||||||
|
|
||||||
|
// save invoice
|
||||||
|
$jo->setInvoice($invoice);
|
||||||
|
$this->em->persist($invoice);
|
||||||
|
|
||||||
|
// add event log
|
||||||
|
$rider = $this->session->getRider();
|
||||||
|
$event = new JOEvent();
|
||||||
|
$event->setDateHappen(new DateTime())
|
||||||
|
->setTypeID(JOEventType::RIDER_EDIT)
|
||||||
|
->setJobOrder($jo)
|
||||||
|
->setRider($rider);
|
||||||
|
$this->em->persist($event);
|
||||||
|
|
||||||
|
$this->em->flush();
|
||||||
|
// TODO: send mqtt event (?)
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
protected function checkMissingParameters(Request $req, $params = [])
|
protected function checkMissingParameters(Request $req, $params = [])
|
||||||
{
|
{
|
||||||
$missing = [];
|
$missing = [];
|
||||||
|
|
@ -683,4 +915,9 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function debugRequest(Request $req)
|
||||||
|
{
|
||||||
|
$all = $req->request->all();
|
||||||
|
error_log(print_r($all, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ use App\Ramcar\ServiceType;
|
||||||
use App\Ramcar\TradeInType;
|
use App\Ramcar\TradeInType;
|
||||||
use App\Ramcar\JOStatus;
|
use App\Ramcar\JOStatus;
|
||||||
use App\Ramcar\JOEventType;
|
use App\Ramcar\JOEventType;
|
||||||
|
use App\Ramcar\InvoiceStatus;
|
||||||
|
use App\Ramcar\ModeOfPayment;
|
||||||
|
use App\Ramcar\InvoiceCriteria;
|
||||||
|
|
||||||
use App\Service\RiderAPIHandlerInterface;
|
use App\Service\RiderAPIHandlerInterface;
|
||||||
use App\Service\RedisClientProvider;
|
use App\Service\RedisClientProvider;
|
||||||
|
|
@ -17,11 +20,16 @@ use App\Service\RiderCache;
|
||||||
use App\Service\MQTTClient;
|
use App\Service\MQTTClient;
|
||||||
use App\Service\WarrantyHandler;
|
use App\Service\WarrantyHandler;
|
||||||
use App\Service\JobOrderHandlerInterface;
|
use App\Service\JobOrderHandlerInterface;
|
||||||
|
use App\Service\InvoiceGeneratorInterface;
|
||||||
|
|
||||||
use App\Entity\RiderSession;
|
use App\Entity\RiderSession;
|
||||||
use App\Entity\Rider;
|
use App\Entity\Rider;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Entity\JOEvent;
|
use App\Entity\JOEvent;
|
||||||
|
use App\Entity\Promo;
|
||||||
|
use App\Entity\Battery;
|
||||||
|
use App\Entity\BatteryModel;
|
||||||
|
use App\Entity\BatterySize;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
|
@ -34,12 +42,15 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
protected $country_code;
|
protected $country_code;
|
||||||
protected $mclient;
|
protected $mclient;
|
||||||
protected $wh;
|
protected $wh;
|
||||||
|
protected $jo_handler;
|
||||||
|
protected $ic;
|
||||||
protected $session;
|
protected $session;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, RedisClientProvider $redis,
|
public function __construct(EntityManagerInterface $em, RedisClientProvider $redis,
|
||||||
EncoderFactoryInterface $ef, RiderCache $rcache,
|
EncoderFactoryInterface $ef, RiderCache $rcache,
|
||||||
string $country_code, MQTTClient $mclient,
|
string $country_code, MQTTClient $mclient,
|
||||||
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler)
|
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler,
|
||||||
|
InvoiceGeneratorInterface $ic)
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->redis = $redis;
|
$this->redis = $redis;
|
||||||
|
|
@ -49,6 +60,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
$this->mclient = $mclient;
|
$this->mclient = $mclient;
|
||||||
$this->wh = $wh;
|
$this->wh = $wh;
|
||||||
$this->jo_handler = $jo_handler;
|
$this->jo_handler = $jo_handler;
|
||||||
|
$this->ic = $ic;
|
||||||
|
|
||||||
// one device = one session, since we have control over the devices
|
// one device = one session, since we have control over the devices
|
||||||
// when a rider logs in, we just change the rider assigned to the device
|
// when a rider logs in, we just change the rider assigned to the device
|
||||||
|
|
@ -564,6 +576,228 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function available(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
// make rider available
|
||||||
|
$this->session->getRider()->setAvailable(true);
|
||||||
|
|
||||||
|
// TODO: log rider available
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPromos(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
$promos = $this->em->getRepository(Promo::class)->findAll();
|
||||||
|
|
||||||
|
$promo_data = [];
|
||||||
|
foreach ($promos as $promo)
|
||||||
|
{
|
||||||
|
$promo_data[] = [
|
||||||
|
'id' => $promo->getID(),
|
||||||
|
'name' => $promo->getName(),
|
||||||
|
'code' => $promo->getCode(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'promos' => $promo_data,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBatteries(Request $req)
|
||||||
|
{
|
||||||
|
// get batteries, models, and sizes
|
||||||
|
$required_params = [];
|
||||||
|
$data = $this->checkParamsAndKey($req, $required_params);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
$batts = $this->em->getRepository(Battery::class)->findAll();
|
||||||
|
$models = $this->em->getRepository(BatteryModel::class)->findAll();
|
||||||
|
$sizes = $this->em->getRepository(BatterySize::class)->findAll();
|
||||||
|
|
||||||
|
$batt_data = [];
|
||||||
|
foreach ($batts as $batt)
|
||||||
|
{
|
||||||
|
$batt_data[] = [
|
||||||
|
'id' => $batt->getID(),
|
||||||
|
'model_id' => $batt->getModel()->getID(),
|
||||||
|
'size_id' => $batt->getSize()->getID(),
|
||||||
|
'sell_price' => $batt->getSellingPrice(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$model_data = [];
|
||||||
|
foreach ($models as $model)
|
||||||
|
{
|
||||||
|
$model_data[] = [
|
||||||
|
'id' => $model->getID(),
|
||||||
|
'name' => $model->getName(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$size_data = [];
|
||||||
|
foreach ($sizes as $size)
|
||||||
|
{
|
||||||
|
$size_data[] = [
|
||||||
|
'id' => $size->getID(),
|
||||||
|
'name' => $size->getName(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'batteries' => $batt_data,
|
||||||
|
'models' => $model_data,
|
||||||
|
'sizes' => $size_data,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeService(Request $req)
|
||||||
|
{
|
||||||
|
$this->debugRequest($req);
|
||||||
|
|
||||||
|
// allow rider to change service, promo, battery and trade-in options
|
||||||
|
$required_params = ['jo_id', 'stype_id', 'promo_id'];
|
||||||
|
$data = $this->checkJO($req, $required_params, $jo);
|
||||||
|
if (isset($data['error']))
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
// check service type
|
||||||
|
$stype_id = $req->request->get('stype_id');
|
||||||
|
if (!ServiceType::validate($stype_id))
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid service type - ' . $stype_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check promo id
|
||||||
|
$promo_id = $req->request->get('promo_id');
|
||||||
|
// no promo
|
||||||
|
if ($promo_id == 0)
|
||||||
|
$promo = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$promo = $this->em->getRepository(Promo::class)->find($promo_id);
|
||||||
|
if ($promo == null)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid promo id - ' . $promo_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check or number
|
||||||
|
$or_num = $req->request->get('or_num');
|
||||||
|
if ($or_num != null)
|
||||||
|
$jo->setORNum($or_num);
|
||||||
|
|
||||||
|
// coolant
|
||||||
|
$flag_coolant = $req->request->get('flag_coolant', 'false');
|
||||||
|
if ($flag_coolant == 'true')
|
||||||
|
$jo->setHasCoolant(true);
|
||||||
|
else
|
||||||
|
$jo->setHasCoolant(false);
|
||||||
|
|
||||||
|
// has motolite battery
|
||||||
|
$cv = $jo->getCustomerVehicle();
|
||||||
|
$has_motolite = $req->request->get('has_motolite', 'false');
|
||||||
|
if ($has_motolite == 'true')
|
||||||
|
$cv->setHasMotoliteBattery(true);
|
||||||
|
else
|
||||||
|
$cv->setHasMotoliteBattery(false);
|
||||||
|
$this->em->persist($cv);
|
||||||
|
|
||||||
|
// check battery id
|
||||||
|
$batt_id = $req->request->get('batt_id', null);
|
||||||
|
// no battery
|
||||||
|
if ($batt_id == 0 || $batt_id == null)
|
||||||
|
$battery = null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$battery = $this->em->getRepository(Battery::class)->find($batt_id);
|
||||||
|
if ($battery == null)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'error' => 'Invalid battery id - ' . $batt_id
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check trade in
|
||||||
|
$trade_in = $req->request->get('trade_in');
|
||||||
|
if (!TradeInType::validate($trade_in))
|
||||||
|
$trade_in = null;
|
||||||
|
|
||||||
|
// check mode of payment
|
||||||
|
$mode = $req->request->get('mode_of_payment');
|
||||||
|
if (!ModeOfPayment::validate($mode))
|
||||||
|
$mode = ModeOfPayment::CASH;
|
||||||
|
$jo->setModeOfPayment($mode);
|
||||||
|
|
||||||
|
// generate new invoice
|
||||||
|
$crit = new InvoiceCriteria();
|
||||||
|
$crit->setServiceType($stype_id);
|
||||||
|
$crit->setCustomerVehicle($cv);
|
||||||
|
$crit->setHasCoolant($jo->hasCoolant());
|
||||||
|
|
||||||
|
if ($promo != null)
|
||||||
|
$crit->addPromo($promo);
|
||||||
|
|
||||||
|
if ($battery != null)
|
||||||
|
{
|
||||||
|
$crit->addEntry($battery, $trade_in, 1);
|
||||||
|
error_log('adding entry for battery - ' . $battery->getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice = $this->ic->generateInvoice($crit);
|
||||||
|
|
||||||
|
// remove previous invoice
|
||||||
|
$old_invoice = $jo->getInvoice();
|
||||||
|
$this->em->remove($old_invoice);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
// save job order
|
||||||
|
$jo->setServiceType($stype_id);
|
||||||
|
|
||||||
|
// save invoice
|
||||||
|
$jo->setInvoice($invoice);
|
||||||
|
$this->em->persist($invoice);
|
||||||
|
|
||||||
|
// add event log
|
||||||
|
$rider = $this->session->getRider();
|
||||||
|
$event = new JOEvent();
|
||||||
|
$event->setDateHappen(new DateTime())
|
||||||
|
->setTypeID(JOEventType::RIDER_EDIT)
|
||||||
|
->setJobOrder($jo)
|
||||||
|
->setRider($rider);
|
||||||
|
$this->em->persist($event);
|
||||||
|
|
||||||
|
$this->em->flush();
|
||||||
|
// TODO: send mqtt event (?)
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
protected function checkMissingParameters(Request $req, $params = [])
|
protected function checkMissingParameters(Request $req, $params = [])
|
||||||
{
|
{
|
||||||
$missing = [];
|
$missing = [];
|
||||||
|
|
@ -681,4 +915,9 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function debugRequest(Request $req)
|
||||||
|
{
|
||||||
|
$all = $req->request->all();
|
||||||
|
error_log(print_r($all, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,12 @@ interface RiderAPIHandlerInterface
|
||||||
public function hubArrive(Request $req);
|
public function hubArrive(Request $req);
|
||||||
|
|
||||||
public function payment(Request $req);
|
public function payment(Request $req);
|
||||||
|
|
||||||
|
public function available(Request $req);
|
||||||
|
|
||||||
|
public function getPromos(Request $req);
|
||||||
|
|
||||||
|
public function getBatteries(Request $req);
|
||||||
|
|
||||||
|
public function changeService(Request $req);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue