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

1.6 KB
Raw Blame
use common_utils::id_type;
use hyperswitch_domain_models::card_issuer::CardIssuersInterface;
use router_env::instrument;

use crate::{
    core::errors::{self, CustomResult},
    db::kafka_store::KafkaStore,
    types::storage,
};

#[async_trait::async_trait]
impl CardIssuersInterface for KafkaStore {
    type Error = errors::StorageError;

    #[instrument(skip_all)]
    async fn insert_card_issuer(
        &self,
        new: storage::NewCardIssuer,
    ) -> CustomResult<storage::CardIssuer, errors::StorageError> {
        self.diesel_store.insert_card_issuer(new).await
    }

    #[instrument(skip_all)]
    async fn update_card_issuer(
        &self,
        id: id_type::CardIssuerId,
        update: storage::UpdateCardIssuer,
    ) -> CustomResult<storage::CardIssuer, errors::StorageError> {
        self.diesel_store.update_card_issuer(id, update).await
    }

    #[instrument(skip_all)]
    async fn delete_card_issuer(
        &self,
        id: id_type::CardIssuerId,
    ) -> CustomResult<bool, errors::StorageError> {
        self.diesel_store.delete_card_issuer(id).await
    }

    #[instrument(skip_all)]
    async fn list_card_issuers(
        &self,
        limit: i64,
    ) -> CustomResult<Vec<storage::CardIssuerListItem>, errors::StorageError> {
        self.diesel_store.list_card_issuers(limit).await
    }

    #[instrument(skip_all)]
    async fn get_card_issuers_by_ids(
        &self,
        ids: Vec<id_type::CardIssuerId>,
    ) -> CustomResult<Vec<storage::CardIssuer>, errors::StorageError> {
        self.diesel_store.get_card_issuers_by_ids(ids).await
    }
}