feat(core): Add product authentication ids in business profile (#6811)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sahkal Poddar
2024-12-12 20:05:20 +05:30
committed by GitHub
parent e9a5615f2b
commit 1564ad72b8
11 changed files with 136 additions and 1 deletions

View File

@ -3622,6 +3622,13 @@ impl ProfileCreateBridge for api::ProfileCreate {
})
.transpose()?;
let authentication_product_ids = self
.authentication_product_ids
.map(serde_json::to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse product authentication id's to value")?;
Ok(domain::Profile::from(domain::ProfileSetter {
profile_id,
merchant_id: merchant_account.get_id().clone(),
@ -3692,6 +3699,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
is_auto_retries_enabled: self.is_auto_retries_enabled.unwrap_or_default(),
max_auto_retries_enabled: self.max_auto_retries_enabled.map(i16::from),
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids,
}))
}
@ -3743,6 +3751,13 @@ impl ProfileCreateBridge for api::ProfileCreate {
})
.transpose()?;
let authentication_product_ids = self
.authentication_product_ids
.map(serde_json::to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse product authentication id's to value")?;
Ok(domain::Profile::from(domain::ProfileSetter {
id: profile_id,
merchant_id: merchant_id.clone(),
@ -3800,6 +3815,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
is_tax_connector_enabled: self.is_tax_connector_enabled,
is_network_tokenization_enabled: self.is_network_tokenization_enabled,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids,
}))
}
}
@ -4007,6 +4023,13 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
})
.transpose()?;
let authentication_product_ids = self
.authentication_product_ids
.map(serde_json::to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse product authentication id's to value")?;
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {
profile_name: self.profile_name,
@ -4050,6 +4073,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
is_auto_retries_enabled: self.is_auto_retries_enabled,
max_auto_retries_enabled: self.max_auto_retries_enabled.map(i16::from),
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids,
},
)))
}
@ -4112,6 +4136,13 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
})
.transpose()?;
let authentication_product_ids = self
.authentication_product_ids
.map(serde_json::to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse product authentication id's to value")?;
Ok(domain::ProfileUpdate::Update(Box::new(
domain::ProfileGeneralUpdate {
profile_name: self.profile_name,
@ -4147,6 +4178,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.always_collect_shipping_details_from_wallet_connector,
is_network_tokenization_enabled: self.is_network_tokenization_enabled,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids,
},
)))
}

View File

@ -175,6 +175,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_auto_retries_enabled: item.is_auto_retries_enabled,
max_auto_retries_enabled: item.max_auto_retries_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
})
}
}
@ -243,6 +244,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_tax_connector_enabled: item.is_tax_connector_enabled,
is_network_tokenization_enabled: item.is_network_tokenization_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
})
}
}
@ -299,6 +301,13 @@ pub async fn create_profile_from_merchant_account(
})
.transpose()?;
let authentication_product_ids = request
.authentication_product_ids
.map(serde_json::to_value)
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse product authentication id's to value")?;
Ok(domain::Profile::from(domain::ProfileSetter {
profile_id,
merchant_id,
@ -370,5 +379,6 @@ pub async fn create_profile_from_merchant_account(
is_auto_retries_enabled: request.is_auto_retries_enabled.unwrap_or_default(),
max_auto_retries_enabled: request.max_auto_retries_enabled.map(i16::from),
is_click_to_pay_enabled: request.is_click_to_pay_enabled,
authentication_product_ids,
}))
}