feat(payouts): extend routing capabilities to payout operation (#3531)

Co-authored-by: Kashif <mohammed.kashif@juspay.in>
This commit is contained in:
Kashif
2024-02-26 13:00:10 +05:30
committed by GitHub
parent c79226b9b2
commit 75c633fc7c
39 changed files with 1341 additions and 556 deletions

View File

@ -48,6 +48,14 @@ pub trait RoutingAlgorithmInterface {
limit: i64,
offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>>;
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &str,
transaction_type: &common_enums::TransactionType,
limit: i64,
offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>>;
}
#[async_trait::async_trait]
@ -144,6 +152,26 @@ impl RoutingAlgorithmInterface for Store {
.map_err(Into::into)
.into_report()
}
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &str,
transaction_type: &common_enums::TransactionType,
limit: i64,
offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>> {
let conn = connection::pg_connection_write(self).await?;
routing_storage::RoutingAlgorithm::list_metadata_by_merchant_id_transaction_type(
&conn,
merchant_id,
transaction_type,
limit,
offset,
)
.await
.map_err(Into::into)
.into_report()
}
}
#[async_trait::async_trait]
@ -196,4 +224,14 @@ impl RoutingAlgorithmInterface for MockDb {
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>> {
Err(errors::StorageError::MockDbError)?
}
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
_merchant_id: &str,
_transaction_type: &common_enums::TransactionType,
_limit: i64,
_offset: i64,
) -> StorageResult<Vec<routing_storage::RoutingProfileMetadata>> {
Err(errors::StorageError::MockDbError)?
}
}