Repository: juspay/hyperswitch
File: crates/diesel_models/src/payment_attempt.rs (Rust)

Code before:
)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct NetworkDetails {
    pub network_advice_code: Option<String>,
}

// ErrorDetails nested structs for V1 payment_attempt
common_utils::impl_to_sql_from_sql_json!(ErrorDetails);
#[derive(
    Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, diesel::AsExpression,
)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct ErrorDetails {
    pub unified_details: Option<UnifiedErrorDetails>,
    pub issuer_details: Option<IssuerErrorDetails>,
    pub connector_details: Option<ConnectorErrorDetails>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct UnifiedErrorDetails {
    pub category: Option<String>,
    pub message: Option<String>,
    pub standardised_code: Option<storage_enums::StandardisedCode>,
    pub description: Option<String>,
    pub user_guidance_message: Option<String>,
    pub recommended_action: Option<storage_enums::Retry>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct IssuerErrorDetails {
    pub code: Option<String>,
    pub message: Option<String>,
    pub network_details: Option<NetworkErrorDetails>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct NetworkErrorDetails {
    pub name: Option<storage_enums::CardNetwork>,
    pub advice_code: Option<String>,
    pub advice_message: Option<String>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct ConnectorErrorDetails {
    pub code: Option<String>,
    pub message: Option<String>,
    pub reason: Option<String>,
}

#[cfg(feature = "v2")]
#[derive(

Review comment (suggestion):
```suggestion
    pub recommended_action: Option<storage_enums::RecommendedAction>,
```

Code after:
)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct NetworkDetails {
    pub network_advice_code: Option<String>,
}

// ErrorDetails nested structs for V1 payment_attempt
common_utils::impl_to_sql_from_sql_json!(ErrorDetails);
#[derive(
    Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, diesel::AsExpression,
)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct ErrorDetails {
    pub unified_details: Option<UnifiedErrorDetails>,
    pub issuer_details: Option<IssuerErrorDetails>,
    pub connector_details: Option<ConnectorErrorDetails>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct UnifiedErrorDetails {
    pub category: Option<String>,
    pub message: Option<String>,
    pub standardised_code: Option<storage_enums::StandardisedCode>,
    pub description: Option<String>,
    pub user_guidance_message: Option<String>,
    pub recommended_action: Option<storage_enums::RecommendedAction>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct IssuerErrorDetails {
    pub code: Option<String>,
    pub message: Option<String>,
    pub network_details: Option<NetworkErrorDetails>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct NetworkErrorDetails {
    pub name: Option<storage_enums::CardNetwork>,
    pub advice_code: Option<String>,
    pub advice_message: Option<String>,
}

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct ConnectorErrorDetails {
    pub code: Option<String>,
    pub message: Option<String>,
    pub reason: Option<String>,
}

#[cfg(feature = "v2")]
#[derive(