diff --git a/crates/api_models/src/open_router.rs b/crates/api_models/src/open_router.rs index cfcb45ef97..08607e1469 100644 --- a/crates/api_models/src/open_router.rs +++ b/crates/api_models/src/open_router.rs @@ -148,6 +148,11 @@ pub struct UpdateScorePayload { pub payment_id: id_type::PaymentId, } +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct UpdateScoreResponse { + pub message: String, +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum TxnStatus { diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index c36de4fb63..f08e76469d 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -1958,11 +1958,12 @@ pub async fn update_gateway_score_with_open_router( match response { Ok(resp) => { - let update_score_resp = String::from_utf8(resp.response.to_vec()).change_context( - errors::RoutingError::OpenRouterError( + let update_score_resp = resp + .response + .parse_struct::("UpdateScoreResponse") + .change_context(errors::RoutingError::OpenRouterError( "Failed to parse the response from open_router".into(), - ), - )?; + ))?; logger::debug!( "open_router update_gateway_score response for gateway with id {}: {:?}",