Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Apr 4, 2024
1 parent 76c381c commit 7774146
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions crates/router/src/db/mandate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,17 @@ impl MandateInterface for Store {
) -> CustomResult<storage::Mandate, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;

match storage_scheme{
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
storage::Mandate::update_by_merchant_id_mandate_id(&conn, merchant_id, mandate_id, mandate_update)
storage::Mandate::update_by_merchant_id_mandate_id(
&conn,
merchant_id,
mandate_id,
mandate_update,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
},
}
MerchantStorageScheme::RedisKv => {
let key = format!("mid_{}_mandate_{}", merchant_id, mandate_id);
let field = format!("mandate_{}", mandate_id);
Expand Down Expand Up @@ -251,20 +256,18 @@ impl MandateInterface for Store {
) -> CustomResult<storage::Mandate, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;

match storage_scheme{
MerchantStorageScheme::PostgresOnly => {
mandate
match storage_scheme {
MerchantStorageScheme::PostgresOnly => mandate
.insert(&conn)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
},
.map_err(|error| report!(errors::StorageError::from(error))),
MerchantStorageScheme::RedisKv => {
let mandate_id = mandate.mandate_id.clone();
let merchant_id = mandate.merchant_id.clone();
let connector_mandate_id = mandate.connector_mandate_id.clone();
let key = format!("mid_{}_mandate_{}", mandate.merchant_id, mandate_id);
let field = format!("mandate_{}", mandate_id);

let storage_mandate = mandate.from_new();

let redis_entry = kv::TypedSql {
Expand All @@ -284,7 +287,8 @@ impl MandateInterface for Store {
updated_by: storage_scheme.to_string(),
};

self.insert_reverse_lookup(reverse_lookup_entry, storage_scheme).await?;
self.insert_reverse_lookup(reverse_lookup_entry, storage_scheme)
.await?;
}

match kv_wrapper::<diesel_models::Mandate, _, _>(
Expand Down

0 comments on commit 7774146

Please sign in to comment.