Add checkIfNewBattery function to job order service. Add RiderAPIHandler to the respective services.yaml. #336

This commit is contained in:
Korina Cordero 2020-02-11 05:54:58 +00:00
parent 23253a1e65
commit f0212cc6d4
6 changed files with 35 additions and 1 deletions

View file

@ -185,6 +185,14 @@ services:
# rider assignment interface
App\Service\RiderAssignmentHandlerInterface: "@App\\Service\\RiderAssignmentHandler\\CMBRiderAssignmentHandler"
# rider API service
App\Service\RiderAPIHandler\CMBRiderAPIHandler:
arguments:
$country_code: "%env(COUNTRY_CODE)%"
# rider API interface
App\Service\RiderAPIHandlerInterface: "@App\\Service\\RiderAPIHandler\\CMBRiderAPIHandler"
# map manager
#App\Service\GISManager\Bing: ~
App\Service\GISManager\OpenStreet: ~

View file

@ -185,6 +185,13 @@ services:
# rider assignment interface
App\Service\RiderAssignmentHandlerInterface: "@App\\Service\\RiderAssignmentHandler\\ResqRiderAssignmentHandler"
# rider API service
App\Service\RiderAPIHandler\ResqRiderAPIHandler:
arguments:
$country_code: "%env(COUNTRY_CODE)%"
App\Service\RiderAPIHandlerInterface: "@App\\Service\\RiderAPIHandler\\ResqRiderAPIHandler"
# map manager
#App\Service\GISManager\Bing: ~
App\Service\GISManager\OpenStreet: ~

View file

@ -2324,6 +2324,14 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
return $params;
}
public function checkIfNewBattery(JobOrder $jo)
{
if ($jo->getServiceType() == CMBServiceType::BATTERY_REPLACEMENT_NEW)
return true;
return false;
}
protected function fillDropdownParameters(&$params)
{
$em = $this->em;

View file

@ -2283,6 +2283,14 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setWarrantyExpiration($warr_date);
}
public function checkIfNewBattery(JobOrder $jo)
{
if ($jo->getServiceType() == ServiceType::BATTERY_REPLACEMENT_NEW)
return true;
return false;
}
protected function fillDropdownParameters(&$params)
{
$em = $this->em;

View file

@ -95,4 +95,7 @@ interface JobOrderHandlerInterface
// update customer vehicle battery warranty info
public function updateVehicleBattery(JobOrder $jo);
// check if service type is new battery
public function checkIfNewBattery(JobOrder $jo);
}

View file

@ -524,7 +524,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
$this->em->flush();
// create warranty
if ($jo->getServiceType() == CMBServiceType::BATTERY_REPLACEMENT_NEW)
if($this->jo_handler->checkIfNewBattery($jo))
{
$serial = null;
$warranty_class = $jo->getWarrantyClass();