| @@ -204,8 +204,21 @@ | ||
| 204 | 204 | if (empty($data)) { |
| 205 | 205 | $data = $request->get_params(); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | + // reCAPTCHA v3 (no-op unless the enquiry form is protected in settings). | |
| 209 | + $recaptcha = \Yatra\Services\RecaptchaService::verifyForm( | |
| 210 | + 'enquiry', | |
| 211 | + (string) ($data['recaptcha_token'] ?? ''), | |
| 212 | + $_SERVER['REMOTE_ADDR'] ?? null | |
| 213 | + ); | |
| 214 | + if (empty($recaptcha['success'])) { | |
| 215 | + return new WP_REST_Response([ | |
| 216 | + 'success' => false, | |
| 217 | + 'message' => $recaptcha['message'] ?? __('reCAPTCHA verification failed.', 'yatra'), | |
| 218 | + ], 400); | |
| 219 | + } | |
| 220 | + | |
| 208 | 221 | $result = $this->enquiryService->createEnquiry($data); |
| 209 | 222 | |
| 210 | 223 | if (!$result['success']) { |
| 211 | 224 | return new WP_REST_Response($result, 400); |
| @@ -273,8 +286,16 @@ | ||
| 273 | 286 | break; |
| 274 | 287 | |
| 275 | 288 | case 'mark_pending': |
| 276 | 289 | $result = $this->enquiryService->bulkUpdateStatus($ids, 'pending'); |
| 290 | + break; | |
| 291 | + | |
| 292 | + case 'mark_completed': | |
| 293 | + $result = $this->enquiryService->bulkUpdateStatus($ids, 'completed'); | |
| 294 | + break; | |
| 295 | + | |
| 296 | + case 'mark_closed': | |
| 297 | + $result = $this->enquiryService->bulkUpdateStatus($ids, 'closed'); | |
| 277 | 298 | break; |
| 278 | 299 | |
| 279 | 300 | case 'mark_spam': |
| 280 | 301 | $result = $this->enquiryService->bulkUpdateStatus($ids, 'spam'); |