Repository: juspay/hyperswitch
File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs (Rust)

Code before:
                                        currency_code: data.request.currency,
                                        total_price_status: GooglePayPriceStatus::Final.to_string(),
                                        total_price: StringMajorUnitForConnector
                                            .convert(
                                                MinorUnit::new(data.request.amount),
                                                data.request.currency,
                                            )
                                            .change_context(
                                                errors::ConnectorError::AmountConversionFailed,
                                            )?,
                                    },
                                    secrets: Some(payment_types::SecretInfoToInitiateSdk {
                                        display: res.data.create_client_token.client_token.clone(),
                                        payment: None,
                                    }),
                                    delayed_session_token: false,
                                    connector: data.connector.clone(),
                                    sdk_next_action: payment_types::SdkNextAction {
                                        next_action: payment_types::NextActionCall::Confirm,
                                    },
                                },
                            ),
                        ))
                    }
                    Some(common_enums::PaymentMethodType::Paypal) => {
                        let metadata = data.connector_meta_data.clone();

                        let paypal_sdk_data = data
                            .connector_meta_data
                            .clone()
                            .parse_value::<payment_types::PaypalSdkSessionTokenData>(
                                "PaypalSdkSessionTokenData",
                            )
                            .change_context(errors::ConnectorError::NoConnectorMetaData)
                            .attach_printable(format!(
                                "Failed to parse paypal_sdk metadata from the given value {metadata:?}"
                            ))?;

                        SessionToken::Paypal(Box::new(
                            api_models::payments::PaypalSessionTokenResponse {
                                connector: data.connector.clone(),
                                session_token: paypal_sdk_data.data.client_id,
                                sdk_next_action: api_models::payments::SdkNextAction {
                                    next_action: api_models::payments::NextActionCall::Confirm,
                                },
                                client_token: Some(
                                    res.data.create_client_token.client_token.clone().expose(),
                                ),
                                transaction_info: Some(
                                    api_models::payments::PaypalTransactionInfo {
                                        flow: PaypalFlow::Checkout.to_string(),

Review comment (suggestion):

```suggestion
                        let metadata = &data.connector_meta_data;
```

Code after:
                                        country_code: data.request.country.ok_or(
                                            errors::ConnectorError::MissingRequiredField {
                                                field_name: "country",
                                            },
                                        )?,
                                        currency_code: data.request.currency,
                                        total_price_status: GooglePayPriceStatus::Final.to_string(),
                                        total_price: StringMajorUnitForConnector
                                            .convert(
                                                MinorUnit::new(data.request.amount),
                                                data.request.currency,
                                            )
                                            .change_context(
                                                errors::ConnectorError::AmountConversionFailed,
                                            )?,
                                    },
                                    secrets: Some(payment_types::SecretInfoToInitiateSdk {
                                        display: res.data.create_client_token.client_token.clone(),
                                        payment: None,
                                    }),
                                    delayed_session_token: false,
                                    connector: data.connector.clone(),
                                    sdk_next_action: payment_types::SdkNextAction {
                                        next_action: payment_types::NextActionCall::Confirm,
                                    },
                                },
                            ),
                        ))
                    }
                    Some(common_enums::PaymentMethodType::Paypal) => {
                        let paypal_sdk_data = data
                            .connector_meta_data
                            .clone()
                            .parse_value::<payment_types::PaypalSdkSessionTokenData>(
                                "PaypalSdkSessionTokenData",
                            )
                            .change_context(errors::ConnectorError::NoConnectorMetaData)
                            .attach_printable("Failed to parse paypal_sdk metadata.".to_string())?;

                        SessionToken::Paypal(Box::new(
                            api_models::payments::PaypalSessionTokenResponse {
                                connector: data.connector.clone(),
                                session_token: paypal_sdk_data.data.client_id,
                                sdk_next_action: api_models::payments::SdkNextAction {
                                    next_action: api_models::payments::NextActionCall::Confirm,
                                },
                                client_token: Some(
                                    res.data.create_client_token.client_token.clone().expose(),
                                ),
                                transaction_info: Some(
                                    api_models::payments::PaypalTransactionInfo {