Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(connector): Add recovery support for stripebilling (#7461)

CHALLA NISHANTH BABUcfe226943dc5
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 6e656a70ef..fa4dd68ede 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7811,6 +7811,7 @@
"square",
"stax",
"stripe",
+ "stripebilling",
"taxjar",
"threedsecureio",
"trustpay",
@@ -21074,6 +21075,7 @@
"square",
"stax",
"stripe",
+ "stripebilling",
"trustpay",
"tsys",
"volt",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 04d598543a..8ce45e57a5 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9893,6 +9893,7 @@
"square",
"stax",
"stripe",
+ "stripebilling",
"taxjar",
"threedsecureio",
"trustpay",
@@ -25443,6 +25444,7 @@
"square",
"stax",
"stripe",
+ "stripebilling",
"trustpay",
"tsys",
"volt",
diff --git a/config/config.example.toml b/config/config.example.toml
index b024dd6150..3464bcb136 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -954,5 +954,5 @@ foreground_color = "#111326"
primary_color = "#006DF9" # Primary color
background_color = "#FFFFFF" # Email background color
-[additional_revenue_recovery_details_call]
-connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-call
+[billing_connectors_payment_sync]
+billing_connectors_which_require_payment_sync = "stripebilling" # List of billing connectors which has payment sync api call
diff --git a/config/development.toml b/config/development.toml
index cae8a54940..279601eb83 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -797,8 +797,8 @@ connectors_with_delayed_session_response = "trustpay,payme"
[webhook_source_verification_call]
connectors_with_webhook_source_verification_call = "paypal"
-[additional_revenue_recovery_details_call]
-connectors_with_additional_revenue_recovery_details_call = "stripebilling"
+[billing_connectors_payment_sync]
+billing_connectors_which_require_payment_sync = "stripebilling"
[mandates.supported_payment_methods]
bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index f7e180e253..e78a26396e 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -326,8 +326,8 @@ connectors_with_delayed_session_response = "trustpay,payme"
[webhook_source_verification_call]
connectors_with_webhook_source_verification_call = "paypal"
-[additional_revenue_recovery_details_call]
-connectors_with_additional_revenue_recovery_details_call = "stripebilling"
+[billing_connectors_payment_sync]
+billing_connectors_which_require_payment_sync = "stripebilling"
[scheduler]
stream = "SCHEDULER_STREAM"
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index d5404d57aa..aa26f55fa7 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -261,6 +261,50 @@ pub enum InvoiceIdType {
ConnectorInvoiceId(String),
}
+#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+impl ObjectReferenceId {
+ pub fn get_connector_transaction_id_as_string(
+ self,
+ ) -> Result<String, common_utils::errors::ValidationError> {
+ match self {
+ Self::PaymentId(
+ payments::PaymentIdType::ConnectorTransactionId(id)
+ ) => Ok(id),
+ Self::PaymentId(_)=>Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "ConnectorTransactionId variant of PaymentId is required but received otherr variant",
+ },
+ ),
+ Self::RefundId(_) => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "PaymentId is required but received RefundId",
+ },
+ ),
+ Self::MandateId(_) => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "PaymentId is required but received MandateId",
+ },
+ ),
+ Self::ExternalAuthenticationID(_) => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "PaymentId is required but received ExternalAuthenticationID",
+ },
+ ),
+ #[cfg(feature = "payouts")]
+ Self::PayoutId(_) => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "PaymentId is required but received PayoutId",
+ },
+ ),
+ Self::InvoiceId(_) => Err(
+ common_utils::errors::ValidationError::IncorrectValueProvided {
+ field_name: "PaymentId is required but received InvoiceId",
+ },
+ )
+ }
+ }
+}
+
pub struct IncomingWebhookDetails {
pub object_reference_id: ObjectReferenceId,
pub resource_object: Vec<u8>,
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index a99bf83bc4..70efd457a9 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -129,7 +129,7 @@ pub enum RoutableConnectors {
Square,
Stax,
Stripe,
- //Stripebilling,
+ Stripebilling,
// Taxjar,
Trustpay,
// Thunes
@@ -275,7 +275,7 @@ pub enum Connector {
Square,
Stax,
Stripe,
- // Stripebilling,
+ Stripebilling,
Taxjar,
Threedsecureio,
//Thunes,
@@ -430,7 +430,7 @@ impl Connector {
| Self::Shift4
| Self::Square
| Self::Stax
- // | Self::Stripebilling
+ | Self::Stripebilling
| Self::Taxjar
// | Self::Thunes
| Self::Trustpay
@@ -582,7 +582,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Square => Self::Square,
RoutableConnectors::Stax => Self::Stax,
RoutableConnectors::Stripe => Self::Stripe,
- // RoutableConnectors::Stripebilling => Self::Stripebilling,
+ RoutableConnectors::Stripebilling => Self::Stripebilling,
RoutableConnectors::Trustpay => Self::Trustpay,
RoutableConnectors::Tsys => Self::Tsys,
RoutableConnectors::Volt => Self::Volt,
@@ -688,6 +688,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Square => Ok(Self::Square),
Connector::Stax => Ok(Self::Stax),
Connector::Stripe => Ok(Self::Stripe),
+ Connector::Stripebilling => Ok(Self::Stripebilling),
Connector::Trustpay => Ok(Self::Trustpay),
Connector::Tsys => Ok(Self::Tsys),
Connector::Volt => Ok(Self::Volt),
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index c4f9ba75ba..782ca4cb71 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -244,7 +244,7 @@ pub struct ConnectorConfig {
pub stripe: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub stripe_payout: Option<ConnectorTomlConfig>,
- // pub stripebilling : Option<ConnectorTomlConfig>,
+ pub stripebilling: Option<ConnectorTomlConfig>,
pub signifyd: Option<ConnectorTomlConfig>,
pub trustpay: Option<ConnectorTomlConfig>,
pub threedsecureio: Option<ConnectorTomlConfig>,
@@ -420,7 +420,7 @@ impl ConnectorConfig {
Connector::Square => Ok(connector_data.square),
Connector::Stax => Ok(connector_data.stax),
Connector::Stripe => Ok(connector_data.stripe),
- // Connector::Stripebilling => Ok(connector_data.stripebilling),
+ Connector::Stripebilling => Ok(connector_data.stripebilling),
Connector::Trustpay => Ok(connector_data.trustpay),
Connector::Threedsecureio => Ok(connector_data.threedsecureio),
Connector::Taxjar => Ok(connector_data.taxjar),
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index 568f8b4919..721e22485b 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -9,6 +9,8 @@ use common_utils::{
types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
};
use error_stack::{report, ResultExt};
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+use hyperswitch_domain_models::revenue_recovery;
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
@@ -29,10 +31,10 @@ use hyperswitch_domain_models::{
};
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
use hyperswitch_domain_models::{
- router_flow_types::RecoveryRecordBack,
- router_request_types::revenue_recovery::RevenueRecoveryRecordBackRequest,
- router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
- types::RevenueRecoveryRecordBackRouterData,
+ router_flow_types::revenue_recovery as recovery_router_flows,
+ router_request_types::revenue_recovery as recovery_request_types,
+ router_response_types::revenue_recovery as recovery_response_types,
+ types as recovery_router_data_types,
};
use hyperswitch_interfaces::{
api::{
@@ -45,7 +47,10 @@ use hyperswitch_interfaces::{
types::{self, Response},
webhooks,
};
-use masking::{ExposeInterface, Mask};
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+use masking::ExposeInterface;
+use masking::{Mask, PeekInterface};
+use stripebilling::auth_headers;
use transformers as stripebilling;
use crate::{constants::headers, types::ResponseRouterData, utils};
@@ -77,6 +82,8 @@ impl api::RefundSync for Stripebilling {}
impl api::PaymentToken for Stripebilling {}
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
impl api::revenue_recovery::RevenueRecoveryRecordBack for Stripebilling {}
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+impl api::revenue_recovery::BillingConnectorPaymentsSyncIntegration for Stripebilling {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Stripebilling
@@ -126,10 +133,16 @@ impl ConnectorCommon for Stripebilling {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = stripebilling::StripebillingAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
- Ok(vec![(
- headers::AUTHORIZATION.to_string(),
- auth.api_key.expose().into_masked(),
- )])
+ Ok(vec![
+ (
+ headers::AUTHORIZATION.to_string(),
+ format!("Bearer {}", auth.api_key.peek()).into_masked(),
+ ),
+ (
+ auth_headers::STRIPE_API_VERSION.to_string(),
+ auth_headers::STRIPE_VERSION.to_string().into_masked(),
+ ),
+ ])
}
fn build_error_response(
@@ -562,14 +575,14 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Stripebil
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
impl
ConnectorIntegration<
- RecoveryRecordBack,
- RevenueRecoveryRecordBackRequest,
- RevenueRecoveryRecordBackResponse,
+ recovery_router_flows::BillingConnectorPaymentsSync,
+ recovery_request_types::BillingConnectorPaymentsSyncRequest,
+ recovery_response_types::BillingConnectorPaymentsSyncResponse,
> for Stripebilling
{
fn get_headers(
&self,
- req: &RevenueRecoveryRecordBackRouterData,
+ req: &recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
@@ -581,7 +594,94 @@ impl
fn get_url(
&self,
- req: &RevenueRecoveryRecordBackRouterData,
+ req: &recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!(
+ "{}v1/charges/{}",
+ self.base_url(connectors),
+ req.request.billing_connector_psync_id
+ ))
+ }
+
+ fn build_request(
+ &self,
+ req: &recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::BillingConnectorPaymentsSyncType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::BillingConnectorPaymentsSyncType::get_headers(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<
+ recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
+ errors::ConnectorError,
+ > {
+ let response: stripebilling::StripebillingRecoveryDetailsData = res
+ .response
+ .parse_struct::<stripebilling::StripebillingRecoveryDetailsData>(
+ "StripebillingRecoveryDetailsData",
+ )
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ recovery_router_data_types::BillingConnectorPaymentsSyncRouterData::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 = "revenue_recovery"))]
+impl
+ ConnectorIntegration<
+ recovery_router_flows::RecoveryRecordBack,
+ recovery_request_types::RevenueRecoveryRecordBackRequest,
+ recovery_response_types::RevenueRecoveryRecordBackResponse,
+ > for Stripebilling
+{
+ fn get_headers(
+ &self,
+ req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let invoice_id = req
@@ -604,7 +704,7 @@ impl
fn build_request(
&self,
- req: &RevenueRecoveryRecordBackRouterData,
+ req: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
@@ -623,10 +723,13 @@ impl
fn handle_response(
&self,
- data: &RevenueRecoveryRecordBackRouterData,
+ data: &recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
- ) -> CustomResult<RevenueRecoveryRecordBackRouterData, errors::ConnectorError> {
+ ) -> CustomResult<
+ recovery_router_data_types::RevenueRecoveryRecordBackRouterData,
+ errors::ConnectorError,
+ > {
let response = res
.response
.parse_struct::<stripebilling::StripebillingRecordBackResponse>(
@@ -635,11 +738,13 @@ impl
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
- RevenueRecoveryRecordBackRouterData::try_from(ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- })
+ recovery_router_data_types::RevenueRecoveryRecordBackRouterData::try_from(
+ ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ },
+ )
}
fn get_error_response(
@@ -712,6 +817,7 @@ impl webhooks::IncomingWebhook for Stripebilling {
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
+
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
fn get_webhook_event_type(
&self,
@@ -762,6 +868,25 @@ impl webhooks::IncomingWebhook for Stripebilling {
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
Ok(Box::new(webhook))
}
+
+ #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+ fn get_revenue_recovery_attempt_details(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<revenue_recovery::RevenueRecoveryAttemptData, errors::ConnectorError> {
+ // since stripe requires an additional call we dont need to implement this function because we get the recovery data from additional call itself
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+ #[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+ fn get_revenue_recovery_invoice_details(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<revenue_recovery::RevenueRecoveryInvoiceData, errors::ConnectorError> {
+ let webhook = stripebilling::StripebillingInvoiceBody::get_invoice_webhook_data_from_body(
+ request.body,
+ )?;
+ revenue_recovery::RevenueRecoveryInvoiceData::try_from(webhook)
+ }
}
fn get_signature_elements_from_header(
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
index ccd40f851e..7fdbace518 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -18,20 +18,26 @@ use hyperswitch_domain_models::{
};
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
use hyperswitch_domain_models::{
- router_flow_types::RecoveryRecordBack,
- router_request_types::revenue_recovery::RevenueRecoveryRecordBackRequest,
- router_response_types::revenue_recovery::RevenueRecoveryRecordBackResponse,
- types::RevenueRecoveryRecordBackRouterData,
+ router_flow_types::revenue_recovery as recovery_router_flows,
+ router_request_types::revenue_recovery as recovery_request_types,
+ router_response_types::revenue_recovery as recovery_response_types,
+ types as recovery_router_data_types,
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
+use time::PrimitiveDateTime;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{convert_uppercase, PaymentsAuthorizeRequestData},
};
+pub mod auth_headers {
+ pub const STRIPE_API_VERSION: &str = "stripe-version";
+ pub const STRIPE_VERSION: &str = "2022-11-15";
+}
+
//TODO: Fill the struct with respective fields
pub struct StripebillingRouterData<T> {
pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
@@ -303,6 +309,61 @@ pub struct StripebillingInvoiceObject {
pub amount: common_utils::types::MinorUnit,
}
+impl StripebillingWebhookBody {
+ pub fn get_webhook_object_from_body(body: &[u8]) -> CustomResult<Self, errors::ConnectorError> {
+ let webhook_body: Self = body
+ .parse_struct::<Self>("StripebillingWebhookBody")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+
+ Ok(webhook_body)
+ }
+}
+
+impl StripebillingInvoiceBody {
+ pub fn get_invoice_webhook_data_from_body(
+ body: &[u8],
+ ) -> CustomResult<Self, errors::ConnectorError> {
+ let webhook_body = body
+ .parse_struct::<Self>("StripebillingInvoiceBody")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok(webhook_body)
+ }
+}
+
+#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
+impl TryFrom<StripebillingInvoiceBody> for revenue_recovery::RevenueRecoveryInvoiceData {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: StripebillingInvoiceBody) -> Result<Self, Self::Error> {
+ let merchant_reference_id =
+ id_type::PaymentReferenceId::from_str(&item.data.object.invoice_id)
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ Ok(Self {
+ amount: item.data.object.amount,
+ currency: item.data.object.currency,
+ merchant_reference_id,
+ })
+ }
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone)]
+pub struct StripebillingRecoveryDetailsData {
+ #[serde(rename = "id")]
+ pub charge_id: String,
+ pub status: StripebillingChargeStatus,
+ pub amount: common_utils::types::MinorUnit,
+ #[serde(deserialize_with = "convert_uppercase")]
+ pub currency: enums::Currency,
+ pub customer: String,
+ pub payment_method: String,
+ pub failure_code: Option<String>,
+ pub failure_message: Option<String>,
+ #[serde(with = "common_utils::custom_serde::timestamp")]
+ pub created: PrimitiveDateTime,
+ pub payment_method_details: StripePaymentMethodDetails,
+ #[serde(rename = "invoice")]
+ pub invoice_id: String,
+}
+
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct StripePaymentMethodDetails {
#[serde(rename = "type")]
@@ -329,10 +390,6 @@ pub enum StripebillingFundingTypes {
Credit,
#[serde(rename = "debit")]
Debit,
- #[serde(rename = "prepaid")]
- Prepaid,
- #[serde(rename = "unknown")]
- Unknown,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
@@ -340,42 +397,102 @@ pub enum StripebillingFundingTypes {
pub enum StripebillingChargeStatus {
Succeeded,
Failed,
- Pending,
}
-impl StripebillingWebhookBody {
- pub fn get_webhook_object_from_body(body: &[u8]) -> CustomResult<Self, errors::ConnectorError> {
- let webhook_body: Self = body
- .parse_struct::<Self>("StripebillingWebhookBody")
- .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+// This is the default hard coded mca Id to find the stripe account associated with the stripe biliing
+// Context : Since we dont have the concept of connector_reference_id in stripebilling because payments always go through stripe.
+// While creating stripebilling we will hard code the stripe account id to string "stripebilling" in mca featrue metadata. So we have to pass the same as account_reference_id here in response.
+const MCA_ID_IDENTIFIER_FOR_STRIPE_IN_STRIPEBILLING_MCA_FEAATURE_METADATA: &str = "stripebilling";
- Ok(webhook_body)
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+impl
+ TryFrom<
+ ResponseRouterData<
+ recovery_router_flows::BillingConnectorPaymentsSync,
+ StripebillingRecoveryDetailsData,
+ recovery_request_types::BillingConnectorPaymentsSyncRequest,
+ recovery_response_types::BillingConnectorPaymentsSyncResponse,
+ >,
+ > for recovery_router_data_types::BillingConnectorPaymentsSyncRouterData
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<
+ recovery_router_flows::BillingConnectorPaymentsSync,
+ StripebillingRecoveryDetailsData,
+ recovery_request_types::BillingConnectorPaymentsSyncRequest,
+ recovery_response_types::BillingConnectorPaymentsSyncResponse,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let merchant_reference_id = id_type::PaymentReferenceId::from_str(
+ &item.response.invoice_id,
+ )
+ .change_context(errors::ConnectorError::MissingRequiredField {
+ field_name: "invoice_id",
+ })?;
+ let connector_transaction_id = Some(common_utils::types::ConnectorTransactionId::from(
+ item.response.charge_id,
+ ));
+
+ Ok(Self {
+ response: Ok(
+ recovery_response_types::BillingConnectorPaymentsSyncResponse {
+ status: item.response.status.into(),
+ amount: item.response.amount,
+ currency: item.response.currency,
+ merchant_reference_id,
+ connector_account_reference_id:
+ MCA_ID_IDENTIFIER_FOR_STRIPE_IN_STRIPEBILLING_MCA_FEAATURE_METADATA
+ .to_string(),
+ connector_transaction_id,
+ error_code: item.response.failure_code,
+ error_message: item.response.failure_message,
+ processor_payment_method_token: item.response.payment_method,
+ connector_customer_id: item.response.customer,
+ transaction_created_at: Some(item.response.created),
+ payment_method_sub_type: common_enums::PaymentMethodType::from(
+ item.response
+ .payment_method_details
+ .card_funding_type
+ .funding,
+ ),
+ payment_method_type: common_enums::PaymentMethod::from(
+ item.response.payment_method_details.type_of_payment_method,
+ ),
+ },
+ ),
+ ..item.data
+ })
}
}
-impl StripebillingInvoiceBody {
- pub fn get_invoice_webhook_data_from_body(
- body: &[u8],
- ) -> CustomResult<Self, errors::ConnectorError> {
- let webhook_body = body
- .parse_struct::<Self>("StripebillingInvoiceBody")
- .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
- Ok(webhook_body)
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+impl From<StripebillingChargeStatus> for enums::AttemptStatus {
+ fn from(status: StripebillingChargeStatus) -> Self {
+ match status {
+ StripebillingChargeStatus::Succeeded => Self::Charged,
+ StripebillingChargeStatus::Failed => Self::Failure,
+ }
}
}
-#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
-impl TryFrom<StripebillingInvoiceBody> for revenue_recovery::RevenueRecoveryInvoiceData {
- type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: StripebillingInvoiceBody) -> Result<Self, Self::Error> {
- let merchant_reference_id =
- id_type::PaymentReferenceId::from_str(&item.data.object.invoice_id)
- .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
- Ok(Self {
- amount: item.data.object.amount,
- currency: item.data.object.currency,
- merchant_reference_id,
- })
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+impl From<StripebillingFundingTypes> for common_enums::PaymentMethodType {
+ fn from(funding: StripebillingFundingTypes) -> Self {
+ match funding {
+ StripebillingFundingTypes::Credit => Self::Credit,
+ StripebillingFundingTypes::Debit => Self::Debit,
+ }
+ }
+}
+
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+impl From<StripebillingPaymentMethod> for common_enums::PaymentMethod {
+ fn from(method: StripebillingPaymentMethod) -> Self {
+ match method {
+ StripebillingPaymentMethod::Card => Self::Card,
+ }
}
}
@@ -388,24 +505,24 @@ pub struct StripebillingRecordBackResponse {
impl
TryFrom<
ResponseRouterData<
- RecoveryRecordBack,
+ recovery_router_flows::RecoveryRecordBack,
StripebillingRecordBackResponse,
- RevenueRecoveryRecordBackRequest,
- RevenueRecoveryRecordBackResponse,
+ recovery_request_types::RevenueRecoveryRecordBackRequest,
+ recovery_response_types::RevenueRecoveryRecordBackResponse,
>,
- > for RevenueRecoveryRecordBackRouterData
+ > for recovery_router_data_types::RevenueRecoveryRecordBackRouterData
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<
- RecoveryRecordBack,
+ recovery_router_flows::RecoveryRecordBack,
StripebillingRecordBackResponse,
- RevenueRecoveryRecordBackRequest,
- RevenueRecoveryRecordBackResponse,
+ recovery_request_types::RevenueRecoveryRecordBackRequest,
+ recovery_response_types::RevenueRecoveryRecordBackResponse,
>,
) -> Result<Self, Self::Error> {
Ok(Self {
- response: Ok(RevenueRecoveryRecordBackResponse {
+ response: Ok(recovery_response_types::RevenueRecoveryRecordBackResponse {
merchant_reference_id: id_type::PaymentReferenceId::from_str(
item.response.id.as_str(),
)
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 4a59e7741b..1da9937d4c 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -24,15 +24,9 @@ use hyperswitch_domain_models::{
};
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
use hyperswitch_domain_models::{
- router_flow_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryDetails, RecoveryRecordBack,
- },
- router_request_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
- },
- router_response_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
- },
+ router_flow_types::revenue_recovery as recovery_router_flows,
+ router_request_types::revenue_recovery as recovery_request,
+ router_response_types::revenue_recovery as recovery_response,
};
use hyperswitch_domain_models::{
router_flow_types::{
@@ -82,9 +76,7 @@ use hyperswitch_interfaces::api::payouts::{
PayoutRecipientAccount, PayoutSync,
};
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-use hyperswitch_interfaces::api::revenue_recovery::{
- AdditionalRevenueRecovery, RevenueRecoveryRecordBack,
-};
+use hyperswitch_interfaces::api::revenue_recovery as recovery_traits;
use hyperswitch_interfaces::{
api::{
self,
@@ -4014,23 +4006,14 @@ default_imp_for_uas_authentication!(
connectors::Zsl
);
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-macro_rules! default_imp_for_revenue_recovery_record_back {
+macro_rules! default_imp_for_revenue_recovery {
($($path:ident::$connector:ident),*) => {
- $( impl RevenueRecoveryRecordBack for $path::$connector {}
- impl
- ConnectorIntegration<
- RecoveryRecordBack,
- RevenueRecoveryRecordBackRequest,
- RevenueRecoveryRecordBackResponse
- > for $path::$connector
- {}
+ $( impl RevenueRecovery for $path::$connector {}
)*
};
}
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-default_imp_for_revenue_recovery_record_back!(
+default_imp_for_revenue_recovery! {
connectors::Aci,
connectors::Adyen,
connectors::Airwallex,
@@ -4046,6 +4029,7 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Boku,
connectors::Cashtocode,
connectors::Checkout,
+ connectors::Chargebee,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
@@ -4065,8 +4049,8 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
- connectors::Helcim,
connectors::Hipay,
+ connectors::Helcim,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
@@ -4096,10 +4080,12 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
+ connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
connectors::Square,
+ connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Trustpay,
@@ -4112,18 +4098,17 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Xendit,
connectors::Zen,
connectors::Zsl
-);
+}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-macro_rules! default_imp_for_additional_revenue_recovery_call {
+macro_rules! default_imp_for_billing_connector_payment_sync {
($($path:ident::$connector:ident),*) => {
- $(
- impl AdditionalRevenueRecovery for $path::$connector {}
+ $( impl recovery_traits::BillingConnectorPaymentsSyncIntegration for $path::$connector {}
impl
ConnectorIntegration<
- GetAdditionalRevenueRecoveryDetails,
- GetAdditionalRevenueRecoveryRequestData,
- GetAdditionalRevenueRecoveryResponseData
+ recovery_router_flows::BillingConnectorPaymentsSync,
+ recovery_request::BillingConnectorPaymentsSyncRequest,
+ recovery_response::BillingConnectorPaymentsSyncResponse
> for $path::$connector
{}
)*
@@ -4131,7 +4116,7 @@ macro_rules! default_imp_for_additional_revenue_recovery_call {
}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-default_imp_for_additional_revenue_recovery_call!(
+default_imp_for_billing_connector_payment_sync!(
connectors::Aci,
connectors::Adyen,
connectors::Airwallex,
@@ -4167,13 +4152,13 @@ default_imp_for_additional_revenue_recovery_call!(
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
- connectors::Hipay,
connectors::Helcim,
+ connectors::Hipay,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
- connectors::Jpmorgan,
connectors::Juspaythreedsserver,
+ connectors::Jpmorgan,
connectors::Klarna,
connectors::Nomupay,
connectors::Noon,
@@ -4203,7 +4188,6 @@ default_imp_for_additional_revenue_recovery_call!(
connectors::Shift4,
connectors::Stax,
connectors::Square,
- connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Trustpay,
@@ -4218,15 +4202,23 @@ default_imp_for_additional_revenue_recovery_call!(
connectors::Zsl
);
-macro_rules! default_imp_for_revenue_recovery {
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+macro_rules! default_imp_for_revenue_recovery_record_back {
($($path:ident::$connector:ident),*) => {
- $(
- impl RevenueRecovery for $path::$connector {}
+ $( impl recovery_traits::RevenueRecoveryRecordBack for $path::$connector {}
+ impl
+ ConnectorIntegration<
+ recovery_router_flows::RecoveryRecordBack,
+ recovery_request::RevenueRecoveryRecordBackRequest,
+ recovery_response::RevenueRecoveryRecordBackResponse
+ > for $path::$connector
+ {}
)*
};
}
-default_imp_for_revenue_recovery!(
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+default_imp_for_revenue_recovery_record_back!(
connectors::Aci,
connectors::Adyen,
connectors::Airwallex,
@@ -4241,7 +4233,6 @@ default_imp_for_revenue_recovery!(
connectors::Braintree,
connectors::Boku,
connectors::Cashtocode,
- connectors::Chargebee,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
@@ -4262,8 +4253,8 @@ default_imp_for_revenue_recovery!(
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
- connectors::Hipay,
connectors::Helcim,
+ connectors::Hipay,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
@@ -4279,9 +4270,9 @@ default_imp_for_revenue_recovery!(
connectors::Opayo,
connectors::Opennode,
connectors::Payeezy,
- connectors::Paypal,
connectors::Paystack,
connectors::Payu,
+ connectors::Paypal,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
@@ -4293,12 +4284,10 @@ default_imp_for_revenue_recovery!(
connectors::Placetopay,
connectors::Rapyd,
connectors::Razorpay,
- connectors::Recurly,
connectors::Redsys,
connectors::Shift4,
connectors::Stax,
connectors::Square,
- connectors::Stripebilling,
connectors::Taxjar,
connectors::Thunes,
connectors::Trustpay,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 46ac9073f7..dc7e8c3a11 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -2,7 +2,8 @@ use hyperswitch_domain_models::{
router_data::AccessToken,
router_data_v2::{
flow_common_types::{
- DisputesFlowData, MandateRevokeFlowData, PaymentFlowData, RefundFlowData,
+ BillingConnectorPaymentsSyncFlowData, DisputesFlowData, MandateRevokeFlowData,
+ PaymentFlowData, RefundFlowData, RevenueRecoveryRecordBackData,
WebhookSourceVerifyData,
},
AccessTokenFlowData, ExternalAuthenticationFlowData, FilesFlowData,
@@ -21,14 +22,17 @@ use hyperswitch_domain_models::{
SetupMandate, Void,
},
refunds::{Execute, RSync},
+ revenue_recovery::{BillingConnectorPaymentsSync, RecoveryRecordBack},
webhooks::VerifyWebhookSource,
AccessTokenAuth,
},
router_request_types::{
- authentication, AcceptDisputeRequestData, AccessTokenRequestData,
- AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
- DefendDisputeRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData,
- PaymentsApproveData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,
+ authentication,
+ revenue_recovery::{BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest},
+ AcceptDisputeRequestData, AccessTokenRequestData, AuthorizeSessionTokenData,
+ CompleteAuthorizeData, ConnectorCustomerData, DefendDisputeRequestData,
+ MandateRevokeRequestData, PaymentMethodTokenizationData, PaymentsApproveData,
+ PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,
PaymentsIncrementalAuthorizationData, PaymentsPostProcessingData,
PaymentsPostSessionTokensData, PaymentsPreProcessingData, PaymentsRejectData,
PaymentsSessionData, PaymentsSyncData, PaymentsTaxCalculationData, RefundsData,
@@ -36,6 +40,9 @@ use hyperswitch_domain_models::{
SubmitEvidenceRequestData, UploadFileRequestData, VerifyWebhookSourceRequestData,
},
router_response_types::{
+ revenue_recovery::{
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
+ },
AcceptDisputeResponse, AuthenticationResponseData, DefendDisputeResponse,
MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData, RetrieveFileResponse,
SubmitEvidenceResponse, TaxCalculationResponseData, UploadFileResponse,
@@ -88,6 +95,10 @@ use hyperswitch_interfaces::{
PaymentsPostProcessingV2, PaymentsPreProcessingV2, TaxCalculationV2,
},
refunds_v2::{RefundExecuteV2, RefundSyncV2, RefundV2},
+ revenue_recovery_v2::{
+ BillingConnectorPaymentsSyncIntegrationV2, RevenueRecoveryRecordBackV2,
+ RevenueRecoveryV2,
+ },
ConnectorAccessTokenV2, ConnectorMandateRevokeV2, ConnectorVerifyWebhookSourceV2,
},
connector_integration_v2::ConnectorIntegrationV2,
@@ -2660,3 +2671,87 @@ default_imp_for_new_connector_integration_connector_authentication!(
connectors::Zen,
connectors::Zsl
);
+
+macro_rules! default_imp_for_new_connector_integration_revenue_recovery {
+ ($($path:ident::$connector:ident),*) => {
+ $( impl RevenueRecoveryV2 for $path::$connector {}
+ impl BillingConnectorPaymentsSyncIntegrationV2 for $path::$connector {}
+ impl RevenueRecoveryRecordBackV2 for $path::$connector {}
+ impl
+ ConnectorIntegrationV2<
+ RecoveryRecordBack,
+ RevenueRecoveryRecordBackData,
+ RevenueRecoveryRecordBackRequest,
+ RevenueRecoveryRecordBackResponse,
+ > for $path::$connector
+ {}
+ impl
+ ConnectorIntegrationV2<
+ BillingConnectorPaymentsSync,
+ BillingConnectorPaymentsSyncFlowData,
+ BillingConnectorPaymentsSyncRequest,
+ BillingConnectorPaymentsSyncResponse,
+ > for $path::$connector
+ {}
+ )*
+ };
+}
+
+default_imp_for_new_connector_integration_revenue_recovery!(
+ connectors::Airwallex,
+ connectors::Amazonpay,
+ connectors::Bambora,
+ connectors::Bamboraapac,
+ connectors::Billwerk,
+ connectors::Bitpay,
+ connectors::Bluesnap,
+ connectors::Boku,
+ connectors::Cashtocode,
+ connectors::Coinbase,
+ connectors::Cryptopay,
+ connectors::CtpMastercard,
+ connectors::Datatrans,
+ connectors::Deutschebank,
+ connectors::Digitalvirgo,
+ connectors::Dlocal,
+ connectors::Elavon,
+ connectors::Fiserv,
+ connectors::Fiservemea,
+ connectors::Fiuu,
+ connectors::Forte,
+ connectors::Globepay,
+ connectors::Gocardless,
+ connectors::Helcim,
+ connectors::Hipay,
+ connectors::Inespay,
+ connectors::Jpmorgan,
+ connectors::Juspaythreedsserver,
+ connectors::Nomupay,
+ connectors::Novalnet,
+ connectors::Nexinets,
+ connectors::Nexixpay,
+ connectors::Paybox,
+ connectors::Payeezy,
+ connectors::Payu,
+ connectors::Placetopay,
+ connectors::Powertranz,
+ connectors::Prophetpay,
+ connectors::Mollie,
+ connectors::Multisafepay,
+ connectors::Rapyd,
+ connectors::Razorpay,
+ connectors::Redsys,
+ connectors::Shift4,
+ connectors::Stax,
+ connectors::Square,
+ connectors::Taxjar,
+ connectors::Thunes,
+ connectors::Tsys,
+ connectors::UnifiedAuthenticationService,
+ connectors::Worldline,
+ connectors::Volt,
+ connectors::Worldpay,
+ connectors::Xendit,
+ connectors::Zen,
+ connectors::Zsl
+);
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index 4bf1fece02..238e84873f 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -3,6 +3,8 @@ use common_enums::enums as common_enums;
use common_utils::{id_type, types as util_types};
use time::PrimitiveDateTime;
+use crate::router_response_types::revenue_recovery::BillingConnectorPaymentsSyncResponse;
+
/// Recovery payload is unified struct constructed from billing connectors
#[derive(Debug)]
pub struct RevenueRecoveryAttemptData {
@@ -191,6 +193,36 @@ impl From<&RevenueRecoveryInvoiceData> for api_payments::PaymentsCreateIntentReq
}
}
+impl From<&BillingConnectorPaymentsSyncResponse> for RevenueRecoveryInvoiceData {
+ fn from(data: &BillingConnectorPaymentsSyncResponse) -> Self {
+ Self {
+ amount: data.amount,
+ currency: data.currency,
+ merchant_reference_id: data.merchant_reference_id.clone(),
+ }
+ }
+}
+
+impl From<&BillingConnectorPaymentsSyncResponse> for RevenueRecoveryAttemptData {
+ fn from(data: &BillingConnectorPaymentsSyncResponse) -> Self {
+ Self {
+ amount: data.amount,
+ currency: data.currency,
+ merchant_reference_id: data.merchant_reference_id.clone(),
+ connector_transaction_id: data.connector_transaction_id.clone(),
+ error_code: data.error_code.clone(),
+ error_message: data.error_message.clone(),
+ processor_payment_method_token: data.processor_payment_method_token.clone(),
+ connector_customer_id: data.connector_customer_id.clone(),
+ connector_account_reference_id: data.connector_account_reference_id.clone(),
+ transaction_created_at: data.transaction_created_at,
+ status: data.status,
+ payment_method_type: data.payment_method_type,
+ payment_method_sub_type: Some(data.payment_method_sub_type),
+ }
+ }
+}
+
impl From<&RevenueRecoveryAttemptData> for api_payments::PaymentAttemptAmountDetails {
fn from(data: &RevenueRecoveryAttemptData) -> Self {
Self {
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
index 16ffcb21b7..2e689d7844 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
@@ -154,4 +154,4 @@ pub struct UasFlowData {
}
#[derive(Debug, Clone)]
-pub struct GetAdditionalRevenueRecoveryFlowCommonData;
+pub struct BillingConnectorPaymentsSyncFlowData;
diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
index b73ce53350..56d240614f 100644
--- a/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_flow_types/revenue_recovery.rs
@@ -1,3 +1,4 @@
-pub struct GetAdditionalRevenueRecoveryDetails;
+#[derive(Debug, Clone)]
+pub struct BillingConnectorPaymentsSync;
#[derive(Debug, Clone)]
pub struct RecoveryRecordBack;
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
index e1b958f2ec..a39d27f14f 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/revenue_recovery.rs
@@ -1,9 +1,9 @@
use common_enums::enums;
#[derive(Debug, Clone)]
-pub struct GetAdditionalRevenueRecoveryRequestData {
- /// unique id for making additional revenue recovery call
- pub additional_revenue_recovery_id: String,
+pub struct BillingConnectorPaymentsSyncRequest {
+ /// unique id for making billing connector psync call
+ pub billing_connector_psync_id: String,
}
#[derive(Debug, Clone)]
diff --git a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
index 9a8ab79101..5f79ff7001 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types/revenue_recovery.rs
@@ -1,7 +1,7 @@
use common_utils::types::MinorUnit;
use time::PrimitiveDateTime;
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
-pub struct GetAdditionalRevenueRecoveryResponseData {
+pub struct BillingConnectorPaymentsSyncResponse {
/// transaction amount against invoice, accepted in minor unit.
pub amount: MinorUnit,
/// currency of the transaction
@@ -15,11 +15,11 @@ pub struct GetAdditionalRevenueRecoveryResponseData {
/// error message sent by billing connector.
pub error_message: Option<String>,
/// mandate token at payment processor end.
- pub processor_payment_method_token: Option<String>,
+ pub processor_payment_method_token: String,
/// customer id at payment connector for which mandate is attached.
- pub connector_customer_id: Option<String>,
+ pub connector_customer_id: String,
/// Payment gateway identifier id at billing processor.
- pub connector_account_reference_id: Option<String>,
+ pub connector_account_reference_id: String,
/// timestamp at which transaction has been created at billing connector
pub transaction_created_at: Option<PrimitiveDateTime>,
/// transaction status at billing connector equivalent to payment attempt status.
diff --git a/crates/hyperswitch_domain_models/src/types.rs b/crates/hyperswitch_domain_models/src/types.rs
index b3dde94269..691fde0de9 100644
--- a/crates/hyperswitch_domain_models/src/types.rs
+++ b/crates/hyperswitch_domain_models/src/types.rs
@@ -4,16 +4,14 @@ use crate::{
router_data::{AccessToken, RouterData},
router_flow_types::{
mandate_revoke::MandateRevoke, revenue_recovery::RecoveryRecordBack, AccessTokenAuth,
- Authenticate, AuthenticationConfirmation, Authorize, AuthorizeSessionToken, CalculateTax,
- Capture, CompleteAuthorize, CreateConnectorCustomer, Execute,
- GetAdditionalRevenueRecoveryDetails, IncrementalAuthorization, PSync, PaymentMethodToken,
+ Authenticate, AuthenticationConfirmation, Authorize, AuthorizeSessionToken,
+ BillingConnectorPaymentsSync, CalculateTax, Capture, CompleteAuthorize,
+ CreateConnectorCustomer, Execute, IncrementalAuthorization, PSync, PaymentMethodToken,
PostAuthenticate, PostSessionTokens, PreAuthenticate, PreProcessing, RSync,
SdkSessionUpdate, Session, SetupMandate, VerifyWebhookSource, Void,
},
router_request_types::{
- revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
- },
+ revenue_recovery::{BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest},
unified_authentication_service::{
UasAuthenticationRequestData, UasAuthenticationResponseData,
UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -29,7 +27,7 @@ use crate::{
},
router_response_types::{
revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
},
MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData,
TaxCalculationResponseData, VerifyWebhookSourceResponseData,
@@ -104,8 +102,8 @@ pub type RevenueRecoveryRecordBackRouterData = RouterData<
pub type UasAuthenticationRouterData =
RouterData<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>;
-pub type AdditionalRevenueRecoveryDetailsRouterData = RouterData<
- GetAdditionalRevenueRecoveryDetails,
- GetAdditionalRevenueRecoveryRequestData,
- GetAdditionalRevenueRecoveryResponseData,
+pub type BillingConnectorPaymentsSyncRouterData = RouterData<
+ BillingConnectorPaymentsSync,
+ BillingConnectorPaymentsSyncRequest,
+ BillingConnectorPaymentsSyncResponse,
>;
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index e9cb8e8a12..37a49f47c7 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -73,8 +73,8 @@ pub use self::payouts::*;
pub use self::payouts_v2::*;
pub use self::{payments::*, refunds::*};
use crate::{
- api::revenue_recovery::RevenueRecovery, connector_integration_v2::ConnectorIntegrationV2,
- consts, errors, events::connector_api_logs::ConnectorEvent, metrics, types, webhooks,
+ connector_integration_v2::ConnectorIntegrationV2, consts, errors,
+ events::connector_api_logs::ConnectorEvent, metrics, types, webhooks,
};
/// Connector trait
@@ -95,7 +95,7 @@ pub trait Connector:
+ authentication::ExternalAuthentication
+ TaxCalculation
+ UnifiedAuthenticationService
- + RevenueRecovery
+ + revenue_recovery::RevenueRecovery
{
}
@@ -116,7 +116,7 @@ impl<
+ authentication::ExternalAuthentication
+ TaxCalculation
+ UnifiedAuthenticationService
- + RevenueRecovery,
+ + revenue_recovery::RevenueRecovery,
> Connector for T
{
}
diff --git a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
index 1a84b65c09..6bf882159a 100644
--- a/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
+++ b/crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
@@ -1,31 +1,32 @@
//! Revenue Recovery Interface
use hyperswitch_domain_models::{
- router_flow_types::{GetAdditionalRevenueRecoveryDetails, RecoveryRecordBack},
+ router_flow_types::{BillingConnectorPaymentsSync, RecoveryRecordBack},
router_request_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
+ BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest,
},
router_response_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
},
};
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
use super::ConnectorCommon;
use super::ConnectorIntegration;
+
/// trait RevenueRecovery
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
pub trait RevenueRecovery:
- ConnectorCommon + AdditionalRevenueRecovery + RevenueRecoveryRecordBack
+ ConnectorCommon + BillingConnectorPaymentsSyncIntegration + RevenueRecoveryRecordBack
{
}
-/// trait AdditionalRevenueRecovery
-pub trait AdditionalRevenueRecovery:
+/// trait BillingConnectorPaymentsSyncIntegration
+pub trait BillingConnectorPaymentsSyncIntegration:
ConnectorIntegration<
- GetAdditionalRevenueRecoveryDetails,
- GetAdditionalRevenueRecoveryRequestData,
- GetAdditionalRevenueRecoveryResponseData,
+ BillingConnectorPaymentsSync,
+ BillingConnectorPaymentsSyncRequest,
+ BillingConnectorPaymentsSyncResponse,
>
{
}
diff --git a/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs b/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
index 6ae59dd6fb..1fca496ea7 100644
--- a/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
@@ -2,34 +2,37 @@
use hyperswitch_domain_models::{
router_data_v2::flow_common_types::{
- GetAdditionalRevenueRecoveryFlowCommonData, RevenueRecoveryRecordBackData,
+ BillingConnectorPaymentsSyncFlowData, RevenueRecoveryRecordBackData,
},
- router_flow_types::{GetAdditionalRevenueRecoveryDetails, RecoveryRecordBack},
+ router_flow_types::{BillingConnectorPaymentsSync, RecoveryRecordBack},
router_request_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
+ BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest,
},
router_response_types::revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
},
};
use crate::connector_integration_v2::ConnectorIntegrationV2;
/// trait RevenueRecoveryV2
-pub trait RevenueRecoveryV2: AdditionalRevenueRecoveryV2 + RevenueRecoveryRecordBackV2 {}
+pub trait RevenueRecoveryV2:
+ BillingConnectorPaymentsSyncIntegrationV2 + RevenueRecoveryRecordBackV2
+{
+}
-/// trait AdditionalRevenueRecoveryV2
-pub trait AdditionalRevenueRecoveryV2:
+/// trait BillingConnectorPaymentsSyncIntegrationV2
+pub trait BillingConnectorPaymentsSyncIntegrationV2:
ConnectorIntegrationV2<
- GetAdditionalRevenueRecoveryDetails,
- GetAdditionalRevenueRecoveryFlowCommonData,
- GetAdditionalRevenueRecoveryRequestData,
- GetAdditionalRevenueRecoveryResponseData,
+ BillingConnectorPaymentsSync,
+ BillingConnectorPaymentsSyncFlowData,
+ BillingConnectorPaymentsSyncRequest,
+ BillingConnectorPaymentsSyncResponse,
>
{
}
-/// trait ConnectorAdditionalRevenueRecoveryDetailsCallV2
+/// trait RevenueRecoveryRecordBackV2
pub trait RevenueRecoveryRecordBackV2:
ConnectorIntegrationV2<
RecoveryRecordBack,
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 3094a0e622..2163d6f468 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -9,9 +9,9 @@ use hyperswitch_domain_models::{
router_data::{self, RouterData},
router_data_v2::{
flow_common_types::{
- AccessTokenFlowData, DisputesFlowData, ExternalAuthenticationFlowData, FilesFlowData,
- MandateRevokeFlowData, PaymentFlowData, RefundFlowData, RevenueRecoveryRecordBackData,
- UasFlowData, WebhookSourceVerifyData,
+ AccessTokenFlowData, BillingConnectorPaymentsSyncFlowData, DisputesFlowData,
+ ExternalAuthenticationFlowData, FilesFlowData, MandateRevokeFlowData, PaymentFlowData,
+ RefundFlowData, RevenueRecoveryRecordBackData, UasFlowData, WebhookSourceVerifyData,
},
RouterDataV2,
},
@@ -798,3 +798,42 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowD
Ok(router_data)
}
}
+
+impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
+ for BillingConnectorPaymentsSyncFlowData
+{
+ fn from_old_router_data(
+ old_router_data: &RouterData<T, Req, Resp>,
+ ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
+ where
+ Self: Sized,
+ {
+ let resource_common_data = Self {};
+ Ok(RouterDataV2 {
+ flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
+ resource_common_data,
+ connector_auth_type: old_router_data.connector_auth_type.clone(),
+ request: old_router_data.request.clone(),
+ response: old_router_data.response.clone(),
+ })
+ }
+
+ fn to_old_router_data(
+ new_router_data: RouterDataV2<T, Self, Req, Resp>,
+ ) -> CustomResult<RouterData<T, Req, Resp>, ConnectorError>
+ where
+ Self: Sized,
+ {
+ let router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "BillingConnectorPaymentsSync",
+ new_router_data.request,
+ new_router_data.response,
+ );
+ Ok(RouterData {
+ connector_auth_type: new_router_data.connector_auth_type.clone(),
+ ..router_data
+ })
+ }
+}
diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rs
index e5c6e1a81d..8e33d5bc15 100644
--- a/crates/hyperswitch_interfaces/src/types.rs
+++ b/crates/hyperswitch_interfaces/src/types.rs
@@ -14,16 +14,14 @@ use hyperswitch_domain_models::{
Session, SetupMandate, Void,
},
refunds::{Execute, RSync},
- revenue_recovery::{GetAdditionalRevenueRecoveryDetails, RecoveryRecordBack},
+ revenue_recovery::{BillingConnectorPaymentsSync, RecoveryRecordBack},
unified_authentication_service::{
Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
},
webhooks::VerifyWebhookSource,
},
router_request_types::{
- revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
- },
+ revenue_recovery::{BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest},
unified_authentication_service::{
UasAuthenticationRequestData, UasAuthenticationResponseData,
UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -40,7 +38,7 @@ use hyperswitch_domain_models::{
},
router_response_types::{
revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
},
AcceptDisputeResponse, DefendDisputeResponse, MandateRevokeResponseData,
PaymentsResponseData, RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
@@ -237,9 +235,9 @@ pub type RevenueRecoveryRecordBackType = dyn ConnectorIntegration<
RevenueRecoveryRecordBackResponse,
>;
-/// Type alias for `ConnectorIntegration<GetAdditionalRevenueRecoveryDetails, GetAdditionalRevenueRecoveryRequestData, GetAdditionalRevenueRecoveryResponseData>`
-pub type AdditionalRevenueRecoveryCallType = dyn ConnectorIntegration<
- GetAdditionalRevenueRecoveryDetails,
- GetAdditionalRevenueRecoveryRequestData,
- GetAdditionalRevenueRecoveryResponseData,
+/// Type alias for `ConnectorIntegration<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
+pub type BillingConnectorPaymentsSyncType = dyn ConnectorIntegration<
+ BillingConnectorPaymentsSync,
+ BillingConnectorPaymentsSyncRequest,
+ BillingConnectorPaymentsSyncResponse,
>;
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index 2c28e6f140..c59b847134 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -506,7 +506,7 @@ pub(crate) async fn fetch_raw_secrets(
required_fields: conf.required_fields,
delayed_session_response: conf.delayed_session_response,
webhook_source_verification_call: conf.webhook_source_verification_call,
- // additional_revenue_recovery_details_call: conf.additional_revenue_recovery_details_call,
+ billing_connectors_payment_sync: conf.billing_connectors_payment_sync,
payment_method_auth,
connector_request_reference_id_config: conf.connector_request_reference_id_config,
#[cfg(feature = "payouts")]
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index b1c92046d0..a4c454ec19 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -96,7 +96,7 @@ pub struct Settings<S: SecretState> {
pub required_fields: RequiredFields,
pub delayed_session_response: DelayedSessionConfig,
pub webhook_source_verification_call: WebhookSourceVerificationCall,
- // pub additional_revenue_recovery_details_call: GetAdditionalRevenueRecoveryDetailsCall,
+ pub billing_connectors_payment_sync: BillingConnectorPaymentsSyncCall,
pub payment_method_auth: SecretStateContainer<PaymentMethodAuth, S>,
pub connector_request_reference_id_config: ConnectorRequestReferenceIdConfig,
#[cfg(feature = "payouts")]
@@ -848,9 +848,9 @@ pub struct WebhookSourceVerificationCall {
}
#[derive(Debug, Deserialize, Clone, Default)]
-pub struct GetAdditionalRevenueRecoveryDetailsCall {
+pub struct BillingConnectorPaymentsSyncCall {
#[serde(deserialize_with = "deserialize_hashset")]
- pub connectors_with_additional_revenue_recovery_details_call: HashSet<enums::Connector>,
+ pub billing_connectors_which_require_payment_sync: HashSet<enums::Connector>,
}
#[derive(Debug, Deserialize, Clone, Default)]
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 9357962237..7bf25e689a 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1573,10 +1573,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
stripe::transformers::StripeAuthType::try_from(self.auth_type)?;
Ok(())
}
- // api_enums::Connector::Stripebilling => {
- // stripebilling::transformers::StripebillingAuthType::try_from(self.auth_type)?;
- // Ok(())
- // }
+ api_enums::Connector::Stripebilling => {
+ stripebilling::transformers::StripebillingAuthType::try_from(self.auth_type)?;
+ Ok(())
+ }
api_enums::Connector::Trustpay => {
trustpay::transformers::TrustpayAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/core/errors.rs b/crates/router/src/core/errors.rs
index d90b9fb743..532a662dda 100644
--- a/crates/router/src/core/errors.rs
+++ b/crates/router/src/core/errors.rs
@@ -498,4 +498,6 @@ pub enum RevenueRecoveryError {
ProcessTrackerCreationError,
#[error("Failed to get the response from process tracker")]
ProcessTrackerResponseError,
+ #[error("Billing connector psync call failed")]
+ BillingConnectorPaymentsSyncFailed,
}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index ee0ffe77ca..1ac0913b22 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -14,7 +14,7 @@ pub mod setup_mandate_flow;
use async_trait::async_trait;
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
use hyperswitch_domain_models::router_flow_types::{
- revenue_recovery::RecoveryRecordBack, GetAdditionalRevenueRecoveryDetails,
+ BillingConnectorPaymentsSync, RecoveryRecordBack,
};
use hyperswitch_domain_models::{
mandates::CustomerAcceptance,
@@ -1979,37 +1979,17 @@ fn handle_post_capture_response(
}
}
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-macro_rules! default_imp_for_revenue_recovery_record_back {
+macro_rules! default_imp_for_revenue_recovery {
($($path:ident::$connector:ident),*) => {
- $(
- impl api::RevenueRecoveryRecordBack for $path::$connector {}
- impl
- services::ConnectorIntegration<
- RecoveryRecordBack,
- types::RevenueRecoveryRecordBackRequest,
- types::RevenueRecoveryRecordBackResponse,
- > for $path::$connector
- {}
+ $( impl api::RevenueRecovery for $path::$connector {}
)*
};
}
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-#[cfg(feature = "dummy_connector")]
-impl<const T: u8> api::RevenueRecoveryRecordBack for connector::DummyConnector<T> {}
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
-impl<const T: u8>
- services::ConnectorIntegration<
- RecoveryRecordBack,
- types::RevenueRecoveryRecordBackRequest,
- types::RevenueRecoveryRecordBackResponse,
- > for connector::DummyConnector<T>
-{
-}
-#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-default_imp_for_revenue_recovery_record_back!(
+impl<const T: u8> api::RevenueRecovery for connector::DummyConnector<T> {}
+
+default_imp_for_revenue_recovery! {
connector::Adyenplatform,
connector::Ebanx,
connector::Gpayments,
@@ -2023,19 +2003,38 @@ default_imp_for_revenue_recovery_record_back!(
connector::Threedsecureio,
connector::Wellsfargopayout,
connector::Wise
-);
+}
-macro_rules! default_imp_for_revenue_recovery {
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+macro_rules! default_imp_for_billing_connector_payment_sync {
($($path:ident::$connector:ident),*) => {
- $( impl api::RevenueRecovery for $path::$connector {}
+ $( impl api::BillingConnectorPaymentsSyncIntegration for $path::$connector {}
+ impl
+ services::ConnectorIntegration<
+ BillingConnectorPaymentsSync,
+ types::BillingConnectorPaymentsSyncRequest,
+ types::BillingConnectorPaymentsSyncResponse,
+ > for $path::$connector
+ {}
)*
};
}
-
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
-impl<const T: u8> api::RevenueRecovery for connector::DummyConnector<T> {}
+impl<const T: u8> api::BillingConnectorPaymentsSyncIntegration for connector::DummyConnector<T> {}
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+#[cfg(feature = "dummy_connector")]
+impl<const T: u8>
+ services::ConnectorIntegration<
+ BillingConnectorPaymentsSync,
+ types::BillingConnectorPaymentsSyncRequest,
+ types::BillingConnectorPaymentsSyncResponse,
+ > for connector::DummyConnector<T>
+{
+}
-default_imp_for_revenue_recovery! {
+#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
+default_imp_for_billing_connector_payment_sync!(
connector::Adyenplatform,
connector::Ebanx,
connector::Gpayments,
@@ -2049,40 +2048,38 @@ default_imp_for_revenue_recovery! {
connector::Threedsecureio,
connector::Wellsfargopayout,
connector::Wise
-}
+);
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-macro_rules! default_imp_for_additional_revenue_recovery_call {
+macro_rules! default_imp_for_revenue_recovery_record_back {
($($path:ident::$connector:ident),*) => {
$(
- impl api::AdditionalRevenueRecovery for $path::$connector {}
+ impl api::RevenueRecoveryRecordBack for $path::$connector {}
impl
services::ConnectorIntegration<
- GetAdditionalRevenueRecoveryDetails,
- types::GetAdditionalRevenueRecoveryRequestData,
- types::GetAdditionalRevenueRecoveryResponseData,
+ RecoveryRecordBack,
+ types::RevenueRecoveryRecordBackRequest,
+ types::RevenueRecoveryRecordBackResponse,
> for $path::$connector
{}
)*
};
}
-
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
-impl<const T: u8> api::AdditionalRevenueRecovery for connector::DummyConnector<T> {}
+impl<const T: u8> api::RevenueRecoveryRecordBack for connector::DummyConnector<T> {}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
services::ConnectorIntegration<
- GetAdditionalRevenueRecoveryDetails,
- types::GetAdditionalRevenueRecoveryRequestData,
- types::GetAdditionalRevenueRecoveryResponseData,
+ RecoveryRecordBack,
+ types::RevenueRecoveryRecordBackRequest,
+ types::RevenueRecoveryRecordBackResponse,
> for connector::DummyConnector<T>
{
}
-
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
-default_imp_for_additional_revenue_recovery_call!(
+default_imp_for_revenue_recovery_record_back!(
connector::Adyenplatform,
connector::Ebanx,
connector::Gpayments,
diff --git a/crates/router/src/core/webhooks/incoming_v2.rs b/crates/router/src/core/webhooks/incoming_v2.rs
index b187343ab7..f1c041b5bc 100644
--- a/crates/router/src/core/webhooks/incoming_v2.rs
+++ b/crates/router/src/core/webhooks/incoming_v2.rs
@@ -361,10 +361,12 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
webhook_details,
source_verified,
&connector,
+ merchant_connector_account,
+ &connector_name,
&request_details,
event_type,
req_state,
- merchant_connector_account,
+ &object_ref_id,
))
.await
.change_context(errors::ApiErrorResponse::WebhookProcessingFailure)
diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs
index a7a627b052..1bd8e83fa1 100644
--- a/crates/router/src/core/webhooks/recovery_incoming.rs
+++ b/crates/router/src/core/webhooks/recovery_incoming.rs
@@ -1,8 +1,17 @@
+use std::{marker::PhantomData, str::FromStr};
+
use api_models::{payments as api_payments, webhooks};
-use common_utils::{ext_traits::AsyncExt, id_type};
+use common_utils::{
+ ext_traits::{AsyncExt, ValueExt},
+ id_type,
+};
use diesel_models::{process_tracker as storage, schema::process_tracker::retry_count};
use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::{errors::api_error_response, revenue_recovery};
+use hyperswitch_domain_models::{
+ errors::api_error_response, revenue_recovery, router_data_v2::flow_common_types,
+ router_flow_types, router_request_types::revenue_recovery as revenue_recovery_request,
+ router_response_types::revenue_recovery as revenue_recovery_response, types as router_types,
+};
use hyperswitch_interfaces::webhooks as interface_webhooks;
use router_env::{instrument, tracing};
use serde_with::rust::unwrap_or_skip;
@@ -10,12 +19,15 @@ use serde_with::rust::unwrap_or_skip;
use crate::{
core::{
errors::{self, CustomResult},
- payments,
+ payments::{self, helpers},
},
- db::StorageInterface,
+ db::{errors::RevenueRecoveryError, StorageInterface},
routes::{app::ReqState, metrics, SessionState},
- services::{self, connector_integration_interface},
- types::{api, domain, storage::revenue_recovery as storage_churn_recovery},
+ services::{
+ self,
+ connector_integration_interface::{self, RouterDataConversion},
+ },
+ types::{self, api, domain, storage::revenue_recovery as storage_churn_recovery},
workflows::revenue_recovery as revenue_recovery_flow,
};
@@ -29,28 +41,50 @@ pub async fn recovery_incoming_webhook_flow(
key_store: domain::MerchantKeyStore,
_webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
- connector: &connector_integration_interface::ConnectorEnum,
+ connector_enum: &connector_integration_interface::ConnectorEnum,
+ billing_connector_account: hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+ connector_name: &str,
request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
event_type: webhooks::IncomingWebhookEvent,
req_state: ReqState,
- billing_connector_account: domain::MerchantConnectorAccount,
+ object_ref_id: &webhooks::ObjectReferenceId,
) -> CustomResult<webhooks::WebhookResponseTracker, errors::RevenueRecoveryError> {
// Source verification is necessary for revenue recovery webhooks flow since We don't have payment intent/attempt object created before in our system.
-
common_utils::fp_utils::when(!source_verified, || {
Err(report!(
errors::RevenueRecoveryError::WebhookAuthenticationFailed
))
})?;
- let invoice_details = RevenueRecoveryInvoice(
- interface_webhooks::IncomingWebhook::get_revenue_recovery_invoice_details(
- connector,
- request_details,
- )
+ let connector = api_models::enums::Connector::from_str(connector_name)
.change_context(errors::RevenueRecoveryError::InvoiceWebhookProcessingFailed)
- .attach_printable("Failed while getting revenue recovery invoice details")?,
- );
+ .attach_printable_lazy(|| format!("unable to parse connector name {connector_name:?}"))?;
+
+ let billing_connectors_with_payment_sync_call = &state.conf.billing_connectors_payment_sync;
+
+ let should_billing_connector_payment_api_called = billing_connectors_with_payment_sync_call
+ .billing_connectors_which_require_payment_sync
+ .contains(&connector);
+
+ let billing_connector_payment_details =
+ BillingConnectorPaymentsSyncResponseData::get_billing_connector_payment_details(
+ should_billing_connector_payment_api_called,
+ &state,
+ &merchant_account,
+ &billing_connector_account,
+ connector_name,
+ object_ref_id,
+ )
+ .await?;
+
+ // Checks whether we have data in recovery_details , If its there then it will use the data and convert it into required from or else fetches from Incoming webhook
+
+ let invoice_details = RevenueRecoveryInvoice::get_recovery_invoice_details(
+ connector_enum,
+ request_details,
+ billing_connector_payment_details.as_ref(),
+ )?;
+
// Fetch the intent using merchant reference id, if not found create new intent.
let payment_intent = invoice_details
.get_payment_intent(
@@ -75,55 +109,22 @@ pub async fn recovery_incoming_webhook_flow(
})
.await?;
- let payment_attempt = match event_type.is_recovery_transaction_event() {
- true => {
- let invoice_transaction_details = RevenueRecoveryAttempt(
- interface_webhooks::IncomingWebhook::get_revenue_recovery_attempt_details(
- connector,
- request_details,
- )
- .change_context(errors::RevenueRecoveryError::TransactionWebhookProcessingFailed)?,
- );
- // Find the payment merchant connector ID at the top level to avoid multiple DB calls.
- let payment_merchant_connector_account = invoice_transaction_details
- .find_payment_merchant_connector_account(
- &state,
- &key_store,
- &billing_connector_account,
- )
- .await?;
-
- Some(
- invoice_transaction_details
- .get_payment_attempt(
- &state,
- &req_state,
- &merchant_account,
- &business_profile,
- &key_store,
- payment_intent.payment_id.clone(),
- )
- .await
- .transpose()
- .async_unwrap_or_else(|| async {
- invoice_transaction_details
- .record_payment_attempt(
- &state,
- &req_state,
- &merchant_account,
- &business_profile,
- &key_store,
- payment_intent.payment_id.clone(),
- &billing_connector_account.id,
- payment_merchant_connector_account,
- )
- .await
- })
- .await?,
- )
- }
- false => None,
- };
+ let is_event_recovery_transaction_event = event_type.is_recovery_transaction_event();
+
+ let payment_attempt = RevenueRecoveryAttempt::get_recovery_payment_attempt(
+ is_event_recovery_transaction_event,
+ &billing_connector_account,
+ &state,
+ &key_store,
+ connector_enum,
+ &req_state,
+ billing_connector_payment_details.as_ref(),
+ request_details,
+ &merchant_account,
+ &business_profile,
+ &payment_intent,
+ )
+ .await?;
let attempt_triggered_by = payment_attempt
.as_ref()
@@ -170,11 +171,37 @@ pub async fn recovery_incoming_webhook_flow(
}
}
}
-
+#[derive(Debug)]
pub struct RevenueRecoveryInvoice(revenue_recovery::RevenueRecoveryInvoiceData);
+#[derive(Debug)]
pub struct RevenueRecoveryAttempt(revenue_recovery::RevenueRecoveryAttemptData);
impl RevenueRecoveryInvoice {
+ fn get_recovery_invoice_details(
+ connector_enum: &connector_integration_interface::ConnectorEnum,
+ request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+ billing_connector_payment_details: Option<
+ &revenue_recovery_response::BillingConnectorPaymentsSyncResponse,
+ >,
+ ) -> CustomResult<Self, errors::RevenueRecoveryError> {
+ billing_connector_payment_details.map_or_else(
+ || {
+ interface_webhooks::IncomingWebhook::get_revenue_recovery_invoice_details(
+ connector_enum,
+ request_details,
+ )
+ .change_context(errors::RevenueRecoveryError::InvoiceWebhookProcessingFailed)
+ .attach_printable("Failed while getting revenue recovery invoice details")
+ .map(RevenueRecoveryInvoice)
+ },
+ |data| {
+ Ok(Self(revenue_recovery::RevenueRecoveryInvoiceData::from(
+ data,
+ )))
+ },
+ )
+ }
+
async fn get_payment_intent(
&self,
state: &SessionState,
@@ -236,12 +263,12 @@ impl RevenueRecoveryInvoice {
let global_payment_id = id_type::GlobalPaymentId::generate(&state.conf.cell_information.id);
let create_intent_response = Box::pin(payments::payments_intent_core::<
- hyperswitch_domain_models::router_flow_types::payments::PaymentCreateIntent,
+ router_flow_types::payments::PaymentCreateIntent,
api_payments::PaymentsIntentResponse,
_,
_,
hyperswitch_domain_models::payments::PaymentIntentData<
- hyperswitch_domain_models::router_flow_types::payments::PaymentCreateIntent,
+ router_flow_types::payments::PaymentCreateIntent,
>,
>(
state.clone(),
@@ -272,6 +299,33 @@ impl RevenueRecoveryInvoice {
}
impl RevenueRecoveryAttempt {
+ fn get_recovery_invoice_transaction_details(
+ connector_enum: &connector_integration_interface::ConnectorEnum,
+ request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+ billing_connector_payment_details: Option<
+ &revenue_recovery_response::BillingConnectorPaymentsSyncResponse,
+ >,
+ ) -> CustomResult<Self, errors::RevenueRecoveryError> {
+ billing_connector_payment_details.map_or_else(
+ || {
+ interface_webhooks::IncomingWebhook::get_revenue_recovery_attempt_details(
+ connector_enum,
+ request_details,
+ )
+ .change_context(errors::RevenueRecoveryError::TransactionWebhookProcessingFailed)
+ .attach_printable(
+ "Failed to get recovery attempt details from the billing connector",
+ )
+ .map(RevenueRecoveryAttempt)
+ },
+ |data| {
+ Ok(Self(revenue_recovery::RevenueRecoveryAttemptData::from(
+ data,
+ )))
+ },
+ )
+ }
+
async fn get_payment_attempt(
&self,
state: &SessionState,
@@ -283,13 +337,13 @@ impl RevenueRecoveryAttempt {
) -> CustomResult<Option<revenue_recovery::RecoveryPaymentAttempt>, errors::RevenueRecoveryError>
{
let attempt_response = Box::pin(payments::payments_core::<
- hyperswitch_domain_models::router_flow_types::payments::PSync,
+ router_flow_types::payments::PSync,
api_payments::PaymentsResponse,
_,
_,
_,
hyperswitch_domain_models::payments::PaymentStatusData<
- hyperswitch_domain_models::router_flow_types::payments::PSync,
+ router_flow_types::payments::PSync,
>,
>(
state.clone(),
@@ -447,6 +501,76 @@ impl RevenueRecoveryAttempt {
Ok(payment_merchant_connector_account)
}
+ #[allow(clippy::too_many_arguments)]
+ async fn get_recovery_payment_attempt(
+ is_recovery_transaction_event: bool,
+ billing_connector_account: &domain::MerchantConnectorAccount,
+ state: &SessionState,
+ key_store: &domain::MerchantKeyStore,
+ connector_enum: &connector_integration_interface::ConnectorEnum,
+ req_state: &ReqState,
+ billing_connector_payment_details: Option<
+ &revenue_recovery_response::BillingConnectorPaymentsSyncResponse,
+ >,
+ request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>,
+ merchant_account: &domain::MerchantAccount,
+ business_profile: &domain::Profile,
+ payment_intent: &revenue_recovery::RecoveryPaymentIntent,
+ ) -> CustomResult<Option<revenue_recovery::RecoveryPaymentAttempt>, errors::RevenueRecoveryError>
+ {
+ let recovery_payment_attempt = match is_recovery_transaction_event {
+ true => {
+ // Checks whether we have data in recovery_details , If its there then it will use the data and convert it into required from or else fetches from Incoming webhook
+ let invoice_transaction_details = Self::get_recovery_invoice_transaction_details(
+ connector_enum,
+ request_details,
+ billing_connector_payment_details,
+ )?;
+
+ // Find the payment merchant connector ID at the top level to avoid multiple DB calls.
+ let payment_merchant_connector_account = invoice_transaction_details
+ .find_payment_merchant_connector_account(
+ state,
+ key_store,
+ billing_connector_account,
+ )
+ .await?;
+
+ Some(
+ invoice_transaction_details
+ .get_payment_attempt(
+ state,
+ req_state,
+ merchant_account,
+ business_profile,
+ key_store,
+ payment_intent.payment_id.clone(),
+ )
+ .await
+ .transpose()
+ .async_unwrap_or_else(|| async {
+ invoice_transaction_details
+ .record_payment_attempt(
+ state,
+ req_state,
+ merchant_account,
+ business_profile,
+ key_store,
+ payment_intent.payment_id.clone(),
+ &billing_connector_account.id,
+ payment_merchant_connector_account,
+ )
+ .await
+ })
+ .await?,
+ )
+ }
+ false => None,
+ };
+
+ Ok(recovery_payment_attempt)
+ }
+
async fn insert_execute_pcr_task(
db: &dyn StorageInterface,
merchant_id: id_type::MerchantId,
@@ -522,3 +646,155 @@ impl RevenueRecoveryAttempt {
})
}
}
+
+pub struct BillingConnectorPaymentsSyncResponseData(
+ revenue_recovery_response::BillingConnectorPaymentsSyncResponse,
+);
+pub struct BillingConnectorPaymentsSyncFlowRouterData(
+ router_types::BillingConnectorPaymentsSyncRouterData,
+);
+
+impl BillingConnectorPaymentsSyncResponseData {
+ async fn handle_billing_connector_payment_sync_call(
+ state: &SessionState,
+ merchant_account: &domain::MerchantAccount,
+ merchant_connector_account: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+ connector_name: &str,
+ id: &str,
+ ) -> CustomResult<Self, errors::RevenueRecoveryError> {
+ let connector_data = api::ConnectorData::get_connector_by_name(
+ &state.conf.connectors,
+ connector_name,
+ api::GetToken::Connector,
+ None,
+ )
+ .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)
+ .attach_printable("invalid connector name received in payment attempt")?;
+
+ let connector_integration: services::BoxedBillingConnectorPaymentsSyncIntegrationInterface<
+ router_flow_types::BillingConnectorPaymentsSync,
+ revenue_recovery_request::BillingConnectorPaymentsSyncRequest,
+ revenue_recovery_response::BillingConnectorPaymentsSyncResponse,
+ > = connector_data.connector.get_connector_integration();
+
+ let router_data =
+ BillingConnectorPaymentsSyncFlowRouterData::construct_router_data_for_billing_connector_payment_sync_call(
+ state,
+ connector_name,
+ merchant_connector_account,
+ merchant_account,
+ id,
+ )
+ .await
+ .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)
+ .attach_printable(
+ "Failed while constructing router data for billing connector psync call",
+ )?
+ .inner();
+
+ let response = services::execute_connector_processing_step(
+ state,
+ connector_integration,
+ &router_data,
+ payments::CallConnectorAction::Trigger,
+ None,
+ )
+ .await
+ .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)
+ .attach_printable("Failed while fetching billing connector payment details")?;
+
+ let additional_recovery_details = match response.response {
+ Ok(response) => Ok(response),
+ error @ Err(_) => {
+ router_env::logger::error!(?error);
+ Err(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)
+ .attach_printable("Failed while fetching billing connector payment details")
+ }
+ }?;
+ Ok(Self(additional_recovery_details))
+ }
+
+ async fn get_billing_connector_payment_details(
+ should_billing_connector_payment_api_called: bool,
+ state: &SessionState,
+ merchant_account: &domain::MerchantAccount,
+ billing_connector_account: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+ connector_name: &str,
+ object_ref_id: &webhooks::ObjectReferenceId,
+ ) -> CustomResult<
+ Option<revenue_recovery_response::BillingConnectorPaymentsSyncResponse>,
+ errors::RevenueRecoveryError,
+ > {
+ let response_data = match should_billing_connector_payment_api_called {
+ true => {
+ let billing_connector_transaction_id = object_ref_id
+ .clone()
+ .get_connector_transaction_id_as_string()
+ .change_context(
+ errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed,
+ )
+ .attach_printable("Billing connector Payments api call failed")?;
+ let billing_connector_payment_details =
+ Self::handle_billing_connector_payment_sync_call(
+ state,
+ merchant_account,
+ billing_connector_account,
+ connector_name,
+ &billing_connector_transaction_id,
+ )
+ .await?;
+ Some(billing_connector_payment_details.inner())
+ }
+ false => None,
+ };
+
+ Ok(response_data)
+ }
+
+ fn inner(self) -> revenue_recovery_response::BillingConnectorPaymentsSyncResponse {
+ self.0
+ }
+}
+
+impl BillingConnectorPaymentsSyncFlowRouterData {
+ async fn construct_router_data_for_billing_connector_payment_sync_call(
+ state: &SessionState,
+ connector_name: &str,
+ merchant_connector_account: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
+ merchant_account: &domain::MerchantAccount,
+ billing_connector_psync_id: &str,
+ ) -> CustomResult<Self, errors::RevenueRecoveryError> {
+ let auth_type: types::ConnectorAuthType = helpers::MerchantConnectorAccountType::DbVal(
+ Box::new(merchant_connector_account.clone()),
+ )
+ .get_connector_account_details()
+ .parse_value("ConnectorAuthType")
+ .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)?;
+
+ let router_data = types::RouterDataV2 {
+ flow: PhantomData::<router_flow_types::BillingConnectorPaymentsSync>,
+ tenant_id: state.tenant.tenant_id.clone(),
+ resource_common_data: flow_common_types::BillingConnectorPaymentsSyncFlowData,
+ connector_auth_type: auth_type,
+ request: revenue_recovery_request::BillingConnectorPaymentsSyncRequest {
+ billing_connector_psync_id: billing_connector_psync_id.to_string(),
+ },
+ response: Err(types::ErrorResponse::default()),
+ };
+
+ let old_router_data =
+ flow_common_types::BillingConnectorPaymentsSyncFlowData::to_old_router_data(
+ router_data,
+ )
+ .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed)
+ .attach_printable(
+ "Cannot construct router data for making the billing connector payments api call",
+ )?;
+
+ Ok(Self(old_router_data))
+ }
+
+ fn inner(self) -> router_types::BillingConnectorPaymentsSyncRouterData {
+ self.0
+ }
+}
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index e8af5b3b77..a69070826f 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -110,10 +110,10 @@ pub type BoxedRevenueRecoveryRecordBackInterface<T, Req, Res> =
pub type BoxedUnifiedAuthenticationServiceInterface<T, Req, Resp> =
BoxedConnectorIntegrationInterface<T, common_types::UasFlowData, Req, Resp>;
-pub type BoxedGetAdditionalRecoveryRecoveryDetailsIntegrationInterface<T, Req, Res> =
+pub type BoxedBillingConnectorPaymentsSyncIntegrationInterface<T, Req, Res> =
BoxedConnectorIntegrationInterface<
T,
- common_types::GetAdditionalRevenueRecoveryFlowCommonData,
+ common_types::BillingConnectorPaymentsSyncFlowData,
Req,
Res,
>;
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 4b506798de..2902479244 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -57,9 +57,7 @@ pub use hyperswitch_domain_models::{
WebhookSourceVerifyData,
},
router_request_types::{
- revenue_recovery::{
- GetAdditionalRevenueRecoveryRequestData, RevenueRecoveryRecordBackRequest,
- },
+ revenue_recovery::{BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest},
unified_authentication_service::{
UasAuthenticationRequestData, UasAuthenticationResponseData,
UasConfirmationRequestData, UasPostAuthenticationRequestData,
@@ -80,7 +78,7 @@ pub use hyperswitch_domain_models::{
},
router_response_types::{
revenue_recovery::{
- GetAdditionalRevenueRecoveryResponseData, RevenueRecoveryRecordBackResponse,
+ BillingConnectorPaymentsSyncResponse, RevenueRecoveryRecordBackResponse,
},
AcceptDisputeResponse, CaptureSyncResponse, DefendDisputeResponse, MandateReference,
MandateRevokeResponseData, PaymentsResponseData, PreprocessingResponseId,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 577c306c36..ad50919ae0 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -56,7 +56,9 @@ pub use hyperswitch_interfaces::{
ConnectorPreAuthenticationVersionCallV2, ExternalAuthenticationV2,
},
fraud_check::FraudCheck,
- revenue_recovery::{AdditionalRevenueRecovery, RevenueRecovery, RevenueRecoveryRecordBack},
+ revenue_recovery::{
+ BillingConnectorPaymentsSyncIntegration, RevenueRecovery, RevenueRecoveryRecordBack,
+ },
revenue_recovery_v2::RevenueRecoveryV2,
BoxedConnector, Connector, ConnectorAccessToken, ConnectorAccessTokenV2, ConnectorCommon,
ConnectorCommonExt, ConnectorMandateRevoke, ConnectorMandateRevokeV2,
@@ -505,9 +507,9 @@ impl ConnectorData {
enums::Connector::Stripe => {
Ok(ConnectorEnum::Old(Box::new(connector::Stripe::new())))
}
- // enums::Connector::Stripebilling =>{
- // Ok(ConnectorEnum::Old(Box::new(connector::Stripebilling::new())))
- // },
+ enums::Connector::Stripebilling => Ok(ConnectorEnum::Old(Box::new(
+ connector::Stripebilling::new(),
+ ))),
enums::Connector::Wise => Ok(ConnectorEnum::Old(Box::new(connector::Wise::new()))),
enums::Connector::Worldline => {
Ok(ConnectorEnum::Old(Box::new(&connector::Worldline)))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index df5b4a3e93..1c60de60bd 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -318,7 +318,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Square => Self::Square,
api_enums::Connector::Stax => Self::Stax,
api_enums::Connector::Stripe => Self::Stripe,
- // api_enums::Connector::Stripebilling => Self::Stripebilling,
+ api_enums::Connector::Stripebilling => Self::Stripebilling,
// api_enums::Connector::Taxjar => Self::Taxjar,
// api_enums::Connector::Thunes => Self::Thunes,
api_enums::Connector::Trustpay => Self::Trustpay,