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

Code before:
            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
        event_builder.map(|i| i.set_response_body(&response));
        router_env::logger::info!(connector_response=?response);
        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)
    }
}

#[cfg(all(feature = "v2", feature = "v1"))]
impl
    ConnectorIntegrationV2<
        hyperswitch_domain_models::router_flow_types::payments::CreateConnectorCustomer,
        hyperswitch_domain_models::router_data_v2::flow_common_types::CreateCustomerData,
        hyperswitch_domain_models::router_request_types::ConnectorCustomerData,
        hyperswitch_domain_models::router_response_types::PaymentsResponseData,
    > for Chargebee
{
    fn get_headers(
        &self,
        _req: &hyperswitch_domain_models::router_data_v2::RouterDataV2<
            hyperswitch_domain_models::router_flow_types::payments::CreateConnectorCustomer,
            hyperswitch_domain_models::router_data_v2::flow_common_types::CreateCustomerData,
            hyperswitch_domain_models::router_request_types::ConnectorCustomerData,
            hyperswitch_domain_models::router_response_types::PaymentsResponseData,
        >,
    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
        todo!()
    }
    fn get_url(
        &self,
        _req: &hyperswitch_domain_models::router_data_v2::RouterDataV2<
            hyperswitch_domain_models::router_flow_types::payments::CreateConnectorCustomer,
            hyperswitch_domain_models::router_data_v2::flow_common_types::CreateCustomerData,
            hyperswitch_domain_models::router_request_types::ConnectorCustomerData,
            hyperswitch_domain_models::router_response_types::PaymentsResponseData,
        >,
    ) -> CustomResult<String, errors::ConnectorError> {
        todo!()
    }
    fn get_content_type(&self) -> &'static str {

Review comment (suggestion):
```suggestion
        CreateConnectorCustomer,
        flow_common_types::CreateCustomerData,
        ConnectorCustomerData,
        PaymentsResponseData,
```

Code after:

    fn handle_response(
        &self,
        data: &GetSubscriptionPlansRouterData,
        event_builder: Option<&mut ConnectorEvent>,
        res: Response,
    ) -> CustomResult<GetSubscriptionPlansRouterData, errors::ConnectorError> {
        let response: ChargebeeListPlansResponse = res
            .response
            .parse_struct("ChargebeeListPlansResponse")
            .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
        event_builder.map(|i| i.set_response_body(&response));
        router_env::logger::info!(connector_response=?response);
        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)
    }
}

impl GetSubscriptionPlansV2 for Chargebee {}

impl
    ConnectorIntegrationV2<
        GetSubscriptionPlans,
        hyperswitch_domain_models::router_data_v2::flow_common_types::GetSubscriptionPlansData,
        GetSubscriptionPlansRequest,
        GetSubscriptionPlansResponse,
    > for Chargebee
{
    // Not implemented (R)
}

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