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

Code before:

        Ok(Self {
            customer_id: req
                .customer_id
                .as_ref()
                .ok_or_else(|| errors::ConnectorError::MissingRequiredField {
                    field_name: "customer_id",
                })?
                .clone(),
            name: req.name.as_ref().map(|n| n.clone().expose()),
            email: req.email.clone(),
            billing_address: req.billing_address.clone(),
        })
    }
}

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ChargebeeCustomerCreateResponse {
    pub customer: ChargebeeCustomerDetails,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ChargebeeCustomerDetails {
    pub id: String,
    pub name: Option<String>,
    pub email: Option<String>,
    pub billing_address: Option<api_models::payments::AddressDetails>,
}

impl
    TryFrom<
        ResponseRouterData<
            hyperswitch_domain_models::router_flow_types::CreateConnectorCustomer,
            ChargebeeCustomerCreateResponse,
            hyperswitch_domain_models::router_request_types::ConnectorCustomerData,
            PaymentsResponseData,
        >,
    > for hyperswitch_domain_models::types::CreateCustomerRouterData
{
    type Error = error_stack::Report<errors::ConnectorError>;

    fn try_from(
        item: ResponseRouterData<
            hyperswitch_domain_models::router_flow_types::CreateConnectorCustomer,
            ChargebeeCustomerCreateResponse,
            hyperswitch_domain_models::router_request_types::ConnectorCustomerData,
            PaymentsResponseData,
        >,
    ) -> Result<Self, Self::Error> {
        let c = &item.response.customer;


Review comment (security):
```suggestion
    pub name: Option<Secret<String>>,
    pub email: Option<Email>,
```

Code after:
    pub is_giftable: bool,
    pub enabled_for_checkout: bool,
    pub enabled_in_portal: bool,
    pub metered: bool,
    pub deleted: bool,
    pub description: Option<String>,
}

impl<F, T>
    TryFrom<ResponseRouterData<F, ChargebeeListPlansResponse, T, GetSubscriptionPlansResponse>>
    for RouterData<F, T, GetSubscriptionPlansResponse>
{
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(
        item: ResponseRouterData<F, ChargebeeListPlansResponse, T, GetSubscriptionPlansResponse>,
    ) -> Result<Self, Self::Error> {
        let plans = item
            .response
            .list
            .into_iter()
            .map(|plan| {
                hyperswitch_domain_models::router_response_types::subscriptions::SubscriptionPlans {
                    subscription_provider_plan_id: plan.item.id,
                    name: plan.item.name,
                    description: plan.item.description,
                }
            })
            .collect();
        Ok(Self {
            response: Ok(GetSubscriptionPlansResponse { list: plans }),
            ..item.data
        })
    }
}

#[derive(Debug, Serialize)]
pub struct ChargebeeCustomerCreateRequest {
    #[serde(rename = "id")]
    pub customer_id: CustomerId,
    #[serde(rename = "first_name")]
    pub name: Option<Secret<String>>,
    pub email: Option<Email>,
    pub billing_address: Option<api_models::payments::AddressDetails>,
}

impl TryFrom<&ChargebeeRouterData<&hyperswitch_domain_models::types::ConnectorCustomerRouterData>>
    for ChargebeeCustomerCreateRequest
{
    type Error = error_stack::Report<errors::ConnectorError>;

    fn try_from(