mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
feat(core): Changed frm_config format type in merchant_connector_account and added frm_message in payments response (#1543)
Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com> Co-authored-by: Sampras Lopes <lsampras@pm.me> Co-authored-by: Sampras Lopes <lsampras@protonmail.com>
This commit is contained in:
@ -494,15 +494,7 @@ pub async fn create_payment_connector(
|
||||
expected_format: "auth_type and api_key".to_string(),
|
||||
})?;
|
||||
|
||||
let frm_configs = match req.frm_configs {
|
||||
Some(frm_value) => {
|
||||
let configs_for_frm_value: serde_json::Value =
|
||||
utils::Encode::<api_models::admin::FrmConfigs>::encode_to_value(&frm_value)
|
||||
.change_context(errors::ApiErrorResponse::ConfigNotFound)?;
|
||||
Some(Secret::new(configs_for_frm_value))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let frm_configs = get_frm_config_as_secret(req.frm_configs);
|
||||
|
||||
let merchant_connector_account = domain::MerchantConnectorAccount {
|
||||
merchant_id: merchant_id.to_string(),
|
||||
@ -672,15 +664,7 @@ pub async fn update_payment_connector(
|
||||
.collect::<Vec<serde_json::Value>>()
|
||||
});
|
||||
|
||||
let frm_configs = match req.frm_configs.as_ref() {
|
||||
Some(frm_value) => {
|
||||
let configs_for_frm_value: serde_json::Value =
|
||||
utils::Encode::<api_models::admin::FrmConfigs>::encode_to_value(&frm_value)
|
||||
.change_context(errors::ApiErrorResponse::ConfigNotFound)?;
|
||||
Some(Secret::new(configs_for_frm_value))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let frm_configs = get_frm_config_as_secret(req.frm_configs);
|
||||
|
||||
let payment_connector = storage::MerchantConnectorAccountUpdate::Update {
|
||||
merchant_id: None,
|
||||
@ -855,3 +839,23 @@ pub async fn check_merchant_account_kv_status(
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
pub fn get_frm_config_as_secret(
|
||||
frm_configs: Option<Vec<api_models::admin::FrmConfigs>>,
|
||||
) -> Option<Vec<Secret<serde_json::Value>>> {
|
||||
match frm_configs.as_ref() {
|
||||
Some(frm_value) => {
|
||||
let configs_for_frm_value: Vec<Secret<serde_json::Value>> = frm_value
|
||||
.iter()
|
||||
.map(|config| {
|
||||
utils::Encode::<api_models::admin::FrmConfigs>::encode_to_value(&config)
|
||||
.change_context(errors::ApiErrorResponse::ConfigNotFound)
|
||||
.map(masking::Secret::new)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.ok()?;
|
||||
Some(configs_for_frm_value)
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user