refactor(router): separate enums for api (#96)

This commit is contained in:
ItsMeShashank
2022-12-09 14:03:43 +05:30
committed by GitHub
parent f76f3e2f54
commit 9710af1e56
34 changed files with 1168 additions and 389 deletions

View File

@ -1,16 +1 @@
use std::convert::TryFrom;
use crate::{core::errors, types::storage::enums};
impl TryFrom<enums::IntentStatus> for enums::EventType {
type Error = errors::ValidationError;
fn try_from(value: enums::IntentStatus) -> Result<Self, Self::Error> {
match value {
enums::IntentStatus::Succeeded => Ok(Self::PaymentSucceeded),
_ => Err(errors::ValidationError::IncorrectValueProvided {
field_name: "intent_status",
}),
}
}
}