Skip to content

Commit

Permalink
add auto retries and stepup 3ds flows
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-harsha-vardhan committed Nov 10, 2023
1 parent 2a4f5d1 commit b362ecf
Show file tree
Hide file tree
Showing 4 changed files with 621 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
license.workspace = true

[features]
default = ["kv_store", "stripe", "oltp", "olap", "backwards_compatibility", "accounts_cache", "dummy_connector", "payouts"]
default = ["kv_store", "stripe", "oltp", "olap", "backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "retry"]
s3 = ["dep:aws-sdk-s3", "dep:aws-config"]
kms = ["external_services/kms", "dep:aws-config"]
email = ["external_services/email", "dep:aws-config"]
Expand All @@ -30,6 +30,7 @@ external_access_dc = ["dummy_connector"]
detailed_errors = ["api_models/detailed_errors", "error-stack/serde"]
payouts = []
api_locking = []
retry = []


[dependencies]
Expand Down
31 changes: 30 additions & 1 deletion crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pub mod customers;
pub mod flows;
pub mod helpers;
pub mod operations;
#[cfg(feature = "retry")]
pub mod retry;
pub mod routing;
pub mod tokenization;
pub mod transformers;
Expand Down Expand Up @@ -231,7 +233,7 @@ where
state,
&merchant_account,
&key_store,
connector_data,
connector_data.clone(),
&operation,
&mut payment_data,
&customer,
Expand All @@ -242,6 +244,33 @@ where
)
.await?;

#[cfg(feature = "retry")]
let mut router_data = router_data;
#[cfg(feature = "retry")]
{
use crate::core::payments::retry::{self, GsmValidation};
let config_bool =
retry::config_should_call_gsm(&*state.store, &merchant_account.merchant_id)
.await;

if config_bool && router_data.should_call_gsm() {
router_data = retry::do_gsm_actions(
&state,
&mut payment_data,
connectors,
connector_data,
router_data,
&merchant_account,
&key_store,
&operation,
&customer,
&validate_result,
schedule_time,
)
.await?;
};
}

let operation = Box::new(PaymentResponse);
let db = &*state.store;
connector_http_status_code = router_data.connector_http_status_code;
Expand Down
Loading

0 comments on commit b362ecf

Please sign in to comment.