Draft: Resolve "Customer source changes" #1461

Closed
korina.cordero wants to merge 4 commits from 548-customer-source-changes into master
6 changed files with 39 additions and 3 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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'));

View file

@ -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);

View file

@ -0,0 +1,22 @@
<?php
namespace App\Ramcar;
class CustomerSource extends NameValue
{
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',
'web_warranty' => 'Web Warranty',
'app_warranty' => 'App Warranty',
'admin_panel' => 'Admin Panel',
'legacy' => 'Legacy',
];
}

View file

@ -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'));