Bug: [FEATURE]: [Noon] Currency Unit Conversion



### :memo: Feature Description

- Each currency can be described in terms of base or minor units. 
- For instance, when dealing with USD currency, the Cent is considered as the minor unit, while the Dollar is considered the base unit. 
- In Hyperswitch, the amount value is expected to be always provided in minor units. 
- For example: In USD, If the amount is 1 in base unit (Dollar), then it will be equivalent to 100 in minor units (Cent)
- Some of the connectors integrated require the amount to be converted to a desirable unit before being passed to them. 
- We have functions `to_currency_base_unit` and `to_currency_lower_unit` in place to convert the minor unit amount to its decimal equivalent and vice versa. These conversions are handled explicitly based on the connector.


### :hammer: Possible Implementation

- ConnectorCommon trait have been implemented for the connector. 
- This trait contains `get_currency_unit` method. This method needs to be implemented. 
- It will define what type of conversion needs to be done during `connector_router_data` creation. Concurrently handle the creation of `connector_router_data` to be passed for the connector request body creation.
- You can check this PR for further reference https://github.com/juspay/hyperswitch/pull/2196

:bookmark: Note: All the changes needed should be contained within `hyperswitch/crates/router/src/connector/`

### :package: Have you spent some time checking if this feature request has been raised before?

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

### :package: Have you read the Contributing Guidelines?

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

### :sparkles: Are you willing to submit a PR?

diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rs
index 45792864255..3bfcbbc6169 100644
--- a/crates/router/src/connector/noon.rs
+++ b/crates/router/src/connector/noon.rs
@@ -114,6 +114,10 @@ impl ConnectorCommon for Noon {
         "noon"
     }
 
+    fn get_currency_unit(&self) -> api::CurrencyUnit {
+        api::CurrencyUnit::Base
+    }
+
     fn common_get_content_type(&self) -> &'static str {
         "application/json"
     }
@@ -213,7 +217,13 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
         req: &types::PaymentsAuthorizeRouterData,
         _connectors: &settings::Connectors,
     ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
-        let req_obj = noon::NoonPaymentsRequest::try_from(req)?;
+        let router_obj = noon::NoonRouterData::try_from((
+            &self.get_currency_unit(),
+            req.request.currency,
+            req.request.amount,
+            req,
+        ))?;
+        let req_obj = noon::NoonPaymentsRequest::try_from(&router_obj)?;
         let noon_req = types::RequestBody::log_and_get_request_body(
             &req_obj,
             utils::Encode::<noon::NoonPaymentsRequest>::encode_to_string_of_json,
@@ -519,7 +529,13 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
         req: &types::RefundsRouterData<api::Execute>,
         _connectors: &settings::Connectors,
     ) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
