Add checking for promo tag before geofence check. #613

This commit is contained in:
Korina Cordero 2021-08-12 09:20:16 +00:00
parent 1a72f5c95a
commit 13ee4c8e51

View file

@ -2636,8 +2636,30 @@ class APIController extends Controller implements LoggedController
$long = $req->request->get('long'); $long = $req->request->get('long');
$lat = $req->request->get('lat'); $lat = $req->request->get('lat');
// NOTE: had to move this up so we can check for promo before geofence
// customer
$cust = $this->session->getCustomer();
if ($cust == null)
{
$res->setError(true)
->setErrorMessage('No customer information found');
return $res->getReturnResponse();
}
$is_covered = false;
// check if customer still has promo
if (($cust->getCustomerTag('TAG_CAR_CLUB_OFFICER_PROMO')) ||
($cust->getCustomerTag('TAG_CAR_CLUB_MEMBER_PROMO')))
{
// if has customer tag, customer has not availed of promo
$is_covered = true;
}
else
{
// geofence // geofence
$is_covered = $geo->isCovered($long, $lat); $is_covered = $geo->isCovered($long, $lat);
}
if (!$is_covered) if (!$is_covered)
{ {
// TODO: put geofence error message in config file somewhere // TODO: put geofence error message in config file somewhere
@ -2690,13 +2712,13 @@ class APIController extends Controller implements LoggedController
->setStatusAutoAssign(AutoAssignStatus::NOT_ASSIGNED); ->setStatusAutoAssign(AutoAssignStatus::NOT_ASSIGNED);
// customer // customer
$cust = $this->session->getCustomer(); // $cust = $this->session->getCustomer();
if ($cust == null) // if ($cust == null)
{ // {
$res->setError(true) // $res->setError(true)
->setErrorMessage('No customer information found'); // ->setErrorMessage('No customer information found');
return $res->getReturnResponse(); // return $res->getReturnResponse();
} // }
$jo->setCustomer($cust); $jo->setCustomer($cust);
// validate service type // validate service type