Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
ae0a6af
feat(router): Configs and switch for dynamic routing
prajjwalkumar17 Sep 6, 2024
c17a95e
build grpc client
Aprabhat19 Sep 8, 2024
f877a38
fix merge conflicts
prajjwalkumar17 Sep 9, 2024
862ec06
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 9, 2024
0b7bb3c
building of client interface and add proto files
Aprabhat19 Sep 9, 2024
200f0a6
resolved conflicts
Aprabhat19 Sep 9, 2024
880c492
chore: run formatter
hyperswitch-bot[bot] Sep 9, 2024
707dbc7
resolved conflicts
Aprabhat19 Sep 9, 2024
b09025f
Cargo.lock changes
Aprabhat19 Sep 9, 2024
a5aa31b
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 9, 2024
6165067
Cargo.lock changes
Aprabhat19 Sep 9, 2024
75eb62a
fix migrations
prajjwalkumar17 Sep 9, 2024
4ca563b
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 9, 2024
ff18039
Merge branch 'main' of https://github.com/juspay/hyperswitch into bui…
Aprabhat19 Sep 9, 2024
7d0ca94
fix clippy
Aprabhat19 Sep 10, 2024
be3ceee
chore: run formatter
hyperswitch-bot[bot] Sep 10, 2024
97c706e
fix spell check
Aprabhat19 Sep 10, 2024
516194d
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 10, 2024
d150118
add else block to handel status as false
prajjwalkumar17 Sep 10, 2024
9adb35c
chore: run formatter
hyperswitch-bot[bot] Sep 10, 2024
55d0233
Merge branch 'main' into dr_configs_defaults
prajjwalkumar17 Sep 10, 2024
9580a1f
Merge branch 'main' of https://github.com/juspay/hyperswitch into bui…
Aprabhat19 Sep 10, 2024
fb84472
minor refactors
prajjwalkumar17 Sep 10, 2024
bd51191
Merge branch 'dr_configs_defaults' into build-grpc-client-dr
Aprabhat19 Sep 10, 2024
62bfa67
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
Aprabhat19 Sep 10, 2024
43671c5
construct the struct
Aprabhat19 Sep 10, 2024
abfb69b
chore: run formatter
hyperswitch-bot[bot] Sep 10, 2024
8e8b925
Merge branch 'main' into dr_configs_defaults
prajjwalkumar17 Sep 11, 2024
0b5717f
Merge branch 'dr_configs_defaults' into build-grpc-client-dr
prajjwalkumar17 Sep 11, 2024
3d3bcc3
ci changes
Aprabhat19 Sep 11, 2024
1d80154
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 11, 2024
7ce9d48
ci pr changes to include v2 checks
Aprabhat19 Sep 11, 2024
abfb0b8
major refactors
prajjwalkumar17 Sep 11, 2024
0703ec8
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 11, 2024
1a9aab4
correct openapi spec
prajjwalkumar17 Sep 11, 2024
6920707
remove to schema flag
prajjwalkumar17 Sep 11, 2024
9bdd848
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 11, 2024
cb16bc9
Merge branch 'dr_configs_defaults' into build-grpc-client-dr
prajjwalkumar17 Sep 12, 2024
6711008
address clippy lints
Aprabhat19 Sep 12, 2024
d0ca412
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 12, 2024
a94b1b7
change the routingAlgoRef to string
prajjwalkumar17 Sep 12, 2024
e7d33d4
chore: run formatter
hyperswitch-bot[bot] Sep 12, 2024
fd8a5b1
fix openapi spec
prajjwalkumar17 Sep 12, 2024
df36246
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 12, 2024
eff1f32
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
Aprabhat19 Sep 12, 2024
142ed90
Merge branch 'dr_configs_defaults' into build-grpc-client-dr
Aprabhat19 Sep 12, 2024
c4d0888
fix openapi spec
prajjwalkumar17 Sep 12, 2024
a02be8d
Merge branch 'main' into dr_configs_defaults
prajjwalkumar17 Sep 12, 2024
b15c748
Merge branch 'main' of https://github.com/juspay/hyperswitch into bui…
Aprabhat19 Sep 12, 2024
2dc37a0
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 12, 2024
8229b18
Merge branch 'dr_configs_defaults' into build-grpc-client-dr
Aprabhat19 Sep 12, 2024
a0fec1d
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 12, 2024
c329fe0
revert to the schema struct
prajjwalkumar17 Sep 12, 2024
327e553
Merge branch 'main' into dr_configs_defaults
prajjwalkumar17 Sep 12, 2024
3ef87c2
chore: run formatter
hyperswitch-bot[bot] Sep 12, 2024
98cdf62
clippy lints
Aprabhat19 Sep 12, 2024
a39f9b6
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 12, 2024
538c495
resolve conflicts
Aprabhat19 Sep 12, 2024
5d5442f
remove the id from default configs
prajjwalkumar17 Sep 12, 2024
62b3ffa
merge main
prajjwalkumar17 Sep 12, 2024
0b174e4
resolve conflicts from base branch
Aprabhat19 Sep 12, 2024
0506670
fix openapi spec
prajjwalkumar17 Sep 12, 2024
ca8eb8a
resolve conflicts with base branch
Aprabhat19 Sep 12, 2024
b130761
refactor the grpc server's api contract
Aprabhat19 Sep 12, 2024
2d3b0b4
change runtime flag to false
Aprabhat19 Sep 12, 2024
57ba534
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 12, 2024
41bd231
add protobuf package to Dockerfile
Aprabhat19 Sep 12, 2024
446e20f
Merge branch 'build-grpc-client-dr' of https://github.com/juspay/hype…
Aprabhat19 Sep 12, 2024
dbabfd6
address comments
prajjwalkumar17 Sep 12, 2024
3a331a1
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 12, 2024
2da8fe6
address comments
prajjwalkumar17 Sep 13, 2024
d03bf4e
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 13, 2024
1443c1e
chore: run formatter
hyperswitch-bot[bot] Sep 13, 2024
5369432
address comments for removal of redundant clones
prajjwalkumar17 Sep 13, 2024
f0f1add
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 13, 2024
0031feb
segregate the clients into different files
Aprabhat19 Sep 13, 2024
e05c56b
add the file
Aprabhat19 Sep 13, 2024
13d7d76
segregate the routes for success based routing
prajjwalkumar17 Sep 13, 2024
203b85c
chore: run formatter
hyperswitch-bot[bot] Sep 13, 2024
f0026b7
minor refactor
prajjwalkumar17 Sep 13, 2024
87afa3c
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 13, 2024
6de0835
address comments
Aprabhat19 Sep 13, 2024
8773de8
address comments
prajjwalkumar17 Sep 13, 2024
ed4c509
chore: run formatter
hyperswitch-bot[bot] Sep 13, 2024
9c57620
compare the id
prajjwalkumar17 Sep 13, 2024
b1ad349
Merge branch 'dr_configs_defaults' of https://github.com/juspay/hyper…
prajjwalkumar17 Sep 13, 2024
0d844e4
resolve conflicts with base branch
Aprabhat19 Sep 15, 2024
79d42f5
chore: run formatter
hyperswitch-bot[bot] Sep 15, 2024
fabc0c1
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 15, 2024
30982ff
resolve conflicts:
Aprabhat19 Sep 16, 2024
4e9ced6
resolve conflicts
Aprabhat19 Sep 16, 2024
f3f5105
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Sep 16, 2024
369f95e
feat(routing): success based routing metrics
prajjwalkumar17 Sep 18, 2024
187334c
resolve conflicts
prajjwalkumar17 Sep 19, 2024
c4ebbbd
redact cache on config update
prajjwalkumar17 Sep 19, 2024
1c27c1d
minor refactors
prajjwalkumar17 Sep 19, 2024
82b9d4f
chore: run formatter
hyperswitch-bot[bot] Sep 19, 2024
d0865c3
documentation refactors
prajjwalkumar17 Sep 23, 2024
17fec52
resolve merge conflicts
prajjwalkumar17 Sep 23, 2024
9852ba8
resolve spell check
prajjwalkumar17 Sep 23, 2024
f350c4e
address comments
prajjwalkumar17 Sep 23, 2024
30d05f2
metrics refactors
prajjwalkumar17 Sep 23, 2024
ffa10e5
add feature flags
prajjwalkumar17 Sep 23, 2024
f2745c1
minor refactors
prajjwalkumar17 Sep 23, 2024
e3cdef6
minor refactors for feature flags
prajjwalkumar17 Sep 23, 2024
4fe187f
minor refactors for removal of redundant mods
prajjwalkumar17 Sep 24, 2024
2ca0ee5
Merge branch 'main' into dr_metrics
prajjwalkumar17 Sep 24, 2024
cde9052
chore: run formatter
hyperswitch-bot[bot] Sep 24, 2024
8d0eff7
minor refactors for addressing comments
prajjwalkumar17 Sep 24, 2024
3df307d
minor refactors for addressing comments
prajjwalkumar17 Sep 24, 2024
9547759
address comments
prajjwalkumar17 Sep 25, 2024
231ad25
revert minor refactors
prajjwalkumar17 Sep 25, 2024
f8f5d58
address lints
prajjwalkumar17 Sep 25, 2024
10f24a5
address lints
prajjwalkumar17 Sep 25, 2024
bb0aecb
chore: run formatter
hyperswitch-bot[bot] Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/api_models/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ pub struct RoutableConnectorChoiceWithStatus {
pub routable_connector_choice: RoutableConnectorChoice,
pub status: bool,
}