-        let req_obj = noon::NoonPaymentsActionRequest::try_from(req)?;
+        let router_obj = noon::NoonRouterData::try_from((
+            &self.get_currency_unit(),
+            req.request.currency,
+            req.request.refund_amount,
+            req,
+        ))?;
+        let req_obj = noon::NoonPaymentsActionRequest::try_from(&router_obj)?;
         let noon_req = types::RequestBody::log_and_get_request_body(
             &req_obj,
             utils::Encode::<noon::NoonPaymentsActionRequest>::encode_to_string_of_json,
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index 5ff92582051..d6b46d9743d 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -175,6 +175,39 @@ pub enum NoonApiOperations {
     Reverse,
     Refund,
 }
+
+#[derive(Debug, Serialize)]
+pub struct NoonRouterData<T> {
+    pub amount: String,
+    pub router_data: T,
+}
+
+impl<T>
+    TryFrom<(
+        &types::api::CurrencyUnit,
+        types::storage::enums::Currency,
+        i64,
+        T,
+    )> for NoonRouterData<T>
+{
+    type Error = error_stack::Report<errors::ConnectorError>;
+
+    fn try_from(
+        (currency_unit, currency, amount, router_data): (
+            &types::api::CurrencyUnit,
+            types::storage::enums::Currency,
+            i64,
+            T,
+        ),
+    ) -> Result<Self, Self::Error> {
+        let amount = conn_utils::get_amount_as_string(currency_unit, amount, currency)?;
+        Ok(Self {
+            amount,
+            router_data,
+        })
+    }
+}
+
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct NoonPaymentsRequest {
@@ -186,10 +219,16 @@ pub struct NoonPaymentsRequest {
     billing: Option<NoonBilling>,
 }
 
-impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
+impl TryFrom<&NoonRouterData<&types::PaymentsAuthorizeRouterData>> for NoonPaymentsRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
-        let (payment_data, currency, category) = match item.request.connector_mandate_id() {
+    fn try_from(
+        item: &NoonRouterData<&types::PaymentsAuthorizeRouterData>,
+    ) -> Result<Self, Self::Error> {
+        let (payment_data, currency, category) = match item
+            .router_data
+            .request
+            .connector_mandate_id()
+        {
             Some(subscription_identifier) => (
                 NoonPaymentData::Subscription(NoonSubscription {
                     subscription_identifier,
@@ -198,7 +237,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
                 None,
             ),
             _ => (
-                match item.request.payment_method_data.clone() {
+                match item.router_data.request.payment_method_data.clone() {
                     api::PaymentMethodData::Card(req_card) => Ok(NoonPaymentData::Card(NoonCard {
                         name_on_card: req_card.card_holder_name.clone(),
                         number_plain: req_card.card_number.clone(),
@@ -242,7 +281,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
                         }
                         api_models::payments::WalletData::PaypalRedirect(_) => {
                             Ok(NoonPaymentData::PayPal(NoonPayPal {
-                                return_url: item.request.get_router_return_url()?,
+                                return_url: item.router_data.request.get_router_return_url()?,
                             }))
                         }
                         api_models::payments::WalletData::AliPayQr(_)
@@ -291,13 +330,14 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
                         })
                     }
                 }?,
-                Some(item.request.currency),
-                item.request.order_category.clone(),
+                Some(item.router_data.request.currency),
+                item.router_data.request.order_category.clone(),
             ),
         };
 
         // The description should not have leading or trailing whitespaces, also it should not have double whitespaces and a max 50 chars according to Noon's Docs
         let name: String = item
+            .router_data
             .get_description()?
             .trim()
             .replace("  ", " ")
@@ -305,11 +345,12 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
             .take(50)
             .collect();
 
-        let ip_address = item.request.get_ip_address_as_optional();
+        let ip_address = item.router_data.request.get_ip_address_as_optional();
 
         let channel = NoonChannels::Web;
 
         let billing = item
+            .router_data
             .address
             .billing
             .clone()
@@ -326,27 +367,34 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
                 },
             });
 
-        let (subscription, tokenize_c_c) =
-            match item.request.setup_future_usage.is_some().then_some((
+        let (subscription, tokenize_c_c) = match item
+            .router_data
+            .request
+            .setup_future_usage
+            .is_some()
+            .then_some((
                 NoonSubscriptionData {
                     subscription_type: NoonSubscriptionType::Unscheduled,
                     name: name.clone(),
                 },
                 true,
             )) {
-                Some((a, b)) => (Some(a), Some(b)),
-                None => (None, None),
-            };
+            Some((a, b)) => (Some(a), Some(b)),
+            None => (None, None),
+        };
         let order = NoonOrder {
-            amount: conn_utils::to_currency_base_unit(item.request.amount, item.request.currency)?,
+            amount: conn_utils::to_currency_base_unit(
+                item.router_data.request.amount,
+                item.router_data.request.currency,
+            )?,
             currency,
             channel,
             category,
-            reference: item.connector_request_reference_id.clone(),
+            reference: item.router_data.connector_request_reference_id.clone(),
             name,
             ip_address,
         };
-        let payment_action = if item.request.is_auto_capture()? {
+        let payment_action = if item.router_data.request.is_auto_capture()? {
             NoonPaymentActions::Sale
         } else {
             NoonPaymentActions::Authorize
@@ -357,7 +405,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
             billing,
             configuration: NoonConfiguration {
                 payment_action,
-                return_url: item.request.router_return_url.clone(),
+                return_url: item.router_data.request.router_return_url.clone(),
                 tokenize_c_c,
             },
             payment_data,
@@ -598,19 +646,19 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NoonPaymentsCancelRequest {
     }
 }
 
-impl<F> TryFrom<&types::RefundsRouterData<F>> for NoonPaymentsActionRequest {
+impl<F> TryFrom<&NoonRouterData<&types::RefundsRouterData<F>>> for NoonPaymentsActionRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
+    fn try_from(item: &NoonRouterData<&types::RefundsRouterData<F>>) -> Result<Self, Self::Error> {
         let order = NoonActionOrder {
-            id: item.request.connector_transaction_id.clone(),
+            id: item.router_data.request.connector_transaction_id.clone(),
         };
         let transaction = NoonActionTransaction {
             amount: conn_utils::to_currency_base_unit(
-                item.request.refund_amount,
-                item.request.currency,
+                item.router_data.request.refund_amount,
+                item.router_data.request.currency,
             )?,
-            currency: item.request.currency,
-            transaction_reference: Some(item.request.refund_id.clone()),
+            currency: item.router_data.request.currency,
+            transaction_reference: Some(item.router_data.request.refund_id.clone()),
         };
         Ok(Self {
             api_operation: NoonApiOperations::Refund,

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

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
- Addressing Issue #2237 
- Modified two files in `hyperswitch/crates/router/src/connector/`
  - `noon.rs`
    - Implement `get_currency_unit` function
    - Modify `ConnectorIntegration` implementations for `Noon`
  - `noon/transformers.rs`
    - Implement `NoonRouterData<T>` structure and functionality
    - Modify implementation for `NoonPaymentsRequest`


### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## 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).
-->


## 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)?
-->


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

- [x] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
