mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
refactor(business_profile): use concrete types for JSON fields (#5531)
This commit is contained in:
@ -167,15 +167,6 @@ impl MerchantAccountCreate {
|
||||
.transpose()
|
||||
}
|
||||
|
||||
pub fn get_webhook_details_as_value(
|
||||
&self,
|
||||
) -> CustomResult<Option<serde_json::Value>, errors::ParsingError> {
|
||||
self.webhook_details
|
||||
.as_ref()
|
||||
.map(|webhook_details| webhook_details.encode_to_value())
|
||||
.transpose()
|
||||
}
|
||||
|
||||
pub fn parse_routing_algorithm(&self) -> CustomResult<(), errors::ParsingError> {
|
||||
match self.routing_algorithm {
|
||||
Some(ref routing_algorithm) => {
|
||||
@ -248,7 +239,7 @@ impl MerchantAccountCreate {
|
||||
pub struct AuthenticationConnectorDetails {
|
||||
/// List of authentication connectors
|
||||
#[schema(value_type = Vec<AuthenticationConnectors>)]
|
||||
pub authentication_connectors: Vec<api_enums::AuthenticationConnectors>,
|
||||
pub authentication_connectors: Vec<common_enums::AuthenticationConnectors>,
|
||||
/// URL of the (customer service) website that will be shown to the shopper in case of technical errors during the 3D Secure 2 process.
|
||||
pub three_ds_requestor_url: String,
|
||||
}
|
||||
@ -483,8 +474,7 @@ pub struct MerchantAccountResponse {
|
||||
pub merchant_details: Option<Encryptable<pii::SecretSerdeValue>>,
|
||||
|
||||
/// Webhook related details
|
||||
#[schema(value_type = Option<WebhookDetails>)]
|
||||
pub webhook_details: Option<serde_json::Value>,
|
||||
pub webhook_details: Option<WebhookDetails>,
|
||||
|
||||
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
|
||||
#[serde(skip)]
|
||||
@ -1948,8 +1938,7 @@ pub struct BusinessProfileResponse {
|
||||
pub redirect_to_merchant_with_http_post: bool,
|
||||
|
||||
/// Webhook related details
|
||||
#[schema(value_type = Option<WebhookDetails>)]
|
||||
pub webhook_details: Option<pii::SecretSerdeValue>,
|
||||
pub webhook_details: Option<WebhookDetails>,
|
||||
|
||||
/// Metadata is useful for storing additional, unstructured information on an object.
|
||||
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
|
||||
@ -1980,7 +1969,8 @@ pub struct BusinessProfileResponse {
|
||||
pub session_expiry: Option<i64>,
|
||||
|
||||
/// Default Payment Link config for all payment links created under this business profile
|
||||
pub payment_link_config: Option<serde_json::Value>,
|
||||
#[schema(value_type = Option<BusinessPaymentLinkConfig>)]
|
||||
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
|
||||
|
||||
/// External 3DS authentication details
|
||||
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
|
||||
|
||||
@ -303,36 +303,6 @@ impl Connector {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum AuthenticationConnectors {
|
||||
Threedsecureio,
|
||||
Netcetera,
|
||||
Gpayments,
|
||||
}
|
||||
|
||||
impl AuthenticationConnectors {
|
||||
pub fn is_separate_version_call_required(&self) -> bool {
|
||||
match self {
|
||||
Self::Threedsecureio | Self::Netcetera => false,
|
||||
Self::Gpayments => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "payouts")]
|
||||
#[derive(
|
||||
Clone,
|
||||
|
||||
Reference in New Issue
Block a user