From 78a43ae85cab59d4e9413df4f1160722892112f4 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Fri, 23 Feb 2024 16:53:04 +0800 Subject: [PATCH] Add insurance body types endpoint #791 --- config/routes/apiv2.yaml | 5 +++++ .../CustomerAppAPI/InsuranceController.php | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/config/routes/apiv2.yaml b/config/routes/apiv2.yaml index deb3b11b..dc603c9f 100644 --- a/config/routes/apiv2.yaml +++ b/config/routes/apiv2.yaml @@ -307,4 +307,9 @@ apiv2_insurance_application_create: apiv2_insurance_premiums_banner: path: /apiv2/insurance/premiums_banner controller: App\Controller\CustomerAppAPI\InsuranceController::getPremiumsBanner + methods: [GET] + +apiv2_insurance_body_types: + path: /apiv2/insurance/body_types + controller: App\Controller\CustomerAppAPI\InsuranceController::getBodyTypes methods: [GET] \ No newline at end of file diff --git a/src/Controller/CustomerAppAPI/InsuranceController.php b/src/Controller/CustomerAppAPI/InsuranceController.php index 8685060b..cc7832eb 100644 --- a/src/Controller/CustomerAppAPI/InsuranceController.php +++ b/src/Controller/CustomerAppAPI/InsuranceController.php @@ -307,6 +307,27 @@ class InsuranceController extends ApiController ]); } + public function getBodyTypes(Request $req) + { + // validate params + $validity = $this->validateRequest($req); + + if (!$validity['is_valid']) { + return new ApiResponse(false, $validity['error']); + } + + // TODO: if this changes often, make an entity and make it manageable on CRM + $body_types = [ + 'SEDAN' => 'Sedan', + 'SUV' => 'SUV', + 'TRUCK' => 'Truck', + ]; + + return new ApiResponse(true, '', [ + 'body_types' => $body_types, + ]); + } + protected function getLineType($mv_type_id, $vehicle_use_type, $is_public = false) { $line = '';