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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
use super::generics;
use crate::{
blocklist_lookup::{BlocklistLookup, BlocklistLookupNew},
schema::blocklist_lookup::dsl,
DatabaseConnectionWithContext, StorageResult,
};
impl BlocklistLookupNew {
pub async fn insert(
self,
conn: &DatabaseConnectionWithContext<'_>,
) -> StorageResult<BlocklistLookup> {
generics::generic_insert(conn, self).await
}
}
impl BlocklistLookup {
pub async fn find_by_merchant_id_fingerprint(
conn: &DatabaseConnectionWithContext<'_>,
merchant_id: &common_utils::id_type::MerchantId,
fingerprint: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::fingerprint.eq(fingerprint.to_owned())),
)
.await
}
pub async fn delete_by_merchant_id_fingerprint(
conn: &DatabaseConnectionWithContext<'_>,
merchant_id: &common_utils::id_type::MerchantId,
fingerprint: &str,
) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::fingerprint.eq(fingerprint.to_owned())),
)
.await
}
}