Skip to content

Commit cfe2269

Browse files
NISHANTH1221Nishanth Challahyperswitch-bot[bot]aniketburman014
authored
feat(connector): Add recovery support for stripebilling (#7461)
Co-authored-by: Nishanth Challa <[email protected]> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Aniket Burman <[email protected]>
1 parent 7358b3a commit cfe2269

File tree

34 files changed

+1044
-320
lines changed

34 files changed

+1044
-320
lines changed

api-reference-v2/openapi_spec.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7811,6 +7811,7 @@
78117811
"square",
78127812
"stax",
78137813
"stripe",
7814+
"stripebilling",
78147815
"taxjar",
78157816
"threedsecureio",
78167817
"trustpay",
@@ -21074,6 +21075,7 @@
2107421075
"square",
2107521076
"stax",
2107621077
"stripe",
21078+
"stripebilling",
2107721079
"trustpay",
2107821080
"tsys",
2107921081
"volt",

api-reference/openapi_spec.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9893,6 +9893,7 @@
98939893
"square",
98949894
"stax",
98959895
"stripe",
9896+
"stripebilling",
98969897
"taxjar",
98979898
"threedsecureio",
98989899
"trustpay",
@@ -25443,6 +25444,7 @@
2544325444
"square",
2544425445
"stax",
2544525446
"stripe",
25447+
"stripebilling",
2544625448
"trustpay",
2544725449
"tsys",
2544825450
"volt",

config/config.example.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,5 +954,5 @@ foreground_color = "#111326"
954954
primary_color = "#006DF9" # Primary color
955955
background_color = "#FFFFFF" # Email background color
956956

957-
[additional_revenue_recovery_details_call]
958-
connectors_with_additional_revenue_recovery_details_call = "stripebilling" # List of connectors which has additional revenue recovery details api-call
957+
[billing_connectors_payment_sync]
958+
billing_connectors_which_require_payment_sync = "stripebilling" # List of billing connectors which has payment sync api call

config/development.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ connectors_with_delayed_session_response = "trustpay,payme"
797797
[webhook_source_verification_call]
798798
connectors_with_webhook_source_verification_call = "paypal"
799799

800-
[additional_revenue_recovery_details_call]
801-
connectors_with_additional_revenue_recovery_details_call = "stripebilling"
800+
[billing_connectors_payment_sync]
801+
billing_connectors_which_require_payment_sync = "stripebilling"
802802

803803
[mandates.supported_payment_methods]
804804
bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }

config/docker_compose.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ connectors_with_delayed_session_response = "trustpay,payme"
326326
[webhook_source_verification_call]
327327
connectors_with_webhook_source_verification_call = "paypal"
328328

329-
[additional_revenue_recovery_details_call]
330-
connectors_with_additional_revenue_recovery_details_call = "stripebilling"
329+
[billing_connectors_payment_sync]
330+
billing_connectors_which_require_payment_sync = "stripebilling"
331331

332332
[scheduler]
333333
stream = "SCHEDULER_STREAM"

crates/api_models/src/webhooks.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,50 @@ pub enum InvoiceIdType {
261261
ConnectorInvoiceId(String),
262262
}
263263

