Make insurance body types a namevalue class #783
This commit is contained in:
parent
69218aecf4
commit
a59aa0f66d
2 changed files with 29 additions and 15 deletions
|
|
@ -18,6 +18,7 @@ use App\Ramcar\InsuranceApplicationStatus;
|
|||
use App\Ramcar\InsuranceMVType;
|
||||
use App\Ramcar\InsuranceClientType;
|
||||
use App\Ramcar\TransactionStatus;
|
||||
use App\Ramcar\InsuranceBodyType;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
use DateTime;
|
||||
|
|
@ -316,21 +317,16 @@ class InsuranceController extends ApiController
|
|||
return new ApiResponse(false, $validity['error']);
|
||||
}
|
||||
|
||||
// TODO: if this changes often, make an entity and make it manageable on CRM
|
||||
$body_types = [
|
||||
[
|
||||
'id' => 'SEDAN',
|
||||
'name' => 'Sedan',
|
||||
],
|
||||
[
|
||||
'id' => 'SUV',
|
||||
'name' => 'SUV',
|
||||
],
|
||||
[
|
||||
'id' => 'TRUCK',
|
||||
'name' => 'Truck',
|
||||
]
|
||||
];
|
||||
$bt_collection = InsuranceBodyType::getCollection();
|
||||
$body_types = [];
|
||||
|
||||
// NOTE: formatting it this way to match how insurance third party API returns their own stuff, so it's all handled one way on the app
|
||||
foreach ($bt_collection as $bt_key => $bt_name) {
|
||||
$body_types[] = [
|
||||
'id' => $bt_key,
|
||||
'name' => $bt_name,
|
||||
];
|
||||
}
|
||||
|
||||
return new ApiResponse(true, '', [
|
||||
'body_types' => $body_types,
|
||||
|
|
|
|||
18
src/Ramcar/InsuranceBodyType.php
Normal file
18
src/Ramcar/InsuranceBodyType.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ramcar;
|
||||
|
||||
class InsuranceBodyType extends NameValue
|
||||
{
|
||||
const SEDAN = 'sedan';
|
||||
const SUV = 'suv';
|
||||
const TRUCK = 'truck';
|
||||
const MOTORCYCLE = 'motorcycle';
|
||||
|
||||
const COLLECTION = [
|
||||
'SEDAN' => 'Sedan',
|
||||
'SUV' => 'SUV',
|
||||
'TRUCK' => 'Truck',
|
||||
'MOTORCYCLE' => 'Motorcycle',
|
||||
];
|
||||
}
|
||||
Loading…
Reference in a new issue