Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

787 B
Raw Blame
pub mod inputs;
pub mod interpreter;
#[cfg(feature = "valued_jit")]
pub mod vir_interpreter;

pub use inputs::BackendInput;
pub use interpreter::InterpreterBackend;
#[cfg(feature = "valued_jit")]
pub use vir_interpreter::VirInterpreterBackend;

use crate::frontend::ast;

#[derive(Debug, Clone, serde::Serialize)]
pub struct BackendOutput<O> {
    pub rule_name: Option<String>,
    pub connector_selection: O,
}

impl<O> BackendOutput<O> {
    // get_connector_selection
    pub fn get_output(&self) -> &O {
        &self.connector_selection
    }
}

pub trait EuclidBackend<O>: Sized {
    type Error: serde::Serialize;

    fn with_program(program: ast::Program<O>) -> Result<Self, Self::Error>;

    fn execute(&self, input: BackendInput) -> Result<BackendOutput<O>, Self::Error>;
}