From 20dd3f51df772fb7b37cde9f61db4bbd91c07665 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 5 Apr 2021 06:18:17 +0000 Subject: [PATCH 1/4] Add customer source when new customer is created via admin panel. #548 --- src/Ramcar/CustomerSource.php | 20 +++++++++++++++++++ .../CustomerHandler/ResqCustomerHandler.php | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 src/Ramcar/CustomerSource.php diff --git a/src/Ramcar/CustomerSource.php b/src/Ramcar/CustomerSource.php new file mode 100644 index 00000000..9e532654 --- /dev/null +++ b/src/Ramcar/CustomerSource.php @@ -0,0 +1,20 @@ + 'Mobile API', + 'third_party_api' => 'Third Party API', + 'warranty' => 'Warranty', + 'admin_panel' => 'Admin Panel', + 'legacy' => 'Legacy', + ]; +} diff --git a/src/Service/CustomerHandler/ResqCustomerHandler.php b/src/Service/CustomerHandler/ResqCustomerHandler.php index 76d20054..321eb976 100644 --- a/src/Service/CustomerHandler/ResqCustomerHandler.php +++ b/src/Service/CustomerHandler/ResqCustomerHandler.php @@ -15,6 +15,7 @@ use App\Ramcar\CustomerClassification; use App\Ramcar\FuelType; use App\Ramcar\VehicleStatusCondition; use App\Ramcar\CrudException; +use App\Ramcar\CustomerSource; use App\Entity\Customer; use App\Entity\CustomerVehicle; @@ -185,6 +186,9 @@ class ResqCustomerHandler implements CustomerHandlerInterface $this->setObject($row, $req); + // set customer source only when new customer + $row->setCreateSource(CustomerSource::ADMIN_PANEL); + // custom validation for vehicles $vehicles = json_decode($req->request->get('vehicles')); -- 2.43.5 From 7dd080b02e011ef1609f076771d247727c432d31 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 5 Apr 2021 08:19:14 +0000 Subject: [PATCH 2/4] Add customer source when a new customer registers via mobile app. #548 --- src/Controller/APIController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index b03f057e..4b80b074 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -28,6 +28,7 @@ use App\Ramcar\TradeInType; use App\Ramcar\JOEventType; use App\Ramcar\AdvanceOrderSlot; use App\Ramcar\AutoAssignStatus; +use App\Ramcar\CustomerSource; use App\Service\InvoiceGeneratorInterface; use App\Service\RisingTideGateway; @@ -413,6 +414,10 @@ class APIController extends Controller implements LoggedController if ($cust == null) { $cust = new Customer(); + + // set customer source + $cust->setCreateSource(CustomerSource::MOBILE); + $em->persist($cust); $this->session->setCustomer($cust); -- 2.43.5 From 61fb0e68efc3dffa488bb064e7d2781ecdb5cd1a Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 5 Apr 2021 08:37:17 +0000 Subject: [PATCH 3/4] Add customer source when customer registers via third party API. #548 --- src/Controller/CAPI/CustomerController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Controller/CAPI/CustomerController.php b/src/Controller/CAPI/CustomerController.php index 55aae2bd..33d87249 100644 --- a/src/Controller/CAPI/CustomerController.php +++ b/src/Controller/CAPI/CustomerController.php @@ -15,6 +15,8 @@ use App\Entity\Customer; use App\Entity\CustomerVehicle; use App\Entity\Vehicle; +use App\Ramcar\CustomerSource; + use Catalyst\APIBundle\Access\Generator as ACLGenerator; class CustomerController extends APIController @@ -157,7 +159,8 @@ class CustomerController extends APIController $new_cust = new Customer(); $new_cust->setFirstName($first_name) ->setLastName($last_name) - ->setPhoneMobile($mobile_number); + ->setPhoneMobile($mobile_number) + ->setCreateSource(CustomerSource::THIRD_PARTY); $em->persist($new_cust); -- 2.43.5 From d4c3dfadc7fc8b8e388f9ec3b20201da7fa141ef Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 6 Apr 2021 03:29:49 +0000 Subject: [PATCH 4/4] Add new warranty source. #548 --- src/Controller/CAPI/CustomerWarrantyController.php | 2 +- src/Controller/CAPI/WarrantyController.php | 4 +++- src/Ramcar/CustomerSource.php | 14 ++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Controller/CAPI/CustomerWarrantyController.php b/src/Controller/CAPI/CustomerWarrantyController.php index 0ebc2c60..cce42ab2 100644 --- a/src/Controller/CAPI/CustomerWarrantyController.php +++ b/src/Controller/CAPI/CustomerWarrantyController.php @@ -420,7 +420,7 @@ class CustomerWarrantyController extends APIController $cust->setFirstName($req->request->get('first_name')) ->setLastName($req->request->get('last_name')) ->setEmail($req->request->get('email')) - ->setCreateSource('web_warranty') + ->setCreateSource(CustomerSource::WEB_WARRANTY) ->setPrivacyPromo($priv_promo) ->setPhoneMobile($req->request->get('contact_num')); diff --git a/src/Controller/CAPI/WarrantyController.php b/src/Controller/CAPI/WarrantyController.php index c444370c..5b9230c3 100644 --- a/src/Controller/CAPI/WarrantyController.php +++ b/src/Controller/CAPI/WarrantyController.php @@ -26,6 +26,7 @@ use App\Ramcar\WarrantyClass; use App\Ramcar\WarrantyStatus; use App\Ramcar\FuelType; use App\Ramcar\VehicleStatusCondition; +use App\Ramcar\CustomerSource; use DateTime; @@ -636,7 +637,8 @@ class WarrantyController extends APIController $new_cust = new Customer(); $new_cust->setFirstName($w_first_name) ->setLastName($w_last_name) - ->setPhoneMobile($w_mobile_num); + ->setPhoneMobile($w_mobile_num) + ->setCreateSource(CustomerSource::APP_WARRANTY); $em->persist($new_cust); diff --git a/src/Ramcar/CustomerSource.php b/src/Ramcar/CustomerSource.php index 9e532654..7f8538aa 100644 --- a/src/Ramcar/CustomerSource.php +++ b/src/Ramcar/CustomerSource.php @@ -4,16 +4,18 @@ namespace App\Ramcar; class CustomerSource extends NameValue { - const MOBILE = 'mobile_api'; - const THIRD_PARTY = 'third_party_api'; - const WARRANTY = 'warranty'; - const ADMIN_PANEL = 'admin_panel'; - const LEGACY = 'legacy'; + const MOBILE = 'mobile_api'; + const THIRD_PARTY = 'third_party_api'; + const WEB_WARRANTY = 'web_warranty'; + const APP_WARRANTY = 'app_warranty'; + const ADMIN_PANEL = 'admin_panel'; + const LEGACY = 'legacy'; const COLLECTION = [ 'mobile_api' => 'Mobile API', 'third_party_api' => 'Third Party API', - 'warranty' => 'Warranty', + 'web_warranty' => 'Web Warranty', + 'app_warranty' => 'App Warranty', 'admin_panel' => 'Admin Panel', 'legacy' => 'Legacy', ]; -- 2.43.5