octicon-rss(16/)
You've already forked hyperswitch
mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-10 23:30:31 +08:00
feat: add an api for toggling extended card info feature (#4444)
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
committed by
GitHub
gitea-unlock(16/)
parent
83ca04ea5e
commit
87d9fced07
octicon-diff(16/tw-mr-1) 16 changed files with 184 additions and 19 deletions
@@ -1648,7 +1648,7 @@ pub async fn update_business_profile(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let business_profile_update = storage::business_profile::BusinessProfileUpdateInternal {
|
||||
let business_profile_update = storage::business_profile::BusinessProfileUpdate::Update {
|
||||
profile_name: request.profile_name,
|
||||
modified_at: Some(date_time::now()),
|
||||
return_url: request.return_url.map(|return_url| return_url.to_string()),
|
||||
@@ -1691,6 +1691,39 @@ pub async fn update_business_profile(
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn extended_card_info_toggle(
|
||||
state: AppState,
|
||||
profile_id: &str,
|
||||
ext_card_info_choice: admin_types::ExtendedCardInfoChoice,
|
||||
) -> RouterResponse<admin_types::ExtendedCardInfoChoice> {
|
||||
let db = state.store.as_ref();
|
||||
let business_profile = db
|
||||
.find_business_profile_by_profile_id(profile_id)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
id: profile_id.to_string(),
|
||||
})?;
|
||||
|
||||
if business_profile.is_extended_card_info_enabled.is_none()
|
||||
|| business_profile
|
||||
.is_extended_card_info_enabled
|
||||
.is_some_and(|existing_config| existing_config != ext_card_info_choice.enabled)
|
||||
{
|
||||
let business_profile_update =
|
||||
storage::business_profile::BusinessProfileUpdate::ExtendedCardInfoUpdate {
|
||||
is_extended_card_info_enabled: Some(ext_card_info_choice.enabled),
|
||||
};
|
||||
|
||||
db.update_business_profile_by_profile_id(business_profile, business_profile_update)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
id: profile_id.to_owned(),
|
||||
})?;
|
||||
}
|
||||
|
||||
Ok(service_api::ApplicationResponse::Json(ext_card_info_choice))
|
||||
}
|
||||
|
||||
pub(crate) fn validate_auth_and_metadata_type(
|
||||
connector_name: api_models::enums::Connector,
|
||||
val: &types::ConnectorAuthType,
|
||||
|
||||
Reference in New Issue
Block a user