Add geofence variable to env.dist. Add checking to APIController if geofence is on or not. #271
This commit is contained in:
parent
d205ee0346
commit
590b9b82b4
2 changed files with 19 additions and 10 deletions
|
|
@ -42,3 +42,6 @@ POLICY_MOBILE=insertmobilepolicyidhere
|
|||
|
||||
# OTP
|
||||
OTP_MODE=settotestorrandom
|
||||
|
||||
# geofence
|
||||
GEOFENCE=settotrueorfalse
|
||||
|
|
|
|||
|
|
@ -839,18 +839,24 @@ class APIController extends Controller
|
|||
$long = $req->request->get('long');
|
||||
$lat = $req->request->get('lat');
|
||||
|
||||
/*
|
||||
// geofence
|
||||
$is_covered = $geo->isCovered($long, $lat);
|
||||
if (!$is_covered)
|
||||
{
|
||||
// TODO: put geofence error message in config file somewhere
|
||||
$res->setError(true)
|
||||
->setErrorMessage('Oops! Our service is limited to Metro Manila only. We will update you as soon as we are able to cover your area');
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
*/
|
||||
// check if geofence is on
|
||||
$dotenv = new Dotenv();
|
||||
$dotenv->loadEnv(__DIR__.'/../../.env');
|
||||
|
||||
$geo_flag = $_ENV['GEOFENCE'];
|
||||
|
||||
if ($geo_flag == 'true')
|
||||
{
|
||||
$is_covered = $geo->isCovered($long, $lat);
|
||||
if (!$is_covered)
|
||||
{
|
||||
// TODO: put geofence error message in config file somewhere
|
||||
$res->setError(true)
|
||||
->setErrorMessage('Oops! Our service is limited to Metro Manila, Baguio, and Laguna only. We will update you as soon as we are able to cover your area');
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
}
|
||||
|
||||
$jo = new JobOrder();
|
||||
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
||||
|
|
|
|||
Loading…
Reference in a new issue