refactor(router): add parent caller function for DB (#3838)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sahkal Poddar
2024-02-29 13:25:49 +05:30
committed by GitHub
parent 6b078fa339
commit 0936b02ade
71 changed files with 266 additions and 174 deletions

View File

@ -74,6 +74,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self,
connector_transaction_id: &str,
@ -96,6 +97,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
&self,
payment_id: &str,
@ -137,6 +139,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_merchant_id_connector_txn_id(
&self,
merchant_id: &str,
@ -181,6 +184,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
@ -218,6 +222,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
)
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_preprocessing_id_merchant_id(
&self,
preprocessing_id: &str,
@ -239,6 +244,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn find_attempts_by_merchant_id_payment_id(
&self,
merchant_id: &str,
@ -259,6 +265,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
})
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_attempt_id_merchant_id(
&self,
attempt_id: &str,
@ -276,6 +283,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.map(PaymentAttempt::from_storage_model)
}
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &str,
@ -557,6 +565,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self,
connector_transaction_id: &str,
@ -604,6 +613,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
&self,
payment_id: &str,
@ -652,6 +662,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
&self,
payment_id: &str,
@ -703,6 +714,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_merchant_id_connector_txn_id(
&self,
merchant_id: &str,
@ -803,6 +815,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_attempt_id_merchant_id(
&self,
attempt_id: &str,
@ -859,6 +872,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_payment_attempt_by_preprocessing_id_merchant_id(
&self,
preprocessing_id: &str,
@ -915,6 +929,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn find_attempts_by_merchant_id_payment_id(
&self,
merchant_id: &str,
@ -954,6 +969,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
}
#[instrument(skip_all)]
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
@ -965,6 +981,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.await
}
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
merchant_id: &str,
@ -1855,6 +1872,7 @@ impl DataModelExt for PaymentAttemptUpdate {
}
#[inline]
#[instrument(skip_all)]
async fn add_connector_txn_id_to_reverse_lookup<T: DatabaseStore>(
store: &KVRouterStore<T>,
key: &str,
@ -1877,6 +1895,7 @@ async fn add_connector_txn_id_to_reverse_lookup<T: DatabaseStore>(
}
#[inline]
#[instrument(skip_all)]
async fn add_preprocessing_id_to_reverse_lookup<T: DatabaseStore>(
store: &KVRouterStore<T>,
key: &str,

View File

@ -316,6 +316,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[async_trait::async_trait]
impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn insert_payment_intent(
&self,
new: PaymentIntentNew,
@ -332,6 +333,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.map(PaymentIntent::from_storage_model)
}
#[instrument(skip_all)]
async fn update_payment_intent(
&self,
this: PaymentIntent,
@ -366,6 +368,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
})
}
#[instrument(skip_all)]
async fn get_active_payment_attempt(
&self,
payment: &mut PaymentIntent,
@ -394,6 +397,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
}
#[cfg(feature = "olap")]
#[instrument(skip_all)]
async fn filter_payment_intent_by_constraints(
&self,
merchant_id: &str,
@ -507,6 +511,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
}
#[cfg(feature = "olap")]
#[instrument(skip_all)]
async fn filter_payment_intents_by_time_range_constraints(
&self,
merchant_id: &str,
@ -520,6 +525,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
}
#[cfg(feature = "olap")]
#[instrument(skip_all)]
async fn get_filtered_payment_intents_attempt(
&self,
merchant_id: &str,
@ -660,6 +666,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
}
#[cfg(feature = "olap")]
#[instrument(skip_all)]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
merchant_id: &str,