mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
initial commit
This commit is contained in:
40
crates/router/src/core/payments/flows.rs
Normal file
40
crates/router/src/core/payments/flows.rs
Normal file
@ -0,0 +1,40 @@
|
||||
mod authorize_flow;
|
||||
mod cancel_flow;
|
||||
mod capture_flow;
|
||||
mod psync_flow;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use super::PaymentData;
|
||||
use crate::{
|
||||
core::{errors::RouterResult, payments},
|
||||
routes::AppState,
|
||||
services,
|
||||
types::{self, api, storage},
|
||||
};
|
||||
|
||||
#[async_trait]
|
||||
pub trait ConstructFlowSpecificData<F, Req, Res> {
|
||||
async fn construct_r_d<'a>(
|
||||
&self,
|
||||
state: &AppState,
|
||||
connector_id: &str,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
) -> RouterResult<types::RouterData<F, Req, Res>>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait Feature<F, T> {
|
||||
async fn decide_flows<'a>(
|
||||
self,
|
||||
state: &AppState,
|
||||
connector: api::ConnectorData,
|
||||
maybe_customer: &Option<api::CustomerResponse>,
|
||||
payment_data: PaymentData<F>,
|
||||
call_connector_action: payments::CallConnectorAction,
|
||||
) -> (RouterResult<Self>, PaymentData<F>)
|
||||
where
|
||||
Self: std::marker::Sized,
|
||||
F: Clone,
|
||||
dyn api::Connector: services::ConnectorIntegration<F, T, types::PaymentsResponseData>;
|
||||
}
|
||||
Reference in New Issue
Block a user