From 7dd9911e2279f10e59d7c306f6244c3680a19e2d Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 21 Feb 2020 02:29:39 +0000 Subject: [PATCH] Move warranty creation out of the RiderAPIHandler. #331 --- src/Service/JobOrderHandler/CMBJobOrderHandler.php | 7 +------ src/Service/JobOrderHandler/ResqJobOrderHandler.php | 6 +----- src/Service/RiderAPIHandler/CMBRiderAPIHandler.php | 10 +++------- src/Service/RiderAPIHandler/ResqRiderAPIHandler.php | 9 +++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index a3a81276..d53ee926 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -24,7 +24,6 @@ use App\Entity\Hub; use App\Entity\Promo; use App\Entity\Rider; use App\Entity\JORejection; -use App\Entity\Warranty; use App\Entity\Customer; use App\Entity\ServiceCharge; @@ -44,7 +43,6 @@ use App\Service\InvoiceGeneratorInterface; use App\Service\JobOrderHandlerInterface; use App\Service\RiderAssignmentHandlerInterface; use App\Service\CustomerHandlerInterface; -use App\Service\WarrantyHandler; use App\Service\MQTTClient; use App\Service\APNSClient; use App\Service\MapTools; @@ -67,7 +65,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface protected $translator; protected $rah; protected $country_code; - protected $wh; protected $cust_handler; protected $template_hash; @@ -75,8 +72,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface public function __construct(Security $security, EntityManagerInterface $em, InvoiceGeneratorInterface $ic, ValidatorInterface $validator, TranslatorInterface $translator, RiderAssignmentHandlerInterface $rah, - string $country_code, WarrantyHandler $wh, - CustomerHandlerInterface $cust_handler) + string $country_code, CustomerHandlerInterface $cust_handler) { $this->em = $em; $this->ic = $ic; @@ -85,7 +81,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $this->translator = $translator; $this->rah = $rah; $this->country_code = $country_code; - $this->wh = $wh; $this->cust_handler = $cust_handler; $this->loadTemplates(); diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index 87aaeac7..50908933 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -23,7 +23,6 @@ use App\Entity\Hub; use App\Entity\Promo; use App\Entity\Rider; use App\Entity\JORejection; -use App\Entity\Warranty; use App\Entity\Customer; use App\Ramcar\InvoiceCriteria; @@ -41,7 +40,6 @@ use App\Ramcar\JORejectionReason; use App\Service\InvoiceGeneratorInterface; use App\Service\JobOrderHandlerInterface; use App\Service\RiderAssignmentHandlerInterface; -use App\Service\WarrantyHandler; use App\Service\MQTTClient; use App\Service\APNSClient; use App\Service\MapTools; @@ -64,14 +62,13 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface protected $translator; protected $rah; protected $country_code; - protected $wh; protected $template_hash; public function __construct(Security $security, EntityManagerInterface $em, InvoiceGeneratorInterface $ic, ValidatorInterface $validator, TranslatorInterface $translator, RiderAssignmentHandlerInterface $rah, - string $country_code, WarrantyHandler $wh) + string $country_code) { $this->em = $em; $this->ic = $ic; @@ -80,7 +77,6 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $this->translator = $translator; $this->rah = $rah; $this->country_code = $country_code; - $this->wh = $wh; $this->loadTemplates(); } diff --git a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php index 3c0236e1..32514afd 100644 --- a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php +++ b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php @@ -18,7 +18,6 @@ use App\Service\RiderAPIHandlerInterface; use App\Service\RedisClientProvider; use App\Service\RiderCache; use App\Service\MQTTClient; -use App\Service\WarrantyHandler; use App\Service\JobOrderHandlerInterface; use App\Service\InvoiceGeneratorInterface; @@ -30,7 +29,6 @@ use App\Entity\Promo; use App\Entity\Battery; use App\Entity\BatteryModel; use App\Entity\BatterySize; -use App\Entity\Warranty; use DateTime; @@ -42,7 +40,6 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface protected $rcache; protected $country_code; protected $mclient; - protected $wh; protected $jo_handler; protected $ic; protected $session; @@ -50,8 +47,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface public function __construct(EntityManagerInterface $em, RedisClientProvider $redis, EncoderFactoryInterface $ef, RiderCache $rcache, string $country_code, MQTTClient $mclient, - WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler, - InvoiceGeneratorInterface $ic) + JobOrderHandlerInterface $jo_handler, InvoiceGeneratorInterface $ic) { $this->em = $em; $this->redis = $redis; @@ -59,7 +55,6 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface $this->rcache = $rcache; $this->country_code = $country_code; $this->mclient = $mclient; - $this->wh = $wh; $this->jo_handler = $jo_handler; $this->ic = $ic; @@ -523,6 +518,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface $this->em->flush(); + /* // create warranty if($this->jo_handler->checkIfNewBattery($jo)) { @@ -561,7 +557,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface $this->wh->createWarranty($serial, $plate_number, $first_name, $last_name, $mobile_number, $batt_list, $date_purchase, $warranty_class); } - } + } */ // send mqtt event (fulfilled) $rider = $this->session->getRider(); diff --git a/src/Service/RiderAPIHandler/ResqRiderAPIHandler.php b/src/Service/RiderAPIHandler/ResqRiderAPIHandler.php index b5bed63b..4a3ea62a 100644 --- a/src/Service/RiderAPIHandler/ResqRiderAPIHandler.php +++ b/src/Service/RiderAPIHandler/ResqRiderAPIHandler.php @@ -18,7 +18,6 @@ use App\Service\RiderAPIHandlerInterface; use App\Service\RedisClientProvider; use App\Service\RiderCache; use App\Service\MQTTClient; -use App\Service\WarrantyHandler; use App\Service\JobOrderHandlerInterface; use App\Service\InvoiceGeneratorInterface; @@ -41,7 +40,6 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface protected $rcache; protected $country_code; protected $mclient; - protected $wh; protected $jo_handler; protected $ic; protected $session; @@ -49,8 +47,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface public function __construct(EntityManagerInterface $em, RedisClientProvider $redis, EncoderFactoryInterface $ef, RiderCache $rcache, string $country_code, MQTTClient $mclient, - WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler, - InvoiceGeneratorInterface $ic) + JobOrderHandlerInterface $jo_handler, InvoiceGeneratorInterface $ic) { $this->em = $em; $this->redis = $redis; @@ -58,7 +55,6 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface $this->rcache = $rcache; $this->country_code = $country_code; $this->mclient = $mclient; - $this->wh = $wh; $this->jo_handler = $jo_handler; $this->ic = $ic; @@ -522,6 +518,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface $this->em->flush(); + /* // create warranty if($this->jo_handler->checkIfNewBattery($jo)) { @@ -556,7 +553,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface } $this->wh->createWarranty($serial, $plate_number, $first_name, $last_name, $mobile_number, $batt_list, $date_purchase, $warranty_class); - } + } */ // send mqtt event (fulfilled) $rider = $this->session->getRider();