text stringlengths 70 351k | source stringclasses 4
values |
|---|---|
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/generic_link.rs | crate: router
use error_stack::report;
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::storage,
};
async fn insert_generic_link(
&self,
generic_link: storage::GenericLinkNew,
) -> CustomResult<storage::GenericLinkState, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/generic_link.rs | crate: router
use error_stack::report;
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::storage,
};
async fn find_payout_link_by_link_id(
&self,
link_id: &str,
) -> CustomResult<storage::PayoutLink, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/generic_link.rs | crate: router
use error_stack::report;
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::storage,
};
async fn find_pm_collect_link_by_link_id(
&self,
link_id: &str,
) -> CustomResult<storage::PaymentMethodCollectLink, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use futures::future::try_join_all;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn list_customers_by_merchant_id(
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
constraints: CustomerListConstraints,
) -> CustomResult<Vec<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_global_id(
&self,
state: &KeyManagerState,
id: &id_type::GlobalCustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use futures::future::try_join_all;
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn list_customers_by_merchant_id(
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
constraints: super::CustomerListConstraints,
) -> CustomResult<Vec<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_merchant_reference_id_merchant_id(
&self,
state: &KeyManagerState,
merchant_reference_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: id_type::CustomerId,
merchant_id: id_type::MerchantId,
_customer: customer::Customer,
customer_update: storage_types::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_global_id(
&self,
state: &KeyManagerState,
id: &id_type::GlobalCustomerId,
customer: customer::Customer,
_merchant_id: &id_type::MerchantId,
customer_update: storage_types::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_global_id(
&self,
state: &KeyManagerState,
id: &id_type::GlobalCustomerId,
_merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{
MerchantStorageScheme::PostgresOnly => database_call().await,<|fim_suffix|>
<|fim_middle|>
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::GlobalId {
id: id.get_string_repr(),
};
let field = format!("cust_{}", id.get_string_repr());
Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
kv_wrapper(
self,
KvOperation::<diesel_models::Customer>::HGet(&field),
key,
)
.await?
.try_into_hget()
},
database_call,
))
.await
}
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn insert_customer(
&self,
customer_data: customer::Customer,
state: &KeyManagerState,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use futures::future::try_join_all;
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn list_customers_by_merchant_id(
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
constraints: super::CustomerListConstraints,
) -> CustomResult<Vec<customer::Customer>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
let customer_list_constraints =
diesel_models::query::customers::CustomerListConstraints::from(constraints);
let encrypted_customers = storage_types::Customer::list_by_merchant_id(
&conn,
merchant_id,
customer_list_constraints,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))?;
let customers = try_join_all(encrypted_customers.into_iter().map(
|encrypted_customer| async {
encrypted_customer
.convert(
state,
key_store.key.get_inner(),
key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
},
))
.await?;
Ok(customers)
} | ast_fragments |
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
let database_call = || async {
storage_types::Customer::find_by_customer_id_merchant_id(
&conn,
customer_id,
merchant_id,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, diesel_models::Customer>(
self,
storage_scheme,
Op::Find,
))
.await;
let customer = match storage_scheme {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id,
customer_id,
};
let field = format!("cust_{}", customer_id.get_string_repr());
Box::pin(db_utils::try_redis_get_else_try_database_get(
async {
Box::pin(kv_wrapper(
self,
KvOperation::<diesel_models::Customer>::HGet(&field),
key,
))
.await?
.try_into_hget()
},
database_call,
))
.await
}
}?;
let result: customer::Customer = customer
.convert(
state,
key_store.key.get_inner(),
key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)?;
match result.name {
Some(ref name) if name.peek() == REDACTED => {
Err(errors::StorageError::CustomerRedacted)?
}
_ => Ok(result),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_merchant_reference_id_merchant_id(
&self,
state: &KeyManagerState,
merchant_reference_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{
Some(ref name) if name.peek() == REDACTED => {
Err(errors::StorageError::CustomerRedacted)?
}<|fim_suffix|>
<|fim_middle|>
_ => Ok(result),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_optional_by_merchant_id_merchant_reference_id(
&self,
state: &KeyManagerState,
merchant_reference_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_optional_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
let database_call = || async {
storage_types::Customer::find_optional_by_customer_id_merchant_id(
&conn,
customer_id,
merchant_id,
)
.await
.map_err(|err| report!(errors::StorageError::from(err)))
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, diesel_models::Customer>(
self,
storage_scheme,
Op::Find,
))
.await;
let maybe_customer = match storage_scheme {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdCustomerId {
merchant_id,
customer_id,
};
let field = format!("cust_{}", customer_id.get_string_repr());
Box::pin(db_utils::try_redis_get_else_try_database_get(
// check for ValueNotFound
async {
Box::pin(kv_wrapper(
self,
KvOperation::<diesel_models::Customer>::HGet(&field),
key,
))
.await?
.try_into_hget()
.map(Some)
},
database_call,
))
.await
}
}?;
let maybe_result = maybe_customer
.async_map(|c| async {
c.convert(
state,
key_store.key.get_inner(),
key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
})
.await
.transpose()?;
maybe_result.map_or(Ok(None), |customer: domain::Customer| match customer.name {
Some(ref name) if name.peek() == REDACTED => {
Err(errors::StorageError::CustomerRedacted)?
}
_ => Ok(Some(customer)),
})
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_optional_by_merchant_id_merchant_reference_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn insert_customer(
&self,
customer_data: customer::Customer,
state: &KeyManagerState,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{
Ok(redis_interface::HsetnxReply::KeyNotSet) => {
Err(report!(errors::StorageError::DuplicateValue {
entity: "customer",
key: Some(customer_id.get_string_repr().to_string()),
}))
}<|fim_suffix|>
<|fim_middle|>
Err(er) => Err(er).change_context(errors::StorageError::KVError),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_global_id(
&self,
_state: &KeyManagerState,
_id: &id_type::GlobalCustomerId,
_merchant_id: &id_type::MerchantId,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_global_id(
&self,
_state: &KeyManagerState,
_id: &id_type::GlobalCustomerId,
_customer: customer::Customer,
_merchant_id: &id_type::MerchantId,
_customer_update: storage_types::CustomerUpdate,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn delete_customer_by_customer_id_merchant_id(
&self,
_customer_id: &id_type::CustomerId,
_merchant_id: &id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn insert_customer(
&self,
customer_data: customer::Customer,
state: &KeyManagerState,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_merchant_reference_id_merchant_id(
&self,
_state: &KeyManagerState,
_merchant_reference_id: &id_type::CustomerId,
_merchant_id: &id_type::MerchantId,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_customer_by_customer_id_merchant_id(
&self,
_state: &KeyManagerState,
_customer_id: &id_type::CustomerId,
_merchant_id: &id_type::MerchantId,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use super::MockDb;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_customer_id_merchant_id(
&self,
_state: &KeyManagerState,
_customer_id: id_type::CustomerId,
_merchant_id: id_type::MerchantId,
_customer: customer::Customer,
_customer_update: storage_types::CustomerUpdate,
_key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn find_optional_by_merchant_id_merchant_reference_id(
&self,
state: &KeyManagerState,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<customer::Customer>, errors::StorageError> {
todo!()
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_global_id(
&self,
state: &KeyManagerState,
id: &id_type::GlobalCustomerId,
customer: customer::Customer,
merchant_id: &id_type::MerchantId,
customer_update: storage_types::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
fn from(value: CustomerListConstraints) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/customers.rs | crate: router
use common_utils::{ext_traits::AsyncExt, id_type, types::keymanager::KeyManagerState};
use diesel_models::query::customers::CustomerListConstraints as DieselCustomerListConstraints;
use hyperswitch_domain_models::customer;
use crate::{
core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
async fn update_customer_by_customer_id_merchant_id(
&self,
state: &KeyManagerState,
customer_id: id_type::CustomerId,
merchant_id: id_type::MerchantId,
customer: customer::Customer,
customer_update: storage_types::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<customer::Customer, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn insert_merchant_key_store(
&self,
state: &KeyManagerState,
merchant_key_store: domain::MerchantKeyStore,
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::MerchantKeyStore, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use error_stack::{report, ResultExt};
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn list_multiple_key_stores(
&self,
state: &KeyManagerState,
merchant_ids: Vec<common_utils::id_type::MerchantId>,
key: &Secret<Vec<u8>>,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn test_mock_db_merchant_key_store_interface() {
{let conf = Settings::new().expect("invalid settings");<|fim_suffix|>
<|fim_middle|>
assert!(find_merchant_key_with_incorrect_master_key_result.is_err());}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn get_all_key_stores(
&self,
state: &KeyManagerState,
key: &Secret<Vec<u8>>,
_from: u32,
_to: u32,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn list_multiple_key_stores(
&self,
state: &KeyManagerState,
merchant_ids: Vec<common_utils::id_type::MerchantId>,
key: &Secret<Vec<u8>>,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
let merchant_key_stores = self.merchant_key_store.lock().await;
futures::future::try_join_all(
merchant_key_stores
.iter()
.filter(|merchant_key| merchant_ids.contains(&merchant_key.merchant_id))
.map(|merchant_key| async {
merchant_key
.to_owned()
.convert(state, key, merchant_key.merchant_id.clone().into())
.await
.change_context(errors::StorageError::DecryptionError)
}),
)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn delete_merchant_key_store_by_merchant_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn get_merchant_key_store_by_merchant_id(
&self,
state: &KeyManagerState,
merchant_id: &common_utils::id_type::MerchantId,
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::MerchantKeyStore, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use error_stack::{report, ResultExt};
use masking::Secret;
use storage_impl::redis::cache::{self, CacheKind, ACCOUNTS_CACHE};
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn get_all_key_stores(
&self,
state: &KeyManagerState,
key: &Secret<Vec<u8>>,
from: u32,
to: u32,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/merchant_key_store.rs | crate: router
use common_utils::types::keymanager::KeyManagerState;
use crate::{
connection,
core::errors::{self, CustomResult},
db::MockDb,
services::Store,
types::domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
};
async fn test_mock_db_merchant_key_store_interface() {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
payment_id: &id_type::PaymentId,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<storage::PaymentAttempt>, errors::StorageError> {
self.diesel_store
.find_attempts_by_merchant_id_payment_id(merchant_id, payment_id, storage_scheme)
.await
}
}
#[async_trait::async_trait]
impl PaymentIntentInterface for KafkaStore {
type Error = errors::StorageError;
async fn update_payment_intent(
&self,
state: &KeyManagerState,
this: storage::PaymentIntent,
payment_intent: storage::PaymentIntentUpdate,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
let intent = self
.diesel_store
.update_payment_intent(
state,
this.clone(),
async fn update_payment_intent(
&self,
state: &KeyManagerState,
this: storage::PaymentIntent,
payment_intent: storage::PaymentIntentUpdate,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
payment_method,
payment_method_type,
authentication_type,
merchant_connector_id,
card_network,
card_discovery,
storage_scheme,
)
.await
}
#[cfg(feature = "v2")]
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<api_models::enums::Connector>,
payment_method_type: Option<common_enums::PaymentMethod>,
payment_method_subtype: Option<common_enums::PaymentMethodType>,
authentication_type: Option<common_enums::AuthenticationType>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
card_network: Option<common_enums::CardNetwork>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.diesel_store
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<api_models::enums::Connector>,
payment_method_type: Option<common_enums::PaymentMethod>,
payment_method_subtype: Option<common_enums::PaymentMethodType>,
authentication_type: Option<common_enums::AuthenticationType>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
card_network: Option<common_enums::CardNetwork>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
errors::StorageError,
> {
self.diesel_store
.get_filters_for_payments(pi, merchant_id, storage_scheme)
.await
}
#[cfg(feature = "v1")]
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
card_discovery: Option<Vec<common_enums::CardDiscovery>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
card_discovery: Option<Vec<common_enums::CardDiscovery>>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
if let Err(er) = self
.kafka_producer
.log_payment_attempt(&attempt, Some(this), self.tenant_id.clone())
.await
{
logger::error!(message="Failed to log analytics event for payment attempt {attempt:?}", error_message=?er)
}
Ok(attempt)
}
#[cfg(feature = "v2")]
async fn update_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
this: storage::PaymentAttempt,
payment_attempt: storage::PaymentAttemptUpdate,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let attempt = self
.diesel_store
.update_payment_attempt(
key_manager_state,
merchant_key_store,
async fn update_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
this: storage::PaymentAttempt,
payment_attempt: storage::PaymentAttemptUpdate,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
if let Err(er) = self
.kafka_producer
.log_payment_attempt(&attempt, None, self.tenant_id.clone())
.await
{
logger::error!(message="Failed to log analytics event for payment attempt {attempt:?}", error_message=?er)
}
Ok(attempt)
}
#[cfg(feature = "v2")]
async fn insert_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
payment_attempt: storage::PaymentAttempt,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let attempt = self
.diesel_store
.insert_payment_attempt(
key_manager_state,
merchant_key_store,
payment_attempt,
async fn insert_payment_attempt(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
payment_attempt: storage::PaymentAttempt,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
merchant_id: &id_type::MerchantId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id(merchant_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &id_type::MerchantId,
transaction_type: &enums::TransactionType,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id_transaction_type(
merchant_id,
transaction_type,
limit,
offset,
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &id_type::MerchantId,
transaction_type: &enums::TransactionType,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &id_type::RoutingId,
profile_id: &id_type::ProfileId,
) -> CustomResult<storage::RoutingProfileMetadata, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_metadata_by_algorithm_id_profile_id(algorithm_id, profile_id)
.await
}
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_profile_id(profile_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
)
.await
}
}
#[async_trait::async_trait]
#[cfg(feature = "v1")]
impl db::payment_method_session::PaymentMethodsSessionInterface for KafkaStore {}
#[async_trait::async_trait]
impl CallbackMapperInterface for KafkaStore {
#[instrument(skip_all)]
async fn insert_call_back_mapper(
&self,
call_back_mapper: domain::CallbackMapper,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
self.diesel_store
.insert_call_back_mapper(call_back_mapper)
.await
}
#[instrument(skip_all)]
async fn find_call_back_mapper_by_id(
&self,
id: &str,
async fn insert_call_back_mapper(
&self,
call_back_mapper: domain::CallbackMapper,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
id: &id_type::GlobalPaymentMethodSessionId,
) -> CustomResult<
hyperswitch_domain_models::payment_methods::PaymentMethodSession,
errors::StorageError,
> {
self.diesel_store
.get_payment_methods_session(state, key_store, id)
.await
}
async fn update_payment_method_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
id: &id_type::GlobalPaymentMethodSessionId,
payment_methods_session: hyperswitch_domain_models::payment_methods::PaymentMethodsSessionUpdateEnum,
current_session: hyperswitch_domain_models::payment_methods::PaymentMethodSession,
) -> CustomResult<
hyperswitch_domain_models::payment_methods::PaymentMethodSession,
errors::StorageError,
> {
self.diesel_store
.update_payment_method_session(
async fn update_payment_method_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
id: &id_type::GlobalPaymentMethodSessionId,
payment_methods_session: hyperswitch_domain_models::payment_methods::PaymentMethodsSessionUpdateEnum,
current_session: hyperswitch_domain_models::payment_methods::PaymentMethodSession,
) -> CustomResult<
hyperswitch_domain_models::payment_methods::PaymentMethodSession,
errors::StorageError,
> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
async fn insert_payment_methods_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
payment_methods_session: hyperswitch_domain_models::payment_methods::PaymentMethodSession,
validity: i64,
) -> CustomResult<(), errors::StorageError> {
self.diesel_store
.insert_payment_methods_session(state, key_store, payment_methods_session, validity)
.await
}
async fn get_payment_methods_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
id: &id_type::GlobalPaymentMethodSessionId,
) -> CustomResult<
hyperswitch_domain_models::payment_methods::PaymentMethodSession,
errors::StorageError,
> {
self.diesel_store
.get_payment_methods_session(state, key_store, id)
.await
}
async fn get_payment_methods_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
id: &id_type::GlobalPaymentMethodSessionId,
) -> CustomResult<
hyperswitch_domain_models::payment_methods::PaymentMethodSession,
errors::StorageError,
> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
theme_id: String,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store
.delete_theme_by_lineage_and_theme_id(theme_id, lineage)
.await
}
}
#[async_trait::async_trait]
#[cfg(feature = "v2")]
impl db::payment_method_session::PaymentMethodsSessionInterface for KafkaStore {
async fn insert_payment_methods_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
payment_methods_session: hyperswitch_domain_models::payment_methods::PaymentMethodSession,
validity: i64,
) -> CustomResult<(), errors::StorageError> {
self.diesel_store
.insert_payment_methods_session(state, key_store, payment_methods_session, validity)
.await
}
async fn get_payment_methods_session(
async fn insert_payment_methods_session(
&self,
state: &KeyManagerState,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
payment_methods_session: hyperswitch_domain_models::payment_methods::PaymentMethodSession,
validity: i64,
) -> CustomResult<(), errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store
.find_most_specific_theme_in_lineage(lineage)
.await
}
async fn find_theme_by_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.find_theme_by_lineage(lineage).await
}
async fn delete_theme_by_lineage_and_theme_id(
&self,
theme_id: String,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store
.delete_theme_by_lineage_and_theme_id(theme_id, lineage)
.await
}
}
#[async_trait::async_trait]
#[cfg(feature = "v2")]
async fn delete_theme_by_lineage_and_theme_id(
&self,
theme_id: String,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store.find_theme_by_theme_id(theme_id).await
}
async fn find_most_specific_theme_in_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<diesel_models::user::theme::Theme, errors::StorageError> {
self.diesel_store
.find_most_specific_theme_in_lineage(lineage)
.await
}
async fn find_theme_by_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.find_theme_by_lineage(lineage).await
}
async fn delete_theme_by_lineage_and_theme_id(
&self,
theme_id: String,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store
async fn find_theme_by_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
theme: storage::theme::ThemeNew,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.insert_theme(theme).await
}
async fn find_theme_by_theme_id(
&self,
theme_id: String,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.find_theme_by_theme_id(theme_id).await
}
async fn find_most_specific_theme_in_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<diesel_models::user::theme::Theme, errors::StorageError> {
self.diesel_store
.find_most_specific_theme_in_lineage(lineage)
.await
}
async fn find_theme_by_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
async fn find_most_specific_theme_in_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<diesel_models::user::theme::Theme, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
}
#[async_trait::async_trait]
impl ThemeInterface for KafkaStore {
async fn insert_theme(
&self,
theme: storage::theme::ThemeNew,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.insert_theme(theme).await
}
async fn find_theme_by_theme_id(
&self,
theme_id: String,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.find_theme_by_theme_id(theme_id).await
}
async fn find_most_specific_theme_in_lineage(
&self,
lineage: ThemeLineage,
) -> CustomResult<diesel_models::user::theme::Theme, errors::StorageError> {
self.diesel_store
.find_most_specific_theme_in_lineage(lineage)
async fn find_theme_by_theme_id(
&self,
theme_id: String,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
) -> CustomResult<
Vec<diesel_models::user_authentication_method::UserAuthenticationMethod>,
errors::StorageError,
> {
self.diesel_store
.list_user_authentication_methods_for_email_domain(email_domain)
.await
}
}
#[async_trait::async_trait]
impl ThemeInterface for KafkaStore {
async fn insert_theme(
&self,
theme: storage::theme::ThemeNew,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.insert_theme(theme).await
}
async fn find_theme_by_theme_id(
&self,
theme_id: String,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
self.diesel_store.find_theme_by_theme_id(theme_id).await
}
async fn insert_theme(
&self,
theme: storage::theme::ThemeNew,
) -> CustomResult<storage::theme::Theme, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn update_user_authentication_method(
&self,
id: &str,
user_authentication_method_update: storage::UserAuthenticationMethodUpdate,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
self.diesel_store
.update_user_authentication_method(id, user_authentication_method_update)
.await
}
async fn list_user_authentication_methods_for_email_domain(
&self,
email_domain: &str,
) -> CustomResult<
Vec<diesel_models::user_authentication_method::UserAuthenticationMethod>,
errors::StorageError,
> {
self.diesel_store
.list_user_authentication_methods_for_email_domain(email_domain)
.await
}
}
async fn list_user_authentication_methods_for_email_domain(
&self,
email_domain: &str,
) -> CustomResult<
Vec<diesel_models::user_authentication_method::UserAuthenticationMethod>,
errors::StorageError,
> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await
}
async fn list_user_authentication_methods_for_owner_id(
&self,
owner_id: &str,
) -> CustomResult<Vec<storage::UserAuthenticationMethod>, errors::StorageError> {
self.diesel_store
.list_user_authentication_methods_for_owner_id(owner_id)
.await
}
async fn update_user_authentication_method(
&self,
id: &str,
user_authentication_method_update: storage::UserAuthenticationMethodUpdate,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
self.diesel_store
.update_user_authentication_method(id, user_authentication_method_update)
.await
}
async fn list_user_authentication_methods_for_email_domain(
&self,
email_domain: &str,
async fn update_user_authentication_method(
&self,
id: &str,
user_authentication_method_update: storage::UserAuthenticationMethodUpdate,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
key: &Secret<Vec<u8>>,
from: u32,
limit: u32,
) -> CustomResult<Vec<domain::UserKeyStore>, errors::StorageError> {
self.diesel_store
.get_all_user_key_store(state, key, from, limit)
.await
}
}
#[async_trait::async_trait]
impl UserAuthenticationMethodInterface for KafkaStore {
async fn insert_user_authentication_method(
&self,
user_authentication_method: storage::UserAuthenticationMethodNew,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
self.diesel_store
.insert_user_authentication_method(user_authentication_method)
.await
}
async fn get_user_authentication_method_by_id(
&self,
id: &str,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
async fn insert_user_authentication_method(
&self,
user_authentication_method: storage::UserAuthenticationMethodNew,
) -> CustomResult<storage::UserAuthenticationMethod, errors::StorageError> {
self.diesel_store
.insert_user_authentication_method(user_authentication_method)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
&self,
payout_link: storage::PayoutLink,
payout_link_update: storage::PayoutLinkUpdate,
) -> CustomResult<storage::PayoutLink, errors::StorageError> {
self.diesel_store
.update_payout_link(payout_link, payout_link_update)
.await
}
}
#[async_trait::async_trait]
impl UserKeyStoreInterface for KafkaStore {
async fn insert_user_key_store(
&self,
state: &KeyManagerState,
user_key_store: domain::UserKeyStore,
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::UserKeyStore, errors::StorageError> {
self.diesel_store
.insert_user_key_store(state, user_key_store, key)
.await
}
async fn get_user_key_store_by_user_id(
&self,
async fn insert_user_key_store(
&self,
state: &KeyManagerState,
user_key_store: domain::UserKeyStore,
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::UserKeyStore, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
link_id: &str,
) -> CustomResult<storage::PayoutLink, errors::StorageError> {
self.diesel_store.find_payout_link_by_link_id(link_id).await
}
async fn insert_generic_link(
&self,
generic_link: storage::GenericLinkNew,
) -> CustomResult<storage::GenericLinkState, errors::StorageError> {
self.diesel_store.insert_generic_link(generic_link).await
}
async fn insert_pm_collect_link(
&self,
pm_collect_link: storage::GenericLinkNew,
) -> CustomResult<storage::PaymentMethodCollectLink, errors::StorageError> {
self.diesel_store
.insert_pm_collect_link(pm_collect_link)
.await
}
async fn insert_payout_link(
&self,
pm_collect_link: storage::GenericLinkNew,
) -> CustomResult<storage::PayoutLink, errors::StorageError> {
async fn insert_pm_collect_link(
&self,
pm_collect_link: storage::GenericLinkNew,
) -> CustomResult<storage::PaymentMethodCollectLink, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
self.diesel_store
.generic_list_roles_by_entity_type(payload, is_lineage_data_required, tenant_id, org_id)
.await
}
}
#[async_trait::async_trait]
impl GenericLinkInterface for KafkaStore {
async fn find_generic_link_by_link_id(
&self,
link_id: &str,
) -> CustomResult<storage::GenericLinkState, errors::StorageError> {
self.diesel_store
.find_generic_link_by_link_id(link_id)
.await
}
async fn find_pm_collect_link_by_link_id(
&self,
link_id: &str,
) -> CustomResult<storage::PaymentMethodCollectLink, errors::StorageError> {
async fn find_generic_link_by_link_id(
&self,
link_id: &str,
) -> CustomResult<storage::GenericLinkState, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
&self,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: Option<&id_type::MerchantId>,
entity_type: Option<enums::EntityType>,
limit: Option<u32>,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
self.diesel_store
.list_roles_for_org_by_parameters(tenant_id, org_id, merchant_id, entity_type, limit)
.await
}
async fn generic_list_roles_by_entity_type(
&self,
payload: diesel_models::role::ListRolesByEntityPayload,
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
self.diesel_store
.generic_list_roles_by_entity_type(payload, is_lineage_data_required, tenant_id, org_id)
.await
}
}
async fn generic_list_roles_by_entity_type(
&self,
payload: diesel_models::role::ListRolesByEntityPayload,
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.update_role_by_role_id(role_id, role_update)
.await
}
async fn delete_role_by_role_id(
&self,
role_id: &str,
) -> CustomResult<storage::Role, errors::StorageError> {
self.diesel_store.delete_role_by_role_id(role_id).await
}
//TODO: Remove once generic_list_roles_by_entity_type is stable
async fn list_roles_for_org_by_parameters(
&self,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: Option<&id_type::MerchantId>,
entity_type: Option<enums::EntityType>,
limit: Option<u32>,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
self.diesel_store
.list_roles_for_org_by_parameters(tenant_id, org_id, merchant_id, entity_type, limit)
.await
}
async fn list_roles_for_org_by_parameters(
&self,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: Option<&id_type::MerchantId>,
entity_type: Option<enums::EntityType>,
limit: Option<u32>,
) -> CustomResult<Vec<storage::Role>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
}
#[async_trait::async_trait]
impl RoleInterface for KafkaStore {
async fn insert_role(
&self,
role: storage::RoleNew,
) -> CustomResult<storage::Role, errors::StorageError> {
self.diesel_store.insert_role(role).await
}
async fn find_role_by_role_id(
&self,
role_id: &str,
) -> CustomResult<storage::Role, errors::StorageError> {
self.diesel_store.find_role_by_role_id(role_id).await
}
async fn find_role_by_role_id_in_lineage(
&self,
role_id: &str,
merchant_id: &id_type::MerchantId,
org_id: &id_type::OrganizationId,
profile_id: &id_type::ProfileId,
async fn find_role_by_role_id(
&self,
role_id: &str,
) -> CustomResult<storage::Role, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_authentication_by_merchant_id_authentication_id(
&self,
merchant_id: &id_type::MerchantId,
authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
self.diesel_store
.find_authentication_by_merchant_id_authentication_id(merchant_id, authentication_id)
.await
}
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
merchant_id: id_type::MerchantId,
connector_authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
self.diesel_store
.find_authentication_by_merchant_id_connector_authentication_id(
merchant_id,
connector_authentication_id,
)
.await
}
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
merchant_id: id_type::MerchantId,
connector_authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
if let Err(er) = self
.kafka_producer
.log_authentication(&auth, None, self.tenant_id.clone())
.await
{
logger::error!(message="Failed to log analytics event for authentication {auth:?}", error_message=?er)
}
Ok(auth)
}
async fn find_authentication_by_merchant_id_authentication_id(
&self,
merchant_id: &id_type::MerchantId,
authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
self.diesel_store
.find_authentication_by_merchant_id_authentication_id(merchant_id, authentication_id)
.await
}
async fn find_authentication_by_merchant_id_connector_authentication_id(
&self,
merchant_id: id_type::MerchantId,
async fn find_authentication_by_merchant_id_authentication_id(
&self,
merchant_id: &id_type::MerchantId,
authentication_id: String,
) -> CustomResult<storage::Authentication, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store
.update_authorization_by_merchant_id_authorization_id(
merchant_id,
authorization_id,
authorization,
)
.await
}
}
#[async_trait::async_trait]
impl AuthenticationInterface for KafkaStore {
async fn insert_authentication(
&self,
authentication: storage::AuthenticationNew,
) -> CustomResult<storage::Authentication, errors::StorageError> {
let auth = self
.diesel_store
.insert_authentication(authentication)
.await?;
if let Err(er) = self
.kafka_producer
.log_authentication(&auth, None, self.tenant_id.clone())
.await
async fn insert_authentication(
&self,
authentication: storage::AuthenticationNew,
) -> CustomResult<storage::Authentication, errors::StorageError> {
let auth = self
.diesel_store
.insert_authentication(authentication)
.await?;
if let Err(er) = self
.kafka_producer
.log_authentication(&auth, None, self.tenant_id.clone())
.await
{
logger::error!(message="Failed to log analytics event for authentication {auth:?}", error_message=?er)
}
Ok(auth)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_all_authorizations_by_merchant_id_payment_id(
&self,
merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
) -> CustomResult<Vec<storage::Authorization>, errors::StorageError> {
self.diesel_store
.find_all_authorizations_by_merchant_id_payment_id(merchant_id, payment_id)
.await
}
async fn update_authorization_by_merchant_id_authorization_id(
&self,
merchant_id: id_type::MerchantId,
authorization_id: String,
authorization: storage::AuthorizationUpdate,
) -> CustomResult<storage::Authorization, errors::StorageError> {
self.diesel_store
.update_authorization_by_merchant_id_authorization_id(
merchant_id,
authorization_id,
authorization,
)
.await
async fn update_authorization_by_merchant_id_authorization_id(
&self,
merchant_id: id_type::MerchantId,
authorization_id: String,
authorization: storage::AuthorizationUpdate,
) -> CustomResult<storage::Authorization, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
}
#[async_trait::async_trait]
impl AuthorizationInterface for KafkaStore {
async fn insert_authorization(
&self,
authorization: storage::AuthorizationNew,
) -> CustomResult<storage::Authorization, errors::StorageError> {
self.diesel_store.insert_authorization(authorization).await
}
async fn find_all_authorizations_by_merchant_id_payment_id(
&self,
merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
) -> CustomResult<Vec<storage::Authorization>, errors::StorageError> {
self.diesel_store
.find_all_authorizations_by_merchant_id_payment_id(merchant_id, payment_id)
.await
}
async fn update_authorization_by_merchant_id_authorization_id(
&self,
merchant_id: id_type::MerchantId,
async fn find_all_authorizations_by_merchant_id_payment_id(
&self,
merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
) -> CustomResult<Vec<storage::Authorization>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
let _ = self
.kafka_producer
.log_dispute_delete(dispute, self.tenant_id.clone())
.await;
}
Ok(disputes_list)
}
}
#[async_trait::async_trait]
impl AuthorizationInterface for KafkaStore {
async fn insert_authorization(
&self,
authorization: storage::AuthorizationNew,
) -> CustomResult<storage::Authorization, errors::StorageError> {
self.diesel_store.insert_authorization(authorization).await
}
async fn find_all_authorizations_by_merchant_id_payment_id(
&self,
merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
) -> CustomResult<Vec<storage::Authorization>, errors::StorageError> {
self.diesel_store
async fn insert_authorization(
&self,
authorization: storage::AuthorizationNew,
) -> CustomResult<storage::Authorization, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
for refund in refunds_list.iter() {
let _ = self
.kafka_producer
.log_refund_delete(refund, self.tenant_id.clone())
.await;
}
Ok(refunds_list)
}
#[cfg(feature = "v1")]
async fn delete_disputes_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<Vec<diesel_models::Dispute>, storage_impl::errors::StorageError> {
let disputes_list = self
.diesel_store
.delete_disputes_for_sample_data(merchant_id)
.await?;
for dispute in disputes_list.iter() {
let _ = self
.kafka_producer
.log_dispute_delete(dispute, self.tenant_id.clone())
async fn delete_disputes_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<Vec<diesel_models::Dispute>, storage_impl::errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
for payment_attempt in payment_attempts_list.iter() {
let _ = self
.kafka_producer
.log_payment_attempt_delete(payment_attempt, self.tenant_id.clone())
.await;
}
Ok(payment_attempts_list)
}
#[cfg(feature = "v1")]
async fn delete_refunds_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<Vec<diesel_models::Refund>, storage_impl::errors::StorageError> {
let refunds_list = self
.diesel_store
.delete_refunds_for_sample_data(merchant_id)
.await?;
for refund in refunds_list.iter() {
let _ = self
.kafka_producer
.log_refund_delete(refund, self.tenant_id.clone())
async fn delete_refunds_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<Vec<diesel_models::Refund>, storage_impl::errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await?;
for payment_intent in payment_intents_list.iter() {
let _ = self
.kafka_producer
.log_payment_intent_delete(payment_intent, self.tenant_id.clone())
.await;
}
Ok(payment_intents_list)
}
#[cfg(feature = "v1")]
async fn delete_payment_attempts_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
storage_impl::errors::StorageError,
> {
let payment_attempts_list = self
.diesel_store
.delete_payment_attempts_for_sample_data(merchant_id)
.await?;
for payment_attempt in payment_attempts_list.iter() {
async fn delete_payment_attempts_for_sample_data(
&self,
merchant_id: &id_type::MerchantId,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
storage_impl::errors::StorageError,
> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await?;
for dispute in disputes_list.iter() {
let _ = self
.kafka_producer
.log_dispute(dispute, None, self.tenant_id.clone())
.await;
}
Ok(disputes_list)
}
#[cfg(feature = "v1")]
async fn delete_payment_intents_for_sample_data(
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::PaymentIntent>,
storage_impl::errors::StorageError,
> {
let payment_intents_list = self
.diesel_store
.delete_payment_intents_for_sample_data(state, merchant_id, key_store)
.await?;
async fn delete_payment_intents_for_sample_data(
&self,
state: &KeyManagerState,
merchant_id: &id_type::MerchantId,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::PaymentIntent>,
storage_impl::errors::StorageError,
> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await?;
for refund in refunds_list.iter() {
let _ = self
.kafka_producer
.log_refund(refund, None, self.tenant_id.clone())
.await;
}
Ok(refunds_list)
}
#[cfg(feature = "v1")]
async fn insert_disputes_batch_for_sample_data(
&self,
batch: Vec<diesel_models::DisputeNew>,
) -> CustomResult<Vec<diesel_models::Dispute>, storage_impl::errors::StorageError> {
let disputes_list = self
.diesel_store
.insert_disputes_batch_for_sample_data(batch)
.await?;
for dispute in disputes_list.iter() {
let _ = self
.kafka_producer
.log_dispute(dispute, None, self.tenant_id.clone())
async fn insert_disputes_batch_for_sample_data(
&self,
batch: Vec<diesel_models::DisputeNew>,
) -> CustomResult<Vec<diesel_models::Dispute>, storage_impl::errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await?;
for payment_attempt in payment_attempts_list.iter() {
let _ = self
.kafka_producer
.log_payment_attempt(payment_attempt, None, self.tenant_id.clone())
.await;
}
Ok(payment_attempts_list)
}
#[cfg(feature = "v1")]
async fn insert_refunds_batch_for_sample_data(
&self,
batch: Vec<diesel_models::RefundNew>,
) -> CustomResult<Vec<diesel_models::Refund>, storage_impl::errors::StorageError> {
let refunds_list = self
.diesel_store
.insert_refunds_batch_for_sample_data(batch)
.await?;
for refund in refunds_list.iter() {
let _ = self
.kafka_producer
.log_refund(refund, None, self.tenant_id.clone())
async fn insert_refunds_batch_for_sample_data(
&self,
batch: Vec<diesel_models::RefundNew>,
) -> CustomResult<Vec<diesel_models::Refund>, storage_impl::errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.await?;
for payment_intent in payment_intents_list.iter() {
let _ = self
.kafka_producer
.log_payment_intent(payment_intent, None, self.tenant_id.clone())
.await;
}
Ok(payment_intents_list)
}
#[cfg(feature = "v1")]
async fn insert_payment_attempts_batch_for_sample_data(
&self,
batch: Vec<diesel_models::user::sample_data::PaymentAttemptBatchNew>,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
storage_impl::errors::StorageError,
> {
let payment_attempts_list = self
.diesel_store
.insert_payment_attempts_batch_for_sample_data(batch)
.await?;
for payment_attempt in payment_attempts_list.iter() {
async fn insert_payment_attempts_batch_for_sample_data(
&self,
batch: Vec<diesel_models::user::sample_data::PaymentAttemptBatchNew>,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt>,
storage_impl::errors::StorageError,
> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.delete_user_scoped_dashboard_metadata_by_merchant_id_data_key(
user_id,
merchant_id,
data_key,
)
.await
}
}
#[async_trait::async_trait]
impl BatchSampleDataInterface for KafkaStore {
#[cfg(feature = "v1")]
async fn insert_payment_intents_batch_for_sample_data(
&self,
state: &KeyManagerState,
batch: Vec<hyperswitch_domain_models::payments::PaymentIntent>,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::PaymentIntent>,
storage_impl::errors::StorageError,
> {
let payment_intents_list = self
.diesel_store
.insert_payment_intents_batch_for_sample_data(state, batch, key_store)
.await?;
async fn insert_payment_intents_batch_for_sample_data(
&self,
state: &KeyManagerState,
batch: Vec<hyperswitch_domain_models::payments::PaymentIntent>,
key_store: &hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
) -> CustomResult<
Vec<hyperswitch_domain_models::payments::PaymentIntent>,
storage_impl::errors::StorageError,
> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn list_user_roles_by_org_id<'a>(
&self,
payload: ListUserRolesByOrgIdPayload<'a>,
) -> CustomResult<Vec<user_storage::UserRole>, errors::StorageError> {
self.diesel_store.list_user_roles_by_org_id(payload).await
}
}
#[async_trait::async_trait]
impl DashboardMetadataInterface for KafkaStore {
async fn insert_metadata(
&self,
metadata: storage::DashboardMetadataNew,
) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
self.diesel_store.insert_metadata(metadata).await
}
async fn update_metadata(
&self,
user_id: Option<String>,
merchant_id: id_type::MerchantId,
org_id: id_type::OrganizationId,
data_key: enums::DashboardMetadata,
async fn insert_metadata(
&self,
metadata: storage::DashboardMetadataNew,
) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
self.diesel_store.insert_metadata(metadata).await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn list_user_roles_by_user_id_across_tenants(
&self,
user_id: &str,
limit: Option<u32>,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
self.diesel_store
.list_user_roles_by_user_id_across_tenants(user_id, limit)
.await
}
async fn list_user_roles_by_org_id<'a>(
&self,
payload: ListUserRolesByOrgIdPayload<'a>,
) -> CustomResult<Vec<user_storage::UserRole>, errors::StorageError> {
self.diesel_store.list_user_roles_by_org_id(payload).await
}
}
#[async_trait::async_trait]
impl DashboardMetadataInterface for KafkaStore {
async fn insert_metadata(
&self,
metadata: storage::DashboardMetadataNew,
async fn list_user_roles_by_org_id<'a>(
&self,
payload: ListUserRolesByOrgIdPayload<'a>,
) -> CustomResult<Vec<user_storage::UserRole>, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store
.find_user_role_by_user_id_and_lineage(
user_id,
tenant_id,
org_id,
merchant_id,
profile_id,
version,
)
.await
}
async fn update_user_role_by_user_id_and_lineage(
&self,
user_id: &str,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: Option<&id_type::MerchantId>,
profile_id: Option<&id_type::ProfileId>,
update: user_storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
.update_user_role_by_user_id_and_lineage(
user_id,
async fn update_user_role_by_user_id_and_lineage(
&self,
user_id: &str,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: Option<&id_type::MerchantId>,
profile_id: Option<&id_type::ProfileId>,
update: user_storage::UserRoleUpdate,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
}
#[async_trait::async_trait]
impl UserRoleInterface for KafkaStore {
async fn insert_user_role(
&self,
user_role: storage::UserRoleNew,
) -> CustomResult<user_storage::UserRole, errors::StorageError> {
self.diesel_store.insert_user_role(user_role).await
}
async fn find_user_role_by_user_id_and_lineage(
&self,
user_id: &str,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
profile_id: &id_type::ProfileId,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
.find_user_role_by_user_id_and_lineage(
user_id,
tenant_id,
async fn find_user_role_by_user_id_and_lineage(
&self,
user_id: &str,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
profile_id: &id_type::ProfileId,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store.find_users_by_user_ids(user_ids).await
}
}
impl RedisConnInterface for KafkaStore {
fn get_redis_conn(&self) -> CustomResult<Arc<RedisConnectionPool>, RedisError> {
self.diesel_store.get_redis_conn()
}
}
#[async_trait::async_trait]
impl UserRoleInterface for KafkaStore {
async fn insert_user_role(
&self,
user_role: storage::UserRoleNew,
) -> CustomResult<user_storage::UserRole, errors::StorageError> {
self.diesel_store.insert_user_role(user_role).await
}
async fn find_user_role_by_user_id_and_lineage(
&self,
user_id: &str,
tenant_id: &id_type::TenantId,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
async fn insert_user_role(
&self,
user_role: storage::UserRoleNew,
) -> CustomResult<user_storage::UserRole, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
self.diesel_store.delete_user_by_user_id(user_id).await
}
async fn find_users_by_user_ids(
&self,
user_ids: Vec<String>,
) -> CustomResult<Vec<storage::User>, errors::StorageError> {
self.diesel_store.find_users_by_user_ids(user_ids).await
}
}
impl RedisConnInterface for KafkaStore {
fn get_redis_conn(&self) -> CustomResult<Arc<RedisConnectionPool>, RedisError> {
self.diesel_store.get_redis_conn()
}
}
#[async_trait::async_trait]
impl UserRoleInterface for KafkaStore {
async fn insert_user_role(
&self,
user_role: storage::UserRoleNew,
) -> CustomResult<user_storage::UserRole, errors::StorageError> {
self.diesel_store.insert_user_role(user_role).await
}
fn get_redis_conn(&self) -> CustomResult<Arc<RedisConnectionPool>, RedisError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn update_user_by_user_id(
&self,
user_id: &str,
user: storage::UserUpdate,
) -> CustomResult<storage::User, errors::StorageError> {
self.diesel_store
.update_user_by_user_id(user_id, user)
.await
}
async fn update_user_by_email(
&self,
user_email: &domain::UserEmail,
user: storage::UserUpdate,
) -> CustomResult<storage::User, errors::StorageError> {
self.diesel_store
.update_user_by_email(user_email, user)
.await
}
async fn delete_user_by_user_id(
&self,
user_id: &str,
async fn update_user_by_email(
&self,
user_email: &domain::UserEmail,
user: storage::UserUpdate,
) -> CustomResult<storage::User, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
use crate::{
core::errors::{self, ProcessTrackerError},
db::{
self,
address::AddressInterface,
api_keys::ApiKeyInterface,
authentication::AuthenticationInterface,
authorization::AuthorizationInterface,
business_profile::ProfileInterface,
callback_mapper::CallbackMapperInterface,
capture::CaptureInterface,
cards_info::CardsInfoInterface,
configs::ConfigInterface,
customers::CustomerInterface,
dispute::DisputeInterface,
ephemeral_key::EphemeralKeyInterface,
events::EventInterface,
file::FileMetadataInterface,
generic_link::GenericLinkInterface,
gsm::GsmInterface,
health_check::HealthCheckDbInterface,
locker_mock_up::LockerMockUpInterface,
mandate::MandateInterface,
merchant_account::MerchantAccountInterface,
merchant_connector_account::{ConnectorAccessToken, MerchantConnectorAccountInterface},
merchant_key_store::MerchantKeyStoreInterface,
payment_link::PaymentLinkInterface,
refund::RefundInterface,
reverse_lookup::ReverseLookupInterface,
routing_algorithm::RoutingAlgorithmInterface,
unified_translations::UnifiedTranslationsInterface,
AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface,
MasterKeyInterface, StorageInterface,
},
services::{kafka::KafkaProducer, Store},
types::{domain, storage, AccessToken},
};
fn get_master_key(&self) -> &[u8] {
self.diesel_store.get_master_key()
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
use crate::{
core::errors::{self, ProcessTrackerError},
db::{
self,
address::AddressInterface,
api_keys::ApiKeyInterface,
authentication::AuthenticationInterface,
authorization::AuthorizationInterface,
business_profile::ProfileInterface,
callback_mapper::CallbackMapperInterface,
capture::CaptureInterface,
cards_info::CardsInfoInterface,
configs::ConfigInterface,
customers::CustomerInterface,
dispute::DisputeInterface,
ephemeral_key::EphemeralKeyInterface,
events::EventInterface,
file::FileMetadataInterface,
generic_link::GenericLinkInterface,
gsm::GsmInterface,
health_check::HealthCheckDbInterface,
locker_mock_up::LockerMockUpInterface,
mandate::MandateInterface,
merchant_account::MerchantAccountInterface,
merchant_connector_account::{ConnectorAccessToken, MerchantConnectorAccountInterface},
merchant_key_store::MerchantKeyStoreInterface,
payment_link::PaymentLinkInterface,
refund::RefundInterface,
reverse_lookup::ReverseLookupInterface,
routing_algorithm::RoutingAlgorithmInterface,
unified_translations::UnifiedTranslationsInterface,
AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface,
MasterKeyInterface, StorageInterface,
},
services::{kafka::KafkaProducer, Store},
types::{domain, storage, AccessToken},
};
fn get_global_storage_interface(&self) -> Box<dyn GlobalStorageInterface> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
use crate::{
core::errors::{self, ProcessTrackerError},
db::{
self,
address::AddressInterface,
api_keys::ApiKeyInterface,
authentication::AuthenticationInterface,
authorization::AuthorizationInterface,
business_profile::ProfileInterface,
callback_mapper::CallbackMapperInterface,
capture::CaptureInterface,
cards_info::CardsInfoInterface,
configs::ConfigInterface,
customers::CustomerInterface,
dispute::DisputeInterface,
ephemeral_key::EphemeralKeyInterface,
events::EventInterface,
file::FileMetadataInterface,
generic_link::GenericLinkInterface,
gsm::GsmInterface,
health_check::HealthCheckDbInterface,
locker_mock_up::LockerMockUpInterface,
mandate::MandateInterface,
merchant_account::MerchantAccountInterface,
merchant_connector_account::{ConnectorAccessToken, MerchantConnectorAccountInterface},
merchant_key_store::MerchantKeyStoreInterface,
payment_link::PaymentLinkInterface,
refund::RefundInterface,
reverse_lookup::ReverseLookupInterface,
routing_algorithm::RoutingAlgorithmInterface,
unified_translations::UnifiedTranslationsInterface,
AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface,
MasterKeyInterface, StorageInterface,
},
services::{kafka::KafkaProducer, Store},
types::{domain, storage, AccessToken},
};
fn get_storage_interface(&self) -> Box<dyn StorageInterface> {
Box::new(self.clone())
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
unified_code: String,
unified_message: String,
locale: String,
) -> CustomResult<bool, errors::StorageError> {
self.diesel_store
.delete_translation(unified_code, unified_message, locale)
.await
}
}
#[async_trait::async_trait]
impl StorageInterface for KafkaStore {
fn get_scheduler_db(&self) -> Box<dyn SchedulerInterface> {
Box::new(self.clone())
}
fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
Box::new(self.clone())
}
}
impl GlobalStorageInterface for KafkaStore {}
impl AccountsStorageInterface for KafkaStore {}
impl PaymentMethodsStorageInterface for KafkaStore {}
fn get_scheduler_db(&self) -> Box<dyn SchedulerInterface> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
&self,
connector: String,
flow: String,
sub_flow: String,
code: String,
message: String,
) -> CustomResult<String, errors::StorageError> {
self.diesel_store
.find_gsm_decision(connector, flow, sub_flow, code, message)
.await
}
async fn find_gsm_rule(
&self,
connector: String,
flow: String,
sub_flow: String,
code: String,
message: String,
) -> CustomResult<storage::GatewayStatusMap, errors::StorageError> {
self.diesel_store
.find_gsm_rule(connector, flow, sub_flow, code, message)
.await
}
async fn find_gsm_rule(
&self,
connector: String,
flow: String,
sub_flow: String,
code: String,
message: String,
) -> CustomResult<storage::GatewayStatusMap, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
.list_routing_algorithm_metadata_by_merchant_id_transaction_type(
merchant_id,
transaction_type,
limit,
offset,
)
.await
}
}
#[async_trait::async_trait]
impl GsmInterface for KafkaStore {
async fn add_gsm_rule(
&self,
rule: storage::GatewayStatusMappingNew,
) -> CustomResult<storage::GatewayStatusMap, errors::StorageError> {
self.diesel_store.add_gsm_rule(rule).await
}
async fn find_gsm_decision(
&self,
connector: String,
flow: String,
sub_flow: String,
code: String,
async fn add_gsm_rule(
&self,
rule: storage::GatewayStatusMappingNew,
) -> CustomResult<storage::GatewayStatusMap, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
merchant_id: &id_type::MerchantId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id(merchant_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &id_type::MerchantId,
transaction_type: &enums::TransactionType,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id_transaction_type(
merchant_id,
transaction_type,
limit,
offset,
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
merchant_id: &id_type::MerchantId,
transaction_type: &enums::TransactionType,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id_transaction_type(
merchant_id,
transaction_type,
limit,
offset,
)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_profile_id(profile_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
merchant_id: &id_type::MerchantId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_merchant_id(merchant_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id_transaction_type(
&self,
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
merchant_id: &id_type::MerchantId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &id_type::RoutingId,
profile_id: &id_type::ProfileId,
) -> CustomResult<storage::RoutingProfileMetadata, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_metadata_by_algorithm_id_profile_id(algorithm_id, profile_id)
.await
}
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_profile_id(profile_id, limit, offset)
.await
}
async fn list_routing_algorithm_metadata_by_merchant_id(
&self,
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
limit: i64,
offset: i64,
) -> CustomResult<Vec<storage::RoutingProfileMetadata>, errors::StorageError> {
self.diesel_store
.list_routing_algorithm_metadata_by_profile_id(profile_id, limit, offset)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_routing_algorithm_by_algorithm_id_merchant_id(
&self,
algorithm_id: &id_type::RoutingId,
merchant_id: &id_type::MerchantId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_by_algorithm_id_merchant_id(algorithm_id, merchant_id)
.await
}
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &id_type::RoutingId,
profile_id: &id_type::ProfileId,
) -> CustomResult<storage::RoutingProfileMetadata, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_metadata_by_algorithm_id_profile_id(algorithm_id, profile_id)
.await
}
async fn list_routing_algorithm_metadata_by_profile_id(
&self,
profile_id: &id_type::ProfileId,
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &id_type::RoutingId,
profile_id: &id_type::ProfileId,
) -> CustomResult<storage::RoutingProfileMetadata, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
}
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
profile_id: &id_type::ProfileId,
algorithm_id: &id_type::RoutingId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_by_profile_id_algorithm_id(profile_id, algorithm_id)
.await
}
async fn find_routing_algorithm_by_algorithm_id_merchant_id(
&self,
algorithm_id: &id_type::RoutingId,
merchant_id: &id_type::MerchantId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_by_algorithm_id_merchant_id(algorithm_id, merchant_id)
.await
}
async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id(
&self,
algorithm_id: &id_type::RoutingId,
async fn find_routing_algorithm_by_algorithm_id_merchant_id(
&self,
algorithm_id: &id_type::RoutingId,
merchant_id: &id_type::MerchantId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_by_algorithm_id_merchant_id(algorithm_id, merchant_id)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/db/kafka_store.rs | crate: router
#[async_trait::async_trait]
impl RoutingAlgorithmInterface for KafkaStore {
async fn insert_routing_algorithm(
&self,
routing_algorithm: storage::RoutingAlgorithm,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.insert_routing_algorithm(routing_algorithm)
.await
}
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
profile_id: &id_type::ProfileId,
algorithm_id: &id_type::RoutingId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
self.diesel_store
.find_routing_algorithm_by_profile_id_algorithm_id(profile_id, algorithm_id)
.await
}
async fn find_routing_algorithm_by_algorithm_id_merchant_id(
&self,
algorithm_id: &id_type::RoutingId,
async fn find_routing_algorithm_by_profile_id_algorithm_id(
&self,
profile_id: &id_type::ProfileId,
algorithm_id: &id_type::RoutingId,
) -> CustomResult<storage::RoutingAlgorithm, errors::StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.