-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(dynamic_routing): add open router integration for success based routing #7795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6f7252a
feat(routing): Skeleton code for Open router integration
6c554bd
blank commit
Sarthak1799 44d8d5d
feat: Added API types for open router
Sarthak1799 28e7c94
feat: Update score API caller
Sarthak1799 ddd6f0e
refactor: Refactored update fucntion
Sarthak1799 b2ce634
refactored types
Sarthak1799 d2b77b7
add sr api integration with open router
Chethan-rao 5745088
Merge branch 'open-router-integration' of github.com:juspay/hyperswit…
Chethan-rao a33d8a1
add sr update-gateway-score api integration with open router
Chethan-rao 2d15f5b
fix clippy lints
Chethan-rao 5ebbf91
fix: Fixed configs
Sarthak1799 93521db
remove open_router config from docker-compose
Chethan-rao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
use std::{collections::HashMap, fmt::Debug}; | ||
|
||
use common_utils::{id_type, types::MinorUnit}; | ||
pub use euclid::{ | ||
dssa::types::EuclidAnalysable, | ||
frontend::{ | ||
ast, | ||
dir::{DirKeyKind, EuclidDirFilter}, | ||
}, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::enums::{Currency, PaymentMethod, RoutableConnectors}; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct OpenRouterDecideGatewayRequest { | ||
pub payment_info: PaymentInfo, | ||
pub merchant_id: id_type::ProfileId, | ||
pub eligible_gateway_list: Option<Vec<RoutableConnectors>>, | ||
pub ranking_algorithm: Option<RankingAlgorithm>, | ||
pub elimination_enabled: Option<bool>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | ||
pub enum RankingAlgorithm { | ||
SrBasedRouting, | ||
Chethan-rao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PlBasedRouting, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct PaymentInfo { | ||
pub payment_id: id_type::PaymentId, | ||
pub amount: MinorUnit, | ||
pub currency: Currency, | ||
// customerId: Option<ETCu::CustomerId>, | ||
// preferredGateway: Option<ETG::Gateway>, | ||
pub payment_type: String, | ||
// metadata: Option<String>, | ||
// internalMetadata: Option<String>, | ||
// isEmi: Option<bool>, | ||
// emiBank: Option<String>, | ||
// emiTenure: Option<i32>, | ||
pub payment_method_type: String, | ||
pub payment_method: PaymentMethod, | ||
// paymentSource: Option<String>, | ||
// authType: Option<ETCa::txn_card_info::AuthType>, | ||
// cardIssuerBankName: Option<String>, | ||
// cardIsin: Option<String>, | ||
// cardType: Option<ETCa::card_type::CardType>, | ||
// cardSwitchProvider: Option<Secret<String>>, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq)] | ||
pub struct DecidedGateway { | ||
pub gateway_priority_map: Option<HashMap<String, f64>>, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct ErrorResponse { | ||
pub status: String, | ||
pub error_code: String, | ||
pub error_message: String, | ||
pub priority_logic_tag: Option<String>, | ||
pub filter_wise_gateways: Option<serde_json::Value>, | ||
pub error_info: UnifiedError, | ||
pub is_dynamic_mga_enabled: bool, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct UnifiedError { | ||
pub code: String, | ||
pub user_message: String, | ||
pub developer_message: String, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct UpdateScorePayload { | ||
pub merchant_id: id_type::ProfileId, | ||
pub gateway: RoutableConnectors, | ||
pub status: TxnStatus, | ||
pub payment_id: id_type::PaymentId, | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | ||
pub enum TxnStatus { | ||
Started, | ||
AuthenticationFailed, | ||
JuspayDeclined, | ||
PendingVBV, | ||
VBVSuccessful, | ||
Authorized, | ||
AuthorizationFailed, | ||
Charged, | ||
Authorizing, | ||
CODInitiated, | ||
Voided, | ||
VoidInitiated, | ||
Nop, | ||
CaptureInitiated, | ||
CaptureFailed, | ||
VoidFailed, | ||
AutoRefunded, | ||
PartialCharged, | ||
ToBeCharged, | ||
Pending, | ||
Failure, | ||
Declined, | ||
} | ||
|
||
impl From<bool> for TxnStatus { | ||
fn from(value: bool) -> Self { | ||
match value { | ||
true => Self::Charged, | ||
_ => Self::Failure, | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.