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

Code before:
        })
    }

    fn get_error_response(
        &self,
        res: Response,
        event_builder: Option<&mut ConnectorEvent>,
    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
        self.build_error_response(res, event_builder)
    }
}

impl ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData>
    for Chargebee
{
    fn get_headers(
        &self,
        req: &hyperswitch_domain_models::types::CreateCustomerRouterData,
        connectors: &Connectors,
    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
        self.build_headers(req, connectors)
    }

    fn get_url(
        &self,
        _req: &hyperswitch_domain_models::types::CreateCustomerRouterData,
        connectors: &Connectors,
    ) -> CustomResult<String, errors::ConnectorError> {
        let url = self
            .base_url(connectors)
            .to_string()
            .replace("$", "hyperswitch-juspay-test"); // TODO: replace with metadata.site
        Ok(format!("{url}v2/customers"))
    }

    fn get_content_type(&self) -> &'static str {
        self.common_get_content_type()
    }

    fn get_request_body(
        &self,
        req: &hyperswitch_domain_models::types::CreateCustomerRouterData,
        _connectors: &Connectors,
    ) -> CustomResult<RequestContent, errors::ConnectorError> {
        let connector_router_data = chargebee::ChargebeeRouterData::from((MinorUnit::new(0), req));
        let connector_req =
            chargebee::ChargebeeCustomerCreateRequest::try_from(&connector_router_data)?;
        Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
    }

    fn build_request(

Review comment (suggestion):
```suggestion
        _req: &CreateCustomerRouterData,
```

Code after:
        RouterData::try_from(ResponseRouterData {
            response,
            data: data.clone(),
            http_code: res.status_code,
        })
    }

    fn get_error_response(
        &self,
        res: Response,
        event_builder: Option<&mut ConnectorEvent>,
    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
        self.build_error_response(res, event_builder)
    }
}

fn get_chargebee_plans_query_params(
    _req: &RouterData<
        GetSubscriptionPlans,
        GetSubscriptionPlansRequest,
        GetSubscriptionPlansResponse,
    >,
) -> CustomResult<String, errors::ConnectorError> {
    // Try to get limit from request, else default to 10
    let limit = _req.request.limit.unwrap_or(10);
    let param = format!("?limit={}&type[is]={}", limit, constants::PLAN_ITEM_TYPE);
    Ok(param)
}

impl api::subscriptions::Subscriptions for Chargebee {}
impl api::subscriptions::GetSubscriptionPlansFlow for Chargebee {}

impl
    ConnectorIntegration<
        GetSubscriptionPlans,
        GetSubscriptionPlansRequest,
        GetSubscriptionPlansResponse,
    > for Chargebee
{
    fn get_headers(
        &self,
        req: &GetSubscriptionPlansRouterData,
        connectors: &Connectors,
    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
        self.build_headers(req, connectors)
    }

    fn get_url(
        &self,
        req: &GetSubscriptionPlansRouterData,
        connectors: &Connectors,