Add get customer hash to api. #640
This commit is contained in:
parent
2e428378c6
commit
b0de01ae1b
2 changed files with 35 additions and 0 deletions
|
|
@ -216,6 +216,11 @@ api_latest_job_order:
|
||||||
controller: App\Controller\APIController::getLatestJobOrder
|
controller: App\Controller\APIController::getLatestJobOrder
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
|
api_customer_hash_get:
|
||||||
|
path: /api/customer_hash
|
||||||
|
controller: App\Controller\APIController::getCustomerHash
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
#api_completed_job_orders:
|
#api_completed_job_orders:
|
||||||
# path: /api/job_orders/completed
|
# path: /api/job_orders/completed
|
||||||
# controller: App\Controller\APIController::getCompletedJobOrders
|
# controller: App\Controller\APIController::getCompletedJobOrders
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ use App\Service\HubSelector;
|
||||||
use App\Service\HubDistributor;
|
use App\Service\HubDistributor;
|
||||||
use App\Service\HubFilterLogger;
|
use App\Service\HubFilterLogger;
|
||||||
use App\Service\HubFilteringGeoChecker;
|
use App\Service\HubFilteringGeoChecker;
|
||||||
|
use App\Service\HashGenerator;
|
||||||
|
|
||||||
use App\Entity\MobileSession;
|
use App\Entity\MobileSession;
|
||||||
use App\Entity\Customer;
|
use App\Entity\Customer;
|
||||||
|
|
@ -3848,6 +3849,35 @@ class APIController extends Controller implements LoggedController
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCustomerHash(Request $req, EntityManagerInterface $em, HashGenerator $hash)
|
||||||
|
{
|
||||||
|
// check required parameters and api key
|
||||||
|
$res = $this->checkParamsAndKey($req, $em, []);
|
||||||
|
if ($res->isError())
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
|
||||||
|
// get customer
|
||||||
|
$cust = $this->session->getCustomer();
|
||||||
|
if ($cust == null)
|
||||||
|
{
|
||||||
|
$res->setError(true)
|
||||||
|
->setErrorMessage('No customer information found');
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
// hash customer id
|
||||||
|
$hashed_id = $hash->getHash($cust->getID());
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'cust_hash' => $hashed_id,
|
||||||
|
];
|
||||||
|
|
||||||
|
$res->setData($data);
|
||||||
|
|
||||||
|
// response
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
|
|
||||||
// commenting it out. Modify the getJOHistory instead to just get the fulfilled
|
// commenting it out. Modify the getJOHistory instead to just get the fulfilled
|
||||||
// and cancelled job orders, since ongoing is not yet part of history
|
// and cancelled job orders, since ongoing is not yet part of history
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue