feat(connector): add payment routes for dummy connector (#980)

This commit is contained in:
ThisIsMani
2023-05-08 15:04:50 +05:30
committed by GitHub
parent 9cb3fa216c
commit 4ece376b56
11 changed files with 320 additions and 1 deletions

View File

@ -79,6 +79,32 @@ impl super::RedisConnectionPool {
self.set_key(key, serialized.as_slice()).await
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn serialize_and_set_key_with_expiry<V>(
&self,
key: &str,
value: V,
seconds: i64,
) -> CustomResult<(), errors::RedisError>
where
V: serde::Serialize + Debug,
{
let serialized = Encode::<V>::encode_to_vec(&value)
.change_context(errors::RedisError::JsonSerializationFailed)?;
self.pool
.set(
key,
serialized.as_slice(),
Some(Expiration::EX(seconds)),
None,
false,
)
.await
.into_report()
.change_context(errors::RedisError::SetExFailed)
}
#[instrument(level = "DEBUG", skip(self))]
pub async fn get_key<V>(&self, key: &str) -> CustomResult<V, errors::RedisError>
where