impl RoutableConnectorChoiceWithStatus {
pub fn new(routable_connector_choice: RoutableConnectorChoice, status: bool) -> Self {
Self {
routable_connector_choice,
status,
}
}
}

#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, strum::Display, ToSchema)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand Down
22 changes: 22 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3219,6 +3219,28 @@ pub enum DeleteStatus {
Redacted,
}

#[derive(
Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, strum::Display, Hash,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum SuccessBasedRoutingConclusiveState {
// pc: payment connector
// sc: success based routing outcome/first connector
// status: payment status
//
// status = success && pc == sc
TruePositive,
// status = failed && pc == sc
FalsePositive,
// status = failed && pc != sc
TrueNegative,
// status = success && pc != sc
FalseNegative,
// status = processing
NonDeterministic,
}

/// Whether 3ds authentication is requested or not
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, Default, ToSchema)]
pub enum External3dsAuthenticationRequest {
Expand Down
2 changes: 1 addition & 1 deletion crates/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"]
payment_v2 = ["api_models/payment_v2", "diesel_models/payment_v2", "hyperswitch_domain_models/payment_v2", "storage_impl/payment_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2", "hyperswitch_domain_models/payment_methods_v2", "storage_impl/payment_methods_v2", "common_utils/payment_methods_v2"]
dynamic_routing = ["external_services/dynamic_routing"]
dynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing"]

# Partial Auth
# The feature reduces the overhead of the router authenticating the merchant for every request, and trusts on `x-merchant-id` header to be present in the request.
Expand Down
1 change: 1 addition & 0 deletions crates/router/src/core/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ counter_metric!(
ROUTING_RETRIEVE_CONFIG_FOR_PROFILE_SUCCESS_RESPONSE,
GLOBAL_METER
);
counter_metric!(DYNAMIC_SUCCESS_BASED_ROUTING, GLOBAL_METER);

#[cfg(feature = "partial-auth")]
counter_metric!(PARTIAL_AUTH_FAILURE, GLOBAL_METER);
Expand Down
21 changes: 21 additions & 0 deletions crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ use super::{
};
#[cfg(feature = "frm")]
use crate::core::fraud_check as frm_core;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use crate::types::api::convert_connector_data_to_routable_connectors;
use crate::{
configs::settings::{ApplePayPreDecryptFlow, PaymentMethodTypeTokenFilter},
connector::utils::missing_field_err,
Expand Down Expand Up @@ -292,6 +294,11 @@ where
};
payment_data = match connector_details {
ConnectorCallType::PreDetermined(connector) => {
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
let routable_connectors =
convert_connector_data_to_routable_connectors(&[connector.clone()])
.map_err(|e| logger::error!(routable_connector_error=?e))
.unwrap_or_default();
let schedule_time = if should_add_task_to_process_tracker {
payment_sync::get_sync_process_schedule_time(
&*state.store,
Expand Down Expand Up @@ -359,6 +366,10 @@ where
&key_store,
merchant_account.storage_scheme,
&locale,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
routable_connectors,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
&business_profile,
)
.await?;

Expand All @@ -381,6 +392,12 @@ where
}

ConnectorCallType::Retryable(connectors) => {
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
let routable_connectors =
convert_connector_data_to_routable_connectors(&connectors)
.map_err(|e| logger::error!(routable_connector_error=?e))
.unwrap_or_default();

let mut connectors = connectors.into_iter();

let connector_data = get_connector_data(&mut connectors)?;
Expand Down Expand Up @@ -484,6 +501,10 @@ where
&key_store,
merchant_account.storage_scheme,
&locale,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
routable_connectors,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
&business_profile,
)
.await?;

Expand Down
6 changes: 6 additions & 0 deletions crates/router/src/core/payments/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub mod payments_incremental_authorization;
pub mod tax_calculation;

use api_models::enums::FrmSuggestion;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use api_models::routing::RoutableConnectorChoice;
use async_trait::async_trait;
use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
Expand Down Expand Up @@ -263,6 +265,10 @@ pub trait PostUpdateTracker<F, D, R: Send>: Send {
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
locale: &Option<String>,
#[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec<
RoutableConnectorChoice,
>,
#[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile,
) -> RouterResult<D>
where
F: 'b + Send + Sync;
Expand Down
Loading
Loading