fix(routing): Added routing validation for payments req (#4762)

This commit is contained in:
Sarthak Soni
2024-05-30 16:27:12 +05:30
committed by GitHub
parent aca6ad1bd1
commit 21a3a2ea8a
3 changed files with 30 additions and 0 deletions

View File

@ -1336,6 +1336,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentConfir
.clone()
.ok_or(report!(errors::ApiErrorResponse::PaymentNotFound))?;
let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
.routing
.clone()
.map(|val| val.parse_value("RoutingAlgorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid straight through routing rules format".to_string(),
})
.attach_printable("Invalid straight through routing rules format")?;
Ok((
Box::new(self),
operations::ValidateResult {

View File

@ -735,6 +735,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentCreate
)?;
}
let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
.routing
.clone()
.map(|val| val.parse_value("RoutingAlgorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid straight through routing rules format".to_string(),
})
.attach_printable("Invalid straight through routing rules format")?;
Ok((
Box::new(self),
operations::ValidateResult {

View File

@ -782,6 +782,16 @@ impl<F: Send + Clone> ValidateRequest<F, api::PaymentsRequest> for PaymentUpdate
&request.mandate_id,
)?;
let _request_straight_through: Option<api::routing::StraightThroughAlgorithm> = request
.routing
.clone()
.map(|val| val.parse_value("RoutingAlgorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "Invalid straight through routing rules format".to_string(),
})
.attach_printable("Invalid straight through routing rules format")?;
Ok((
Box::new(self),
operations::ValidateResult {