mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(merchant_id): create domain type for merchant_id (#5408)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
@ -8,9 +8,7 @@ use error_stack::ResultExt;
|
||||
use euclid::frontend::ast;
|
||||
use storage_impl::redis::cache;
|
||||
|
||||
use super::routing::helpers::{
|
||||
get_payment_config_routing_id, update_merchant_active_algorithm_ref,
|
||||
};
|
||||
use super::routing::helpers::update_merchant_active_algorithm_ref;
|
||||
use crate::{
|
||||
core::errors::{self, RouterResponse},
|
||||
routes::SessionState,
|
||||
@ -62,7 +60,7 @@ pub async fn upsert_conditional_config(
|
||||
.attach_printable("Could not decode the routing algorithm")?
|
||||
.unwrap_or_default();
|
||||
|
||||
let key = get_payment_config_routing_id(merchant_account.merchant_id.as_str());
|
||||
let key = merchant_account.get_id().get_payment_config_routing_id();
|
||||
let read_config_key = db.find_config_by_key(&key).await;
|
||||
|
||||
ast::lowering::lower_program(prog.clone())
|
||||
@ -157,7 +155,7 @@ pub async fn delete_conditional_config(
|
||||
merchant_account: domain::MerchantAccount,
|
||||
) -> RouterResponse<()> {
|
||||
let db = state.store.as_ref();
|
||||
let key = get_payment_config_routing_id(&merchant_account.merchant_id);
|
||||
let key = merchant_account.get_id().get_payment_config_routing_id();
|
||||
let mut algo_id: routing::RoutingAlgorithmRef = merchant_account
|
||||
.routing_algorithm
|
||||
.clone()
|
||||
@ -185,7 +183,7 @@ pub async fn retrieve_conditional_config(
|
||||
merchant_account: domain::MerchantAccount,
|
||||
) -> RouterResponse<DecisionManagerResponse> {
|
||||
let db = state.store.as_ref();
|
||||
let algorithm_id = get_payment_config_routing_id(merchant_account.merchant_id.as_str());
|
||||
let algorithm_id = merchant_account.get_id().get_payment_config_routing_id();
|
||||
let algo_config = db
|
||||
.find_config_by_key(&algorithm_id)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user