From c7c3f94a76f09fd5d9bc8959cacf33611f2e6b63 Mon Sep 17 00:00:00 2001 From: Sangamesh Kulkarni <59434228+Sangamesh26@users.noreply.github.com> Date: Thu, 5 Jan 2023 18:13:05 +0530 Subject: [PATCH] fix: merchant account update fix (#288) --- crates/router/src/core/admin.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 21968854a9..cd3d1994da 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -154,7 +154,9 @@ pub async fn merchant_account_update( let mut response = req.clone(); let updated_merchant_account = storage::MerchantAccountUpdate::Update { merchant_id: merchant_id.to_string(), - merchant_name: merchant_account.merchant_name.to_owned(), + merchant_name: req + .merchant_name + .or_else(|| merchant_account.merchant_name.to_owned()), api_key: merchant_account.api_key.clone(), merchant_details: if req.merchant_details.is_some() { Some( @@ -200,12 +202,18 @@ pub async fn merchant_account_update( .or_else(|| merchant_account.parent_merchant_id.clone()), ) .await?, - enable_payment_response_hash: Some(merchant_account.enable_payment_response_hash), - payment_response_hash_key: merchant_account.payment_response_hash_key.to_owned(), - redirect_to_merchant_with_http_post: Some( - merchant_account.redirect_to_merchant_with_http_post, - ), - publishable_key: merchant_account.publishable_key.clone(), + enable_payment_response_hash: req + .enable_payment_response_hash + .or(Some(merchant_account.enable_payment_response_hash)), + payment_response_hash_key: req + .payment_response_hash_key + .or_else(|| merchant_account.payment_response_hash_key.to_owned()), + redirect_to_merchant_with_http_post: req + .redirect_to_merchant_with_http_post + .or(Some(merchant_account.redirect_to_merchant_with_http_post)), + publishable_key: req + .publishable_key + .or_else(|| merchant_account.publishable_key.clone()), }; response.merchant_id = merchant_id.to_string(); response.api_key = merchant_account.api_key.to_owned();