Merge branch '613-car-club-geofence-fix' into 'master-fix'
Resolve "Car club geofence fix" See merge request jankstudio/resq!726
This commit is contained in:
commit
9473da9f2a
1 changed files with 57 additions and 12 deletions
|
|
@ -2228,8 +2228,31 @@ class APIController extends Controller implements LoggedController
|
|||
$long = $req->query->get('longitude');
|
||||
$lat = $req->query->get('latitude');
|
||||
|
||||
// NOTE: had to add this for promo tag
|
||||
$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
|
||||
$is_covered = $geo->isCovered($long, $lat);
|
||||
}
|
||||
|
||||
// geofence
|
||||
// $is_covered = $geo->isCovered($long, $lat);
|
||||
|
||||
$data = [
|
||||
'longitude' => $long,
|
||||
|
|
@ -2636,8 +2659,30 @@ class APIController extends Controller implements LoggedController
|
|||
$long = $req->request->get('long');
|
||||
$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
|
||||
$is_covered = $geo->isCovered($long, $lat);
|
||||
}
|
||||
|
||||
if (!$is_covered)
|
||||
{
|
||||
// TODO: put geofence error message in config file somewhere
|
||||
|
|
@ -2690,13 +2735,13 @@ class APIController extends Controller implements LoggedController
|
|||
->setStatusAutoAssign(AutoAssignStatus::NOT_ASSIGNED);
|
||||
|
||||
// customer
|
||||
$cust = $this->session->getCustomer();
|
||||
if ($cust == null)
|
||||
{
|
||||
$res->setError(true)
|
||||
->setErrorMessage('No customer information found');
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
// $cust = $this->session->getCustomer();
|
||||
// if ($cust == null)
|
||||
// {
|
||||
// $res->setError(true)
|
||||
// ->setErrorMessage('No customer information found');
|
||||
// return $res->getReturnResponse();
|
||||
// }
|
||||
$jo->setCustomer($cust);
|
||||
|
||||
// validate service type
|
||||
|
|
|
|||
Loading…
Reference in a new issue