mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	feat(router): add card testing check in payments eligibility flow (#9876)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		 Sai Harsha Vardhan
					Sai Harsha Vardhan
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							247bce518f
						
					
				
				
					commit
					01cb658696
				
			| @ -339,6 +339,12 @@ pub trait AsyncExt<A> { | ||||
|     where | ||||
|         F: FnOnce() -> Fut + Send, | ||||
|         Fut: futures::Future<Output = A> + Send; | ||||
|  | ||||
|     /// Extending `or_else` to allow async fallback that returns Self::WrappedSelf<A> | ||||
|     async fn async_or_else<F, Fut>(self, func: F) -> Self::WrappedSelf<A> | ||||
|     where | ||||
|         F: FnOnce() -> Fut + Send, | ||||
|         Fut: futures::Future<Output = Self::WrappedSelf<A>> + Send; | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "async_ext")] | ||||
| @ -381,6 +387,21 @@ impl<A: Send, E: Send + std::fmt::Debug> AsyncExt<A> for Result<A, E> { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async fn async_or_else<F, Fut>(self, func: F) -> Self::WrappedSelf<A> | ||||
|     where | ||||
|         F: FnOnce() -> Fut + Send, | ||||
|         Fut: futures::Future<Output = Self::WrappedSelf<A>> + Send, | ||||
|     { | ||||
|         match self { | ||||
|             Ok(a) => Ok(a), | ||||
|             Err(_err) => { | ||||
|                 #[cfg(feature = "logs")] | ||||
|                 logger::error!("Error: {:?}", _err); | ||||
|                 func().await | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "async_ext")] | ||||
| @ -419,6 +440,17 @@ impl<A: Send> AsyncExt<A> for Option<A> { | ||||
|             None => func().await, | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async fn async_or_else<F, Fut>(self, func: F) -> Self::WrappedSelf<A> | ||||
|     where | ||||
|         F: FnOnce() -> Fut + Send, | ||||
|         Fut: futures::Future<Output = Self::WrappedSelf<A>> + Send, | ||||
|     { | ||||
|         match self { | ||||
|             Some(a) => Some(a), | ||||
|             None => func().await, | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// Extension trait for validating application configuration. This trait provides utilities to | ||||
|  | ||||
		Reference in New Issue
	
	Block a user