mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	feat(connector): [Trustpay] add webhooks (payment and refund events) (#746)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in> Co-authored-by: sai harsha <sai.harsha@sai.harsha-MacBookPro> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
		| @ -487,3 +487,41 @@ where | ||||
|     })?; | ||||
|     serializer.serialize_f64(float_value) | ||||
| } | ||||
|  | ||||
| pub fn collect_values_by_removing_signature( | ||||
|     value: &serde_json::Value, | ||||
|     signature: &String, | ||||
| ) -> Vec<String> { | ||||
|     match value { | ||||
|         serde_json::Value::Null => vec!["null".to_owned()], | ||||
|         serde_json::Value::Bool(b) => vec![b.to_string()], | ||||
|         serde_json::Value::Number(n) => match n.as_f64() { | ||||
|             Some(f) => vec![format!("{:.2}", f)], | ||||
|             None => vec![n.to_string()], | ||||
|         }, | ||||
|         serde_json::Value::String(s) => { | ||||
|             if signature == s { | ||||
|                 vec![] | ||||
|             } else { | ||||
|                 vec![s.clone()] | ||||
|             } | ||||
|         } | ||||
|         serde_json::Value::Array(arr) => arr | ||||
|             .iter() | ||||
|             .flat_map(|v| collect_values_by_removing_signature(v, signature)) | ||||
|             .collect(), | ||||
|         serde_json::Value::Object(obj) => obj | ||||
|             .values() | ||||
|             .flat_map(|v| collect_values_by_removing_signature(v, signature)) | ||||
|             .collect(), | ||||
|     } | ||||
| } | ||||
|  | ||||
| pub fn collect_and_sort_values_by_removing_signature( | ||||
|     value: &serde_json::Value, | ||||
|     signature: &String, | ||||
| ) -> Vec<String> { | ||||
|     let mut values = collect_values_by_removing_signature(value, signature); | ||||
|     values.sort(); | ||||
|     values | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 saiharsha-juspay
					saiharsha-juspay