From 13ee4c8e517f14a3826d7c700a1de26437fd2f89 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 12 Aug 2021 09:20:16 +0000 Subject: [PATCH 1/2] Add checking for promo tag before geofence check. #613 --- src/Controller/APIController.php | 40 +++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 707e57b1..9bb86d38 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2636,8 +2636,30 @@ class APIController extends Controller implements LoggedController $long = $req->request->get('long'); $lat = $req->request->get('lat'); - // geofence - $is_covered = $geo->isCovered($long, $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 +2712,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 From 13e28d8c478fa9a92e8f37c9376bc5fc81cf67d0 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 12 Aug 2021 09:39:56 +0000 Subject: [PATCH 2/2] Add checking for promo tag for locationSupport. #613 --- src/Controller/APIController.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 9bb86d38..15a63519 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2225,11 +2225,34 @@ class APIController extends Controller implements LoggedController if ($res->isError()) return $res->getReturnResponse(); - $long = $req->query->get('longitude'); - $lat = $req->query->get('latitude'); + $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); + // $is_covered = $geo->isCovered($long, $lat); $data = [ 'longitude' => $long,