264+
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
265+
impl ObjectReferenceId {
266+
pub fn get_connector_transaction_id_as_string(
267+
self,
268+
) -> Result<String, common_utils::errors::ValidationError> {
269+
match self {
270+
Self::PaymentId(
271+
payments::PaymentIdType::ConnectorTransactionId(id)
272+
) => Ok(id),
273+
Self::PaymentId(_)=>Err(
274+
common_utils::errors::ValidationError::IncorrectValueProvided {
275+
field_name: "ConnectorTransactionId variant of PaymentId is required but received otherr variant",
276+
},
277+
),
278+
Self::RefundId(_) => Err(
279+
common_utils::errors::ValidationError::IncorrectValueProvided {
280+
field_name: "PaymentId is required but received RefundId",
281+
},
282+
),
283+
Self::MandateId(_) => Err(
284+
common_utils::errors::ValidationError::IncorrectValueProvided {
285+
field_name: "PaymentId is required but received MandateId",
286+
},
287+
),
288+
Self::ExternalAuthenticationID(_) => Err(
289+
common_utils::errors::ValidationError::IncorrectValueProvided {
290+
field_name: "PaymentId is required but received ExternalAuthenticationID",
291+
},
292+
),
293+
#[cfg(feature = "payouts")]
294+
Self::PayoutId(_) => Err(
295+
common_utils::errors::ValidationError::IncorrectValueProvided {
296+
field_name: "PaymentId is required but received PayoutId",
297+
},
298+
),
299+
Self::InvoiceId(_) => Err(
300+
common_utils::errors::ValidationError::IncorrectValueProvided {
301+
field_name: "PaymentId is required but received InvoiceId",
302+
},
303+
)
304+
}
305+
}
306+
}
307+
264308
pub struct IncomingWebhookDetails {
265309
pub object_reference_id: ObjectReferenceId,
266310
pub resource_object: Vec<u8>,

crates/common_enums/src/connector_enums.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub enum RoutableConnectors {
129129
Square,
130130
Stax,
131131
Stripe,
132-
//Stripebilling,
132+
Stripebilling,
133133
// Taxjar,
134134
Trustpay,
135135
// Thunes
@@ -275,7 +275,7 @@ pub enum Connector {
275275
Square,
276276
Stax,
277277
Stripe,
278-
// Stripebilling,
278+
Stripebilling,
279279
Taxjar,
280280
Threedsecureio,
281281
//Thunes,
@@ -430,7 +430,7 @@ impl Connector {
430430
| Self::Shift4
431431
| Self::Square
432432
| Self::Stax
433-
// | Self::Stripebilling
433+
| Self::Stripebilling
434434
| Self::Taxjar
435435
// | Self::Thunes
436436
| Self::Trustpay
@@ -582,7 +582,7 @@ impl From<RoutableConnectors> for Connector {
582582
RoutableConnectors::Square => Self::Square,
583583
RoutableConnectors::Stax => Self::Stax,
584584
RoutableConnectors::Stripe => Self::Stripe,
585-
// RoutableConnectors::Stripebilling => Self::Stripebilling,
585+
RoutableConnectors::Stripebilling => Self::Stripebilling,
586586
RoutableConnectors::Trustpay => Self::Trustpay,
587587
RoutableConnectors::Tsys => Self::Tsys,
588588
RoutableConnectors::Volt => Self::Volt,
@@ -688,6 +688,7 @@ impl TryFrom<Connector> for RoutableConnectors {
688688
Connector::Square => Ok(Self::Square),
689689
Connector::Stax => Ok(Self::Stax),
690690
Connector::Stripe => Ok(Self::Stripe),
691+
Connector::Stripebilling => Ok(Self::Stripebilling),
691692
Connector::Trustpay => Ok(Self::Trustpay),
692693
Connector::Tsys => Ok(Self::Tsys),
693694
Connector::Volt => Ok(Self::Volt),

crates/connector_configs/src/connector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub struct ConnectorConfig {
244244
pub stripe: Option<ConnectorTomlConfig>,
245245
#[cfg(feature = "payouts")]
246246
pub stripe_payout: Option<ConnectorTomlConfig>,
247-
// pub stripebilling : Option<ConnectorTomlConfig>,
247+
pub stripebilling: Option<ConnectorTomlConfig>,
248248
pub signifyd: Option<ConnectorTomlConfig>,
249249
pub trustpay: Option<ConnectorTomlConfig>,
250250
pub threedsecureio: Option<ConnectorTomlConfig>,
@@ -420,7 +420,7 @@ impl ConnectorConfig {
420420
Connector::Square => Ok(connector_data.square),
421421
Connector::Stax => Ok(connector_data.stax),
422422
Connector::Stripe => Ok(connector_data.stripe),
423-
// Connector::Stripebilling => Ok(connector_data.stripebilling),
423+
Connector::Stripebilling => Ok(connector_data.stripebilling),
424424
Connector::Trustpay => Ok(connector_data.trustpay),
425425
Connector::Threedsecureio => Ok(connector_data.threedsecureio),
426426
Connector::Taxjar => Ok(connector_data.taxjar),

0 commit comments

Comments
 (0)