Bug: [BUG] "mandate_data" returned as null in the PaymentsCreate response body while creating a new mandate payment



### Bug Description

While creating a new mandate payment, the `mandate_data` field is being returned as **null** in the response body. This occurs even after passing the right `mandate_data` content in the request body.

### Expected Behavior

`mandate_data` should be set and returned in accordance to what is being passed in the request body.

### Steps To Reproduce

Create a mandate payment by passing a valid set of mandate data and check the response body.

### Environment

Local

### Have you spent some time to check if this bug has been raised before?

- [X] I checked and didn't find similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes I am willing to submit a PR!
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index a49a8f00fa8..58652009b27 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1422,6 +1422,7 @@ pub struct PaymentsResponse {
     pub mandate_id: Option<String>,
 
     /// Provided mandate information for creating a mandate
+    #[auth_based]
     pub mandate_data: Option<MandateData>,
 
     /// Indicates that you intend to make future payments with this Payment’s payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 407b6353645..96a5852ead8 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -179,6 +179,7 @@ where
             &operation,
             payment_data.ephemeral_key,
             payment_data.sessions_token,
+            payment_data.setup_mandate,
         )
     }
 }
@@ -269,6 +270,7 @@ pub fn payments_to_payments_response<R, Op>(
     operation: &Op,
     ephemeral_key_option: Option<ephemeral_key::EphemeralKey>,
     session_tokens: Vec<api::SessionToken>,
+    mandate_data: Option<api_models::payments::MandateData>,
 ) -> RouterResponse<api::PaymentsResponse>
 where
     Op: Debug,
@@ -412,6 +414,10 @@ where
                                 .and_then(|cus| cus.phone.as_ref().map(|s| s.to_owned())),
                         )
                         .set_mandate_id(mandate_id)
+                        .set_mandate_data(
+                            mandate_data.map(api::MandateData::from),
+                            auth_flow == services::AuthFlow::Merchant,
+                        )
                         .set_description(payment_intent.description)
                         .set_refunds(refunds_response) // refunds.iter().map(refund_to_refund_response),
                         .set_disputes(disputes_response)

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

- [x] Bugfix

## Description
<!-- Describe your changes in detail -->
Earlier `mandate_data` was being returned as `null`. This PR fixes the same and populates `mandate_data` with the same content as sent in the request body.

## 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 its an obvious bug or documentation fix
that will have little conversation).
-->
This PR closes [this](https://github.com/juspay/hyperswitch/issues/1532) issue.

## 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)?
-->
Locally using Postman

## 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 submitted code