From 270a4cfb1082a041ff8daae760e7e45e173638a0 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Thu, 22 Feb 2024 16:51:26 +0800 Subject: [PATCH] Add endpoint for insurance premiums banner #791 --- .gitignore | 1 + config/routes/apiv2.yaml | 5 +++++ config/services.yaml | 1 + .../CustomerAppAPI/InsuranceController.php | 14 ++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index cf3b012e..c99c0c14 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ *.swp /public/warranty_uploads/* +.vscode diff --git a/config/routes/apiv2.yaml b/config/routes/apiv2.yaml index 9f183530..deb3b11b 100644 --- a/config/routes/apiv2.yaml +++ b/config/routes/apiv2.yaml @@ -303,3 +303,8 @@ apiv2_insurance_application_create: path: /apiv2/insurance/application controller: App\Controller\CustomerAppAPI\InsuranceController::createApplication methods: [POST] + +apiv2_insurance_premiums_banner: + path: /apiv2/insurance/premiums_banner + controller: App\Controller\CustomerAppAPI\InsuranceController::getPremiumsBanner + methods: [GET] \ No newline at end of file diff --git a/config/services.yaml b/config/services.yaml index b19ecabc..4cd646ec 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -15,6 +15,7 @@ parameters: api_version: "%env(API_VERSION)%" android_app_version: "%env(ANDROID_APP_VERSION)%" ios_app_version: "%env(IOS_APP_VERSION)%" + insurance_premiums_banner_url: "%env(INSURANCE_PREMIUMS_BANNER_URL)%" services: # default configuration for services in *this* file diff --git a/src/Controller/CustomerAppAPI/InsuranceController.php b/src/Controller/CustomerAppAPI/InsuranceController.php index a3c5624a..8685060b 100644 --- a/src/Controller/CustomerAppAPI/InsuranceController.php +++ b/src/Controller/CustomerAppAPI/InsuranceController.php @@ -293,6 +293,20 @@ class InsuranceController extends ApiController ]); } + public function getPremiumsBanner(Request $req) + { + // validate params + $validity = $this->validateRequest($req); + + if (!$validity['is_valid']) { + return new ApiResponse(false, $validity['error']); + } + + return new ApiResponse(true, '', [ + 'url' => $this->getParameter('insurance_premiums_banner_url'), + ]); + } + protected function getLineType($mv_type_id, $vehicle_use_type, $is_public = false) { $line = '';