diff --git a/src/Controller/CustomerAppAPI/InsuranceController.php b/src/Controller/CustomerAppAPI/InsuranceController.php index 9d302549..271ebdb8 100644 --- a/src/Controller/CustomerAppAPI/InsuranceController.php +++ b/src/Controller/CustomerAppAPI/InsuranceController.php @@ -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, diff --git a/src/Ramcar/InsuranceBodyType.php b/src/Ramcar/InsuranceBodyType.php new file mode 100644 index 00000000..2abffcdc --- /dev/null +++ b/src/Ramcar/InsuranceBodyType.php @@ -0,0 +1,18 @@ + 'Sedan', + 'SUV' => 'SUV', + 'TRUCK' => 'Truck', + 'MOTORCYCLE' => 'Motorcycle', + ]; +}