fix: merchant account update fix (#288)

This commit is contained in:
Sangamesh Kulkarni
2023-01-05 18:13:05 +05:30
committed by GitHub
parent 3174c43b24
commit c7c3f94a76

View File

@ -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();