feat(connector): Add support for chargebee recovery webhooks (#7110)

Co-authored-by: Chikke Srujan <chikke.srujan@Chikke-Srujan-N7WRTY72X7.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
chikke srujan
2025-02-27 17:02:18 +05:30
committed by GitHub
parent 5965d0f8ac
commit 37aacfa165
16 changed files with 436 additions and 14 deletions

View File

@ -38,7 +38,7 @@ v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2", "hyperswitch_domain_models/payment_methods_v2", "storage_impl/payment_methods_v2", "common_utils/payment_methods_v2"]
dynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing", "api_models/dynamic_routing"]
revenue_recovery =["api_models/revenue_recovery","hyperswitch_interfaces/revenue_recovery","hyperswitch_domain_models/revenue_recovery"]
revenue_recovery =["api_models/revenue_recovery","hyperswitch_interfaces/revenue_recovery","hyperswitch_domain_models/revenue_recovery","hyperswitch_connectors/revenue_recovery"]
# Partial Auth
# The feature reduces the overhead of the router authenticating the merchant for every request, and trusts on `x-merchant-id` header to be present in the request.

View File

@ -14,6 +14,7 @@ use diesel_models::configs;
#[cfg(all(any(feature = "v1", feature = "v2"), feature = "olap"))]
use diesel_models::{business_profile::CardTestingGuardConfig, organization::OrganizationBridge};
use error_stack::{report, FutureExt, ResultExt};
use hyperswitch_connectors::connectors::chargebee;
use hyperswitch_domain_models::merchant_connector_account::{
FromRequestEncryptableMerchantConnectorAccount, UpdateEncryptableMerchantConnectorAccount,
};
@ -1310,6 +1311,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
cashtocode::transformers::CashtocodeAuthType::try_from(self.auth_type)?;
Ok(())
}
api_enums::Connector::Chargebee => {
chargebee::transformers::ChargebeeAuthType::try_from(self.auth_type)?;
Ok(())
}
api_enums::Connector::Checkout => {
checkout::transformers::CheckoutAuthType::try_from(self.auth_type)?;
Ok(())
@ -1844,6 +1849,8 @@ impl ConnectorTypeAndConnectorName<'_> {
api_enums::convert_authentication_connector(self.connector_name.to_string().as_str());
let tax_connector =
api_enums::convert_tax_connector(self.connector_name.to_string().as_str());
let billing_connector =
api_enums::convert_billing_connector(self.connector_name.to_string().as_str());
if pm_auth_connector.is_some() {
if self.connector_type != &api_enums::ConnectorType::PaymentMethodAuth
@ -1868,6 +1875,13 @@ impl ConnectorTypeAndConnectorName<'_> {
}
.into());
}
} else if billing_connector.is_some() {
if self.connector_type != &api_enums::ConnectorType::BillingProcessor {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid connector type given".to_string(),
}
.into());
}
} else {
let routable_connector_option = self
.connector_name

View File

@ -359,9 +359,11 @@ impl ConnectorData {
Ok(ConnectorEnum::Old(Box::new(connector::Braintree::new())))
}
enums::Connector::Cashtocode => {
// enums::Connector::Chargebee => Ok(ConnectorEnum::Old(Box::new(connector::Chargebee))),
Ok(ConnectorEnum::Old(Box::new(connector::Cashtocode::new())))
}
enums::Connector::Chargebee => {
Ok(ConnectorEnum::Old(Box::new(connector::Chargebee::new())))
}
enums::Connector::Checkout => {
Ok(ConnectorEnum::Old(Box::new(connector::Checkout::new())))
}

View File

@ -225,7 +225,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Boku => Self::Boku,
api_enums::Connector::Braintree => Self::Braintree,
api_enums::Connector::Cashtocode => Self::Cashtocode,
// api_enums::Connector::Chargebee => Self::Chargebee,
api_enums::Connector::Chargebee => Self::Chargebee,
api_enums::Connector::Checkout => Self::Checkout,
api_enums::Connector::Coinbase => Self::Coinbase,
api_enums::Connector::Coingate => Self::Coingate,