Skip to content
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

refactor(core): ignore routing algorithm from merchant account create and business profile create #2253

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
72e8acb
remove routing algorithm from merchant account and business profile
Aprabhat19 Sep 21, 2023
18b5a67
remove form merchant account update req
Aprabhat19 Sep 21, 2023
7404354
chore: fmt re-rum
Aprabhat19 Sep 21, 2023
8236317
open-api run
Aprabhat19 Sep 21, 2023
de587bb
conflict resolution
Aprabhat19 Oct 27, 2023
fe05afd
chore: update Cargo.lock
github-actions[bot] Oct 27, 2023
2ef0688
docs(openapi): re-generate OpenAPI specification
github-actions[bot] Oct 27, 2023
848ad6c
added back the routing field in the struct
Aprabhat19 Oct 27, 2023
02ba3bd
Merge branch 'remove-routing-field' of https://github.com/juspay/hype…
Aprabhat19 Oct 27, 2023
5be6ef2
docs(openapi): re-generate OpenAPI specification
github-actions[bot] Oct 27, 2023
ca2d302
Merge branch 'main' into remove-routing-field
Aprabhat19 Oct 27, 2023
c260b55
made update as none
Aprabhat19 Oct 27, 2023
08fe4d3
Merge branch 'remove-routing-field' of https://github.com/juspay/hype…
Aprabhat19 Oct 27, 2023
09041ca
Merge branch 'main' into remove-routing-field
Aprabhat19 Oct 27, 2023
93874eb
cargo lock changes
Aprabhat19 Nov 7, 2023
93eaad3
resolved conflicts
Aprabhat19 Nov 7, 2023
1d379cd
docs(openapi): re-generate OpenAPI specification
github-actions[bot] Nov 7, 2023
2641c9a
Merge branch 'main' into remove-routing-field
Narayanbhat166 Nov 22, 2023
cda4d84
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 22, 2023
1917005
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 22, 2023
69c7c59
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 22, 2023
635cb3a
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 24, 2023
806199f
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 29, 2023
37f25e0
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 30, 2023
7011ae6
Merge branch 'main' into remove-routing-field
Aprabhat19 Nov 30, 2023
fc16661
resoleve conflicts
Aprabhat19 Dec 7, 2023
1f0fcbc
Merge branch 'main' into remove-routing-field
Aprabhat19 Dec 8, 2023
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
48 changes: 3 additions & 45 deletions crates/router/src/core/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ pub async fn create_merchant_account(
})
.transpose()?;

if let Some(ref routing_algorithm) = req.routing_algorithm {
let _: api_models::routing::RoutingAlgorithm = routing_algorithm
.clone()
.parse_value("RoutingAlgorithm")
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "routing_algorithm",
})
.attach_printable("Invalid routing algorithm given")?;
}

let key_store = domain::MerchantKeyStore {
merchant_id: req.merchant_id.clone(),
key: domain_types::encrypt(key.to_vec().into(), master_key)
Expand Down Expand Up @@ -183,9 +173,7 @@ pub async fn create_merchant_account(
return_url: req.return_url.map(|a| a.to_string()),
webhook_details,
routing_algorithm: Some(serde_json::json!({
"algorithm_id": null,
"timestamp": 0
})),
"algorithm_id":null,"timestamp":0})),
sub_merchants_enabled: req.sub_merchants_enabled,
parent_merchant_id,
enable_payment_response_hash,
Expand Down Expand Up @@ -476,16 +464,6 @@ pub async fn merchant_account_update(
}))?;
}

if let Some(ref routing_algorithm) = req.routing_algorithm {
let _: api_models::routing::RoutingAlgorithm = routing_algorithm
.clone()
.parse_value("RoutingAlgorithm")
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "routing_algorithm",
})
.attach_printable("Invalid routing algorithm given")?;
}

let primary_business_details = req
.primary_business_details
.as_ref()
Expand Down Expand Up @@ -564,7 +542,7 @@ pub async fn merchant_account_update(
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)?,

routing_algorithm: req.routing_algorithm,
routing_algorithm: None,
sub_merchants_enabled: req.sub_merchants_enabled,

parent_merchant_id: get_parent_merchant(
Expand Down Expand Up @@ -1483,16 +1461,6 @@ pub async fn create_business_profile(
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;

if let Some(ref routing_algorithm) = request.routing_algorithm {
let _: api_models::routing::RoutingAlgorithm = routing_algorithm
.clone()
.parse_value("RoutingAlgorithm")
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "routing_algorithm",
})
.attach_printable("Invalid routing algorithm given")?;
}

let business_profile =
create_and_insert_business_profile(db, request, merchant_account.clone()).await?;

Expand Down Expand Up @@ -1595,16 +1563,6 @@ pub async fn update_business_profile(
})
.transpose()?;

if let Some(ref routing_algorithm) = request.routing_algorithm {
let _: api_models::routing::RoutingAlgorithm = routing_algorithm
.clone()
.parse_value("RoutingAlgorithm")
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "routing_algorithm",
})
.attach_printable("Invalid routing algorithm given")?;
}

let business_profile_update = storage::business_profile::BusinessProfileUpdateInternal {
profile_name: request.profile_name,
modified_at: Some(date_time::now()),
Expand All @@ -1614,7 +1572,7 @@ pub async fn update_business_profile(
redirect_to_merchant_with_http_post: request.redirect_to_merchant_with_http_post,
webhook_details,
metadata: request.metadata,
routing_algorithm: request.routing_algorithm,
routing_algorithm: None,
intent_fulfillment_time: request.intent_fulfillment_time.map(i64::from),
frm_routing_algorithm: request.frm_routing_algorithm,
payout_routing_algorithm: request.payout_routing_algorithm,
Expand Down
5 changes: 1 addition & 4 deletions crates/router/src/types/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ impl ForeignTryFrom<(domain::MerchantAccount, BusinessProfileCreate)>
.unwrap_or(merchant_account.redirect_to_merchant_with_http_post),
webhook_details: webhook_details.or(merchant_account.webhook_details),
metadata: request.metadata,
routing_algorithm: Some(serde_json::json!({
"algorithm_id": null,
"timestamp": 0
})),
routing_algorithm: Some(serde_json::json!({"algorithm_id":null,"timestamp":0})),
intent_fulfillment_time: request
.intent_fulfillment_time
.map(i64::from)
Expand Down
Loading