mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +08:00 
			
		
		
		
	feat(router): Add tokenization support for proxy and update the route for proxy (#8530)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -1,3 +1,9 @@ | ||||
| use std::borrow::Cow; | ||||
|  | ||||
| use error_stack::ResultExt; | ||||
|  | ||||
| use crate::errors::{CustomResult, ValidationError}; | ||||
|  | ||||
| crate::global_id_type!( | ||||
|     GlobalTokenId, | ||||
|     "A global id that can be used to identify a token. | ||||
| @ -17,6 +23,15 @@ impl GlobalTokenId { | ||||
|         self.0.get_string_repr() | ||||
|     } | ||||
|  | ||||
|     ///Get GlobalTokenId from a string | ||||
|     pub fn from_string(token_string: &str) -> CustomResult<Self, ValidationError> { | ||||
|         let token = super::GlobalId::from_string(Cow::Owned(token_string.to_string())) | ||||
|             .change_context(ValidationError::IncorrectValueProvided { | ||||
|                 field_name: "GlobalTokenId", | ||||
|             })?; | ||||
|         Ok(Self(token)) | ||||
|     } | ||||
|  | ||||
|     /// Generate a new GlobalTokenId from a cell id | ||||
|     pub fn generate(cell_id: &crate::id_type::CellId) -> Self { | ||||
|         let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Token); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Prasunna Soppa
					Prasunna Soppa