Bug: [FIX] fix 404 when not sending payment_id to compatibility layer




diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index 87560032ea4..56bcb2d58d0 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -7,7 +7,8 @@ use router_env::{instrument, tracing, Flow, Tag};
 use crate::{
     compatibility::{stripe::errors, wrap},
     core::{api_locking::GetLockingInput, payment_methods::Oss, payments},
-    logger, routes,
+    logger,
+    routes::{self, payments::get_or_generate_payment_id},
     services::{api, authentication as auth},
     types::api as api_types,
 };
@@ -26,15 +27,19 @@ pub async fn payment_intents_create(
         Ok(p) => p,
         Err(err) => return api::log_and_return_error_response(err),
     };
+
     tracing::Span::current().record("payment_id", &payload.id.clone().unwrap_or_default());
 
     logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
 
-    let create_payment_req: payment_types::PaymentsRequest = match payload.try_into() {
+    let mut create_payment_req: payment_types::PaymentsRequest = match payload.try_into() {
         Ok(req) => req,
         Err(err) => return api::log_and_return_error_response(err),
     };
 
+    if let Err(err) = get_or_generate_payment_id(&mut create_payment_req) {
+        return api::log_and_return_error_response(err);
+    }
     let flow = Flow::PaymentsCreate;
     let locking_action = create_payment_req.get_locking_input(flow.clone());
     Box::pin(wrap::compatibility_api_wrap::<

## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix


## Description
<!-- Describe your changes in detail -->
Fixed the bug where `compatibility` layer would throw 404 if `payment_id` is not sent.

## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
- This fixes the bug where `compatibility` layer would throw 404 if `payment_id` is not sent in request

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
- Create a payment without passing the `payment_id` to stripe compatibility layer

```bash
curl --location 'http://localhost:8080/vs/v1/payment_intents' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'User-Agent: helloMozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36' \
--header 'api-key: dev_N1nUguE0Mue3z1CrAMAt5ZahpeFGVcwzuiBM9mM6DR9ClR4r5uFrKfI7UcdDnToM' \
--data-urlencode 'amount=2000' \
--data-urlencode 'currency=AED' \
--data-urlencode 'confirm=true' \
--data-urlencode 'payment_method_data%5Btype%5D=card' \
--data-urlencode 'payment_method_data%5Bcard%5D%5Bnumber%5D=4242424242424242' \
--data-urlencode 'payment_method_data%5Bcard%5D%5Bexp_month%5D=12' \
--data-urlencode 'payment_method_data%5Bcard%5D%5Bexp_year%5D=2030' \
--data-urlencode 'payment_method_data%5Bcard%5D%5Bcvc%5D=123' \
--data-urlencode 'connector%5B%5D=stripe' \
--data-urlencode 'capture_method=automatic' \
--data-urlencode 'customer=sahkal' \
--data-urlencode 'description=Card Payment' \
--data-urlencode 'off_session=true' \
--data-urlencode 'mandate_data%5Bcustomer_acceptance%5D%5Bonline%5D%5Buser_agent%5D=helloMozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36' \
--data-urlencode 'mandate_data%5Bcustomer_acceptance%5D%5Bonline%5D%5Bip_address%5D=123.32.25.123' \
--data-urlencode 'mandate_data%5Bamount%5D=20877' \
--data-urlencode 'setup_future_usage=off_session' \
--data-urlencode 'return_url=https://juspay.in' \
--data-urlencode 'metadata%5Btxn_Id%5D=sahkal_payment' \
--data-urlencode 'metadata%5BtxnUuid%5D=94hfdmoakosdkifdhaisl' \
--data-urlencode 'metadata%5Bmerchant_id%5D=sahkal' \
--data-urlencode 'metadata%5Beuler_merchant_id%5D=global_installment' \
--data-urlencode 'connector_metadata%5Bnoon%5D%5Border_category%5D=pay' \
--data-urlencode 'payment_method_data%5Bcard%5D%5Bholder_name%5D=sahkal'
```
- It should return 200 with auto generated `payment_id`

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code